Bug 1034477 - Save stacks that cross contexts in js::SavedStacks. r=shu

This commit is contained in:
Nick Fitzgerald 2014-07-10 12:33:00 -04:00
parent 195262fa39
commit db16b5400a
2 changed files with 25 additions and 1 deletions

View File

@ -0,0 +1,24 @@
// Test that we can save stacks that cross contexts.
const stack = (function iife() {
return evaluate("(" + function evalFrame() {
return saveStack();
} + "())", {
newContext: true,
fileName: "evaluated"
});
}());
print(stack);
assertEq(stack.functionDisplayName, "evalFrame");
assertEq(stack.source, "evaluated");
assertEq(stack.parent.source, "evaluated");
assertEq(stack.parent.parent.functionDisplayName, "iife");
assertEq(/new-context\.js$/.test(stack.parent.parent.source), true);
assertEq(/new-context\.js$/.test(stack.parent.parent.parent.source), true);
assertEq(stack.parent.parent.parent.parent, null);

View File

@ -401,7 +401,7 @@ SavedStacks::saveCurrentStack(JSContext *cx, MutableHandleSavedFrame frame, unsi
JS_ASSERT(initialized());
JS_ASSERT(&cx->compartment()->savedStacks() == this);
FrameIter iter(cx);
FrameIter iter(cx, FrameIter::ALL_CONTEXTS, FrameIter::GO_THROUGH_SAVED);
return insertFrames(cx, iter, frame, maxFrameCount);
}