Bug 1192401 - Do not capture SavedFrame stacks before Object.prototype has been initialized. r=shu, a=sledru
authorNick Fitzgerald <fitzgen@gmail.com>
Mon, 17 Aug 2015 14:58:46 -0400
changeset 281952 2d9e2f22c8137c94dfda15de2ba87d9bda042b8e
parent 281951 49ce1516814d4b9ed77f9bab9eff39b90cbbece2
child 281953 0364790f94b1adeed4b79a450962583f42a16ef4
push id4962
push userryanvm@gmail.com
push dateMon, 17 Aug 2015 19:02:17 +0000
treeherdermozilla-beta@6fbcbf05900f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshu, sledru
bugs1192401
milestone41.0
Bug 1192401 - Do not capture SavedFrame stacks before Object.prototype has been initialized. r=shu, a=sledru
js/src/jit-test/tests/bug-1192401.js
js/src/vm/SavedStacks.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/bug-1192401.js
@@ -0,0 +1,5 @@
+const dbg = new Debugger();
+const g = evalcx("lazy");
+dbg.addDebuggee(g);
+dbg.memory.trackingAllocationSites = true;
+g.eval("this.alloc = {}");
--- a/js/src/vm/SavedStacks.cpp
+++ b/js/src/vm/SavedStacks.cpp
@@ -807,17 +807,20 @@ SavedStacks::init()
 }
 
 bool
 SavedStacks::saveCurrentStack(JSContext* cx, MutableHandleSavedFrame frame, unsigned maxFrameCount)
 {
     MOZ_ASSERT(initialized());
     assertSameCompartment(cx, this);
 
-    if (creatingSavedFrame) {
+    if (creatingSavedFrame ||
+        cx->isExceptionPending() ||
+        !cx->global()->isStandardClassResolved(JSProto_Object))
+    {
         frame.set(nullptr);
         return true;
     }
 
     FrameIter iter(cx, FrameIter::ALL_CONTEXTS, FrameIter::GO_THROUGH_SAVED);
     return insertFrames(cx, iter, frame, maxFrameCount);
 }