diff --git a/React/DevSupport/RCTInspectorDevServerHelper.h b/React/DevSupport/RCTInspectorDevServerHelper.h index 1a1317ee8..eabfd99eb 100644 --- a/React/DevSupport/RCTInspectorDevServerHelper.h +++ b/React/DevSupport/RCTInspectorDevServerHelper.h @@ -10,8 +10,7 @@ @interface RCTInspectorDevServerHelper : NSObject -+ (void)connectForContext:(JSGlobalContextRef)context - withBundleURL:(NSURL *)bundleURL; ++ (void)connectWithBundleURL:(NSURL *)bundleURL; + (void)disableDebugger; + (void)attachDebugger:(NSString *)owner withBundleURL:(NSURL *)bundleURL diff --git a/React/DevSupport/RCTInspectorDevServerHelper.mm b/React/DevSupport/RCTInspectorDevServerHelper.mm index dc80a3a48..2fa4fae5b 100644 --- a/React/DevSupport/RCTInspectorDevServerHelper.mm +++ b/React/DevSupport/RCTInspectorDevServerHelper.mm @@ -104,13 +104,8 @@ static void displayErrorAlert(UIViewController *view, NSString *message) { sendEventToAllConnections(kDebuggerMsgDisable); } -+ (void)connectForContext:(JSGlobalContextRef)context - withBundleURL:(NSURL *)bundleURL ++ (void)connectWithBundleURL:(NSURL *)bundleURL { - if (!isCustomJSCPtr(context)) { - return; - } - NSURL *inspectorURL = getInspectorDeviceUrl(bundleURL); // Note, using a static dictionary isn't really the greatest design, but diff --git a/React/Modules/RCTDevSettings.mm b/React/Modules/RCTDevSettings.mm index ea75e892d..1b9bb4435 100644 --- a/React/Modules/RCTDevSettings.mm +++ b/React/Modules/RCTDevSettings.mm @@ -195,12 +195,13 @@ RCT_EXPORT_MODULE() // finished with its initialisation. But it does finish by the time it // relinquishes control of the main thread, so only queue on the JS thread // after the current main thread operation is done. - dispatch_async(dispatch_get_main_queue(), ^{ - [bridge dispatchBlock:^{ - [RCTInspectorDevServerHelper connectForContext:bridge.jsContextRef - withBundleURL:bridge.bundleURL]; - } queue:RCTJSThread]; - }); + if (self.isNuclideDebuggingAvailable) { + dispatch_async(dispatch_get_main_queue(), ^{ + [bridge dispatchBlock:^{ + [RCTInspectorDevServerHelper connectWithBundleURL:bridge.bundleURL]; + } queue:RCTJSThread]; + }); + } #endif } @@ -256,10 +257,10 @@ static void pokeSamplingProfiler(RCTBridge *const bridge, RCTPackagerClientRespo - (BOOL)isNuclideDebuggingAvailable { #if RCT_ENABLE_INSPECTOR - return facebook::react::isCustomJSCPtr(_bridge.jsContextRef); + return _bridge.isInspectable; #else return false; -#endif //RCT_ENABLE_INSPECTOR +#endif // RCT_ENABLE_INSPECTOR } - (BOOL)isRemoteDebuggingAvailable