react-native icon indicating copy to clipboard operation
react-native copied to clipboard

[JSCRuntime] Add runtimeConfig to set debugger options

Open Saadnajmi opened this issue 2 years ago • 5 comments

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.

Screenshot 2023-08-16 at 5 48 08 AM

Saadnajmi avatar Aug 11 '23 09:08 Saadnajmi

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

analysis-bot avatar Aug 11 '23 09:08 analysis-bot

Closing this PR till I rework it with the feedback above. EDIT: which I did a couple of hours later 😅

Saadnajmi avatar Aug 16 '23 10:08 Saadnajmi

@motiz88 friendly ping, in case you could take a second look

Saadnajmi avatar Aug 23 '23 21:08 Saadnajmi

@motiz88 Could you take another look? I've addressed your new set of comments

Saadnajmi avatar Oct 25 '23 22:10 Saadnajmi

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.

github-actions[bot] avatar May 06 '24 05:05 github-actions[bot]

This PR was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar May 14 '24 05:05 github-actions[bot]