Bug 1571793 - browser_startup.js and browser_startup_content.js should record the correct stacks with failures, r=johannh.

Differential Revision: https://phabricator.services.mozilla.com/D40839

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Florian Quèze 2019-08-07 13:55:49 +00:00
parent a5446915fb
commit e7ef747496
2 changed files with 22 additions and 20 deletions

View File

@ -186,12 +186,14 @@ add_task(async function() {
.filter(c => c != "startupRecorder.js");
}
function printStack(scriptType, name) {
function getStack(scriptType, name) {
if (scriptType == "modules") {
info(Cu.getModuleImportStack(name));
} else if (scriptType == "components") {
info(componentStacks.get(name));
return Cu.getModuleImportStack(name);
}
if (scriptType == "components") {
return componentStacks.get(name);
}
return "";
}
// This block only adds debug output to help find the next bugs to file,
@ -207,7 +209,7 @@ add_task(async function() {
if (!previous || !data[previous][scriptType].includes(f)) {
info(`${scriptType} loaded ${phase}: ${f}`);
if (kDumpAllStacks) {
printStack(scriptType, f);
info(getStack(scriptType, f));
}
}
}
@ -233,8 +235,8 @@ add_task(async function() {
`should have no unexpected ${scriptType} loaded ${phase}`
);
for (let script of loadedList[scriptType]) {
ok(false, `unexpected ${scriptType}: ${script}`);
printStack(scriptType, script);
let message = `unexpected ${scriptType}: ${script}`;
record(false, message, undefined, getStack(scriptType, script));
}
is(
whitelist[scriptType].size,
@ -251,9 +253,11 @@ add_task(async function() {
for (let scriptType in blacklist) {
for (let file of blacklist[scriptType]) {
let loaded = loadedList[scriptType].includes(file);
ok(!loaded, `${file} is not allowed ${phase}`);
if (loaded) {
printStack(scriptType, file);
let message = `${file} is not allowed ${phase}`;
if (!loaded) {
ok(true, message);
} else {
record(false, message, undefined, getStack(scriptType, file));
}
}
}

View File

@ -207,12 +207,12 @@ add_task(async function() {
);
for (let script of loadedList[scriptType]) {
ok(
record(
false,
`Unexpected ${scriptType} loaded during content process startup: ${script}`
`Unexpected ${scriptType} loaded during content process startup: ${script}`,
undefined,
loadedInfo[scriptType][script]
);
info(`Stack that loaded ${script}:\n`);
info(loadedInfo[scriptType][script]);
}
is(
@ -246,14 +246,12 @@ add_task(async function() {
for (let script of blacklist[scriptType]) {
let loaded = script in loadedInfo[scriptType];
if (loaded) {
ok(
record(
false,
`Unexpected ${scriptType} loaded during content process startup: ${script}`
`Unexpected ${scriptType} loaded during content process startup: ${script}`,
undefined,
loadedInfo[scriptType][script]
);
if (loadedInfo[scriptType][script]) {
info(`Stack that loaded ${script}:\n`);
info(loadedInfo[scriptType][script]);
}
}
}
}