Bug 1260728 - Ensure that the script has had its arguments usage analyzed before we get arguments in the debugger; r=shu
authorNick Fitzgerald <fitzgen@gmail.com>
Wed, 01 Jun 2016 17:10:00 +0200
changeset 339157 403b82279b764fb278c651198e8e77018c71d400
parent 339156 df4c70f4b9f6a5403afc565f65262ac20e2d7086
child 339158 94c374f96f84710e07fd4678fb56dc923c38252a
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshu
bugs1260728
milestone49.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 1260728 - Ensure that the script has had its arguments usage analyzed before we get arguments in the debugger; r=shu
js/src/jit-test/tests/debug/bug-1260728.js
js/src/vm/Debugger.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/debug/bug-1260728.js
@@ -0,0 +1,12 @@
+// |jit-test| error:Error
+
+var g = newGlobal();
+var dbg = new Debugger(g);
+dbg.onNewScript = function(script) {
+  fscript = script.getChildScripts()[0];
+}
+g.eval("function f(x) { arguments[0] = 3; return x }");
+fscript.setBreakpoint(0, {hit:function(frame) {
+  assertEq(frame.eval("assertEq(arguments, undefined)").return, 1);
+}});
+assertEq(g.f(1), 42);
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -720,16 +720,19 @@ Debugger::memory() const
 
 bool
 Debugger::getScriptFrameWithIter(JSContext* cx, AbstractFramePtr frame,
                                  const ScriptFrameIter* maybeIter, MutableHandleValue vp)
 {
     MOZ_ASSERT_IF(maybeIter, maybeIter->abstractFramePtr() == frame);
     MOZ_ASSERT(!frame.script()->selfHosted());
 
+    if (!frame.script()->ensureHasAnalyzedArgsUsage(cx))
+        return false;
+
     FrameMap::AddPtr p = frames.lookupForAdd(frame);
     if (!p) {
         /* Create and populate the Debugger.Frame object. */
         RootedObject proto(cx, &object->getReservedSlot(JSSLOT_DEBUG_FRAME_PROTO).toObject());
         RootedNativeObject frameobj(cx, NewNativeObjectWithGivenProto(cx, &DebuggerFrame_class,
                                                                       proto));
         if (!frameobj)
             return false;