Skip to content

Commit

Permalink
Bug 1289058 - Null check principals before holding them in JS::FirstS…
Browse files Browse the repository at this point in the history
…ubsumedFrame; r=jimb
  • Loading branch information
fitzgen committed Jul 25, 2016
1 parent d09099a commit 8ef4071
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions js/src/jit-test/tests/saved-stacks/bug-1289058.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const g1 = newGlobal({});
const g2 = newGlobal(newGlobal);
g1.g2obj = g2.eval("new Object");
g1.evaluate(`
const global = this;
function capture(shouldIgnoreSelfHosted = true) {
return captureFirstSubsumedFrame(global.g2obj, shouldIgnoreSelfHosted);
}
(function iife1() {
const captureTrueStack = capture(true);
}());
`, {
});
3 changes: 2 additions & 1 deletion js/src/jsapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -5933,7 +5933,8 @@ struct FirstSubsumedFrame
, principals(p)
, ignoreSelfHosted(ignoreSelfHostedFrames)
{
JS_HoldPrincipals(principals);
if (principals)
JS_HoldPrincipals(principals);
}

// No copying because we want to avoid holding and dropping principals
Expand Down

0 comments on commit 8ef4071

Please sign in to comment.