зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1256869 - Fix eslint issues in browser_webconsole_bug_752559_ineffective_iframe_sandbox_warning.js;r=me
MozReview-Commit-ID: G054kUVXbcr
This commit is contained in:
Родитель
4066f6ab49
Коммит
34bc1cd7d4
|
@ -96,11 +96,8 @@ registerCleanupFunction(() => {
|
|||
});
|
||||
|
||||
registerCleanupFunction(function* cleanup() {
|
||||
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
yield gDevTools.closeToolbox(target);
|
||||
|
||||
while (gBrowser.tabs.length > 1) {
|
||||
gBrowser.removeCurrentTab();
|
||||
yield closeTabAndToolbox(gBrowser.selectedTab);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI_WARNING = "http://example.com/browser/devtools/client/" +
|
||||
"webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning0.html";
|
||||
requestLongerTimeout(2);
|
||||
|
||||
const TEST_URI_WARNING = "http://example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning0.html";
|
||||
const TEST_URI_NOWARNING = [
|
||||
"http://example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning1.html",
|
||||
"http://example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning2.html",
|
||||
|
@ -23,60 +24,60 @@ const INEFFECTIVE_IFRAME_SANDBOXING_MSG = "An iframe which has both " +
|
|||
"its sandboxing.";
|
||||
const SENTINEL_MSG = "testing ineffective sandboxing message";
|
||||
|
||||
function test() {
|
||||
loadTab(TEST_URI_WARNING).then(() => {
|
||||
openConsole().then((hud) => {
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, SENTINEL_MSG, function*(msg) {
|
||||
content.console.log(msg);
|
||||
});
|
||||
waitForMessages({
|
||||
webconsole: hud,
|
||||
messages: [
|
||||
{
|
||||
name: "Ineffective iframe sandboxing warning displayed successfully",
|
||||
text: INEFFECTIVE_IFRAME_SANDBOXING_MSG,
|
||||
category: CATEGORY_SECURITY,
|
||||
severity: SEVERITY_WARNING
|
||||
},
|
||||
{
|
||||
text: SENTINEL_MSG,
|
||||
severity: SEVERITY_LOG
|
||||
}
|
||||
]
|
||||
}).then(() => {
|
||||
let msgs = hud.outputNode.querySelectorAll(".message[category=security]");
|
||||
is(msgs.length, 1, "one security message");
|
||||
testNoWarning(0);
|
||||
});
|
||||
});
|
||||
add_task(function* () {
|
||||
yield testYesWarning();
|
||||
|
||||
for (let id = 0; id < TEST_URI_NOWARNING.length; id++) {
|
||||
yield testNoWarning(id);
|
||||
}
|
||||
});
|
||||
|
||||
function* testYesWarning() {
|
||||
yield loadTab(TEST_URI_WARNING);
|
||||
let hud = yield openConsole();
|
||||
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, SENTINEL_MSG, function* (msg) {
|
||||
content.console.log(msg);
|
||||
});
|
||||
|
||||
yield waitForMessages({
|
||||
webconsole: hud,
|
||||
messages: [
|
||||
{
|
||||
name: "Ineffective iframe sandboxing warning displayed successfully",
|
||||
text: INEFFECTIVE_IFRAME_SANDBOXING_MSG,
|
||||
category: CATEGORY_SECURITY,
|
||||
severity: SEVERITY_WARNING
|
||||
},
|
||||
{
|
||||
text: SENTINEL_MSG,
|
||||
severity: SEVERITY_LOG
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
let msgs = hud.outputNode.querySelectorAll(".message[category=security]");
|
||||
is(msgs.length, 1, "one security message");
|
||||
}
|
||||
|
||||
function testNoWarning(id) {
|
||||
loadTab(TEST_URI_NOWARNING[id]).then(() => {
|
||||
openConsole().then((hud) => {
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, SENTINEL_MSG, function*(msg) {
|
||||
content.console.log(msg);
|
||||
});
|
||||
waitForMessages({
|
||||
webconsole: hud,
|
||||
messages: [
|
||||
{
|
||||
text: SENTINEL_MSG,
|
||||
severity: SEVERITY_LOG
|
||||
}
|
||||
]
|
||||
}).then(() => {
|
||||
let msgs = hud.outputNode.querySelectorAll(".message[category=security]");
|
||||
is(msgs.length, 0, "no security messages (case " + id + ")");
|
||||
function* testNoWarning(id) {
|
||||
yield loadTab(TEST_URI_NOWARNING[id]);
|
||||
let hud = yield openConsole();
|
||||
|
||||
id += 1;
|
||||
if (id < TEST_URI_NOWARNING.length) {
|
||||
testNoWarning(id);
|
||||
} else {
|
||||
finishTest();
|
||||
}
|
||||
});
|
||||
});
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, SENTINEL_MSG, function* (msg) {
|
||||
content.console.log(msg);
|
||||
});
|
||||
|
||||
yield waitForMessages({
|
||||
webconsole: hud,
|
||||
messages: [
|
||||
{
|
||||
text: SENTINEL_MSG,
|
||||
severity: SEVERITY_LOG
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
let msgs = hud.outputNode.querySelectorAll(".message[category=security]");
|
||||
is(msgs.length, 0, "no security messages (case " + id + ")");
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче