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() {
this.popInner(this._innerEventHandlers.length);
this.popOuter(this._outerEventHandlers.length);
}
},
};
</script>

View file

@ -65,7 +65,7 @@ function spawnWithObserver(browser, observerFunc, func) {
// Call the initialization function (if present)
func ? ("(" + func.toString() + ")();") : "",
"});",
].join('\n');
].join("\n");
return ContentTask.spawn(browser, null, new Function(source));
}
@ -270,7 +270,7 @@ async function startTraceTest(browser) {
{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: "foobar585956a", lineNumber: 15},
{columnNumber: 1, filename: TEST_URI, functionName: "onclick", lineNumber: 1}
{columnNumber: 1, filename: TEST_URI, functionName: "onclick", lineNumber: 1},
];
});
@ -301,7 +301,7 @@ async function startLocationTest(browser) {
await spawnWithObserver(browser, testLocationData, function(opts) {
gLevel = "log";
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.arguments[0], "a", "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.arguments[0], "b", "group arguments[0] 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");
}
@ -388,7 +386,7 @@ async function startTimeTest(browser) {
{filename: TEST_URI, lineNumber: 23, functionName: "startTimer",
arguments: ["foo"],
timer: { name: "foo" },
}
},
];
});
@ -457,8 +455,8 @@ async function startTimeStampTest(browser) {
gLevel = "timeStamp";
gArgs = [
{filename: TEST_URI, lineNumber: 58, functionName: "timeStamp",
arguments: ["!!!"]
}
arguments: ["!!!"],
},
];
});
@ -486,8 +484,8 @@ async function startEmptyTimeStampTest(browser) {
gLevel = "timeStamp";
gArgs = [
{filename: TEST_URI, lineNumber: 58, functionName: "timeStamp",
arguments: []
}
arguments: [],
},
];
});

View file

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

View file

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

View file

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

View file

