Bug 1508985 - Enable ESLint for dom/tests/browser/ (automatic changes) r=Standard8,qdot

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Vincent W 2019-01-22 21:26:30 +00:00
parent cbfb044695
commit 3b243b7e27
34 changed files with 379 additions and 316 deletions

View file

@ -84,7 +84,7 @@
reset() { reset() {
this.popInner(this._innerEventHandlers.length); this.popInner(this._innerEventHandlers.length);
this.popOuter(this._outerEventHandlers.length); this.popOuter(this._outerEventHandlers.length);
} },
}; };
</script> </script>

View file

@ -65,7 +65,7 @@ function spawnWithObserver(browser, observerFunc, func) {
// Call the initialization function (if present) // Call the initialization function (if present)
func ? ("(" + func.toString() + ")();") : "", func ? ("(" + func.toString() + ")();") : "",
"});", "});",
].join('\n'); ].join("\n");
return ContentTask.spawn(browser, null, new Function(source)); return ContentTask.spawn(browser, null, new Function(source));
} }
@ -122,7 +122,7 @@ function testConsoleData(aMessageObject) {
} }
default: { default: {
is(aMessageObject.arguments.length, gArgs.length, "arguments.length matches"); is(aMessageObject.arguments.length, gArgs.length, "arguments.length matches");
gArgs.forEach(function (a, i) { gArgs.forEach(function(a, i) {
// Waive Xray so that we don't get messed up by Xray ToString. // Waive Xray so that we don't get messed up by Xray ToString.
// //
// It'd be nice to just use XPCNativeWrapper.unwrap here, but there are // It'd be nice to just use XPCNativeWrapper.unwrap here, but there are
@ -270,7 +270,7 @@ async function startTraceTest(browser) {
{columnNumber: 9, filename: TEST_URI, functionName: "window.foobar585956c", lineNumber: 6}, {columnNumber: 9, filename: TEST_URI, functionName: "window.foobar585956c", lineNumber: 6},
{columnNumber: 16, filename: TEST_URI, functionName: "foobar585956b", lineNumber: 11}, {columnNumber: 16, filename: TEST_URI, functionName: "foobar585956b", lineNumber: 11},
{columnNumber: 16, filename: TEST_URI, functionName: "foobar585956a", lineNumber: 15}, {columnNumber: 16, filename: TEST_URI, functionName: "foobar585956a", lineNumber: 15},
{columnNumber: 1, filename: TEST_URI, functionName: "onclick", lineNumber: 1} {columnNumber: 1, filename: TEST_URI, functionName: "onclick", lineNumber: 1},
]; ];
}); });
@ -290,7 +290,7 @@ function testLocationData(aMessageObject) {
is(aMessageObject.lineNumber, gArgs[0].lineNumber, "lineNumber matches"); is(aMessageObject.lineNumber, gArgs[0].lineNumber, "lineNumber matches");
is(aMessageObject.functionName, gArgs[0].functionName, "functionName matches"); is(aMessageObject.functionName, gArgs[0].functionName, "functionName matches");
is(aMessageObject.arguments.length, gArgs[0].arguments.length, "arguments.length matches"); is(aMessageObject.arguments.length, gArgs[0].arguments.length, "arguments.length matches");
gArgs[0].arguments.forEach(function (a, i) { gArgs[0].arguments.forEach(function(a, i) {
is(aMessageObject.arguments[i], a, "correct arg " + i); is(aMessageObject.arguments[i], a, "correct arg " + i);
}); });
@ -301,7 +301,7 @@ async function startLocationTest(browser) {
await spawnWithObserver(browser, testLocationData, function(opts) { await spawnWithObserver(browser, testLocationData, function(opts) {
gLevel = "log"; gLevel = "log";
gArgs = [ gArgs = [
{filename: TEST_URI, functionName: "foobar646025", arguments: ["omg", "o", "d"], lineNumber: 19} {filename: TEST_URI, functionName: "foobar646025", arguments: ["omg", "o", "d"], lineNumber: 19},
]; ];
}); });
@ -341,13 +341,11 @@ function testConsoleGroup(aMessageObject) {
is(aMessageObject.groupName, "a group", "groupCollapsed groupName matches"); is(aMessageObject.groupName, "a group", "groupCollapsed groupName matches");
is(aMessageObject.arguments[0], "a", "groupCollapsed arguments[0] matches"); is(aMessageObject.arguments[0], "a", "groupCollapsed arguments[0] matches");
is(aMessageObject.arguments[1], "group", "groupCollapsed arguments[0] matches"); is(aMessageObject.arguments[1], "group", "groupCollapsed arguments[0] matches");
} } else if (aMessageObject.level == "group") {
else if (aMessageObject.level == "group") {
is(aMessageObject.groupName, "b group", "group groupName matches"); is(aMessageObject.groupName, "b group", "group groupName matches");
is(aMessageObject.arguments[0], "b", "group arguments[0] matches"); is(aMessageObject.arguments[0], "b", "group arguments[0] matches");
is(aMessageObject.arguments[1], "group", "group arguments[1] matches"); is(aMessageObject.arguments[1], "group", "group arguments[1] matches");
} } else if (aMessageObject.level == "groupEnd") {
else if (aMessageObject.level == "groupEnd") {
is(aMessageObject.groupName, "b group", "groupEnd groupName matches"); is(aMessageObject.groupName, "b group", "groupEnd groupName matches");
} }
@ -374,7 +372,7 @@ function testConsoleTime(aMessageObject) {
is(aMessageObject.functionName, gArgs[0].functionName, "functionName matches"); is(aMessageObject.functionName, gArgs[0].functionName, "functionName matches");
is(aMessageObject.timer.name, gArgs[0].timer.name, "timer.name matches"); is(aMessageObject.timer.name, gArgs[0].timer.name, "timer.name matches");
gArgs[0].arguments.forEach(function (a, i) { gArgs[0].arguments.forEach(function(a, i) {
is(aMessageObject.arguments[i], a, "correct arg " + i); is(aMessageObject.arguments[i], a, "correct arg " + i);
}); });
@ -388,7 +386,7 @@ async function startTimeTest(browser) {
{filename: TEST_URI, lineNumber: 23, functionName: "startTimer", {filename: TEST_URI, lineNumber: 23, functionName: "startTimer",
arguments: ["foo"], arguments: ["foo"],
timer: { name: "foo" }, timer: { name: "foo" },
} },
]; ];
}); });
@ -412,7 +410,7 @@ function testConsoleTimeEnd(aMessageObject) {
info("timer duration: " + aMessageObject.timer.duration); info("timer duration: " + aMessageObject.timer.duration);
ok(aMessageObject.timer.duration >= 0, "timer duration is positive"); ok(aMessageObject.timer.duration >= 0, "timer duration is positive");
gArgs[0].arguments.forEach(function (a, i) { gArgs[0].arguments.forEach(function(a, i) {
is(aMessageObject.arguments[i], a, "correct arg " + i); is(aMessageObject.arguments[i], a, "correct arg " + i);
}); });
@ -445,7 +443,7 @@ function testConsoleTimeStamp(aMessageObject) {
is(aMessageObject.functionName, gArgs[0].functionName, "functionName matches"); is(aMessageObject.functionName, gArgs[0].functionName, "functionName matches");
ok(aMessageObject.timeStamp > 0, "timeStamp is a positive value"); ok(aMessageObject.timeStamp > 0, "timeStamp is a positive value");
gArgs[0].arguments.forEach(function (a, i) { gArgs[0].arguments.forEach(function(a, i) {
is(aMessageObject.arguments[i], a, "correct arg " + i); is(aMessageObject.arguments[i], a, "correct arg " + i);
}); });
@ -457,8 +455,8 @@ async function startTimeStampTest(browser) {
gLevel = "timeStamp"; gLevel = "timeStamp";
gArgs = [ gArgs = [
{filename: TEST_URI, lineNumber: 58, functionName: "timeStamp", {filename: TEST_URI, lineNumber: 58, functionName: "timeStamp",
arguments: ["!!!"] arguments: ["!!!"],
} },
]; ];
}); });
@ -486,8 +484,8 @@ async function startEmptyTimeStampTest(browser) {
gLevel = "timeStamp"; gLevel = "timeStamp";
gArgs = [ gArgs = [
{filename: TEST_URI, lineNumber: 58, functionName: "timeStamp", {filename: TEST_URI, lineNumber: 58, functionName: "timeStamp",
arguments: [] arguments: [],
} },
]; ];
}); });

View file

