Check for thread consistency in JSCRuntime

Summary:
In the version of JSC on iOS 11, creating a JSContext on one
thread and using it on another can trigger subtle and nearly
impossible to debug reentrancy-related crashes in the VM (see
https://bugs.webkit.org/show_bug.cgi?id=186827).  In !NDEBUG builds,
check for this case and throw an exception, so it can be detected
early.

Reviewed By: amnn

Differential Revision: D13313264

fbshipit-source-id: ee85435c20e23c8520495ce743d2f91f2eeada5c
This commit is contained in:
Marc Horowitz
2018-12-04 11:42:24 -08:00
committed by Facebook Github Bot
parent 512676c65e
commit bdb084e8a8
2 changed files with 33 additions and 9 deletions

View File

@@ -53,6 +53,8 @@ void Instance::initializeBridge(
m_syncCV.notify_all();
});
// If the NativeToJsBridge ctor throws an exception, this check will
// likely happen before before the redbox can be rendered.
CHECK(nativeToJsBridge_);
}