@ -21,7 +21,7 @@ add_task(async function() {
await SpecialPowers.pushPrefEnv({
set: [
["dom.largeAllocationHeader.enabled", true],
]
],
});
// A toplevel tab should be able to navigate cross process!

View file

@ -59,7 +59,7 @@ add_task(async function() {
await BrowserTestUtils.loadURI(browser, "about:support");
await Promise.all([
dialogShown1,
BrowserTestUtils.browserLoaded(browser)
BrowserTestUtils.browserLoaded(browser),
]);
is(beforeUnloadCount, 1, "Should have received one beforeunload event.");
@ -77,7 +77,7 @@ add_task(async function() {
gBrowser.goForward();
await Promise.all([
dialogShown2,
BrowserTestUtils.browserLoaded(browser)
BrowserTestUtils.browserLoaded(browser),
]);
is(beforeUnloadCount, 2, "Should have received two beforeunload events.");
@ -114,7 +114,7 @@ add_task(async function() {
await BrowserTestUtils.loadURI(browser, TEST_URL);
await Promise.all([
dialogShown1,
BrowserTestUtils.browserLoaded(browser)
BrowserTestUtils.browserLoaded(browser),
]);
is(beforeUnloadCount, 1, "Should have received one beforeunload event.");
ok(browser.isRemoteBrowser, "Browser should be remote.");
@ -138,7 +138,7 @@ add_task(async function() {
gBrowser.goForward();
await Promise.all([
dialogShown2,
BrowserTestUtils.browserLoaded(browser)
BrowserTestUtils.browserLoaded(browser),
]);
is(beforeUnloadCount, 2, "Should have received two beforeunload events.");

View file

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

View file

@ -57,8 +57,8 @@ function startTests() {
async function mozBrowserTests(browser) {
info("Granting special powers for mozbrowser");
SpecialPowers.addPermission("browser", true, TEST_URI);
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true);
SpecialPowers.setBoolPref('network.disable.ipc.security', true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
SpecialPowers.setBoolPref("network.disable.ipc.security", true);
await ContentTask.spawn(browser, null, function() {
info("Checking mozbrowser iframe");
@ -72,7 +72,7 @@ async function mozBrowserTests(browser) {
});
info("Revoking special powers for mozbrowser");
SpecialPowers.clearUserPref('dom.mozBrowserFramesEnabled');
SpecialPowers.clearUserPref('network.disable.ipc.security');
SpecialPowers.clearUserPref("dom.mozBrowserFramesEnabled");
SpecialPowers.clearUserPref("network.disable.ipc.security");
SpecialPowers.removePermission("browser", TEST_URI);
}

View file

@ -55,7 +55,7 @@ function addOuterBeforeUnloadListeners(browser, howMany = 1, frameDepth = 1) {
if (frameDepth == 0) {
throw new Error("When adding a beforeunload listener on an outer " +
"window, the frame you're targeting needs to be at " +
"depth > 0.")
"depth > 0.");
}
return controlFrameAt(browser, frameDepth, {
@ -115,7 +115,7 @@ function removeOuterBeforeUnloadListeners(browser, howMany = 1, frameDepth = 1)
if (frameDepth == 0) {
throw new Error("When removing a beforeunload listener from an outer " +
"window, the frame you're targeting needs to be at " +
"depth > 0.")
"depth > 0.");
}
return controlFrameAt(browser, frameDepth, {
@ -445,8 +445,8 @@ add_task(async function test_inner_window_scenarios() {
// |--> <iframe at PAGE_URL> (BOTTOM)
//
await prepareSubframes(browser, [
{ sandboxAttributes: null, },
{ sandboxAttributes: null, },
{ sandboxAttributes: null },
{ sandboxAttributes: null },
]);
// These constants are just to make it easier to know which
// 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.
await prepareSubframes(browser, [
{ sandboxAttributes: null, },
{ sandboxAttributes: null, },
{ sandboxAttributes: null },
{ sandboxAttributes: null },
]);
// 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
// MIDDLE <iframe>, that hasBeforeUnload is set to false.
await prepareSubframes(browser, [
{ sandboxAttributes: null, },
{ sandboxAttributes: null, },
{ sandboxAttributes: null },
{ sandboxAttributes: null },
]);
await addBeforeUnloadListeners(browser, 3, MIDDLE);
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
// hasBeforeUnload is set to false.
await prepareSubframes(browser, [
{ sandboxAttributes: null, },
{ sandboxAttributes: null, },
{ sandboxAttributes: null },
{ sandboxAttributes: null },
]);
await addBeforeUnloadListeners(browser, 3, MIDDLE);
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
// being set to true when beforeunload event listeners are added.
await prepareSubframes(browser, [
{ sandboxAttributes: "allow-scripts", },
{ sandboxAttributes: "allow-scripts", },
{ sandboxAttributes: "allow-scripts" },
{ sandboxAttributes: "allow-scripts" },
]);
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
// to true when beforeunload event listeners are added.
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);
@ -591,8 +591,8 @@ add_task(async function test_outer_window_scenarios() {
// |--> <iframe at PAGE_URL> (BOTTOM)
//
await prepareSubframes(browser, [
{ sandboxAttributes: null, },
{ sandboxAttributes: null, },
{ sandboxAttributes: null },
{ sandboxAttributes: null },
]);
// 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);
await prepareSubframes(browser, [
{ sandboxAttributes: null, },
{ sandboxAttributes: null, },
{ sandboxAttributes: null },
{ sandboxAttributes: null },
]);
// 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.
await prepareSubframes(browser, [
{ sandboxAttributes: null, },
{ sandboxAttributes: null, },
{ sandboxAttributes: null },
{ sandboxAttributes: null },
]);
// 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
// both iframes should set hasBeforeUnload to false.
await prepareSubframes(browser, [
{ sandboxAttributes: null, },
{ sandboxAttributes: null, },
{ sandboxAttributes: null },
{ sandboxAttributes: null },
]);
await addOuterBeforeUnloadListeners(browser, 3, MIDDLE);
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
// false.
await prepareSubframes(browser, [
{ sandboxAttributes: null, },
{ sandboxAttributes: null, },
{ sandboxAttributes: null },
{ sandboxAttributes: null },
]);
await addOuterBeforeUnloadListeners(browser, 3, MIDDLE);
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
// security exception is thrown.
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);
@ -741,8 +741,8 @@ add_task(async function test_outer_window_scenarios() {
// that this requires the allow-same-origin permission,
// otherwise a cross-origin security exception is thrown.
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);
@ -781,8 +781,8 @@ add_task(async function test_mixed_inner_and_outer_window_scenarios() {
// |--> <iframe at PAGE_URL> (BOTTOM)
//
await prepareSubframes(browser, [
{ sandboxAttributes: null, },
{ sandboxAttributes: null, },
{ sandboxAttributes: null },
{ sandboxAttributes: null },
]);
// 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],
// Increase processCount.webLargeAllocation to avoid any races where
// processes aren't being cleaned up quickly enough.
["dom.ipc.processCount.webLargeAllocation", 20]
]
["dom.ipc.processCount.webLargeAllocation", 20],
],
});
await largeAllocSuccessTests();
@ -31,8 +31,8 @@ add_task(async function() {
["dom.largeAllocation.forceEnable", false],
// Increase processCount.webLargeAllocation to avoid any races where
// processes aren't being cleaned up quickly enough.
["dom.ipc.processCount.webLargeAllocation", 20]
]
["dom.ipc.processCount.webLargeAllocation", 20],
],
});
await largeAllocFailTests();

View file

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

View file

@ -5,6 +5,74 @@ const HELPER_PAGE_ORIGIN = "http://example.com/";
let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
Services.scriptloader.loadSubScript(testDir + "/helper_localStorage_e10s.js",
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
@ -20,10 +88,10 @@ function waitForLocalStorageFlush() {
return new Promise(function(resolve) {
let observer = {
observe: function() {
observe() {
SpecialPowers.removeObserver(observer, "domstorage-test-flushed");
resolve();
}
},
};
SpecialPowers.addObserver(observer, "domstorage-test-flushed");
});
@ -50,7 +118,7 @@ function triggerAndWaitForLocalStorageFlush() {
// So issue a second flush and wait for that.
SpecialPowers.notifyObservers(null, "domstorage-test-flush-force");
return waitForLocalStorageFlush();
})
});
}
/**
@ -262,7 +330,7 @@ add_task(async function() {
// Enable LocalStorage's testing API so we can explicitly trigger a flush
// when needed.
["dom.storage.testing", true],
]
],
});
// Ensure that there is no localstorage data or potential false positives for
@ -290,7 +358,7 @@ add_task(async function() {
await verifyTabPreload(readerTab, false);
// - Configure the tabs.
const initialSentinel = 'initial';
const initialSentinel = "initial";
const noSentinelCheck = null;
await recordTabStorageEvents(listenerTab, initialSentinel);
@ -308,12 +376,12 @@ add_task(async function() {
["getsDeletedImmediately", null, "5"],
["alsoStays", "6", null],
["getsDeletedLater", null, "4"],
["clobbered", "post", "pre"]
["clobbered", "post", "pre"],
];
const initialWriteState = {
stays: "3",
clobbered: "post",
alsoStays: "6"
alsoStays: "6",
};
await mutateTabStorage(writerTab, initialWriteMutations, initialSentinel);
@ -349,17 +417,17 @@ add_task(async function() {
// it did not add an event listener.
info("late writes");
const lateWriteSentinel = 'lateWrite';
const lateWriteSentinel = "lateWrite";
const lateWriteMutations = [
["lateStays", "10", null],
["lateClobbered", "latePre", null],
["lateDeleted", "11", null],
["lateClobbered", "lastPost", "latePre"],
["lateDeleted", null, "11"]
["lateDeleted", null, "11"],
];
const lateWriteState = Object.assign({}, initialWriteState, {
lateStays: "10",
lateClobbered: "lastPost"
lateClobbered: "lastPost",
});
await recordTabStorageEvents(listenerTab, lateWriteSentinel);
@ -379,17 +447,17 @@ add_task(async function() {
// - Issue last set of writes from writerTab.
info("last set of writes");
const lastWriteSentinel = 'lastWrite';
const lastWriteSentinel = "lastWrite";
const lastWriteMutations = [
["lastStays", "20", null],
["lastDeleted", "21", null],
["lastClobbered", "lastPre", null],
["lastClobbered", "lastPost", "lastPre"],
["lastDeleted", null, "21"]
["lastDeleted", null, "21"],
];
const lastWriteState = Object.assign({}, lateWriteState, {
lastStays: "20",
lastClobbered: "lastPost"
lastClobbered: "lastPost",
});
await recordTabStorageEvents(listenerTab, lastWriteSentinel);

View file

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

View file

@ -2,7 +2,7 @@ add_task(async function browserNoopenerNullUri() {
await BrowserTestUtils.withNewTab({gBrowser}, async function(aBrowser) {
let numTabs = gBrowser.tabs.length;
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");
});
await TestUtils.waitForCondition(() => gBrowser.tabs.length == numTabs + 1);

View file

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

View file

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

View file

@ -133,7 +133,7 @@ function prepareForResult(aBrowser, aExpectation) {
})();
break;
default:
ok(false, "prepareForResult can't handle an expectation of " + aExpectation)
ok(false, "prepareForResult can't handle an expectation of " + aExpectation);
return;
}

View file

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

View file

@ -15,7 +15,7 @@ var sandboxCode = (function() {
} else {
result = "ok";
}
postMessage({result: result}, "*");
postMessage({result}, "*");
}
};
req.send(null);

View file

@ -68,8 +68,8 @@ async function largeAllocSuccessTests() {
["dom.largeAllocation.forceEnable", !isWin32],
// Increase processCount.webLargeAllocation to avoid any races where
// 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!
@ -106,7 +106,7 @@ async function largeAllocSuccessTests() {
content.document.body.innerHTML = `<iframe src='${TEST_URI}'></iframe>`;
return new Promise(resolve => {
content.document.body.querySelector('iframe').onload = () => {
content.document.body.querySelector("iframe").onload = () => {
ok(true, "Iframe finished loading");
resolve();
};
@ -131,11 +131,11 @@ async function largeAllocSuccessTests() {
let stopExpectNoProcess = expectNoProcess();
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 => {
content.document.querySelector('button').onclick = e => {
let w = content.window.open(TEST_URI, '_blank');
content.document.querySelector("button").onclick = e => {
let w = content.window.open(TEST_URI, "_blank");
w.onload = () => {
ok(true, "Window finished loading");
w.close();
@ -440,7 +440,7 @@ async function largeAllocSuccessTests() {
info("Starting test 8");
await SpecialPowers.pushPrefEnv({
set: [
["dom.ipc.processCount.webLargeAllocation", 1]
["dom.ipc.processCount.webLargeAllocation", 1],
],
});
@ -512,7 +512,7 @@ async function largeAllocSuccessTests() {
info("Starting test 10");
await SpecialPowers.pushPrefEnv({
set: [
["dom.ipc.processCount.webLargeAllocation", 1]
["dom.ipc.processCount.webLargeAllocation", 1],
],
});
@ -576,7 +576,7 @@ async function largeAllocSuccessTests() {
ContentTask.spawn(aBrowser, null, () => {
content.document.querySelector("#submit").click();
}),
BrowserTestUtils.browserLoaded(aBrowser)
BrowserTestUtils.browserLoaded(aBrowser),
]);
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
// events.
const SENTINEL_KEY = 'WRITE_BATCH_SENTINEL';
const SENTINEL_KEY = "WRITE_BATCH_SENTINEL";
var storageEventsPromise = null;
function listenForStorageEvents(sentinelValue) {

View file

@ -20,8 +20,8 @@ function jsonrpc(tab, method, params) {
let messageManager = tab.linkedBrowser.messageManager;
messageManager.sendAsyncMessage("jsonrpc", {
id: currentId,
method: method,
params: params
method,
params,
});
return new Promise(function(resolve, reject) {
messageManager.addMessageListener("jsonrpc", function listener(event) {
@ -49,15 +49,15 @@ add_task(async function test() {
// Load 3 pages and wait. The 3rd one has a worker
let page1 = await BrowserTestUtils.openNewForegroundTab({
gBrowser, opening: "about:about", forceNewProcess: false
gBrowser, opening: "about:about", forceNewProcess: false,
});
let page2 = await BrowserTestUtils.openNewForegroundTab({
gBrowser, opening: "about:memory", forceNewProcess: false
gBrowser, opening: "about:memory", forceNewProcess: false,
});
let page3 = await BrowserTestUtils.openNewForegroundTab({
gBrowser, opening: WORKER_URL
gBrowser, opening: WORKER_URL,
});
// load a 4th tab with a worker
await BrowserTestUtils.withNewTab({ gBrowser, url: WORKER_URL2 },

View file

@ -8,14 +8,14 @@
var shared;
function init() {
myWorker = new Worker('ping_worker.js');
myWorker = new Worker("ping_worker.js");
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.onmessage = function(e) {
console.log(e);
}
};
}
</script>

View file

@ -7,7 +7,7 @@
var shared;
function init() {
shared = new SharedWorker('shared_worker.js');
shared = new SharedWorker("shared_worker.js");
shared.port.start();
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];
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]);
}
}
};
};

View file

@ -33,7 +33,7 @@
}
function test() {
var str = "Test Message."
var str = "Test Message.";
console.foobar(str); // if this throws, we don't execute following funcs
console.log(str);
console.info(str);

View file

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

View file

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