Bug 1253246 - Handle DebugScopeProxies around unqualified varobjs in setname. (r=jorendorff)
authorShu-yu Guo <shu@rfrn.org>
Tue, 22 Mar 2016 16:19:52 -0700
changeset 289866 4ec87322b994b6624ff3338ce3479e2bda40c7bf
parent 289865 741f7c1ea3da067cedf66cf8b323248a55d17614
child 289867 6c3d92cbde28b6921e2525e91d7199c718b33169
push id74023
push usershu@rfrn.org
push dateTue, 22 Mar 2016 23:17:29 +0000
treeherdermozilla-inbound@fd8964d81f84 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1253246
milestone48.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 1253246 - Handle DebugScopeProxies around unqualified varobjs in setname. (r=jorendorff)
js/src/jit-test/tests/debug/bug1253246.js
js/src/vm/Interpreter-inl.h
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/debug/bug1253246.js
@@ -0,0 +1,5 @@
+var g = newGlobal();
+var dbg = new Debugger(g);
+
+dbg.onDebuggerStatement = (frame) => { frame.eval("c = 42;"); };
+g.evalReturningScope("'use strict'; debugger;");
--- a/js/src/vm/Interpreter-inl.h
+++ b/js/src/vm/Interpreter-inl.h
@@ -273,19 +273,23 @@ SetNameOperation(JSContext* cx, JSScript
     // In strict mode, assigning to an undeclared global variable is an
     // error. To detect this, we call NativeSetProperty directly and pass
     // Unqualified. It stores the error, if any, in |result|.
     bool ok;
     ObjectOpResult result;
     RootedId id(cx, NameToId(name));
     RootedValue receiver(cx, ObjectValue(*scope));
     if (scope->isUnqualifiedVarObj()) {
-        MOZ_ASSERT(!scope->getOps()->setProperty);
-        ok = NativeSetProperty(cx, scope.as<NativeObject>(), id, val, receiver, Unqualified,
-                               result);
+        RootedNativeObject varobj(cx);
+        if (scope->is<DebugScopeObject>())
+            varobj = &scope->as<DebugScopeObject>().scope().as<NativeObject>();
+        else
+            varobj = &scope->as<NativeObject>();
+        MOZ_ASSERT(!varobj->getOps()->setProperty);
+        ok = NativeSetProperty(cx, varobj, id, val, receiver, Unqualified, result);
     } else {
         ok = SetProperty(cx, scope, id, val, receiver, result);
     }
     return ok && result.checkStrictErrorOrWarning(cx, scope, id, strict);
 }
 
 inline bool
 DefLexicalOperation(JSContext* cx, Handle<ClonedBlockObject*> lexicalScope,