Bug 960108 - Ignore saved frame chains and contexts in JS::DescribeStack. r=bz

This commit is contained in:
Bobby Holley 2014-03-05 20:15:35 -08:00
parent fb2ed1264a
commit 8e3b6aa7ec
2 changed files with 13 additions and 1 deletions

View File

@ -939,7 +939,10 @@ JS::DescribeStack(JSContext *cx, unsigned maxFrames)
{
Vector<FrameDescription> frames(cx);
for (NonBuiltinScriptFrameIter i(cx); !i.done(); ++i) {
NonBuiltinScriptFrameIter i(cx, ScriptFrameIter::ALL_CONTEXTS,
ScriptFrameIter::GO_THROUGH_SAVED,
cx->compartment()->principals);
for ( ; !i.done(); ++i) {
if (!frames.append(i))
return nullptr;
if (frames.length() == maxFrames)

View File

@ -26,6 +26,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=960820
ok(/clickCallback/.test(stack), "clickCallback should be in the stack");
ok(!/clickHandler/.test(stack), "clickHandler should not be in the stack");
ok(/dispatchClick/.test(stack), "dispatchClick should be in the stack");
// Check Components.stack, but first filter through the SpecialPowers junk.
var stack = SpecialPowers.wrap(SpecialPowers.Components).stack;
while (/specialpowers/.test(stack)) {
stack = stack.caller;
}
ok(/clickCallback/.test(stack), "clickCallback should be reachable via Components.stack");
ok(/clickHandler/.test(stack.caller), "clickHandler should be reachable via Components.stack");
ok(/dispatchClick/.test(stack.caller.caller), "dispatchClick hould be reachable via Components.stack");
}
function dispatchClick() {
document.dispatchEvent(new MouseEvent('click'));