Bug 1359653: Part 4 - Fallback to the default JS version when decoding regexps off-thread. r=shu draft
authorKris Maglione <maglione.k@gmail.com>
Fri, 28 Apr 2017 11:55:52 -0700
changeset 571602 8172778c3ed0ded9e0a20e82460beb90f580a604
parent 571601 96fb3931699c6b93b8472a8c60543dad307825f2
child 571603 647ffe2b243f898053296fb0bc15f8dcff0b51d9
child 572140 37f75bddd34ffd622fcb7be2862d5e4d28b441d0
push id56864
push usermaglione.k@gmail.com
push dateWed, 03 May 2017 01:22:20 +0000
reviewersshu
bugs1359653
milestone55.0a1
Bug 1359653: Part 4 - Fallback to the default JS version when decoding regexps off-thread. r=shu When decoding off-thread, we can't safely access the JS runtime to get the current JS version, and doing so causes failed assertions. MozReview-Commit-ID: Lra437aa8SM
js/src/jscntxt.cpp
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -1441,16 +1441,19 @@ JSVersion
 JSContext::findVersion()
 {
     if (JSScript* script = currentScript(nullptr, ALLOW_CROSS_COMPARTMENT))
         return script->getVersion();
 
     if (compartment() && compartment()->behaviors().version() != JSVERSION_UNKNOWN)
         return compartment()->behaviors().version();
 
+    if (!CurrentThreadCanAccessRuntime(runtime()))
+        return JSVERSION_DEFAULT;
+
     return runtime()->defaultVersion();
 }
 
 #ifdef DEBUG
 
 JS::AutoCheckRequestDepth::AutoCheckRequestDepth(JSContext* cxArg)
   : cx(cxArg->helperThread() ? nullptr : cxArg)
 {