Bug 1143793 part 5. Release-assert that a script being executed against a non-global scopechain is not compileAndGo. r=luke
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 19 Mar 2015 10:13:34 -0400
changeset 234484 7f2b308acde09ec683d4094be51021ea53d310dc
parent 234483 55efc4756e69b7b710dd1bc874bd587b5632ced8
child 234485 5c293e45278d31a8e941d5e6233cade570ddf182
push id28446
push userkwierso@gmail.com
push dateFri, 20 Mar 2015 02:15:45 +0000
treeherdermozilla-central@3257d9c4b257 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1143793
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1143793 part 5. Release-assert that a script being executed against a non-global scopechain is not compileAndGo. r=luke
js/src/vm/Interpreter.cpp
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -662,16 +662,20 @@ bool
 js::Execute(JSContext *cx, HandleScript script, JSObject &scopeChainArg, Value *rval)
 {
     /* The scope chain could be anything, so innerize just in case. */
     RootedObject scopeChain(cx, &scopeChainArg);
     scopeChain = GetInnerObject(scopeChain);
     if (!scopeChain)
         return false;
 
+    MOZ_RELEASE_ASSERT(scopeChain->is<GlobalObject>() || !script->compileAndGo(),
+                       "Only non-compile-and-go scripts can be executed with "
+                       "interesting scopechains");
+
     /* Ensure the scope chain is all same-compartment and terminates in a global. */
 #ifdef DEBUG
     JSObject *s = scopeChain;
     do {
         assertSameCompartment(cx, s);
         MOZ_ASSERT_IF(!s->enclosingScope(), s->is<GlobalObject>());
     } while ((s = s->enclosingScope()));
 #endif