-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Add a way to access the underlying JavaScriptCore context #10399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
By analyzing the blame information on this pull request, we identified @adamjernst and @cjhopman to be potential reviewers. |
@nikki93 I believe this will be extremely useful for a project I'm working on. Could this be extended to also allow access for creating a separate JSCore context from JS-land? I'm currently using a WebView context to evaluate user generated code but would prefer access to a context without having to write a bridge into a native module. |
@dannycochran there's an experimental WebWorker API on RN which allows for that, but this PR is substantially different. It exposes a JSContext pointer to native code and doesn't create a new JSContext with a new RN environment (this is what WebWorkers do) or interact with JavaScript at all. I recommend you write a native module that addresses your use cases because they sound rather different than the ones this PR addresses. |
@lexs Oh great! Yeah I'm ready for a merge! |
@nikki93 Github reports a conflict in |
3dc2b5b
to
c8405d1
Compare
@lexs Fixed! |
@lexs has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Summary: **Motivation** I'm working on a project that uses React Native and needs to add direct synchronous bindings to native stuff through the JavaScriptCore C API. This is because it's performance-sensitive and would benefit from the quickest JS->C path. It does this using cross-platform C++ code that works on both iOS and Android. Most of the infrastructure for getting access to the JSC context is already in React Native actually, just had to add a few more things. (lexs you mentioned to tag you in this pull request) **Test plan** Modify the JavaScriptCore context through the `JSContextRef` returned (eg. add an object at global scope) and verify that it exists in JavaScript. Closes facebook#10399 Differential Revision: D4080945 Pulled By: lexs fbshipit-source-id: 6659b7a01e09fd84475adde183c1d3aca2d4cf09
Summary: **Motivation** I'm working on a project that uses React Native and needs to add direct synchronous bindings to native stuff through the JavaScriptCore C API. This is because it's performance-sensitive and would benefit from the quickest JS->C path. It does this using cross-platform C++ code that works on both iOS and Android. Most of the infrastructure for getting access to the JSC context is already in React Native actually, just had to add a few more things. (lexs you mentioned to tag you in this pull request) **Test plan** Modify the JavaScriptCore context through the `JSContextRef` returned (eg. add an object at global scope) and verify that it exists in JavaScript. Closes facebook#10399 Differential Revision: D4080945 Pulled By: lexs fbshipit-source-id: 6659b7a01e09fd84475adde183c1d3aca2d4cf09
Summary: **Motivation** I'm working on a project that uses React Native and needs to add direct synchronous bindings to native stuff through the JavaScriptCore C API. This is because it's performance-sensitive and would benefit from the quickest JS->C path. It does this using cross-platform C++ code that works on both iOS and Android. Most of the infrastructure for getting access to the JSC context is already in React Native actually, just had to add a few more things. (lexs you mentioned to tag you in this pull request) **Test plan** Modify the JavaScriptCore context through the `JSContextRef` returned (eg. add an object at global scope) and verify that it exists in JavaScript. Closes facebook#10399 Differential Revision: D4080945 Pulled By: lexs fbshipit-source-id: 6659b7a01e09fd84475adde183c1d3aca2d4cf09
Summary: **Motivation** I'm working on a project that uses React Native and needs to add direct synchronous bindings to native stuff through the JavaScriptCore C API. This is because it's performance-sensitive and would benefit from the quickest JS->C path. It does this using cross-platform C++ code that works on both iOS and Android. Most of the infrastructure for getting access to the JSC context is already in React Native actually, just had to add a few more things. (lexs you mentioned to tag you in this pull request) **Test plan** Modify the JavaScriptCore context through the `JSContextRef` returned (eg. add an object at global scope) and verify that it exists in JavaScript. Closes facebook#10399 Differential Revision: D4080945 Pulled By: lexs fbshipit-source-id: 6659b7a01e09fd84475adde183c1d3aca2d4cf09
Motivation
I'm working on a project that uses React Native and needs to add direct synchronous bindings to native stuff through the JavaScriptCore C API. This is because it's performance-sensitive and would benefit from the quickest JS->C path. It does this using cross-platform C++ code that works on both iOS and Android. Most of the infrastructure for getting access to the JSC context is already in React Native actually, just had to add a few more things.
(@lexs you mentioned to tag you in this pull request)
Test plan
Modify the JavaScriptCore context through the
JSContextRef
returned (eg. add an object at global scope) and verify that it exists in JavaScript.