@ -40,11 +40,10 @@ const ConsoleObserver = {
finish(); finish();
} }
} },
}; };
function test() function test() {
{
ConsoleObserver.init(); ConsoleObserver.init();
waitForExplicitFinish(); waitForExplicitFinish();

View file

@ -3,14 +3,12 @@
const TEST_URI_NAV = "http://example.com/browser/dom/tests/browser/"; const TEST_URI_NAV = "http://example.com/browser/dom/tests/browser/";
function tearDown() function tearDown() {
{
while (gBrowser.tabs.length > 1) while (gBrowser.tabs.length > 1)
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
} }
add_task(async function() add_task(async function() {
{
// Don't cache removed tabs, so "clear console cache on tab close" triggers. // Don't cache removed tabs, so "clear console cache on tab close" triggers.
await SpecialPowers.pushPrefEnv({ set: [[ "browser.tabs.max_tabs_undo", 0 ]] }); await SpecialPowers.pushPrefEnv({ set: [[ "browser.tabs.max_tabs_undo", 0 ]] });
@ -35,7 +33,7 @@ add_task(async function()
let ConsoleObserver = { let ConsoleObserver = {
QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]), QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]),
observe: function(aSubject, aTopic, aData) { observe(aSubject, aTopic, aData) {
if (aTopic == "console-storage-cache-event") { if (aTopic == "console-storage-cache-event") {
apiCallCount++; apiCallCount++;
if (apiCallCount == 4) { if (apiCallCount == 4) {
@ -49,7 +47,7 @@ add_task(async function()
resolve(windowId); resolve(windowId);
} }
} }
} },
}; };
Services.obs.addObserver(ConsoleObserver, "console-storage-cache-event"); Services.obs.addObserver(ConsoleObserver, "console-storage-cache-event");
@ -85,7 +83,7 @@ add_task(async function()
browser = gBrowser.selectedBrowser; browser = gBrowser.selectedBrowser;
// Spin the event loop to make sure everything is cleared. // Spin the event loop to make sure everything is cleared.
await ContentTask.spawn(browser, null, function () { await ContentTask.spawn(browser, null, function() {
return Promise.resolve(); return Promise.resolve();
}); });

View file

@ -29,7 +29,7 @@ function test() {
function doTest(aIsPrivateMode, aWindow, aCallback) { function doTest(aIsPrivateMode, aWindow, aCallback) {
BrowserTestUtils.browserLoaded(aWindow.gBrowser.selectedBrowser).then(() => { BrowserTestUtils.browserLoaded(aWindow.gBrowser.selectedBrowser).then(() => {
consoleObserver = { consoleObserver = {
observe: function(aSubject, aTopic, aData) { observe(aSubject, aTopic, aData) {
if (aTopic == "console-api-log-event") { if (aTopic == "console-api-log-event") {
afterEvents = ConsoleAPIStorage.getEvents(innerID); afterEvents = ConsoleAPIStorage.getEvents(innerID);
is(beforeEvents.length == afterEvents.length - 1, storageShouldOccur, is(beforeEvents.length == afterEvents.length - 1, storageShouldOccur,
@ -40,7 +40,7 @@ function test() {
aCallback(); aCallback();
}); });
} }
} },
}; };
aWindow.Services.obs.addObserver( aWindow.Services.obs.addObserver(
@ -63,7 +63,7 @@ function test() {
// call whenNewWindowLoaded() instead of testOnWindow() on your test. // call whenNewWindowLoaded() instead of testOnWindow() on your test.
executeSoon(() => aCallback(aWin)); executeSoon(() => aCallback(aWin));
}); });
}; }
// this function is called after calling finish() on the test. // this function is called after calling finish() on the test.
registerCleanupFunction(function() { registerCleanupFunction(function() {

View file

@ -21,7 +21,7 @@ add_task(async function() {
await SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({
set: [ set: [
["dom.largeAllocationHeader.enabled", true], ["dom.largeAllocationHeader.enabled", true],
] ],
}); });
// A toplevel tab should be able to navigate cross process! // A toplevel tab should be able to navigate cross process!
@ -36,7 +36,7 @@ add_task(async function() {
// Allocate a gigabyte of memory in the content process // Allocate a gigabyte of memory in the content process
await ContentTask.spawn(aBrowser, null, () => { await ContentTask.spawn(aBrowser, null, () => {
let arrayBuffer = new ArrayBuffer(1024*1024*1024); let arrayBuffer = new ArrayBuffer(1024 * 1024 * 1024);
ok(arrayBuffer, "Successfully allocated a gigabyte of memory in content process"); ok(arrayBuffer, "Successfully allocated a gigabyte of memory in content process");
}); });
}); });

View file

@ -1,7 +1,7 @@
const TEST_URL = "http://www.example.com/browser/dom/tests/browser/dummy.html"; const TEST_URL = "http://www.example.com/browser/dom/tests/browser/dummy.html";
function pageScript() { function pageScript() {
window.addEventListener("beforeunload", function (event) { window.addEventListener("beforeunload", function(event) {
var str = "Leaving?"; var str = "Leaving?";
event.returnValue = str; event.returnValue = str;
return str; return str;
@ -10,7 +10,7 @@ function pageScript() {
function injectBeforeUnload(browser) { function injectBeforeUnload(browser) {
return ContentTask.spawn(browser, null, async function() { return ContentTask.spawn(browser, null, async function() {
content.window.addEventListener("beforeunload", function (event) { content.window.addEventListener("beforeunload", function(event) {
sendAsyncMessage("Test:OnBeforeUnloadReceived"); sendAsyncMessage("Test:OnBeforeUnloadReceived");
var str = "Leaving?"; var str = "Leaving?";
event.returnValue = str; event.returnValue = str;
@ -59,7 +59,7 @@ add_task(async function() {
await BrowserTestUtils.loadURI(browser, "about:support"); await BrowserTestUtils.loadURI(browser, "about:support");
await Promise.all([ await Promise.all([
dialogShown1, dialogShown1,
BrowserTestUtils.browserLoaded(browser) BrowserTestUtils.browserLoaded(browser),
]); ]);
is(beforeUnloadCount, 1, "Should have received one beforeunload event."); is(beforeUnloadCount, 1, "Should have received one beforeunload event.");
@ -77,7 +77,7 @@ add_task(async function() {
gBrowser.goForward(); gBrowser.goForward();
await Promise.all([ await Promise.all([
dialogShown2, dialogShown2,
BrowserTestUtils.browserLoaded(browser) BrowserTestUtils.browserLoaded(browser),
]); ]);
is(beforeUnloadCount, 2, "Should have received two beforeunload events."); is(beforeUnloadCount, 2, "Should have received two beforeunload events.");
@ -101,7 +101,7 @@ add_task(async function() {
ok(!browser.isRemoteBrowser, "Browser should not be remote."); ok(!browser.isRemoteBrowser, "Browser should not be remote.");
await ContentTask.spawn(browser, null, async function() { await ContentTask.spawn(browser, null, async function() {
content.window.addEventListener("beforeunload", function (event) { content.window.addEventListener("beforeunload", function(event) {
sendAsyncMessage("Test:OnBeforeUnloadReceived"); sendAsyncMessage("Test:OnBeforeUnloadReceived");
var str = "Leaving?"; var str = "Leaving?";
event.returnValue = str; event.returnValue = str;
@ -114,7 +114,7 @@ add_task(async function() {
await BrowserTestUtils.loadURI(browser, TEST_URL); await BrowserTestUtils.loadURI(browser, TEST_URL);
await Promise.all([ await Promise.all([
dialogShown1, dialogShown1,
BrowserTestUtils.browserLoaded(browser) BrowserTestUtils.browserLoaded(browser),
]); ]);
is(beforeUnloadCount, 1, "Should have received one beforeunload event."); is(beforeUnloadCount, 1, "Should have received one beforeunload event.");
ok(browser.isRemoteBrowser, "Browser should be remote."); ok(browser.isRemoteBrowser, "Browser should be remote.");
@ -124,7 +124,7 @@ add_task(async function() {
gBrowser.goBack(); gBrowser.goBack();
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);
await ContentTask.spawn(browser, null, async function() { await ContentTask.spawn(browser, null, async function() {
content.window.addEventListener("beforeunload", function (event) { content.window.addEventListener("beforeunload", function(event) {
sendAsyncMessage("Test:OnBeforeUnloadReceived"); sendAsyncMessage("Test:OnBeforeUnloadReceived");
var str = "Leaving?"; var str = "Leaving?";
event.returnValue = str; event.returnValue = str;
@ -138,7 +138,7 @@ add_task(async function() {
gBrowser.goForward(); gBrowser.goForward();
await Promise.all([ await Promise.all([
dialogShown2, dialogShown2,
BrowserTestUtils.browserLoaded(browser) BrowserTestUtils.browserLoaded(browser),
]); ]);
is(beforeUnloadCount, 2, "Should have received two beforeunload events."); is(beforeUnloadCount, 2, "Should have received two beforeunload events.");

View file

@ -5,23 +5,23 @@
add_task(async function() { add_task(async function() {
await BrowserTestUtils.withNewTab("about:blank", async function(aBrowser) { await BrowserTestUtils.withNewTab("about:blank", async function(aBrowser) {
let duration = await ContentTask.spawn(aBrowser, null, function (opts) { let duration = await ContentTask.spawn(aBrowser, null, function(opts) {
const TEST_URI = "http://example.com/browser/dom/tests/browser/test_bug1004814.html"; const TEST_URI = "http://example.com/browser/dom/tests/browser/test_bug1004814.html";
return new Promise(resolve => { return new Promise(resolve => {
let ConsoleObserver = { let ConsoleObserver = {
QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]), QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]),
observe: function(aSubject, aTopic, aData) { observe(aSubject, aTopic, aData) {
var obj = aSubject.wrappedJSObject; var obj = aSubject.wrappedJSObject;
if (obj.arguments.length != 1 || obj.arguments[0] != 'bug1004814' || if (obj.arguments.length != 1 || obj.arguments[0] != "bug1004814" ||
obj.level != 'timeEnd') { obj.level != "timeEnd") {
return; return;
} }
Services.obs.removeObserver(this, "console-api-log-event"); Services.obs.removeObserver(this, "console-api-log-event");
resolve(obj.timer.duration); resolve(obj.timer.duration);
} },
}; };
Services.obs.addObserver(ConsoleObserver, "console-api-log-event"); Services.obs.addObserver(ConsoleObserver, "console-api-log-event");

View file

@ -23,7 +23,7 @@ add_task(async function() {
// it will show up as a non-shutdown leak. // it will show up as a non-shutdown leak.
await BrowserTestUtils.withNewTab({ await BrowserTestUtils.withNewTab({
gBrowser, gBrowser,
url: TEST_URI url: TEST_URI,
}, function(browser) { /* ... */ }); }, function(browser) { /* ... */ });
ok(true, "Need to do something in this test"); ok(true, "Need to do something in this test");

View file

@ -11,175 +11,175 @@ function testInDocument(doc, documentID) {
} }
/* List copy/pasted from nsHTMLTagList.h */ /* List copy/pasted from nsHTMLTagList.h */
HTML_TAG("a", "Anchor") HTML_TAG("a", "Anchor");
HTML_TAG("abbr", "Span") HTML_TAG("abbr", "Span");
HTML_TAG("acronym", "Span") HTML_TAG("acronym", "Span");
HTML_TAG("address", "Span") HTML_TAG("address", "Span");
HTML_TAG("applet", "Unknown") HTML_TAG("applet", "Unknown");
HTML_TAG("area", "Area") HTML_TAG("area", "Area");
HTML_TAG("b", "Span") HTML_TAG("b", "Span");
HTML_TAG("base", "Shared") HTML_TAG("base", "Shared");
HTML_TAG("basefont", "Span") HTML_TAG("basefont", "Span");
HTML_TAG("bdi", "") HTML_TAG("bdi", "");
HTML_TAG("bdo", "Span") HTML_TAG("bdo", "Span");
HTML_TAG("bgsound", "Span") HTML_TAG("bgsound", "Span");
HTML_TAG("big", "Span") HTML_TAG("big", "Span");
HTML_TAG("blockquote", "Shared") HTML_TAG("blockquote", "Shared");
HTML_TAG("body", "Body") HTML_TAG("body", "Body");
HTML_TAG("br", "BR") HTML_TAG("br", "BR");
HTML_TAG("button", "Button") HTML_TAG("button", "Button");
HTML_TAG("canvas", "Canvas") HTML_TAG("canvas", "Canvas");
HTML_TAG("caption", "TableCaption") HTML_TAG("caption", "TableCaption");
HTML_TAG("center", "Span") HTML_TAG("center", "Span");
HTML_TAG("cite", "Span") HTML_TAG("cite", "Span");
HTML_TAG("code", "Span") HTML_TAG("code", "Span");
HTML_TAG("col", "TableCol") HTML_TAG("col", "TableCol");
HTML_TAG("colgroup", "TableCol") HTML_TAG("colgroup", "TableCol");
HTML_TAG("dd", "Span") HTML_TAG("dd", "Span");
HTML_TAG("del", "Mod") HTML_TAG("del", "Mod");
HTML_TAG("dfn", "Span") HTML_TAG("dfn", "Span");
HTML_TAG("dir", "Shared") HTML_TAG("dir", "Shared");
HTML_TAG("div", "Div") HTML_TAG("div", "Div");
HTML_TAG("dl", "SharedList") HTML_TAG("dl", "SharedList");
HTML_TAG("dt", "Span") HTML_TAG("dt", "Span");
HTML_TAG("em", "Span") HTML_TAG("em", "Span");
HTML_TAG("embed", "Embed") HTML_TAG("embed", "Embed");
HTML_TAG("fieldset", "FieldSet") HTML_TAG("fieldset", "FieldSet");
HTML_TAG("font", "Font") HTML_TAG("font", "Font");
HTML_TAG("form", "Form") HTML_TAG("form", "Form");
HTML_TAG("frame", "Frame") HTML_TAG("frame", "Frame");
HTML_TAG("frameset", "FrameSet") HTML_TAG("frameset", "FrameSet");
HTML_TAG("h1", "Heading") HTML_TAG("h1", "Heading");
HTML_TAG("h2", "Heading") HTML_TAG("h2", "Heading");
HTML_TAG("h3", "Heading") HTML_TAG("h3", "Heading");
HTML_TAG("h4", "Heading") HTML_TAG("h4", "Heading");
HTML_TAG("h5", "Heading") HTML_TAG("h5", "Heading");
HTML_TAG("h6", "Heading") HTML_TAG("h6", "Heading");
HTML_TAG("head", "Head") HTML_TAG("head", "Head");
HTML_TAG("hr", "HR") HTML_TAG("hr", "HR");
HTML_TAG("html", "Html") HTML_TAG("html", "Html");
HTML_TAG("i", "Span") HTML_TAG("i", "Span");
HTML_TAG("iframe", "IFrame") HTML_TAG("iframe", "IFrame");
HTML_TAG("image", "") HTML_TAG("image", "");
HTML_TAG("img", "Image") HTML_TAG("img", "Image");
HTML_TAG("input", "Input") HTML_TAG("input", "Input");
HTML_TAG("ins", "Mod") HTML_TAG("ins", "Mod");
HTML_TAG("isindex", "Unknown") HTML_TAG("isindex", "Unknown");
HTML_TAG("kbd", "Span") HTML_TAG("kbd", "Span");
HTML_TAG("keygen", "Span") HTML_TAG("keygen", "Span");
HTML_TAG("label", "Label") HTML_TAG("label", "Label");
HTML_TAG("legend", "Legend") HTML_TAG("legend", "Legend");
HTML_TAG("li", "LI") HTML_TAG("li", "LI");
HTML_TAG("link", "Link") HTML_TAG("link", "Link");
HTML_TAG("listing", "Span") HTML_TAG("listing", "Span");
HTML_TAG("map", "Map") HTML_TAG("map", "Map");
HTML_TAG("marquee", "Div") HTML_TAG("marquee", "Div");
HTML_TAG("menu", "Shared") HTML_TAG("menu", "Shared");
HTML_TAG("meta", "Meta") HTML_TAG("meta", "Meta");
HTML_TAG("multicol", "Unknown") HTML_TAG("multicol", "Unknown");
HTML_TAG("nobr", "Span") HTML_TAG("nobr", "Span");
HTML_TAG("noembed", "Div") HTML_TAG("noembed", "Div");
HTML_TAG("noframes", "Div") HTML_TAG("noframes", "Div");
HTML_TAG("noscript", "Div") HTML_TAG("noscript", "Div");
HTML_TAG("object", "Object") HTML_TAG("object", "Object");
HTML_TAG("ol", "SharedList") HTML_TAG("ol", "SharedList");
HTML_TAG("optgroup", "OptGroup") HTML_TAG("optgroup", "OptGroup");
HTML_TAG("option", "Option") HTML_TAG("option", "Option");
HTML_TAG("p", "Paragraph") HTML_TAG("p", "Paragraph");
HTML_TAG("param", "Shared") HTML_TAG("param", "Shared");
HTML_TAG("plaintext", "Span") HTML_TAG("plaintext", "Span");
HTML_TAG("pre", "Pre") HTML_TAG("pre", "Pre");
HTML_TAG("q", "Shared") HTML_TAG("q", "Shared");
HTML_TAG("s", "Span") HTML_TAG("s", "Span");
HTML_TAG("samp", "Span") HTML_TAG("samp", "Span");
HTML_TAG("script", "Script") HTML_TAG("script", "Script");
HTML_TAG("select", "Select") HTML_TAG("select", "Select");
HTML_TAG("small", "Span") HTML_TAG("small", "Span");
HTML_TAG("spacer", "Unknown") HTML_TAG("spacer", "Unknown");
HTML_TAG("span", "Span") HTML_TAG("span", "Span");
HTML_TAG("strike", "Span") HTML_TAG("strike", "Span");
HTML_TAG("strong", "Span") HTML_TAG("strong", "Span");
HTML_TAG("style", "Style") HTML_TAG("style", "Style");
HTML_TAG("sub", "Span") HTML_TAG("sub", "Span");
HTML_TAG("sup", "Span") HTML_TAG("sup", "Span");
HTML_TAG("table", "Table") HTML_TAG("table", "Table");
HTML_TAG("tbody", "TableSection") HTML_TAG("tbody", "TableSection");
HTML_TAG("td", "TableCell") HTML_TAG("td", "TableCell");
HTML_TAG("textarea", "TextArea") HTML_TAG("textarea", "TextArea");
HTML_TAG("tfoot", "TableSection") HTML_TAG("tfoot", "TableSection");
HTML_TAG("th", "TableCell") HTML_TAG("th", "TableCell");
HTML_TAG("thead", "TableSection") HTML_TAG("thead", "TableSection");
HTML_TAG("template", "Template") HTML_TAG("template", "Template");
HTML_TAG("title", "Title") HTML_TAG("title", "Title");
HTML_TAG("tr", "TableRow") HTML_TAG("tr", "TableRow");
HTML_TAG("tt", "Span") HTML_TAG("tt", "Span");
HTML_TAG("u", "Span") HTML_TAG("u", "Span");
HTML_TAG("ul", "SharedList") HTML_TAG("ul", "SharedList");
HTML_TAG("var", "Span") HTML_TAG("var", "Span");
HTML_TAG("wbr", "Shared") HTML_TAG("wbr", "Shared");
HTML_TAG("xmp", "Span") HTML_TAG("xmp", "Span");
function SVG_TAG(name) { function SVG_TAG(name) {
allNodes.push(doc.createElementNS("http://www.w3.org/2000/svg", name)); allNodes.push(doc.createElementNS("http://www.w3.org/2000/svg", name));
} }
// List sorta stolen from SVG element factory. // List sorta stolen from SVG element factory.
SVG_TAG("a") SVG_TAG("a");
SVG_TAG("polyline") SVG_TAG("polyline");
SVG_TAG("polygon") SVG_TAG("polygon");
SVG_TAG("circle") SVG_TAG("circle");
SVG_TAG("ellipse") SVG_TAG("ellipse");
SVG_TAG("line") SVG_TAG("line");
SVG_TAG("rect") SVG_TAG("rect");
SVG_TAG("svg") SVG_TAG("svg");
SVG_TAG("g") SVG_TAG("g");
SVG_TAG("foreignObject") SVG_TAG("foreignObject");
SVG_TAG("path") SVG_TAG("path");
SVG_TAG("text") SVG_TAG("text");
SVG_TAG("tspan") SVG_TAG("tspan");
SVG_TAG("image") SVG_TAG("image");
SVG_TAG("style") SVG_TAG("style");
SVG_TAG("linearGradient") SVG_TAG("linearGradient");
SVG_TAG("metadata") SVG_TAG("metadata");
SVG_TAG("radialGradient") SVG_TAG("radialGradient");
SVG_TAG("stop") SVG_TAG("stop");
SVG_TAG("defs") SVG_TAG("defs");
SVG_TAG("desc") SVG_TAG("desc");
SVG_TAG("script") SVG_TAG("script");
SVG_TAG("use") SVG_TAG("use");
SVG_TAG("symbol") SVG_TAG("symbol");
SVG_TAG("marker") SVG_TAG("marker");
SVG_TAG("title") SVG_TAG("title");
SVG_TAG("clipPath") SVG_TAG("clipPath");
SVG_TAG("textPath") SVG_TAG("textPath");
SVG_TAG("filter") SVG_TAG("filter");
SVG_TAG("feBlend") SVG_TAG("feBlend");
SVG_TAG("feColorMatrix") SVG_TAG("feColorMatrix");
SVG_TAG("feComponentTransfer") SVG_TAG("feComponentTransfer");
SVG_TAG("feComposite") SVG_TAG("feComposite");
SVG_TAG("feFuncR") SVG_TAG("feFuncR");
SVG_TAG("feFuncG") SVG_TAG("feFuncG");
SVG_TAG("feFuncB") SVG_TAG("feFuncB");
SVG_TAG("feFuncA") SVG_TAG("feFuncA");
SVG_TAG("feGaussianBlur") SVG_TAG("feGaussianBlur");
SVG_TAG("feMerge") SVG_TAG("feMerge");
SVG_TAG("feMergeNode") SVG_TAG("feMergeNode");
SVG_TAG("feMorphology") SVG_TAG("feMorphology");
SVG_TAG("feOffset") SVG_TAG("feOffset");
SVG_TAG("feFlood") SVG_TAG("feFlood");
SVG_TAG("feTile") SVG_TAG("feTile");
SVG_TAG("feTurbulence") SVG_TAG("feTurbulence");
SVG_TAG("feConvolveMatrix") SVG_TAG("feConvolveMatrix");
SVG_TAG("feDistantLight") SVG_TAG("feDistantLight");
SVG_TAG("fePointLight") SVG_TAG("fePointLight");
SVG_TAG("feSpotLight") SVG_TAG("feSpotLight");
SVG_TAG("feDiffuseLighting") SVG_TAG("feDiffuseLighting");
SVG_TAG("feSpecularLighting") SVG_TAG("feSpecularLighting");
SVG_TAG("feDisplacementMap") SVG_TAG("feDisplacementMap");
SVG_TAG("feImage") SVG_TAG("feImage");
SVG_TAG("pattern") SVG_TAG("pattern");
SVG_TAG("mask") SVG_TAG("mask");
SVG_TAG("svgSwitch") SVG_TAG("svgSwitch");
// Toss in some other namespaced stuff too, for good measure // Toss in some other namespaced stuff too, for good measure
// XUL stuff might not be creatable in content documents // XUL stuff might not be creatable in content documents

View file

@ -30,7 +30,7 @@ add_task(async function test() {
isnot(fm.focusedElement, document.getElementById("urlbar").inputField, isnot(fm.focusedElement, document.getElementById("urlbar").inputField,
"Failed to move focus away from search bar: button=" + button); "Failed to move focus away from search bar: button=" + button);
await ContentTask.spawn(tab.linkedBrowser, button, async function (button) { await ContentTask.spawn(tab.linkedBrowser, button, async function(button) {
let fm = Cc["@mozilla.org/focus-manager;1"]. let fm = Cc["@mozilla.org/focus-manager;1"].
getService(Ci.nsIFocusManager); getService(Ci.nsIFocusManager);

View file

@ -11,7 +11,7 @@ add_task(async function test() {
if (!browser.isRemoteBrowser) { if (!browser.isRemoteBrowser) {
// Non-e10s, access contentWindow and confirm its container is the browser: // Non-e10s, access contentWindow and confirm its container is the browser:
let windowUtils = browser.contentWindow.windowUtils; let windowUtils = browser.contentWindow.windowUtils;
is (windowUtils.containerElement, browser, is(windowUtils.containerElement, browser,
"Container element for main window is xul:browser"); "Container element for main window is xul:browser");
} }
@ -57,8 +57,8 @@ function startTests() {
async function mozBrowserTests(browser) { async function mozBrowserTests(browser) {
info("Granting special powers for mozbrowser"); info("Granting special powers for mozbrowser");
SpecialPowers.addPermission("browser", true, TEST_URI); SpecialPowers.addPermission("browser", true, TEST_URI);
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true); SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
SpecialPowers.setBoolPref('network.disable.ipc.security', true); SpecialPowers.setBoolPref("network.disable.ipc.security", true);
await ContentTask.spawn(browser, null, function() { await ContentTask.spawn(browser, null, function() {
info("Checking mozbrowser iframe"); info("Checking mozbrowser iframe");
@ -72,7 +72,7 @@ async function mozBrowserTests(browser) {
}); });
info("Revoking special powers for mozbrowser"); info("Revoking special powers for mozbrowser");
SpecialPowers.clearUserPref('dom.mozBrowserFramesEnabled'); SpecialPowers.clearUserPref("dom.mozBrowserFramesEnabled");
SpecialPowers.clearUserPref('network.disable.ipc.security'); SpecialPowers.clearUserPref("network.disable.ipc.security");
SpecialPowers.removePermission("browser", TEST_URI); SpecialPowers.removePermission("browser", TEST_URI);
} }

View file

@ -55,7 +55,7 @@ function addOuterBeforeUnloadListeners(browser, howMany = 1, frameDepth = 1) {
if (frameDepth == 0) { if (frameDepth == 0) {
throw new Error("When adding a beforeunload listener on an outer " + throw new Error("When adding a beforeunload listener on an outer " +
"window, the frame you're targeting needs to be at " + "window, the frame you're targeting needs to be at " +
"depth > 0.") "depth > 0.");
} }
return controlFrameAt(browser, frameDepth, { return controlFrameAt(browser, frameDepth, {
@ -115,7 +115,7 @@ function removeOuterBeforeUnloadListeners(browser, howMany = 1, frameDepth = 1)
if (frameDepth == 0) { if (frameDepth == 0) {
throw new Error("When removing a beforeunload listener from an outer " + throw new Error("When removing a beforeunload listener from an outer " +
"window, the frame you're targeting needs to be at " + "window, the frame you're targeting needs to be at " +
"depth > 0.") "depth > 0.");
} }
return controlFrameAt(browser, frameDepth, { return controlFrameAt(browser, frameDepth, {
@ -445,8 +445,8 @@ add_task(async function test_inner_window_scenarios() {
// |--> <iframe at PAGE_URL> (BOTTOM) // |--> <iframe at PAGE_URL> (BOTTOM)
// //
await prepareSubframes(browser, [ await prepareSubframes(browser, [
{ sandboxAttributes: null, }, { sandboxAttributes: null },
{ sandboxAttributes: null, }, { sandboxAttributes: null },
]); ]);
// These constants are just to make it easier to know which // These constants are just to make it easier to know which
// frame we're referring to without having to remember the // frame we're referring to without having to remember the
@ -488,8 +488,8 @@ add_task(async function test_inner_window_scenarios() {
// Reset our window structure now. // Reset our window structure now.
await prepareSubframes(browser, [ await prepareSubframes(browser, [
{ sandboxAttributes: null, }, { sandboxAttributes: null },
{ sandboxAttributes: null, }, { sandboxAttributes: null },
]); ]);
// This time, add beforeunload event listeners to both the // This time, add beforeunload event listeners to both the
@ -505,8 +505,8 @@ add_task(async function test_inner_window_scenarios() {
// event listeners, and if we remove the BOTTOM <iframe> and the // event listeners, and if we remove the BOTTOM <iframe> and the
// MIDDLE <iframe>, that hasBeforeUnload is set to false. // MIDDLE <iframe>, that hasBeforeUnload is set to false.
await prepareSubframes(browser, [ await prepareSubframes(browser, [
{ sandboxAttributes: null, }, { sandboxAttributes: null },
{ sandboxAttributes: null, }, { sandboxAttributes: null },
]); ]);
await addBeforeUnloadListeners(browser, 3, MIDDLE); await addBeforeUnloadListeners(browser, 3, MIDDLE);
await addBeforeUnloadListeners(browser, 1, BOTTOM); await addBeforeUnloadListeners(browser, 1, BOTTOM);
@ -520,8 +520,8 @@ add_task(async function test_inner_window_scenarios() {
// event listeners, and if we remove just the MIDDLE <iframe>, that // event listeners, and if we remove just the MIDDLE <iframe>, that
// hasBeforeUnload is set to false. // hasBeforeUnload is set to false.
await prepareSubframes(browser, [ await prepareSubframes(browser, [
{ sandboxAttributes: null, }, { sandboxAttributes: null },
{ sandboxAttributes: null, }, { sandboxAttributes: null },
]); ]);
await addBeforeUnloadListeners(browser, 3, MIDDLE); await addBeforeUnloadListeners(browser, 3, MIDDLE);
await addBeforeUnloadListeners(browser, 1, BOTTOM); await addBeforeUnloadListeners(browser, 1, BOTTOM);
@ -533,8 +533,8 @@ add_task(async function test_inner_window_scenarios() {
// permission, do not result in the hasBeforeUnload attribute // permission, do not result in the hasBeforeUnload attribute
// being set to true when beforeunload event listeners are added. // being set to true when beforeunload event listeners are added.
await prepareSubframes(browser, [ await prepareSubframes(browser, [
{ sandboxAttributes: "allow-scripts", }, { sandboxAttributes: "allow-scripts" },
{ sandboxAttributes: "allow-scripts", }, { sandboxAttributes: "allow-scripts" },
]); ]);
await addBeforeUnloadListeners(browser, 3, MIDDLE); await addBeforeUnloadListeners(browser, 3, MIDDLE);
@ -549,8 +549,8 @@ add_task(async function test_inner_window_scenarios() {
// permission, cause the hasBeforeUnload attribute to be set // permission, cause the hasBeforeUnload attribute to be set
// to true when beforeunload event listeners are added. // to true when beforeunload event listeners are added.
await prepareSubframes(browser, [ await prepareSubframes(browser, [
{ sandboxAttributes: "allow-scripts allow-modals", }, { sandboxAttributes: "allow-scripts allow-modals" },
{ sandboxAttributes: "allow-scripts allow-modals", }, { sandboxAttributes: "allow-scripts allow-modals" },
]); ]);
await addBeforeUnloadListeners(browser, 3, MIDDLE); await addBeforeUnloadListeners(browser, 3, MIDDLE);
@ -591,8 +591,8 @@ add_task(async function test_outer_window_scenarios() {
// |--> <iframe at PAGE_URL> (BOTTOM) // |--> <iframe at PAGE_URL> (BOTTOM)
// //
await prepareSubframes(browser, [ await prepareSubframes(browser, [
{ sandboxAttributes: null, }, { sandboxAttributes: null },
{ sandboxAttributes: null, }, { sandboxAttributes: null },
]); ]);
// These constants are just to make it easier to know which // These constants are just to make it easier to know which
@ -641,8 +641,8 @@ add_task(async function test_outer_window_scenarios() {
assertHasBeforeUnload(browser, false); assertHasBeforeUnload(browser, false);
await prepareSubframes(browser, [ await prepareSubframes(browser, [
{ sandboxAttributes: null, }, { sandboxAttributes: null },
{ sandboxAttributes: null, }, { sandboxAttributes: null },
]); ]);
// Tests that if there are beforeunload event listeners on // Tests that if there are beforeunload event listeners on
@ -674,8 +674,8 @@ add_task(async function test_outer_window_scenarios() {
// Reset our window structure now. // Reset our window structure now.
await prepareSubframes(browser, [ await prepareSubframes(browser, [
{ sandboxAttributes: null, }, { sandboxAttributes: null },
{ sandboxAttributes: null, }, { sandboxAttributes: null },
]); ]);
// This time, add beforeunload event listeners to the outer // This time, add beforeunload event listeners to the outer
@ -691,8 +691,8 @@ add_task(async function test_outer_window_scenarios() {
// MIDDLE and BOTOTM, and then removes those iframes. Removing // MIDDLE and BOTOTM, and then removes those iframes. Removing
// both iframes should set hasBeforeUnload to false. // both iframes should set hasBeforeUnload to false.
await prepareSubframes(browser, [ await prepareSubframes(browser, [
{ sandboxAttributes: null, }, { sandboxAttributes: null },
{ sandboxAttributes: null, }, { sandboxAttributes: null },
]); ]);
await addOuterBeforeUnloadListeners(browser, 3, MIDDLE); await addOuterBeforeUnloadListeners(browser, 3, MIDDLE);
await addOuterBeforeUnloadListeners(browser, 1, BOTTOM); await addOuterBeforeUnloadListeners(browser, 1, BOTTOM);
@ -707,8 +707,8 @@ add_task(async function test_outer_window_scenarios() {
// take the bottom one with it). This should set hasBeforeUnload to // take the bottom one with it). This should set hasBeforeUnload to
// false. // false.
await prepareSubframes(browser, [ await prepareSubframes(browser, [
{ sandboxAttributes: null, }, { sandboxAttributes: null },
{ sandboxAttributes: null, }, { sandboxAttributes: null },
]); ]);
await addOuterBeforeUnloadListeners(browser, 3, MIDDLE); await addOuterBeforeUnloadListeners(browser, 3, MIDDLE);
await addOuterBeforeUnloadListeners(browser, 1, BOTTOM); await addOuterBeforeUnloadListeners(browser, 1, BOTTOM);
@ -723,8 +723,8 @@ add_task(async function test_outer_window_scenarios() {
// allow-same-origin permission, otherwise a cross-origin // allow-same-origin permission, otherwise a cross-origin
// security exception is thrown. // security exception is thrown.
await prepareSubframes(browser, [ await prepareSubframes(browser, [
{ sandboxAttributes: "allow-same-origin allow-scripts", }, { sandboxAttributes: "allow-same-origin allow-scripts" },
{ sandboxAttributes: "allow-same-origin allow-scripts", }, { sandboxAttributes: "allow-same-origin allow-scripts" },
]); ]);
await addOuterBeforeUnloadListeners(browser, 3, MIDDLE); await addOuterBeforeUnloadListeners(browser, 3, MIDDLE);
@ -741,8 +741,8 @@ add_task(async function test_outer_window_scenarios() {
// that this requires the allow-same-origin permission, // that this requires the allow-same-origin permission,
// otherwise a cross-origin security exception is thrown. // otherwise a cross-origin security exception is thrown.
await prepareSubframes(browser, [ await prepareSubframes(browser, [
{ sandboxAttributes: "allow-same-origin allow-scripts allow-modals", }, { sandboxAttributes: "allow-same-origin allow-scripts allow-modals" },
{ sandboxAttributes: "allow-same-origin allow-scripts allow-modals", }, { sandboxAttributes: "allow-same-origin allow-scripts allow-modals" },
]); ]);
await addOuterBeforeUnloadListeners(browser, 3, MIDDLE); await addOuterBeforeUnloadListeners(browser, 3, MIDDLE);
@ -781,8 +781,8 @@ add_task(async function test_mixed_inner_and_outer_window_scenarios() {
// |--> <iframe at PAGE_URL> (BOTTOM) // |--> <iframe at PAGE_URL> (BOTTOM)
// //
await prepareSubframes(browser, [ await prepareSubframes(browser, [
{ sandboxAttributes: null, }, { sandboxAttributes: null },
{ sandboxAttributes: null, }, { sandboxAttributes: null },
]); ]);
// These constants are just to make it easier to know which // These constants are just to make it easier to know which

View file

@ -13,8 +13,8 @@ add_task(async function() {
["dom.largeAllocation.forceEnable", true], ["dom.largeAllocation.forceEnable", true],
// Increase processCount.webLargeAllocation to avoid any races where // Increase processCount.webLargeAllocation to avoid any races where
// processes aren't being cleaned up quickly enough. // processes aren't being cleaned up quickly enough.
["dom.ipc.processCount.webLargeAllocation", 20] ["dom.ipc.processCount.webLargeAllocation", 20],
] ],
}); });
await largeAllocSuccessTests(); await largeAllocSuccessTests();
@ -31,8 +31,8 @@ add_task(async function() {
["dom.largeAllocation.forceEnable", false], ["dom.largeAllocation.forceEnable", false],
// Increase processCount.webLargeAllocation to avoid any races where // Increase processCount.webLargeAllocation to avoid any races where
// processes aren't being cleaned up quickly enough. // processes aren't being cleaned up quickly enough.
["dom.ipc.processCount.webLargeAllocation", 20] ["dom.ipc.processCount.webLargeAllocation", 20],
] ],
}); });
await largeAllocFailTests(); await largeAllocFailTests();

View file

@ -9,8 +9,8 @@ add_task(async function() {
["dom.largeAllocationHeader.enabled", true], ["dom.largeAllocationHeader.enabled", true],
// Increase processCount.webLargeAllocation to avoid any races where // Increase processCount.webLargeAllocation to avoid any races where
// processes aren't being cleaned up quickly enough. // processes aren't being cleaned up quickly enough.
["dom.ipc.processCount.webLargeAllocation", 20] ["dom.ipc.processCount.webLargeAllocation", 20],
] ],
}); });
await largeAllocSuccessTests(); await largeAllocSuccessTests();

View file

@ -5,6 +5,74 @@ const HELPER_PAGE_ORIGIN = "http://example.com/";
let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/")); let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
Services.scriptloader.loadSubScript(testDir + "/helper_localStorage_e10s.js", Services.scriptloader.loadSubScript(testDir + "/helper_localStorage_e10s.js",
this); this);
// Simple tab wrapper abstracting our messaging mechanism;
class KnownTab {
constructor(name, tab) {
this.name = name;
this.tab = tab;
}
cleanup() {
this.tab = null;
}
}
// Simple data structure class to help us track opened tabs and their pids.
class KnownTabs {
constructor() {
this.byPid = new Map();
this.byName = new Map();
}
cleanup() {
this.byPid = null;
this.byName = null;
}
}
/**
* Open our helper page in a tab in its own content process, asserting that it
* really is in its own process. We initially load and wait for about:blank to
* load, and only then loadURI to our actual page. This is to ensure that
* LocalStorageManager has had an opportunity to be created and populate
* mOriginsHavingData.
*
* (nsGlobalWindow will reliably create LocalStorageManager as a side-effect of
* the unconditional call to nsGlobalWindow::PreloadLocalStorage. This will
* reliably create the StorageDBChild instance, and its corresponding
* StorageDBParent will send the set of origins when it is constructed.)
*/
async function openTestTabInOwnProcess(name, knownTabs) {
let realUrl = HELPER_PAGE_URL + "?" + encodeURIComponent(name);
// Load and wait for about:blank.
let tab = await BrowserTestUtils.openNewForegroundTab({
gBrowser, opening: "about:blank", forceNewProcess: true,
});
let pid = tab.linkedBrowser.frameLoader.tabParent.osPid;
ok(!knownTabs.byName.has(name), "tab needs its own name: " + name);
ok(!knownTabs.byPid.has(pid), "tab needs to be in its own process: " + pid);
let knownTab = new KnownTab(name, tab);
knownTabs.byPid.set(pid, knownTab);
knownTabs.byName.set(name, knownTab);
// Now trigger the actual load of our page.
BrowserTestUtils.loadURI(tab.linkedBrowser, realUrl);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
is(tab.linkedBrowser.frameLoader.tabParent.osPid, pid, "still same pid");
return knownTab;
}
/**
* Close all the tabs we opened.
*/
async function cleanupTabs(knownTabs) {
for (let knownTab of knownTabs.byName.values()) {
BrowserTestUtils.removeTab(knownTab.tab);
knownTab.cleanup();
}
knownTabs.cleanup();
}
/** /**
* Wait for a LocalStorage flush to occur. This notification can occur as a * Wait for a LocalStorage flush to occur. This notification can occur as a
@ -20,10 +88,10 @@ function waitForLocalStorageFlush() {
return new Promise(function(resolve) { return new Promise(function(resolve) {
let observer = { let observer = {
observe: function() { observe() {
SpecialPowers.removeObserver(observer, "domstorage-test-flushed"); SpecialPowers.removeObserver(observer, "domstorage-test-flushed");
resolve(); resolve();
} },
}; };
SpecialPowers.addObserver(observer, "domstorage-test-flushed"); SpecialPowers.addObserver(observer, "domstorage-test-flushed");
}); });
@ -50,7 +118,7 @@ function triggerAndWaitForLocalStorageFlush() {
// So issue a second flush and wait for that. // So issue a second flush and wait for that.
SpecialPowers.notifyObservers(null, "domstorage-test-flush-force"); SpecialPowers.notifyObservers(null, "domstorage-test-flush-force");
return waitForLocalStorageFlush(); return waitForLocalStorageFlush();
}) });
} }
/** /**
@ -262,7 +330,7 @@ add_task(async function() {
// Enable LocalStorage's testing API so we can explicitly trigger a flush // Enable LocalStorage's testing API so we can explicitly trigger a flush
// when needed. // when needed.
["dom.storage.testing", true], ["dom.storage.testing", true],
] ],
}); });
// Ensure that there is no localstorage data or potential false positives for // Ensure that there is no localstorage data or potential false positives for
@ -290,14 +358,14 @@ add_task(async function() {
await verifyTabPreload(readerTab, false); await verifyTabPreload(readerTab, false);
// - Configure the tabs. // - Configure the tabs.
const initialSentinel = 'initial'; const initialSentinel = "initial";
const noSentinelCheck = null; const noSentinelCheck = null;
await recordTabStorageEvents(listenerTab, initialSentinel); await recordTabStorageEvents(listenerTab, initialSentinel);
// - Issue the initial batch of writes and verify. // - Issue the initial batch of writes and verify.
info("initial writes"); info("initial writes");
const initialWriteMutations = [ const initialWriteMutations = [
//[key (null=clear), newValue (null=delete), oldValue (verification)] // [key (null=clear), newValue (null=delete), oldValue (verification)]
["getsCleared", "1", null], ["getsCleared", "1", null],
["alsoGetsCleared", "2", null], ["alsoGetsCleared", "2", null],
[null, null, null], [null, null, null],
@ -308,12 +376,12 @@ add_task(async function() {
["getsDeletedImmediately", null, "5"], ["getsDeletedImmediately", null, "5"],
["alsoStays", "6", null], ["alsoStays", "6", null],
["getsDeletedLater", null, "4"], ["getsDeletedLater", null, "4"],
["clobbered", "post", "pre"] ["clobbered", "post", "pre"],
]; ];
const initialWriteState = { const initialWriteState = {
stays: "3", stays: "3",
clobbered: "post", clobbered: "post",
alsoStays: "6" alsoStays: "6",
}; };
await mutateTabStorage(writerTab, initialWriteMutations, initialSentinel); await mutateTabStorage(writerTab, initialWriteMutations, initialSentinel);
@ -349,17 +417,17 @@ add_task(async function() {
// it did not add an event listener. // it did not add an event listener.
info("late writes"); info("late writes");
const lateWriteSentinel = 'lateWrite'; const lateWriteSentinel = "lateWrite";
const lateWriteMutations = [ const lateWriteMutations = [
["lateStays", "10", null], ["lateStays", "10", null],
["lateClobbered", "latePre", null], ["lateClobbered", "latePre", null],
["lateDeleted", "11", null], ["lateDeleted", "11", null],
["lateClobbered", "lastPost", "latePre"], ["lateClobbered", "lastPost", "latePre"],
["lateDeleted", null, "11"] ["lateDeleted", null, "11"],
]; ];
const lateWriteState = Object.assign({}, initialWriteState, { const lateWriteState = Object.assign({}, initialWriteState, {
lateStays: "10", lateStays: "10",
lateClobbered: "lastPost" lateClobbered: "lastPost",
}); });
await recordTabStorageEvents(listenerTab, lateWriteSentinel); await recordTabStorageEvents(listenerTab, lateWriteSentinel);
@ -379,17 +447,17 @@ add_task(async function() {
// - Issue last set of writes from writerTab. // - Issue last set of writes from writerTab.
info("last set of writes"); info("last set of writes");
const lastWriteSentinel = 'lastWrite'; const lastWriteSentinel = "lastWrite";
const lastWriteMutations = [ const lastWriteMutations = [
["lastStays", "20", null], ["lastStays", "20", null],
["lastDeleted", "21", null], ["lastDeleted", "21", null],
["lastClobbered", "lastPre", null], ["lastClobbered", "lastPre", null],
["lastClobbered", "lastPost", "lastPre"], ["lastClobbered", "lastPost", "lastPre"],
["lastDeleted", null, "21"] ["lastDeleted", null, "21"],
]; ];
const lastWriteState = Object.assign({}, lateWriteState, { const lastWriteState = Object.assign({}, lateWriteState, {
lastStays: "20", lastStays: "20",
lastClobbered: "lastPost" lastClobbered: "lastPost",
}); });
await recordTabStorageEvents(listenerTab, lastWriteSentinel); await recordTabStorageEvents(listenerTab, lastWriteSentinel);

View file

@ -1,14 +1,14 @@
add_task(async function() { add_task(async function() {
var privWin = OpenBrowserWindow({private: true}); var privWin = OpenBrowserWindow({private: true});
await new privWin.Promise(resolve => { await new privWin.Promise(resolve => {
privWin.addEventListener('load', function() { privWin.addEventListener("load", function() {
resolve(); resolve();
}, {once: true}); }, {once: true});
}); });
var pubWin = OpenBrowserWindow({private: false}); var pubWin = OpenBrowserWindow({private: false});
await new pubWin.Promise(resolve => { await new pubWin.Promise(resolve => {
pubWin.addEventListener('load', function() { pubWin.addEventListener("load", function() {
resolve(); resolve();
}, {once: true}); }, {once: true});
}); });
@ -26,13 +26,13 @@ add_task(async function() {
// Check if pubWin can see privWin's storage events // Check if pubWin can see privWin's storage events
await ContentTask.spawn(pubBrowser, null, function(opts) { await ContentTask.spawn(pubBrowser, null, function(opts) {
content.window.gotStorageEvent = false; content.window.gotStorageEvent = false;
content.window.addEventListener('storage', ev => { content.window.addEventListener("storage", ev => {
content.window.gotStorageEvent = true; content.window.gotStorageEvent = true;
}); });
}); });
await ContentTask.spawn(privBrowser, null, function(opts) { await ContentTask.spawn(privBrowser, null, function(opts) {
content.window.localStorage['key'] = 'ablooabloo'; content.window.localStorage.key = "ablooabloo";
}); });
let pubSaw = await ContentTask.spawn(pubBrowser, null, function(opts) { let pubSaw = await ContentTask.spawn(pubBrowser, null, function(opts) {
@ -43,7 +43,7 @@ add_task(async function() {
await ContentTask.spawn(privBrowser, null, function(opts) { await ContentTask.spawn(privBrowser, null, function(opts) {
content.window.gotStorageEvent = false; content.window.gotStorageEvent = false;
content.window.addEventListener('storage', ev => { content.window.addEventListener("storage", ev => {
content.window.gotStorageEvent = true; content.window.gotStorageEvent = true;
}); });
}); });
@ -51,13 +51,13 @@ add_task(async function() {
// Check if privWin can see pubWin's storage events // Check if privWin can see pubWin's storage events
await ContentTask.spawn(privBrowser, null, function(opts) { await ContentTask.spawn(privBrowser, null, function(opts) {
content.window.gotStorageEvent = false; content.window.gotStorageEvent = false;
content.window.addEventListener('storage', ev => { content.window.addEventListener("storage", ev => {
content.window.gotStorageEvent = true; content.window.gotStorageEvent = true;
}); });
}); });
await ContentTask.spawn(pubBrowser, null, function(opts) { await ContentTask.spawn(pubBrowser, null, function(opts) {
content.window.localStorage['key'] = 'ablooabloo'; content.window.localStorage.key = "ablooabloo";
}); });
let privSaw = await ContentTask.spawn(privBrowser, null, function(opts) { let privSaw = await ContentTask.spawn(privBrowser, null, function(opts) {

View file

@ -2,7 +2,7 @@ add_task(async function browserNoopenerNullUri() {
await BrowserTestUtils.withNewTab({gBrowser}, async function(aBrowser) { await BrowserTestUtils.withNewTab({gBrowser}, async function(aBrowser) {
let numTabs = gBrowser.tabs.length; let numTabs = gBrowser.tabs.length;
await ContentTask.spawn(aBrowser, null, async () => { await ContentTask.spawn(aBrowser, null, async () => {
ok(!content.window.open(undefined, undefined, 'noopener'), ok(!content.window.open(undefined, undefined, "noopener"),
"window.open should return null"); "window.open should return null");
}); });
await TestUtils.waitForCondition(() => gBrowser.tabs.length == numTabs + 1); await TestUtils.waitForCondition(() => gBrowser.tabs.length == numTabs + 1);

View file

@ -87,7 +87,7 @@ add_task(async function() {
dls.removeFinished(); dls.removeFinished();
resolve(); resolve();
} }
} },
}); });
}); });
}); });

View file

@ -82,7 +82,7 @@ add_task(async function test_image_download() {
dls.removeFinished(); dls.removeFinished();
resolve(download); resolve(download);
} }
} },
}); });
}); });
// open the context menu. // open the context menu.

View file

@ -106,7 +106,7 @@ registerCleanupFunction(function() {
*/ */
function prepareForResult(aBrowser, aExpectation) { function prepareForResult(aBrowser, aExpectation) {
let expectedSpec = kContentDoc.replace(/[^\/]*$/, "dummy.html"); let expectedSpec = kContentDoc.replace(/[^\/]*$/, "dummy.html");
switch(aExpectation) { switch (aExpectation) {
case kSameTab: case kSameTab:
return (async function() { return (async function() {
await BrowserTestUtils.browserLoaded(aBrowser); await BrowserTestUtils.browserLoaded(aBrowser);
@ -133,7 +133,7 @@ function prepareForResult(aBrowser, aExpectation) {
})(); })();
break; break;
default: default:
ok(false, "prepareForResult can't handle an expectation of " + aExpectation) ok(false, "prepareForResult can't handle an expectation of " + aExpectation);
return; return;
} }

View file

@ -44,7 +44,7 @@ function getToolbarsFromWindowChrome(win) {
personalbar: win.personalbar.visible, personalbar: win.personalbar.visible,
statusbar: win.statusbar.visible, statusbar: win.statusbar.visible,
locationbar: win.locationbar.visible, locationbar: win.locationbar.visible,
} };
} }
/** /**

View file

@ -15,7 +15,7 @@ var sandboxCode = (function() {
} else { } else {
result = "ok"; result = "ok";
} }
postMessage({result: result}, "*"); postMessage({result}, "*");
} }
}; };
req.send(null); req.send(null);
@ -30,7 +30,7 @@ function test() {
frame.setAttribute("type", "content"); frame.setAttribute("type", "content");
frame.setAttribute("src", "http://mochi.test:8888/browser/dom/tests/browser/browser_xhr_sandbox.js"); frame.setAttribute("src", "http://mochi.test:8888/browser/dom/tests/browser/browser_xhr_sandbox.js");
frame.addEventListener("load", function () { frame.addEventListener("load", function() {
let workerWindow = frame.contentWindow; let workerWindow = frame.contentWindow;
workerWindow.addEventListener("message", function(evt) { workerWindow.addEventListener("message", function(evt) {
is(evt.data.result, "ok", "check the sandbox code was happy"); is(evt.data.result, "ok", "check the sandbox code was happy");

View file

@ -68,8 +68,8 @@ async function largeAllocSuccessTests() {
["dom.largeAllocation.forceEnable", !isWin32], ["dom.largeAllocation.forceEnable", !isWin32],
// Increase processCount.webLargeAllocation to avoid any races where // Increase processCount.webLargeAllocation to avoid any races where
// processes aren't being cleaned up quickly enough. // processes aren't being cleaned up quickly enough.
["dom.ipc.processCount.webLargeAllocation", 20] ["dom.ipc.processCount.webLargeAllocation", 20],
] ],
}); });
// A toplevel tab should be able to navigate cross process! // A toplevel tab should be able to navigate cross process!
@ -106,7 +106,7 @@ async function largeAllocSuccessTests() {
content.document.body.innerHTML = `<iframe src='${TEST_URI}'></iframe>`; content.document.body.innerHTML = `<iframe src='${TEST_URI}'></iframe>`;
return new Promise(resolve => { return new Promise(resolve => {
content.document.body.querySelector('iframe').onload = () => { content.document.body.querySelector("iframe").onload = () => {
ok(true, "Iframe finished loading"); ok(true, "Iframe finished loading");
resolve(); resolve();
}; };
@ -131,11 +131,11 @@ async function largeAllocSuccessTests() {
let stopExpectNoProcess = expectNoProcess(); let stopExpectNoProcess = expectNoProcess();
let loaded = ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => { let loaded = ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => {
content.document.body.innerHTML = '<button>CLICK ME</button>'; content.document.body.innerHTML = "<button>CLICK ME</button>";
return new Promise(resolve => { return new Promise(resolve => {
content.document.querySelector('button').onclick = e => { content.document.querySelector("button").onclick = e => {
let w = content.window.open(TEST_URI, '_blank'); let w = content.window.open(TEST_URI, "_blank");
w.onload = () => { w.onload = () => {
ok(true, "Window finished loading"); ok(true, "Window finished loading");
w.close(); w.close();
@ -440,7 +440,7 @@ async function largeAllocSuccessTests() {
info("Starting test 8"); info("Starting test 8");
await SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({
set: [ set: [
["dom.ipc.processCount.webLargeAllocation", 1] ["dom.ipc.processCount.webLargeAllocation", 1],
], ],
}); });
@ -512,7 +512,7 @@ async function largeAllocSuccessTests() {
info("Starting test 10"); info("Starting test 10");
await SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({
set: [ set: [
["dom.ipc.processCount.webLargeAllocation", 1] ["dom.ipc.processCount.webLargeAllocation", 1],
], ],
}); });
@ -576,7 +576,7 @@ async function largeAllocSuccessTests() {
ContentTask.spawn(aBrowser, null, () => { ContentTask.spawn(aBrowser, null, () => {
content.document.querySelector("#submit").click(); content.document.querySelector("#submit").click();
}), }),
BrowserTestUtils.browserLoaded(aBrowser) BrowserTestUtils.browserLoaded(aBrowser),
]); ]);
let innerText = await ContentTask.spawn(aBrowser, null, () => { let innerText = await ContentTask.spawn(aBrowser, null, () => {

View file

@ -51,7 +51,7 @@ window.addEventListener(
// Key that conveys the end of a write batch. Filtered out from state and // Key that conveys the end of a write batch. Filtered out from state and
// events. // events.
const SENTINEL_KEY = 'WRITE_BATCH_SENTINEL'; const SENTINEL_KEY = "WRITE_BATCH_SENTINEL";
var storageEventsPromise = null; var storageEventsPromise = null;
function listenForStorageEvents(sentinelValue) { function listenForStorageEvents(sentinelValue) {

View file

@ -20,10 +20,10 @@ function jsonrpc(tab, method, params) {
let messageManager = tab.linkedBrowser.messageManager; let messageManager = tab.linkedBrowser.messageManager;
messageManager.sendAsyncMessage("jsonrpc", { messageManager.sendAsyncMessage("jsonrpc", {
id: currentId, id: currentId,
method: method, method,
params: params params,
}); });
return new Promise(function (resolve, reject) { return new Promise(function(resolve, reject) {
messageManager.addMessageListener("jsonrpc", function listener(event) { messageManager.addMessageListener("jsonrpc", function listener(event) {
let { id, result, error } = event.data; let { id, result, error } = event.data;
if (id !== currentId) { if (id !== currentId) {
@ -49,15 +49,15 @@ add_task(async function test() {
// Load 3 pages and wait. The 3rd one has a worker // Load 3 pages and wait. The 3rd one has a worker
let page1 = await BrowserTestUtils.openNewForegroundTab({ let page1 = await BrowserTestUtils.openNewForegroundTab({
gBrowser, opening: "about:about", forceNewProcess: false gBrowser, opening: "about:about", forceNewProcess: false,
}); });
let page2 = await BrowserTestUtils.openNewForegroundTab({ let page2 = await BrowserTestUtils.openNewForegroundTab({
gBrowser, opening: "about:memory", forceNewProcess: false gBrowser, opening: "about:memory", forceNewProcess: false,
}); });
let page3 = await BrowserTestUtils.openNewForegroundTab({ let page3 = await BrowserTestUtils.openNewForegroundTab({
gBrowser, opening: WORKER_URL gBrowser, opening: WORKER_URL,
}); });
// load a 4th tab with a worker // load a 4th tab with a worker
await BrowserTestUtils.withNewTab({ gBrowser, url: WORKER_URL2 }, await BrowserTestUtils.withNewTab({ gBrowser, url: WORKER_URL2 },
@ -90,7 +90,7 @@ add_task(async function test() {
sharedWorker = entry.host.endsWith("shared_worker.js") || sharedWorker; sharedWorker = entry.host.endsWith("shared_worker.js") || sharedWorker;
heapUsage += entry.memoryInfo.GCHeapUsage; heapUsage += entry.memoryInfo.GCHeapUsage;
mediaMemory += entry.memoryInfo.media.audioSize + entry.memoryInfo.media.resourcesSize; mediaMemory += entry.memoryInfo.media.audioSize + entry.memoryInfo.media.resourcesSize;
Assert.ok(entry.host != "" || entry.windowId !=0, Assert.ok(entry.host != "" || entry.windowId != 0,
"An entry should have a host or a windowId"); "An entry should have a host or a windowId");
if (entry.windowId != 0 && !entry.isToplevel && !entry.isWorker && !subFrameIds.includes(entry.windowId)) { if (entry.windowId != 0 && !entry.isToplevel && !entry.isWorker && !subFrameIds.includes(entry.windowId)) {
subFrameIds.push(entry.windowId); subFrameIds.push(entry.windowId);

View file

@ -8,14 +8,14 @@
var shared; var shared;
function init() { function init() {
myWorker = new Worker('ping_worker.js'); myWorker = new Worker("ping_worker.js");
for (let i = 0; i++; i < 10) myWorker.postMessage("ping"); for (let i = 0; i++; i < 10) myWorker.postMessage("ping");
shared = new SharedWorker('shared_worker.js'); shared = new SharedWorker("shared_worker.js");
shared.port.start(); shared.port.start();
shared.port.onmessage = function(e) { shared.port.onmessage = function(e) {
console.log(e); console.log(e);
} };
} }
</script> </script>

View file

@ -7,7 +7,7 @@
var shared; var shared;
function init() { function init() {
shared = new SharedWorker('shared_worker.js'); shared = new SharedWorker("shared_worker.js");
shared.port.start(); shared.port.start();
for (let i = 0; i++; i < 10) shared.port.postMessage(["ok"]); for (let i = 0; i++; i < 10) shared.port.postMessage(["ok"]);
} }

View file

@ -3,7 +3,7 @@ onconnect = function(e) {
var port = e.ports[0]; var port = e.ports[0];
port.onmessage = function(e) { port.onmessage = function(e) {
var workerResult = 'Result: ' + (e.data[0] * e.data[1]); var workerResult = "Result: " + (e.data[0] * e.data[1]);
port.postMessage(e.data[0]); port.postMessage(e.data[0]);
} };
} };

View file

@ -4,11 +4,11 @@
<script type="text/javascript"> <script type="text/javascript">
window.foobar585956c = function(a) { window.foobar585956c = function(a) {
console.trace(); console.trace();
return a+"c"; return a + "c";
}; };
function foobar585956b(a) { function foobar585956b(a) {
return foobar585956c(a+"b"); return foobar585956c(a + "b");
} }
function foobar585956a(omg) { function foobar585956a(omg) {
@ -33,7 +33,7 @@
} }
function test() { function test() {
var str = "Test Message." var str = "Test Message.";
console.foobar(str); // if this throws, we don't execute following funcs console.foobar(str); // if this throws, we don't execute following funcs
console.log(str); console.log(str);
console.info(str); console.info(str);

View file

@ -6,7 +6,7 @@
<body> <body>
<script> <script>
var w = new Worker('worker_bug1004814.js'); var w = new Worker("worker_bug1004814.js");
w.postMessage(true); w.postMessage(true);
</script> </script>

View file

@ -13,12 +13,12 @@
</html> </html>
<script> <script>
function openWindow(aFeatures="") { function openWindow(aFeatures = "") {
window.open("dummy.html", "_blank", aFeatures); window.open("dummy.html", "_blank", aFeatures);
return false; return false;
} }
function openBlankWindow(aFeatures="") { function openBlankWindow(aFeatures = "") {
window.open("", "_blank", aFeatures); window.open("", "_blank", aFeatures);
return false; return false;
} }

View file

@ -1,6 +1,6 @@
onmessage = function(evt) { onmessage = function(evt) {
console.time('bug1004814'); console.time("bug1004814");
setTimeout(function() { setTimeout(function() {
console.timeEnd('bug1004814'); console.timeEnd("bug1004814");
}, 200); }, 200);
} };