Bug 1348885 - Prevent throwing on dead wrapper when processing stacks of error from nuked globals. r=jryans

MozReview-Commit-ID: gdFNYNzXLz

--HG--
extra : rebase_source : 429b0ca6ad020acb4cf14e01e0856b9f0d512c12
This commit is contained in:
Alexandre Poirot 2017-03-23 18:53:57 +01:00
parent 314a1804e2
commit 523f358ad5
2 changed files with 20 additions and 1 deletions

View File

@ -50,6 +50,17 @@ function consoleOpened(hud) {
// Use another js script to not depend on the test file line numbers.
Services.scriptloader.loadSubScript(TEST_FILE, hud.iframeWindow);
// Bug 1348885: test that error from nuked globals do not throw
let sandbox = new Cu.Sandbox(null, {
wantComponents: false,
wantGlobalProperties: ["URL", "URLSearchParams"],
});
let error = Cu.evalInSandbox(`
new Error("1348885");
`, sandbox);
Cu.reportError(error);
Cu.nukeSandbox(sandbox);
// Add a message from a content window.
content.console.log("bug587757b");
@ -99,6 +110,12 @@ function consoleOpened(hud) {
// and consoleOpened call
]
},
{
name: "Error from nuked global works",
text: "1348885",
category: CATEGORY_JS,
severity: SEVERITY_ERROR,
},
{
name: "content window console.log() is displayed",
text: "bug587757b",

View File

@ -1512,7 +1512,9 @@ WebConsoleActor.prototype =
{
let stack = null;
// Convert stack objects to the JSON attributes expected by client code
if (aPageError.stack) {
// Bug 1348885: If the global from which this error came from has been
// nuked, stack is going to be a dead wrapper.
if (aPageError.stack && !Cu.isDeadWrapper(aPageError.stack)) {
stack = [];
let s = aPageError.stack;
while (s !== null) {