-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
[JSCRuntime] Add runtimeConfig to set debugger options #38942
Conversation
Base commit: d2e8225 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Saadnajmi! I agree with the intent of this PR and would like to ship something close to this, but see some concerns/suggestions in comments.
Closing this PR till I rework it with the feedback above. |
@motiz88 friendly ping, in case you could take a second look |
15d0622
to
9b6c1a0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So sorry about the delay, but I have some concerns here (plus some nits).
@motiz88 Could you take another look? I've addressed your new set of comments |
#if DEBUG | ||
bool enableDebugger_ = true; | ||
#else | ||
bool enableDebugger_ = false; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oversight caught internally: Initially this was always true
so release builds would have the debugger enabled. I changed it so the default is true only for debug. This way, one could still enable debugging for a ship/release build if they wished.
I considered copying what Hermes does and putting all debugging code behind a custom preprocessor variable (#37723), but that seemed overkill and would prevent us from enable debugging on ship.
For reference, equivalent PRs in React Native macOS:
microsoft#1976
microsoft#1977
microsoft#1978
microsoft#1979
This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This PR was closed because it has been stalled for 7 days with no activity. |
Summary:
When using React Native with JavascriptCore with a brownfield app, you may have multiple instances of React Native running, each with a JSContext. You attach a debugger to this JSContext via the Safari->Develop menu. To distinguish multiple JSContexts apart, JSContext has a name property, with a C style setter. We currently don't take advantage of that property, meaning that all your React Native instances show in the Develop menu with the default name "JSContext", making them hard to distinguish from each other.
Let's solve this by adding a
runtimeConfig
parameter to the methodmakeJSCRuntime()
, and pass through the propertiesenableDebugger
anddebuggerName
to it. These names / the API to set them are heavily inspired by a similar change made toHermesExecutorFactory
: 32d12e8Changelog:
[IOS] [CHANGED] - Add facebook::jsc::runtimeConfig to set enable debugger and set debugger
Test Plan:
Running RNTester with JSC shows the JSContext with the updated name.