react-native
react-native copied to clipboard
[JSCRuntime] Add runtimeConfig to set debugger options
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 method makeJSCRuntime(), and pass through the properties enableDebugger and debuggerName to it. These names / the API to set them are heavily inspired by a similar change made to HermesExecutorFactory: https://github.com/facebook/react-native/commit/32d12e89f864a106433c8e54c10691d7876333ee
Changelog:
[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.
| Platform | Engine | Arch | Size (bytes) | Diff |
|---|---|---|---|---|
| android | hermes | arm64-v8a | 17,657,546 | +23,343 |
| android | hermes | armeabi-v7a | n/a | -- |
| android | hermes | x86 | n/a | -- |
| android | hermes | x86_64 | n/a | -- |
| android | jsc | arm64-v8a | 21,039,214 | +21,155 |
| android | jsc | armeabi-v7a | n/a | -- |
| android | jsc | x86 | n/a | -- |
| android | jsc | x86_64 | n/a | -- |
Base commit: d2e822588703a05f93acf10c2bbaa79157d97d9a Branch: main
Closing this PR till I rework it with the feedback above. EDIT: which I did a couple of hours later 😅
@motiz88 friendly ping, in case you could take a second look
@motiz88 Could you take another look? I've addressed your new set of comments
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.