Merge mozilla-central to autoland

This commit is contained in:
Carsten "Tomcat" Book 2017-01-25 13:52:18 +01:00
commit ff34e66ec7
721 changed files with 4793 additions and 4210 deletions

View file

@ -9,6 +9,7 @@ module.exports = {
"mozilla/import-globals": "warn", "mozilla/import-globals": "warn",
"mozilla/no-import-into-var-and-global": "error", "mozilla/no-import-into-var-and-global": "error",
"mozilla/no-useless-parameters": "error", "mozilla/no-useless-parameters": "error",
"mozilla/no-useless-removeEventListener": "error",
// No (!foo in bar) or (!object instanceof Class) // No (!foo in bar) or (!object instanceof Class)
"no-unsafe-negation": "error", "no-unsafe-negation": "error",

View file

@ -51,10 +51,9 @@ window.location = "data:application/vnd.mozilla.xul+xml;charset=utf-8,<window/>"
// Create a promise that is delivered once add-on window is interactive, // Create a promise that is delivered once add-on window is interactive,
// used by add-on runner to defer add-on loading until window is ready. // used by add-on runner to defer add-on loading until window is ready.
var { promise, resolve } = defer(); var { promise, resolve } = defer();
eventTarget.addEventListener("DOMContentLoaded", function handler(event) { eventTarget.addEventListener("DOMContentLoaded", function(event) {
eventTarget.removeEventListener("DOMContentLoaded", handler);
resolve(); resolve();
}); }, {once: true});
exports.ready = promise; exports.ready = promise;
exports.window = window; exports.window = window;

View file

@ -317,10 +317,9 @@ TestRunner.prototype = {
resolve() resolve()
} }
else { else {
win.addEventListener("DOMContentLoaded", function onLoad() { win.addEventListener("DOMContentLoaded", function() {
win.removeEventListener("DOMContentLoaded", onLoad);
resolve(); resolve();
}); }, {once: true});
} }
}); });
}); });

View file

@ -19,8 +19,7 @@ const open = ({ id }) => new Promise((resolve, reject) => {
let browser = getBrowserForTab(tab); let browser = getBrowserForTab(tab);
// waiting for the about:addons page to load // waiting for the about:addons page to load
browser.addEventListener("load", function onPageLoad() { browser.addEventListener("load", function() {
browser.removeEventListener("load", onPageLoad, true);
let window = browser.contentWindow; let window = browser.contentWindow;
// wait for the add-on's "addon-options-displayed" // wait for the add-on's "addon-options-displayed"
@ -37,6 +36,6 @@ const open = ({ id }) => new Promise((resolve, reject) => {
// display the add-on inline preferences page // display the add-on inline preferences page
window.gViewController.commands.cmd_showItemDetails.doCommand({ id: id }, true); window.gViewController.commands.cmd_showItemDetails.doCommand({ id: id }, true);
}, true); }, {capture: true, once: true});
}); });
exports.open = open; exports.open = open;

View file

@ -74,9 +74,7 @@ const registerFrame = ({id, url}) => {
outerFrame.setAttribute("scrolling", "no"); outerFrame.setAttribute("scrolling", "no");
outerFrame.setAttribute("disablehistory", true); outerFrame.setAttribute("disablehistory", true);
outerFrame.setAttribute("seamless", "seamless"); outerFrame.setAttribute("seamless", "seamless");
outerFrame.addEventListener("load", function onload() { outerFrame.addEventListener("load", function() {
outerFrame.removeEventListener("load", onload, true);
let doc = outerFrame.contentDocument; let doc = outerFrame.contentDocument;
let innerFrame = doc.createElementNS(HTML_NS, "iframe"); let innerFrame = doc.createElementNS(HTML_NS, "iframe");
@ -91,7 +89,7 @@ const registerFrame = ({id, url}) => {
"left: 0", "overflow: hidden"].join(";")); "left: 0", "overflow: hidden"].join(";"));
doc.body.appendChild(innerFrame); doc.body.appendChild(innerFrame);
}, true); }, {capture: true, once: true});
view.appendChild(outerFrame); view.appendChild(outerFrame);

View file

@ -213,10 +213,9 @@ function onFocus(window) {
resolve(window); resolve(window);
} }
else { else {
window.addEventListener("focus", function focusListener() { window.addEventListener("focus", function() {
window.removeEventListener("focus", focusListener, true);
resolve(window); resolve(window);
}, true); }, {capture: true, once: true});
} }
return promise; return promise;

View file

@ -21,10 +21,9 @@ exports.testCrossDomainIframe = function(assert, done) {
contentScript: "new " + function ContentScriptScope() { contentScript: "new " + function ContentScriptScope() {
self.on("message", function (url) { self.on("message", function (url) {
let iframe = document.createElement("iframe"); let iframe = document.createElement("iframe");
iframe.addEventListener("load", function onload() { iframe.addEventListener("load", function() {
iframe.removeEventListener("load", onload);
self.postMessage(iframe.contentWindow.document.body.innerHTML); self.postMessage(iframe.contentWindow.document.body.innerHTML);
}); }, {once: true});
iframe.setAttribute("src", url); iframe.setAttribute("src", url);
document.documentElement.appendChild(iframe); document.documentElement.appendChild(iframe);
}); });

View file

@ -173,8 +173,7 @@ exports["test postMessage"] = createProxyTest(html, function (helper, assert) {
let ifWindow = helper.xrayWindow.document.getElementById("iframe").contentWindow; let ifWindow = helper.xrayWindow.document.getElementById("iframe").contentWindow;
// Listen without proxies, to check that it will work in regular case // Listen without proxies, to check that it will work in regular case
// simulate listening from a web document. // simulate listening from a web document.
ifWindow.addEventListener("message", function listener(event) { ifWindow.addEventListener("message", function(event) {
ifWindow.removeEventListener("message", listener);
// As we are in system principal, event is an XrayWrapper // As we are in system principal, event is an XrayWrapper
// xrays use current compartments when calling postMessage method. // xrays use current compartments when calling postMessage method.
// Whereas js proxies was using postMessage method compartment, // Whereas js proxies was using postMessage method compartment,
@ -187,7 +186,7 @@ exports["test postMessage"] = createProxyTest(html, function (helper, assert) {
"message data is correct"); "message data is correct");
helper.done(); helper.done();
}); }, {once: true});
helper.createWorker( helper.createWorker(
'new ' + function ContentScriptScope() { 'new ' + function ContentScriptScope() {
@ -658,9 +657,7 @@ exports["test Listeners"] = createProxyTest(html, function (helper) {
let addEventListenerCalled = false; let addEventListenerCalled = false;
let expandoCalled = false; let expandoCalled = false;
input.addEventListener("click", function onclick(event) { input.addEventListener("click", function (event) {
input.removeEventListener("click", onclick, true);
assert(!addEventListenerCalled, "closure given to addEventListener is called once"); assert(!addEventListenerCalled, "closure given to addEventListener is called once");
if (addEventListenerCalled) if (addEventListenerCalled)
return; return;
@ -689,7 +686,7 @@ exports["test Listeners"] = createProxyTest(html, function (helper) {
input.click(); input.click();
}, 0); }, 0);
}, true); }, {capture: true, once: true});
input.click(); input.click();
} }
@ -747,21 +744,18 @@ exports["test Cross Domain Iframe"] = createProxyTest("", function (helper) {
self.on("message", function (url) { self.on("message", function (url) {
// Creates an iframe with this page // Creates an iframe with this page
let iframe = document.createElement("iframe"); let iframe = document.createElement("iframe");
iframe.addEventListener("load", function onload() { iframe.addEventListener("load", function() {
iframe.removeEventListener("load", onload, true);
try { try {
// Try to communicate with iframe's content // Try to communicate with iframe's content
window.addEventListener("message", function onmessage(event) { window.addEventListener("message", function(event) {
window.removeEventListener("message", onmessage, true);
assert(event.data == "hello world", "COW works properly"); assert(event.data == "hello world", "COW works properly");
self.port.emit("end"); self.port.emit("end");
}, true); }, {capture: true, once: true});
iframe.contentWindow.postMessage("hello", "*"); iframe.contentWindow.postMessage("hello", "*");
} catch(e) { } catch(e) {
assert(false, "COW fails : "+e.message); assert(false, "COW fails : "+e.message);
} }
}, true); }, {capture: true, once: true});
iframe.setAttribute("src", url); iframe.setAttribute("src", url);
document.body.appendChild(iframe); document.body.appendChild(iframe);
}); });

View file

@ -75,8 +75,7 @@ function loadAndWait(browser, url, callback) {
function WorkerTest(url, callback) { function WorkerTest(url, callback) {
return function testFunction(assert, done) { return function testFunction(assert, done) {
let chromeWindow = makeWindow(); let chromeWindow = makeWindow();
chromeWindow.addEventListener("load", function onload() { chromeWindow.addEventListener("load", function() {
chromeWindow.removeEventListener("load", onload, true);
let browser = chromeWindow.document.createElement("browser"); let browser = chromeWindow.document.createElement("browser");
browser.setAttribute("type", "content"); browser.setAttribute("type", "content");
chromeWindow.document.documentElement.appendChild(browser); chromeWindow.document.documentElement.appendChild(browser);
@ -90,7 +89,7 @@ function WorkerTest(url, callback) {
}); });
}); });
}); });
}, true); }, {capture: true, once: true});
}; };
} }
@ -767,8 +766,7 @@ exports["test:check worker API with page history"] = WorkerTest(
}, 0); }, 0);
// Wait for the document to be hidden // Wait for the document to be hidden
browser.addEventListener("pagehide", function onpagehide() { browser.addEventListener("pagehide", function() {
browser.removeEventListener("pagehide", onpagehide);
// Now any event sent to this worker should be cached // Now any event sent to this worker should be cached
worker.postMessage("message"); worker.postMessage("message");
@ -808,7 +806,7 @@ exports["test:check worker API with page history"] = WorkerTest(
browser.goForward(); browser.goForward();
}, 500); }, 500);
}); }, {once: true});
}); });
} }

View file

@ -13,14 +13,13 @@ exports["test sdk/event/dom does not leak when attached to closed window"] = fun
let loader = Loader(module); let loader = Loader(module);
let { open } = loader.require('sdk/event/dom'); let { open } = loader.require('sdk/event/dom');
let w = openWindow(); let w = openWindow();
w.addEventListener("DOMWindowClose", function windowClosed(evt) { w.addEventListener("DOMWindowClose", function(evt) {
w.removeEventListener("DOMWindowClose", windowClosed);
// The sdk/event/dom module tries to clean itself up when DOMWindowClose // The sdk/event/dom module tries to clean itself up when DOMWindowClose
// is fired. Verify that it doesn't leak if its attached to an // is fired. Verify that it doesn't leak if its attached to an
// already closed window either. (See bug 1268898.) // already closed window either. (See bug 1268898.)
open(w.document, "TestEvent1"); open(w.document, "TestEvent1");
resolve(loader); resolve(loader);
}); }, {once: true});
w.close(); w.close();
}); });
}); });

View file

@ -13,14 +13,12 @@ exports["test sdk/tab/events does not leak new window"] = function*(assert) {
let loader = Loader(module); let loader = Loader(module);
let { events } = loader.require('sdk/tab/events'); let { events } = loader.require('sdk/tab/events');
let w = openWindow(); let w = openWindow();
w.addEventListener("load", function windowLoaded(evt) { w.addEventListener("load", function(evt) {
w.removeEventListener("load", windowLoaded); w.addEventListener("DOMWindowClose", function(evt) {
w.addEventListener("DOMWindowClose", function windowClosed(evt) {
w.removeEventListener("DOMWindowClose", windowClosed);
resolve(loader); resolve(loader);
}); }, {once: true});
w.close(); w.close();
}); }, {once: true});
}); });
}); });
} }
@ -30,15 +28,13 @@ exports["test sdk/tab/events does not leak when attached to existing window"] =
return new Promise(resolve => { return new Promise(resolve => {
let loader = Loader(module); let loader = Loader(module);
let w = openWindow(); let w = openWindow();
w.addEventListener("load", function windowLoaded(evt) { w.addEventListener("load", function(evt) {
w.removeEventListener("load", windowLoaded);
let { events } = loader.require('sdk/tab/events'); let { events } = loader.require('sdk/tab/events');
w.addEventListener("DOMWindowClose", function windowClosed(evt) { w.addEventListener("DOMWindowClose", function(evt) {
w.removeEventListener("DOMWindowClose", windowClosed);
resolve(loader); resolve(loader);
}); }, {once: true});
w.close(); w.close();
}); }, {once: true});
}); });
}); });
} }

View file

@ -49,15 +49,13 @@ exports["test window/events for leaks with existing window"] = function*(assert)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let loader = Loader(module); let loader = Loader(module);
let w = open(); let w = open();
w.addEventListener("load", function windowLoaded(evt) { w.addEventListener("load", function(evt) {
w.removeEventListener("load", windowLoaded);
let { events } = loader.require("sdk/window/events"); let { events } = loader.require("sdk/window/events");
w.addEventListener("DOMWindowClose", function windowClosed(evt) { w.addEventListener("DOMWindowClose", function(evt) {
w.removeEventListener("DOMWindowClose", windowClosed);
resolve(loader); resolve(loader);
}); }, {once: true});
w.close(); w.close();
}); }, {once: true});
}); });
}); });
}; };

View file

@ -13,10 +13,9 @@ function openTab(rawWindow, url) {
return resolve(); return resolve();
} }
window.addEventListener("load", function onLoad() { window.addEventListener("load", function() {
window.removeEventListener("load", onLoad, true);
resolve(); resolve();
}, true); }, {capture: true, once: true});
return null; return null;
}) })

View file

@ -173,8 +173,7 @@ exports["test postMessage"] = createProxyTest(html, function (helper, assert) {
let ifWindow = helper.xrayWindow.document.getElementById("iframe").contentWindow; let ifWindow = helper.xrayWindow.document.getElementById("iframe").contentWindow;
// Listen without proxies, to check that it will work in regular case // Listen without proxies, to check that it will work in regular case
// simulate listening from a web document. // simulate listening from a web document.
ifWindow.addEventListener("message", function listener(event) { ifWindow.addEventListener("message", function(event) {
ifWindow.removeEventListener("message", listener);
// As we are in system principal, event is an XrayWrapper // As we are in system principal, event is an XrayWrapper
// xrays use current compartments when calling postMessage method. // xrays use current compartments when calling postMessage method.
// Whereas js proxies was using postMessage method compartment, // Whereas js proxies was using postMessage method compartment,
@ -187,7 +186,7 @@ exports["test postMessage"] = createProxyTest(html, function (helper, assert) {
"message data is correct"); "message data is correct");
helper.done(); helper.done();
}); }, {once: true});
helper.createWorker( helper.createWorker(
'new ' + function ContentScriptScope() { 'new ' + function ContentScriptScope() {
@ -659,8 +658,6 @@ exports["test Listeners"] = createProxyTest(html, function (helper) {
let addEventListenerCalled = false; let addEventListenerCalled = false;
let expandoCalled = false; let expandoCalled = false;
input.addEventListener("click", function onclick(event) { input.addEventListener("click", function onclick(event) {
input.removeEventListener("click", onclick, true);
assert(!addEventListenerCalled, "closure given to addEventListener is called once"); assert(!addEventListenerCalled, "closure given to addEventListener is called once");
if (addEventListenerCalled) if (addEventListenerCalled)
return; return;
@ -689,7 +686,7 @@ exports["test Listeners"] = createProxyTest(html, function (helper) {
input.click(); input.click();
}, 0); }, 0);
}, true); }, {capture: true, once: true});
input.click(); input.click();
} }
@ -747,21 +744,18 @@ exports["test Cross Domain Iframe"] = createProxyTest("", function (helper) {
self.on("message", function (url) { self.on("message", function (url) {
// Creates an iframe with this page // Creates an iframe with this page
let iframe = document.createElement("iframe"); let iframe = document.createElement("iframe");
iframe.addEventListener("load", function onload() { iframe.addEventListener("load", function() {
iframe.removeEventListener("load", onload, true);
try { try {
// Try to communicate with iframe's content // Try to communicate with iframe's content
window.addEventListener("message", function onmessage(event) { window.addEventListener("message", function(event) {
window.removeEventListener("message", onmessage, true);
assert(event.data == "hello world", "COW works properly"); assert(event.data == "hello world", "COW works properly");
self.port.emit("end"); self.port.emit("end");
}, true); }, {capture: true, once: true});
iframe.contentWindow.postMessage("hello", "*"); iframe.contentWindow.postMessage("hello", "*");
} catch(e) { } catch(e) {
assert(false, "COW fails : "+e.message); assert(false, "COW fails : "+e.message);
} }
}, true); }, {capture: true, once: true});
iframe.setAttribute("src", url); iframe.setAttribute("src", url);
document.body.appendChild(iframe); document.body.appendChild(iframe);
}); });

View file

@ -74,8 +74,7 @@ function loadAndWait(browser, url, callback) {
function WorkerTest(url, callback) { function WorkerTest(url, callback) {
return function testFunction(assert, done) { return function testFunction(assert, done) {
let chromeWindow = makeWindow(); let chromeWindow = makeWindow();
chromeWindow.addEventListener("load", function onload() { chromeWindow.addEventListener("load", function() {
chromeWindow.removeEventListener("load", onload, true);
let browser = chromeWindow.document.createElement("browser"); let browser = chromeWindow.document.createElement("browser");
browser.setAttribute("type", "content"); browser.setAttribute("type", "content");
chromeWindow.document.documentElement.appendChild(browser); chromeWindow.document.documentElement.appendChild(browser);
@ -89,7 +88,7 @@ function WorkerTest(url, callback) {
}); });
}); });
}); });
}, true); }, {capture: true, once: true});
}; };
} }
@ -751,8 +750,7 @@ exports["test:check worker API with page history"] = WorkerTest(
}, 0); }, 0);
// Wait for the document to be hidden // Wait for the document to be hidden
browser.addEventListener("pagehide", function onpagehide() { browser.addEventListener("pagehide", function() {
browser.removeEventListener("pagehide", onpagehide);
// Now any event sent to this worker should throw // Now any event sent to this worker should throw
assert.throws( assert.throws(
@ -781,7 +779,7 @@ exports["test:check worker API with page history"] = WorkerTest(
browser.goForward(); browser.goForward();
}, 500); }, 500);
}); }, {once: true});
}); });
} }

View file

@ -75,8 +75,7 @@ function loadAndWait(browser, url, callback) {
function WorkerTest(url, callback) { function WorkerTest(url, callback) {
return function testFunction(assert, done) { return function testFunction(assert, done) {
let chromeWindow = makeWindow(); let chromeWindow = makeWindow();
chromeWindow.addEventListener("load", function onload() { chromeWindow.addEventListener("load", function() {
chromeWindow.removeEventListener("load", onload, true);
let browser = chromeWindow.document.createElement("browser"); let browser = chromeWindow.document.createElement("browser");
browser.setAttribute("type", "content"); browser.setAttribute("type", "content");
chromeWindow.document.documentElement.appendChild(browser); chromeWindow.document.documentElement.appendChild(browser);
@ -90,7 +89,7 @@ function WorkerTest(url, callback) {
}); });
}); });
}); });
}, true); }, {capture: true, once: true});
}; };
} }
@ -768,8 +767,7 @@ exports["test:check worker API with page history"] = WorkerTest(
}, 0); }, 0);
// Wait for the document to be hidden // Wait for the document to be hidden
browser.addEventListener("pagehide", function onpagehide() { browser.addEventListener("pagehide", function() {
browser.removeEventListener("pagehide", onpagehide);
// Now any event sent to this worker should be cached // Now any event sent to this worker should be cached
worker.postMessage("message"); worker.postMessage("message");
@ -809,7 +807,7 @@ exports["test:check worker API with page history"] = WorkerTest(
browser.goForward(); browser.goForward();
}, 500); }, 500);
}); }, {once: true});
}); });
} }

View file

@ -29,13 +29,12 @@ exports['test fram has js disabled by default'] = function(assert, done) {
uri: 'data:text/html;charset=utf-8,<script>document.documentElement.innerHTML' + uri: 'data:text/html;charset=utf-8,<script>document.documentElement.innerHTML' +
'= "J" + "S"</script>', '= "J" + "S"</script>',
}); });
frame.contentWindow.addEventListener('DOMContentLoaded', function ready() { frame.contentWindow.addEventListener('DOMContentLoaded', function() {
frame.contentWindow.removeEventListener('DOMContentLoaded', ready);
assert.ok(!~frame.contentDocument.documentElement.innerHTML.indexOf('JS'), assert.ok(!~frame.contentDocument.documentElement.innerHTML.indexOf('JS'),
'JS was executed'); 'JS was executed');
close(window).then(done); close(window).then(done);
}); }, {once: true});
}); });
}; };
@ -46,13 +45,12 @@ exports['test frame with js enabled'] = function(assert, done) {
'= "J" + "S"</script>', '= "J" + "S"</script>',
allowJavascript: true allowJavascript: true
}); });
frame.contentWindow.addEventListener('DOMContentLoaded', function ready() { frame.contentWindow.addEventListener('DOMContentLoaded', function() {
frame.contentWindow.removeEventListener('DOMContentLoaded', ready);
assert.ok(~frame.contentDocument.documentElement.innerHTML.indexOf('JS'), assert.ok(~frame.contentDocument.documentElement.innerHTML.indexOf('JS'),
'JS was executed'); 'JS was executed');
close(window).then(done); close(window).then(done);
}); }, {once: true});
}); });
}; };

View file

@ -1027,8 +1027,7 @@ exports.testAttachToTabsOnly = function(assert, done) {
let hiddenFrame = hiddenFrames.add(hiddenFrames.HiddenFrame({ let hiddenFrame = hiddenFrames.add(hiddenFrames.HiddenFrame({
onReady: function () { onReady: function () {
let element = this.element; let element = this.element;
element.addEventListener('DOMContentLoaded', function onload() { element.addEventListener('DOMContentLoaded', function() {
element.removeEventListener('DOMContentLoaded', onload);
hiddenFrames.remove(hiddenFrame); hiddenFrames.remove(hiddenFrame);
if (!xulApp.is("Fennec")) { if (!xulApp.is("Fennec")) {
@ -1037,7 +1036,7 @@ exports.testAttachToTabsOnly = function(assert, done) {
else { else {
openBrowserIframe(); openBrowserIframe();
} }
}); }, {once: true});
element.setAttribute('src', 'data:text/html;charset=utf-8,foo'); element.setAttribute('src', 'data:text/html;charset=utf-8,foo');
} }
})); }));
@ -1046,11 +1045,10 @@ exports.testAttachToTabsOnly = function(assert, done) {
function openToplevelWindow() { function openToplevelWindow() {
assert.pass('Open toplevel window'); assert.pass('Open toplevel window');
let win = open('data:text/html;charset=utf-8,bar'); let win = open('data:text/html;charset=utf-8,bar');
win.addEventListener('DOMContentLoaded', function onload() { win.addEventListener('DOMContentLoaded', function() {
win.removeEventListener('DOMContentLoaded', onload);
win.close(); win.close();
openBrowserIframe(); openBrowserIframe();
}); }, {once: true});
} }
function openBrowserIframe() { function openBrowserIframe() {
@ -1060,11 +1058,10 @@ exports.testAttachToTabsOnly = function(assert, done) {
let iframe = document.createElement('iframe'); let iframe = document.createElement('iframe');
iframe.setAttribute('type', 'content'); iframe.setAttribute('type', 'content');
iframe.setAttribute('src', 'data:text/html;charset=utf-8,foobar'); iframe.setAttribute('src', 'data:text/html;charset=utf-8,foobar');
iframe.addEventListener('DOMContentLoaded', function onload() { iframe.addEventListener('DOMContentLoaded', function() {
iframe.removeEventListener('DOMContentLoaded', onload);
iframe.parentNode.removeChild(iframe); iframe.parentNode.removeChild(iframe);
openTabWithIframes(); openTabWithIframes();
}); }, {once: true});
document.documentElement.appendChild(iframe); document.documentElement.appendChild(iframe);
} }

View file

@ -1095,10 +1095,9 @@ exports.testSidebarLeakCheckDestroyAfterAttach = function*(assert) {
yield new Promise(resolve => { yield new Promise(resolve => {
let panelBrowser = window.document.getElementById('sidebar').contentDocument.getElementById('web-panels-browser'); let panelBrowser = window.document.getElementById('sidebar').contentDocument.getElementById('web-panels-browser');
panelBrowser.contentWindow.addEventListener('unload', function onUnload() { panelBrowser.contentWindow.addEventListener('unload', function() {
panelBrowser.contentWindow.removeEventListener('unload', onUnload);
resolve(); resolve();
}); }, {once: true});
sidebar.destroy(); sidebar.destroy();
}); });
@ -1137,10 +1136,9 @@ exports.testSidebarLeakCheckUnloadAfterAttach = function*(assert) {
let panelBrowser = window.document.getElementById('sidebar').contentDocument.getElementById('web-panels-browser'); let panelBrowser = window.document.getElementById('sidebar').contentDocument.getElementById('web-panels-browser');
yield new Promise(resolve => { yield new Promise(resolve => {
panelBrowser.contentWindow.addEventListener('unload', function onUnload() { panelBrowser.contentWindow.addEventListener('unload', function() {
panelBrowser.contentWindow.removeEventListener('unload', onUnload);
resolve(); resolve();
}); }, {once: true});
loader.unload(); loader.unload();
}); });

View file

@ -41,8 +41,7 @@ exports.testWindowTracker = function(assert, done) {
var myWindow = makeEmptyWindow(); var myWindow = makeEmptyWindow();
assert.pass('window was created'); assert.pass('window was created');
myWindow.addEventListener("load", function onload() { myWindow.addEventListener("load", function() {
myWindow.removeEventListener("load", onload);
assert.pass("test window has opened"); assert.pass("test window has opened");
// test bug 638007 (new is optional), using new // test bug 638007 (new is optional), using new
@ -61,7 +60,7 @@ exports.testWindowTracker = function(assert, done) {
} }
} }
}); });
}); }, {once: true});
}; };
exports['test window watcher untracker'] = function(assert, done) { exports['test window watcher untracker'] = function(assert, done) {

View file

@ -51,12 +51,11 @@ exports.testLocalXhr = function(assert, done) {
assert.equal(req.responseText, '{}\n', 'XMLHttpRequest should get local files'); assert.equal(req.responseText, '{}\n', 'XMLHttpRequest should get local files');
} }
}; };
req.addEventListener('load', function onload() { req.addEventListener('load', function() {
req.removeEventListener('load', onload);
assert.pass('addEventListener for load event worked'); assert.pass('addEventListener for load event worked');
assert.ok(ready, 'onreadystatechange listener worked'); assert.ok(ready, 'onreadystatechange listener worked');
done(); done();
}); }, {once: true});
req.send(null); req.send(null);
}; };

View file

@ -60,10 +60,9 @@ var OrientationChangeHandler = {
return; return;
} }
window.addEventListener("resize", function waitForResize(e) { window.addEventListener("resize", function(e) {
window.removeEventListener("resize", waitForResize);
trigger(); trigger();
}); }, {once: true});
} }
}; };

View file

@ -113,8 +113,7 @@ var steps = [
SystemAppProxy.registerFrame(frame); SystemAppProxy.registerFrame(frame);
assert.ok(true, "Frame created and registered"); assert.ok(true, "Frame created and registered");
frame.contentWindow.addEventListener("load", function onload() { frame.contentWindow.addEventListener("load", function() {
frame.contentWindow.removeEventListener("load", onload);
assert.ok(true, "Frame document loaded"); assert.ok(true, "Frame document loaded");
// Declare that the iframe is now loaded. // Declare that the iframe is now loaded.
@ -128,7 +127,7 @@ var steps = [
// Once pending events are received, // Once pending events are received,
// we will run checkEventDispatching from `listener` function // we will run checkEventDispatching from `listener` function
}); }, {once: true});
frame.setAttribute("src", "data:text/html,system app"); frame.setAttribute("src", "data:text/html,system app");
}, },

View file

@ -50,10 +50,9 @@ function loadBrowser() {
iframe.src = 'about:blank'; iframe.src = 'about:blank';
document.body.appendChild(iframe); document.body.appendChild(iframe);
iframe.addEventListener("load", function onLoad() { iframe.addEventListener("load", function() {
iframe.removeEventListener("load", onLoad);
runNext(); runNext();
}); }, {once: true});
} }
gScript.addMessageListener("permission-request", function (detail) { gScript.addMessageListener("permission-request", function (detail) {

View file

@ -228,7 +228,7 @@
@RESPATH@/components/layout_xul.xpt @RESPATH@/components/layout_xul.xpt
@RESPATH@/components/locale.xpt @RESPATH@/components/locale.xpt
@RESPATH@/components/lwbrk.xpt @RESPATH@/components/lwbrk.xpt
#ifdef MOZ_ENABLE_PROFILER_SPS #ifdef MOZ_GECKO_PROFILER
@RESPATH@/components/memory_profiler.xpt @RESPATH@/components/memory_profiler.xpt
#endif #endif
@RESPATH@/components/migration.xpt @RESPATH@/components/migration.xpt
@ -260,7 +260,7 @@
@RESPATH@/components/plugin.xpt @RESPATH@/components/plugin.xpt
@RESPATH@/components/pref.xpt @RESPATH@/components/pref.xpt
@RESPATH@/components/prefetch.xpt @RESPATH@/components/prefetch.xpt
#ifdef MOZ_ENABLE_PROFILER_SPS #ifdef MOZ_GECKO_PROFILER
@RESPATH@/components/profiler.xpt @RESPATH@/components/profiler.xpt
#endif #endif
@RESPATH@/components/proxyObject.xpt @RESPATH@/components/proxyObject.xpt

View file

@ -939,12 +939,6 @@ pref("browser.tabs.remote.autostart", false);
pref("browser.tabs.remote.desktopbehavior", true); pref("browser.tabs.remote.desktopbehavior", true);
#if defined(XP_WIN) && defined(MOZ_SANDBOX) #if defined(XP_WIN) && defined(MOZ_SANDBOX)
// When this pref is true the Windows process sandbox will set up dummy
// interceptions and log to the browser console when calls fail in the sandboxed
// process and also if they are subsequently allowed by the broker process.
// This will require a restart.
pref("security.sandbox.windows.log", false);
// Controls whether and how the Windows NPAPI plugin process is sandboxed. // Controls whether and how the Windows NPAPI plugin process is sandboxed.
// To get a different setting for a particular plugin replace "default", with // To get a different setting for a particular plugin replace "default", with
// the plugin's nice file name, see: nsPluginTag::GetNiceFileName. // the plugin's nice file name, see: nsPluginTag::GetNiceFileName.
@ -1033,15 +1027,10 @@ pref("security.sandbox.content.tempDirSuffix", "");
#endif #endif
#if defined(MOZ_SANDBOX) #if defined(MOZ_SANDBOX)
#if defined(XP_MACOSX)
// This pref determines if messages relevant to sandbox violations are // This pref determines if messages relevant to sandbox violations are
// logged. // logged.
// At present, this setting refers only to mac sandbox messages sent to
// the system console but the setting will be used on other platforms
// in the future.
pref("security.sandbox.logging.enabled", true); pref("security.sandbox.logging.enabled", true);
#endif #endif
#endif
// This pref governs whether we attempt to work around problems caused by // This pref governs whether we attempt to work around problems caused by
// plugins using OS calls to manipulate the cursor while running out-of- // plugins using OS calls to manipulate the cursor while running out-of-

View file

@ -497,8 +497,7 @@ function getDefaultProfilePath() {
return defaultProfile.rootDir.path; return defaultProfile.rootDir.path;
} }
document.addEventListener("DOMContentLoaded", function onload() { document.addEventListener("DOMContentLoaded", function() {
document.removeEventListener("DOMContentLoaded", onload, true);
init(); init();
var buttonGetStarted = document.getElementById("buttonGetStarted"); var buttonGetStarted = document.getElementById("buttonGetStarted");
buttonGetStarted.addEventListener("click", getStarted); buttonGetStarted.addEventListener("click", getStarted);
@ -511,7 +510,7 @@ document.addEventListener("DOMContentLoaded", function onload() {
var buttonOpenPrefs = document.getElementById("buttonOpenPrefs") var buttonOpenPrefs = document.getElementById("buttonOpenPrefs")
buttonOpenPrefs.addEventListener("click", openPrefs); buttonOpenPrefs.addEventListener("click", openPrefs);
}, true); }, {capture: true, once: true});
function initObservers() { function initObservers() {
function observe(subject, topic, data) { function observe(subject, topic, data) {

View file

@ -226,10 +226,9 @@ function setupSearch() {
// immediately when the element is first drawn, so the // immediately when the element is first drawn, so the
// attribute is also used for styling when the page first loads. // attribute is also used for styling when the page first loads.
searchText = document.getElementById("searchText"); searchText = document.getElementById("searchText");
searchText.addEventListener("blur", function searchText_onBlur() { searchText.addEventListener("blur", function() {
searchText.removeEventListener("blur", searchText_onBlur);
searchText.removeAttribute("autofocus"); searchText.removeAttribute("autofocus");
}); }, {once: true});
if (!gContentSearchController) { if (!gContentSearchController) {
gContentSearchController = gContentSearchController =

View file

@ -1943,10 +1943,9 @@ function focusAndSelectUrlBar() {
// We can't focus it when it's disabled, so we need to re-run ourselves when // We can't focus it when it's disabled, so we need to re-run ourselves when
// we've finished leaving customize mode. // we've finished leaving customize mode.
if (CustomizationHandler.isExitingCustomizeMode) { if (CustomizationHandler.isExitingCustomizeMode) {
gNavToolbox.addEventListener("aftercustomization", function afterCustomize() { gNavToolbox.addEventListener("aftercustomization", function() {
gNavToolbox.removeEventListener("aftercustomization", afterCustomize);
focusAndSelectUrlBar(); focusAndSelectUrlBar();
}); }, {once: true});
return true; return true;
} }

View file

@ -853,10 +853,9 @@ ContentSearchUIController.prototype = {
"chrome://browser/skin/search-engine-placeholder.png"); "chrome://browser/skin/search-engine-placeholder.png");
} }
img.setAttribute("src", uri); img.setAttribute("src", uri);
img.addEventListener("load", function imgLoad() { img.addEventListener("load", function() {
img.removeEventListener("load", imgLoad);
URL.revokeObjectURL(uri); URL.revokeObjectURL(uri);
}); }, {once: true});
button.appendChild(img); button.appendChild(img);
button.style.width = buttonWidth + "px"; button.style.width = buttonWidth + "px";
button.setAttribute("title", engine.name); button.setAttribute("title", engine.name);

View file

@ -32,10 +32,9 @@ var gCustomize = {
}, },
hidePanel: function() { hidePanel: function() {
this._nodes.overlay.addEventListener("transitionend", function onTransitionEnd() { this._nodes.overlay.addEventListener("transitionend", function() {
gCustomize._nodes.overlay.removeEventListener("transitionend", onTransitionEnd);
gCustomize._nodes.overlay.style.display = "none"; gCustomize._nodes.overlay.style.display = "none";
}); }, {once: true});
this._nodes.overlay.style.opacity = 0; this._nodes.overlay.style.opacity = 0;
this._nodes.button.removeAttribute("active"); this._nodes.button.removeAttribute("active");
this._nodes.panel.removeAttribute("open"); this._nodes.panel.removeAttribute("open");

View file

@ -111,8 +111,6 @@ var gSyncUtils = {
iframe.collapsed = true; iframe.collapsed = true;
document.documentElement.appendChild(iframe); document.documentElement.appendChild(iframe);
iframe.contentWindow.addEventListener("load", function() { iframe.contentWindow.addEventListener("load", function() {
iframe.contentWindow.removeEventListener("load", arguments.callee);
// Insert the Sync Key into the page. // Insert the Sync Key into the page.
let el = iframe.contentDocument.getElementById("synckey"); let el = iframe.contentDocument.getElementById("synckey");
el.firstChild.nodeValue = pp; el.firstChild.nodeValue = pp;
@ -129,7 +127,7 @@ var gSyncUtils = {
el.firstChild.nodeValue = privacyURL; el.firstChild.nodeValue = privacyURL;
callback(iframe); callback(iframe);
}); }, {once: true});
}, },
/** /**

View file

@ -1114,10 +1114,9 @@
var forwardButtonContainer = document.getElementById("urlbar-wrapper"); var forwardButtonContainer = document.getElementById("urlbar-wrapper");
if (forwardButtonContainer) { if (forwardButtonContainer) {
forwardButtonContainer.setAttribute("switchingtabs", "true"); forwardButtonContainer.setAttribute("switchingtabs", "true");
window.addEventListener("MozAfterPaint", function removeSwitchingtabsAttr() { window.addEventListener("MozAfterPaint", function() {
window.removeEventListener("MozAfterPaint", removeSwitchingtabsAttr);
forwardButtonContainer.removeAttribute("switchingtabs"); forwardButtonContainer.removeAttribute("switchingtabs");
}); }, {once: true});
} }
this._appendStatusPanel(); this._appendStatusPanel();

View file

@ -3,15 +3,14 @@ function promiseAlertWindow() {
let listener = { let listener = {
onOpenWindow(window) { onOpenWindow(window) {
let alertWindow = window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow); let alertWindow = window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
alertWindow.addEventListener("load", function onLoad() { alertWindow.addEventListener("load", function() {
alertWindow.removeEventListener("load", onLoad);
let windowType = alertWindow.document.documentElement.getAttribute("windowtype"); let windowType = alertWindow.document.documentElement.getAttribute("windowtype");
if (windowType != "alert:alert") { if (windowType != "alert:alert") {
return; return;
} }
Services.wm.removeListener(listener); Services.wm.removeListener(listener);
resolve(alertWindow); resolve(alertWindow);
}); }, {once: true});
}, },
}; };
Services.wm.addListener(listener); Services.wm.addListener(listener);

View file

@ -565,9 +565,7 @@ function* withSnippetsMap(setupFn, testFn, testArgs = null, parentFn = null) {
let document = content.document; let document = content.document;
// We're not using Promise-based listeners, because they resolve asynchronously. // We're not using Promise-based listeners, because they resolve asynchronously.
// The snippets test setup code relies on synchronous behaviour here. // The snippets test setup code relies on synchronous behaviour here.
document.addEventListener("AboutHomeLoadSnippets", function loadSnippets() { document.addEventListener("AboutHomeLoadSnippets", function() {
document.removeEventListener("AboutHomeLoadSnippets", loadSnippets);
let updateSnippets; let updateSnippets;
if (args.setupFnSource) { if (args.setupFnSource) {
updateSnippets = eval(`(() => (${args.setupFnSource}))()`); updateSnippets = eval(`(() => (${args.setupFnSource}))()`);
@ -594,7 +592,7 @@ function* withSnippetsMap(setupFn, testFn, testArgs = null, parentFn = null) {
resolve(); resolve();
}); });
}); }, {once: true});
}); });
}); });
}; };

View file

@ -12,10 +12,9 @@ add_task(function* () {
// While in the child process, add a listener for the popstate event here. This // While in the child process, add a listener for the popstate event here. This
// event will fire when the mouse click happens. // event will fire when the mouse click happens.
content.addEventListener("popstate", function onPopState() { content.addEventListener("popstate", function() {
content.removeEventListener("popstate", onPopState);
sendAsyncMessage("Test:PopStateOccurred", { location: content.document.location.href }); sendAsyncMessage("Test:PopStateOccurred", { location: content.document.location.href });
}); }, {once: true});
}); });
window.maximize(); window.maximize();

View file

@ -68,13 +68,12 @@ function test_paste(aCurrentTest) {
// Focus the element and wait for focus event. // Focus the element and wait for focus event.
info("About to focus " + element.id); info("About to focus " + element.id);
element.addEventListener("focus", function() { element.addEventListener("focus", function() {
element.removeEventListener("focus", arguments.callee);
executeSoon(function() { executeSoon(function() {
// Pasting is async because the Accel+V codepath ends up going through // Pasting is async because the Accel+V codepath ends up going through
// nsDocumentViewer::FireClipboardEvent. // nsDocumentViewer::FireClipboardEvent.
info("Pasting into " + element.id); info("Pasting into " + element.id);
EventUtils.synthesizeKey("v", { accelKey: true }); EventUtils.synthesizeKey("v", { accelKey: true });
}); });
}); }, {once: true});
element.focus(); element.focus();
} }

View file

@ -25,10 +25,9 @@ function addTab(aURI, aIndex) {
gBrowser.removeTab(gBrowser.tabs[0], {skipPermitUnload: true}); gBrowser.removeTab(gBrowser.tabs[0], {skipPermitUnload: true});
tab.linkedBrowser.addEventListener("load", function(event) { tab.linkedBrowser.addEventListener("load", function(event) {
event.currentTarget.removeEventListener("load", arguments.callee, true);
if (++count == URIS.length) if (++count == URIS.length)
executeSoon(doTabsTest); executeSoon(doTabsTest);
}, true); }, {capture: true, once: true});
} }
function doTabsTest() { function doTabsTest() {
@ -36,14 +35,13 @@ function doTabsTest() {
// sample of "close related tabs" feature // sample of "close related tabs" feature
gBrowser.tabContainer.addEventListener("TabClose", function(event) { gBrowser.tabContainer.addEventListener("TabClose", function(event) {
event.currentTarget.removeEventListener("TabClose", arguments.callee, true);
var closedTab = event.originalTarget; var closedTab = event.originalTarget;
var scheme = closedTab.linkedBrowser.currentURI.scheme; var scheme = closedTab.linkedBrowser.currentURI.scheme;
Array.slice(gBrowser.tabs).forEach(function(aTab) { Array.slice(gBrowser.tabs).forEach(function(aTab) {
if (aTab != closedTab && aTab.linkedBrowser.currentURI.scheme == scheme) if (aTab != closedTab && aTab.linkedBrowser.currentURI.scheme == scheme)
gBrowser.removeTab(aTab, {skipPermitUnload: true}); gBrowser.removeTab(aTab, {skipPermitUnload: true});
}); });
}, true); }, {capture: true, once: true});
gBrowser.removeTab(gBrowser.tabs[0], {skipPermitUnload: true}); gBrowser.removeTab(gBrowser.tabs[0], {skipPermitUnload: true});
is(gBrowser.tabs.length, 1, "Related tabs are not closed unexpectedly"); is(gBrowser.tabs.length, 1, "Related tabs are not closed unexpectedly");

View file

@ -44,10 +44,9 @@ function test() {
waitForExplicitFinish(); waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab(); gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function onLoad() { gBrowser.selectedBrowser.addEventListener("load", function() {
gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
waitForStarChange(false, initTest); waitForStarChange(false, initTest);
}, true); }, {capture: true, once: true});
content.location = testURL; content.location = testURL;
} }

View file

@ -6,13 +6,10 @@ function test() {
gBrowser.selectedTab = gBrowser.addTab(); gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function() { gBrowser.selectedBrowser.addEventListener("load", function() {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
var pageInfo = BrowserPageInfo(gBrowser.selectedBrowser.currentURI.spec, var pageInfo = BrowserPageInfo(gBrowser.selectedBrowser.currentURI.spec,
"mediaTab"); "mediaTab");
pageInfo.addEventListener("load", function() { pageInfo.addEventListener("load", function() {
pageInfo.removeEventListener("load", arguments.callee, true);
pageInfo.onFinished.push(function() { pageInfo.onFinished.push(function() {
executeSoon(function() { executeSoon(function() {
var imageTree = pageInfo.document.getElementById("imagetree"); var imageTree = pageInfo.document.getElementById("imagetree");
@ -28,8 +25,8 @@ function test() {
finish(); finish();
}); });
}); });
}, true); }, {capture: true, once: true});
}, true); }, {capture: true, once: true});
content.location = content.location =
"data:text/html," + "data:text/html," +

View file

@ -4,8 +4,6 @@ function test() {
"http://mochi.test:8888/browser/browser/base/content/test/general/browser_bug479408_sample.html"); "http://mochi.test:8888/browser/browser/base/content/test/general/browser_bug479408_sample.html");
gBrowser.addEventListener("DOMLinkAdded", function(aEvent) { gBrowser.addEventListener("DOMLinkAdded", function(aEvent) {
gBrowser.removeEventListener("DOMLinkAdded", arguments.callee, true);
executeSoon(function() { executeSoon(function() {
ok(!tab.linkedBrowser.engines, ok(!tab.linkedBrowser.engines,
"the subframe's search engine wasn't detected"); "the subframe's search engine wasn't detected");
@ -13,5 +11,5 @@ function test() {
gBrowser.removeTab(tab); gBrowser.removeTab(tab);
finish(); finish();
}); });
}, true); }, {capture: true, once: true});
} }

View file

@ -12,13 +12,11 @@ function test() {
// test normal close // test normal close
tabA = gBrowser.addTab(testPage); tabA = gBrowser.addTab(testPage);
gBrowser.tabContainer.addEventListener("TabClose", function(firstTabCloseEvent) { gBrowser.tabContainer.addEventListener("TabClose", function(firstTabCloseEvent) {
gBrowser.tabContainer.removeEventListener("TabClose", arguments.callee, true);
ok(!firstTabCloseEvent.detail.adoptedBy, "This was a normal tab close"); ok(!firstTabCloseEvent.detail.adoptedBy, "This was a normal tab close");
// test tab close by moving // test tab close by moving
tabB = gBrowser.addTab(testPage); tabB = gBrowser.addTab(testPage);
gBrowser.tabContainer.addEventListener("TabClose", function(secondTabCloseEvent) { gBrowser.tabContainer.addEventListener("TabClose", function(secondTabCloseEvent) {
gBrowser.tabContainer.removeEventListener("TabClose", arguments.callee, true);
executeSoon(function() { executeSoon(function() {
ok(secondTabCloseEvent.detail.adoptedBy, "This was a tab closed by moving"); ok(secondTabCloseEvent.detail.adoptedBy, "This was a tab closed by moving");
@ -26,9 +24,9 @@ function test() {
newWin.close(); newWin.close();
executeSoon(finish); executeSoon(finish);
}); });
}, true); }, {capture: true, once: true});
newWin = gBrowser.replaceTabWithWindow(tabB); newWin = gBrowser.replaceTabWithWindow(tabB);
}, true); }, {capture: true, once: true});
gBrowser.removeTab(tabA); gBrowser.removeTab(tabA);
} }

View file

@ -6,15 +6,12 @@ function test() {
gBrowser.selectedTab = gBrowser.addTab(); gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function() { gBrowser.selectedBrowser.addEventListener("load", function() {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
var doc = gBrowser.contentDocument; var doc = gBrowser.contentDocument;
var testImg = doc.getElementById("test-image"); var testImg = doc.getElementById("test-image");
var pageInfo = BrowserPageInfo(gBrowser.selectedBrowser.currentURI.spec, var pageInfo = BrowserPageInfo(gBrowser.selectedBrowser.currentURI.spec,
"mediaTab", testImg); "mediaTab", testImg);
pageInfo.addEventListener("load", function() { pageInfo.addEventListener("load", function() {
pageInfo.removeEventListener("load", arguments.callee, true);
pageInfo.onFinished.push(function() { pageInfo.onFinished.push(function() {
executeSoon(function() { executeSoon(function() {
var pageInfoImg = pageInfo.document.getElementById("thepreviewimage"); var pageInfoImg = pageInfo.document.getElementById("thepreviewimage");
@ -28,8 +25,8 @@ function test() {
finish(); finish();
}); });
}); });
}, true); }, {capture: true, once: true});
}, true); }, {capture: true, once: true});
content.location = content.location =
"data:text/html," + "data:text/html," +

View file

@ -61,10 +61,9 @@ function waitForProgressNotification(aPanelOpen = false, aExpectedCount = 1) {
panelEventPromise = Promise.resolve(); panelEventPromise = Promise.resolve();
} else { } else {
panelEventPromise = new Promise(resolve => { panelEventPromise = new Promise(resolve => {
PopupNotifications.panel.addEventListener("popupshowing", function eventListener() { PopupNotifications.panel.addEventListener("popupshowing", function() {
PopupNotifications.panel.removeEventListener("popupshowing", eventListener);
resolve(); resolve();
}); }, {once: true});
}); });
} }
@ -134,10 +133,9 @@ function waitForNotification(aId, aExpectedCount = 1) {
function waitForNotificationClose() { function waitForNotificationClose() {
return new Promise(resolve => { return new Promise(resolve => {
info("Waiting for notification to close"); info("Waiting for notification to close");
PopupNotifications.panel.addEventListener("popuphidden", function listener() { PopupNotifications.panel.addEventListener("popuphidden", function() {
PopupNotifications.panel.removeEventListener("popuphidden", listener);
resolve(); resolve();
}); }, {once: true});
}); });
} }

View file

@ -12,10 +12,9 @@ function test() {
// Verify that about:addons loads // Verify that about:addons loads
waitForExplicitFinish(); waitForExplicitFinish();
gBrowser.selectedBrowser.addEventListener("load", function() { gBrowser.selectedBrowser.addEventListener("load", function() {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
let browser = blanktab.linkedBrowser; let browser = blanktab.linkedBrowser;
is(browser.currentURI.spec, "about:addons", "about:addons should load into blank tab."); is(browser.currentURI.spec, "about:addons", "about:addons should load into blank tab.");
gBrowser.removeTab(blanktab); gBrowser.removeTab(blanktab);
finish(); finish();
}, true); }, {capture: true, once: true});
} }

View file

@ -17,8 +17,6 @@ function test() {
let tab = gBrowser.selectedTab = gBrowser.addTab(); let tab = gBrowser.selectedTab = gBrowser.addTab();
tab.linkedBrowser.addEventListener("load", (function(event) { tab.linkedBrowser.addEventListener("load", (function(event) {
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
let uri = makeURI(testURL); let uri = makeURI(testURL);
let bmTxn = let bmTxn =
new PlacesCreateBookmarkTransaction(uri, new PlacesCreateBookmarkTransaction(uri,
@ -28,7 +26,7 @@ function test() {
ok(PlacesUtils.bookmarks.isBookmarked(uri), "the test url is bookmarked"); ok(PlacesUtils.bookmarks.isBookmarked(uri), "the test url is bookmarked");
waitForStarChange(true, onStarred); waitForStarChange(true, onStarred);
}), true); }), {capture: true, once: true});
content.location = testURL; content.location = testURL;
} }

View file

@ -10,9 +10,8 @@ var LightweightThemeManager = tempScope.LightweightThemeManager;
function wait_for_notification(aCallback) { function wait_for_notification(aCallback) {
PopupNotifications.panel.addEventListener("popupshown", function() { PopupNotifications.panel.addEventListener("popupshown", function() {
PopupNotifications.panel.removeEventListener("popupshown", arguments.callee);
aCallback(PopupNotifications.panel); aCallback(PopupNotifications.panel);
}); }, {once: true});
} }
var TESTS = [ var TESTS = [

View file

@ -30,18 +30,16 @@ function duplicate(delta, msg, cb) {
duplicateTabIn(gBrowser.selectedTab, "tab", delta); duplicateTabIn(gBrowser.selectedTab, "tab", delta);
let tab = gBrowser.selectedTab; let tab = gBrowser.selectedTab;
tab.addEventListener("SSTabRestored", function tabRestoredListener() { tab.addEventListener("SSTabRestored", function() {
tab.removeEventListener("SSTabRestored", tabRestoredListener);
is(gBrowser.sessionHistory.index, start + delta, msg); is(gBrowser.sessionHistory.index, start + delta, msg);
executeSoon(cb); executeSoon(cb);
}); }, {once: true});
} }
function loadAndWait(url, cb) { function loadAndWait(url, cb) {
gBrowser.selectedBrowser.addEventListener("load", function() { gBrowser.selectedBrowser.addEventListener("load", function() {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
executeSoon(cb); executeSoon(cb);
}, true); }, {capture: true, once: true});
gBrowser.loadURI(url); gBrowser.loadURI(url);
} }

View file

@ -4,8 +4,6 @@ function test() {
var tab = gBrowser.addTab(); var tab = gBrowser.addTab();
tab.addEventListener("TabClose", function() { tab.addEventListener("TabClose", function() {
tab.removeEventListener("TabClose", arguments.callee);
ok(tab.linkedBrowser, "linkedBrowser should still exist during the TabClose event"); ok(tab.linkedBrowser, "linkedBrowser should still exist during the TabClose event");
executeSoon(function() { executeSoon(function() {
@ -13,7 +11,7 @@ function test() {
finish(); finish();
}); });
}); }, {once: true});
gBrowser.removeTab(tab); gBrowser.removeTab(tab);
} }

View file

@ -35,10 +35,9 @@ function test() {
} }
function load(aTab, aUrl, aCallback) { function load(aTab, aUrl, aCallback) {
aTab.linkedBrowser.addEventListener("load", function onload(aEvent) { aTab.linkedBrowser.addEventListener("load", function(aEvent) {
aEvent.currentTarget.removeEventListener("load", onload, true);
waitForFocus(aCallback, content); waitForFocus(aCallback, content);
}, true); }, {capture: true, once: true});
aTab.linkedBrowser.loadURI(aUrl); aTab.linkedBrowser.loadURI(aUrl);
} }

View file

@ -65,10 +65,9 @@ add_task(function* () {
// Wait for the iframe to load. // Wait for the iframe to load.
return new Promise(resolve => { return new Promise(resolve => {
iframe.addEventListener("load", function onload() { iframe.addEventListener("load", function() {
iframe.removeEventListener("load", onload, true);
resolve("context-showonlythisframe"); resolve("context-showonlythisframe");
}, true); }, {capture: true, once: true});
}); });
}); });
}, },

View file

@ -28,9 +28,8 @@ function test() {
} }
function load(aTab, aUrl, aCallback) { function load(aTab, aUrl, aCallback) {
aTab.linkedBrowser.addEventListener("load", function onload(aEvent) { aTab.linkedBrowser.addEventListener("load", function(aEvent) {
aEvent.currentTarget.removeEventListener("load", onload, true);
waitForFocus(aCallback, content); waitForFocus(aCallback, content);
}, true); }, {capture: true, once: true});
aTab.linkedBrowser.loadURI(aUrl); aTab.linkedBrowser.loadURI(aUrl);
} }

View file

@ -83,8 +83,7 @@ function openNewTab(aWindow, aCallback) {
return; return;
} }
browser.addEventListener("load", function onLoad() { browser.addEventListener("load", function() {
browser.removeEventListener("load", onLoad, true);
executeSoon(aCallback); executeSoon(aCallback);
}, true); }, {capture: true, once: true});
} }

View file

@ -48,8 +48,7 @@ function preparePendingTab(aCallback) {
} }
function whenLoaded(aElement, aCallback) { function whenLoaded(aElement, aCallback) {
aElement.addEventListener("load", function onLoad() { aElement.addEventListener("load", function() {
aElement.removeEventListener("load", onLoad, true);
executeSoon(aCallback); executeSoon(aCallback);
}, true); }, {capture: true, once: true});
} }

View file

@ -7,8 +7,7 @@ function test() {
ok(true, "Starting up"); ok(true, "Starting up");
gBrowser.selectedBrowser.focus(); gBrowser.selectedBrowser.focus();
gURLBar.addEventListener("focus", function onFocus() { gURLBar.addEventListener("focus", function() {
gURLBar.removeEventListener("focus", onFocus);
ok(true, "Invoked onfocus handler"); ok(true, "Invoked onfocus handler");
EventUtils.synthesizeKey("VK_RETURN", { shiftKey: true }); EventUtils.synthesizeKey("VK_RETURN", { shiftKey: true });
@ -17,7 +16,7 @@ function test() {
ok(true, "Evaluated without crashing"); ok(true, "Evaluated without crashing");
finish(); finish();
}); });
}); }, {once: true});
gURLBar.inputField.value = "javascript: var foo = '11111111'; "; gURLBar.inputField.value = "javascript: var foo = '11111111'; ";
gURLBar.focus(); gURLBar.focus();
} }

View file

@ -10,14 +10,13 @@ add_task(function*() {
textbox.select(); textbox.select();
yield new Promise((resolve, reject) => { yield new Promise((resolve, reject) => {
textbox.addEventListener("copy", function copyEvent(event) { textbox.addEventListener("copy", function(event) {
textbox.removeEventListener("copy", copyEvent, true);
event.clipboardData.setData("text/plain", "Alternate"); event.clipboardData.setData("text/plain", "Alternate");
// For this test, it doesn't matter that the file isn't actually a file. // For this test, it doesn't matter that the file isn't actually a file.
event.clipboardData.setData("application/x-moz-file", "Sample"); event.clipboardData.setData("application/x-moz-file", "Sample");
event.preventDefault(); event.preventDefault();
resolve(); resolve();
}, true) }, {capture: true, once: true})
EventUtils.synthesizeKey("c", { accelKey: true }); EventUtils.synthesizeKey("c", { accelKey: true });
}); });
@ -40,9 +39,7 @@ add_task(function*() {
textbox.focus(); textbox.focus();
yield new Promise((resolve, reject) => { yield new Promise((resolve, reject) => {
textbox.addEventListener("paste", function copyEvent(event) { textbox.addEventListener("paste", function(event) {
textbox.removeEventListener("paste", copyEvent, true);
let dt = event.clipboardData; let dt = event.clipboardData;
is(dt.types.length, 3, "number of types"); is(dt.types.length, 3, "number of types");
ok(dt.types.includes("text/plain"), "text/plain exists in types"); ok(dt.types.includes("text/plain"), "text/plain exists in types");
@ -51,7 +48,7 @@ add_task(function*() {
is(dt.mozGetDataAt("text/plain", 0), "Alternate", "text/plain returned in mozGetDataAt"); is(dt.mozGetDataAt("text/plain", 0), "Alternate", "text/plain returned in mozGetDataAt");
resolve(); resolve();
}, true); }, {capture: true, once: true});
EventUtils.synthesizeKey("v", { accelKey: true }); EventUtils.synthesizeKey("v", { accelKey: true });
}); });

View file

@ -7,11 +7,10 @@ add_task(function* () {
// Wait for a process change and then fulfil the promise. // Wait for a process change and then fulfil the promise.
function awaitProcessChange(browser) { function awaitProcessChange(browser) {
return new Promise(resolve => { return new Promise(resolve => {
browser.addEventListener("BrowserChangedProcess", function bcp(e) { browser.addEventListener("BrowserChangedProcess", function(e) {
browser.removeEventListener("BrowserChangedProcess", bcp);
ok(true, "The browser changed process!"); ok(true, "The browser changed process!");
resolve(); resolve();
}); }, {once: true});
}); });
} }

View file

@ -45,10 +45,9 @@ function promiseNextTick() {
*/ */
function promiseWaitForAlertActive(aNotificationBox) { function promiseWaitForAlertActive(aNotificationBox) {
let deferred = PromiseUtils.defer(); let deferred = PromiseUtils.defer();
aNotificationBox.addEventListener("AlertActive", function onActive() { aNotificationBox.addEventListener("AlertActive", function() {
aNotificationBox.removeEventListener("AlertActive", onActive, true);
deferred.resolve(); deferred.resolve();
}); }, {once: true});
return deferred.promise; return deferred.promise;
} }

View file

@ -6,9 +6,8 @@ function doc() {
function setHandlerFunc(aResultFunc) { function setHandlerFunc(aResultFunc) {
gBrowser.addEventListener("DOMLinkAdded", function(event) { gBrowser.addEventListener("DOMLinkAdded", function(event) {
gBrowser.removeEventListener("DOMLinkAdded", arguments.callee);
executeSoon(aResultFunc); executeSoon(aResultFunc);
}); }, {once: true});
} }
function test() { function test() {
@ -17,9 +16,8 @@ function test() {
gBrowser.selectedTab = gBrowser.addTab(); gBrowser.selectedTab = gBrowser.addTab();
browser = gBrowser.selectedBrowser; browser = gBrowser.selectedBrowser;
browser.addEventListener("load", function(event) { browser.addEventListener("load", function(event) {
event.currentTarget.removeEventListener("load", arguments.callee, true);
iconDiscovery(); iconDiscovery();
}, true); }, {capture: true, once: true});
var rootDir = getRootDirectory(gTestPath); var rootDir = getRootDirectory(gTestPath);
content.location = rootDir + "discovery.html"; content.location = rootDir + "discovery.html";
} }

View file

@ -48,9 +48,7 @@ function* expectFocusOnF6(backward, expectedDocument, expectedElement, onContent
return; return;
} }
contentExpectedElement.addEventListener("focus", function focusReceived() { contentExpectedElement.addEventListener("focus", function() {
contentExpectedElement.removeEventListener("focus", focusReceived, true);
const contentFM = Components.classes["@mozilla.org/focus-manager;1"]. const contentFM = Components.classes["@mozilla.org/focus-manager;1"].
getService(Components.interfaces.nsIFocusManager); getService(Components.interfaces.nsIFocusManager);
let details = contentFM.focusedWindow.document.documentElement.id; let details = contentFM.focusedWindow.document.documentElement.id;
@ -59,7 +57,7 @@ function* expectFocusOnF6(backward, expectedDocument, expectedElement, onContent
} }
sendSyncMessage("BrowserTest:FocusChanged", { details }); sendSyncMessage("BrowserTest:FocusChanged", { details });
}, true); }, {capture: true, once: true});
}); });
} }

View file

@ -5,17 +5,15 @@ add_task(function *() {
gURLBar.focus(); gURLBar.focus();
window.addEventListener("keyup", function countKeyUps(event) { window.addEventListener("keyup", function(event) {
window.removeEventListener("keyup", countKeyUps, true);
if (event.originalTarget == gURLBar.inputField) { if (event.originalTarget == gURLBar.inputField) {
keyUps++; keyUps++;
} }
}, true); }, {capture: true, once: true});
gURLBar.addEventListener("keydown", function redirectFocus(event) { gURLBar.addEventListener("keydown", function(event) {
gURLBar.removeEventListener("keydown", redirectFocus, true);
gBrowser.selectedBrowser.focus(); gBrowser.selectedBrowser.focus();
}, true); }, {capture: true, once: true});
EventUtils.synthesizeKey("v", { }); EventUtils.synthesizeKey("v", { });

View file

@ -14,13 +14,11 @@ function test() {
let numVisBeforeHide, numVisAfterHide; let numVisBeforeHide, numVisAfterHide;
gBrowser.tabContainer.addEventListener("TabSelect", function() { gBrowser.tabContainer.addEventListener("TabSelect", function() {
gBrowser.tabContainer.removeEventListener("TabSelect", arguments.callee);
// While the next tab is being selected, hide the removing tab // While the next tab is being selected, hide the removing tab
numVisBeforeHide = gBrowser.visibleTabs.length; numVisBeforeHide = gBrowser.visibleTabs.length;
gBrowser.hideTab(testTab); gBrowser.hideTab(testTab);
numVisAfterHide = gBrowser.visibleTabs.length; numVisAfterHide = gBrowser.visibleTabs.length;
}); }, {once: true});
gBrowser.removeTab(testTab, {animate: true}); gBrowser.removeTab(testTab, {animate: true});
// Make sure the tab gets removed at the end of the animation by polling // Make sure the tab gets removed at the end of the animation by polling

View file

@ -121,7 +121,10 @@ function nextTest() {
} }
} }
function checkResult() { function checkResult(event) {
if (event.target.URL == "about:blank")
return;
// Sanity check other values, and the value of gIdentityHandler.getEffectiveHost() // Sanity check other values, and the value of gIdentityHandler.getEffectiveHost()
is(gIdentityHandler._uri.spec, gCurrentTest.location, "location matches for test " + gTestDesc); is(gIdentityHandler._uri.spec, gCurrentTest.location, "location matches for test " + gTestDesc);
// getEffectiveHost can't be called for all modes // getEffectiveHost can't be called for all modes

View file

@ -46,9 +46,8 @@ add_task(function* test_keyword_bookmarklet() {
function* promisePageShow() { function* promisePageShow() {
return new Promise(resolve => { return new Promise(resolve => {
gBrowser.selectedBrowser.addEventListener("pageshow", function listen() { gBrowser.selectedBrowser.addEventListener("pageshow", function() {
gBrowser.selectedBrowser.removeEventListener("pageshow", listen);
resolve(); resolve();
}); }, {once: true});
}); });
} }

View file

@ -25,9 +25,8 @@ function test() {
ok(false, "Alert window opened"); ok(false, "Alert window opened");
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget); let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
win.addEventListener("load", function() { win.addEventListener("load", function() {
win.removeEventListener("load", arguments.callee);
win.close(); win.close();
}); }, {once: true});
executeSoon(finish); executeSoon(finish);
} }
} }

View file

@ -23,10 +23,9 @@ function promiseNewWindow() {
if (topic == "domwindowopened") { if (topic == "domwindowopened") {
Services.ww.unregisterNotification(observer); Services.ww.unregisterNotification(observer);
let win = subject.QueryInterface(Ci.nsIDOMWindow); let win = subject.QueryInterface(Ci.nsIDOMWindow);
win.addEventListener("load", function onLoad() { win.addEventListener("load", function() {
win.removeEventListener("load", onLoad);
resolve(win); resolve(win);
}); }, {once: true});
} }
}; };

View file

@ -68,12 +68,11 @@ function test() {
// tab to open - which we track via an "Initialized" event. // tab to open - which we track via an "Initialized" event.
PopupNotifications.panel.firstElementChild.button.click(); PopupNotifications.panel.firstElementChild.button.click();
let newTabBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab); let newTabBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
newTabBrowser.addEventListener("Initialized", function PrefInit() { newTabBrowser.addEventListener("Initialized", function() {
newTabBrowser.removeEventListener("Initialized", PrefInit, true);
executeSoon(function() { executeSoon(function() {
checkInContentPreferences(newTabBrowser.contentWindow); checkInContentPreferences(newTabBrowser.contentWindow);
}) })
}, true); }, {capture: true, once: true});
}); });
onCachedAttached.then(function() { onCachedAttached.then(function() {
Services.prefs.setIntPref("offline-apps.quota.warn", 1); Services.prefs.setIntPref("offline-apps.quota.warn", 1);
@ -87,9 +86,8 @@ function test() {
function promiseNotification() { function promiseNotification() {
return new Promise(resolve => { return new Promise(resolve => {
PopupNotifications.panel.addEventListener("popupshown", function onShown() { PopupNotifications.panel.addEventListener("popupshown", function() {
PopupNotifications.panel.removeEventListener("popupshown", onShown);
resolve(); resolve();
}); }, {once: true});
}); });
} }

View file

@ -4,12 +4,10 @@ function test() {
var pageInfo; var pageInfo;
gBrowser.selectedTab = gBrowser.addTab(); gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function loadListener() { gBrowser.selectedBrowser.addEventListener("load", function() {
gBrowser.selectedBrowser.removeEventListener("load", loadListener, true);
Services.obs.addObserver(observer, "page-info-dialog-loaded", false); Services.obs.addObserver(observer, "page-info-dialog-loaded", false);
pageInfo = BrowserPageInfo(); pageInfo = BrowserPageInfo();
}, true); }, {capture: true, once: true});
content.location = content.location =
"https://example.com/browser/browser/base/content/test/general/feed_tab.html"; "https://example.com/browser/browser/base/content/test/general/feed_tab.html";

View file

@ -786,15 +786,13 @@ WindowHelper.prototype = {
let win = aSubject.QueryInterface(Ci.nsIDOMWindow); let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
win.addEventListener("load", function onload(event) { win.addEventListener("load", function onload(event) {
win.removeEventListener("load", onload);
if (win.name !== "SanitizeDialog") if (win.name !== "SanitizeDialog")
return; return;
wh.win = win; wh.win = win;
loaded = true; loaded = true;
executeSoon(() => wh.onload()); executeSoon(() => wh.onload());
}); }, {once: true});
win.addEventListener("unload", function onunload(event) { win.addEventListener("unload", function onunload(event) {
if (win.name !== "SanitizeDialog") { if (win.name !== "SanitizeDialog") {

View file

@ -104,9 +104,7 @@ var windowObserver = {
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget); let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
win.addEventListener("load", function onLoad(event) { win.addEventListener("load", function(event) {
win.removeEventListener("load", onLoad);
if (win.location == UCT_URI) { if (win.location == UCT_URI) {
SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() {
if (windowObserver._callback) { if (windowObserver._callback) {
@ -117,7 +115,7 @@ var windowObserver = {
} }
}); });
} }
}); }, {once: true});
} }
}; };

View file

@ -329,10 +329,9 @@ add_task(function*() {
elem = content.document.getElementById(contentStep[0]); elem = content.document.getElementById(contentStep[0]);
} }
changedWin.addEventListener("MozAfterPaint", function onPaint() { changedWin.addEventListener("MozAfterPaint", function() {
changedWin.removeEventListener("MozAfterPaint", onPaint);
resolve(); resolve();
}); }, {once: true});
elem.style = contentStep[1]; elem.style = contentStep[1];
elem.getBoundingClientRect(); elem.getBoundingClientRect();
@ -675,11 +674,10 @@ add_task(function* test_mousemove_correcttarget() {
yield popupShownPromise; yield popupShownPromise;
yield new Promise(resolve => { yield new Promise(resolve => {
window.addEventListener("mousemove", function checkForMouseMove(event) { window.addEventListener("mousemove", function(event) {
window.removeEventListener("mousemove", checkForMouseMove, true);
is(event.target.localName.indexOf("menu"), 0, "mouse over menu"); is(event.target.localName.indexOf("menu"), 0, "mouse over menu");
resolve(); resolve();
}, true); }, {capture: true, once: true});
EventUtils.synthesizeMouseAtCenter(selectPopup.firstChild, { type: "mousemove" }); EventUtils.synthesizeMouseAtCenter(selectPopup.firstChild, { type: "mousemove" });
}); });

View file

@ -8,13 +8,11 @@ function test() {
let tab = gBrowser.addTab(testPath + "file_bug970276_popup1.html"); let tab = gBrowser.addTab(testPath + "file_bug970276_popup1.html");
tab.linkedBrowser.addEventListener("load", function() { tab.linkedBrowser.addEventListener("load", function() {
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
let expectedIcon = testPath + "file_bug970276_favicon1.ico"; let expectedIcon = testPath + "file_bug970276_favicon1.ico";
is(gBrowser.getIcon(tab), expectedIcon, "Correct icon."); is(gBrowser.getIcon(tab), expectedIcon, "Correct icon.");
gBrowser.removeTab(tab); gBrowser.removeTab(tab);
finish(); finish();
}, true); }, {capture: true, once: true});
} }

View file

@ -224,10 +224,9 @@ add_task(function*() {
let switchWaiter; let switchWaiter;
if (gMultiProcessBrowser) { if (gMultiProcessBrowser) {
switchWaiter = new Promise((resolve, reject) => { switchWaiter = new Promise((resolve, reject) => {
gBrowser.addEventListener("TabSwitchDone", function listener() { gBrowser.addEventListener("TabSwitchDone", function() {
gBrowser.removeEventListener("TabSwitchDone", listener);
executeSoon(resolve); executeSoon(resolve);
}); }, {once: true});
}); });
} }
@ -326,10 +325,9 @@ add_task(function*() {
gURLBar.focus(); gURLBar.focus();
yield new Promise((resolve, reject) => { yield new Promise((resolve, reject) => {
window.addEventListener("pageshow", function navigationOccured(event) { window.addEventListener("pageshow", function(event) {
window.removeEventListener("pageshow", navigationOccured, true);
resolve(); resolve();
}, true); }, {capture: true, once: true});
document.getElementById("Browser:Back").doCommand(); document.getElementById("Browser:Back").doCommand();
}); });

View file

@ -7,10 +7,9 @@ const kTestPage = "http://example.org/browser/browser/base/content/test/general/
function promiseNewTabSwitched() { function promiseNewTabSwitched() {
return new Promise(resolve => { return new Promise(resolve => {
gBrowser.addEventListener("TabSwitchDone", function onSwitch() { gBrowser.addEventListener("TabSwitchDone", function() {
gBrowser.removeEventListener("TabSwitchDone", onSwitch);
executeSoon(resolve); executeSoon(resolve);
}); }, {once: true});
}); });
} }

View file

@ -19,7 +19,6 @@ function test() {
is(gBrowser.visibleTabs.length, 3, "3 tabs should be open"); is(gBrowser.visibleTabs.length, 3, "3 tabs should be open");
// Wait for tab load, the code checks for currentURI. // Wait for tab load, the code checks for currentURI.
testTab2.linkedBrowser.addEventListener("load", function() { testTab2.linkedBrowser.addEventListener("load", function() {
testTab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
is(Disabled(), false, "Bookmark All Tabs should be enabled since there are two tabs with different addresses"); is(Disabled(), false, "Bookmark All Tabs should be enabled since there are two tabs with different addresses");
// Hide the original tab // Hide the original tab
@ -52,7 +51,7 @@ function test() {
is(gBrowser.selectedTab, origTab, "got the orig tab"); is(gBrowser.selectedTab, origTab, "got the orig tab");
is(origTab.hidden, false, "and it's not hidden -- visible!"); is(origTab.hidden, false, "and it's not hidden -- visible!");
finish(); finish();
}, true); }, {capture: true, once: true});
} }
function Disabled() { function Disabled() {

View file

@ -94,10 +94,9 @@ var messageHandlers = {
type: "mousemove", type: "mousemove",
clickcount: 0, clickcount: 0,
} }
row.addEventListener("mousemove", function handler() { row.addEventListener("mousemove", function() {
row.removeEventListener("mousemove", handler);
ack("mousemove"); ack("mousemove");
}); }, {once: true});
content.synthesizeMouseAtCenter(row, event); content.synthesizeMouseAtCenter(row, event);
}, },

View file

@ -5,11 +5,9 @@
</head> </head>
<body> <body>
<script> <script>
window.addEventListener("load", function onLoad() { window.addEventListener("load", function() {
window.removeEventListener("load", onLoad, true);
document.getElementById("test").addEventListener("click", onClick, true); document.getElementById("test").addEventListener("click", onClick, true);
}, true); }, {capture: true, once: true});
function onClick(aEvent) { function onClick(aEvent) {
aEvent.preventDefault(); aEvent.preventDefault();

View file

@ -86,19 +86,17 @@ function openToolbarCustomizationUI(aCallback, aBrowserWin) {
aBrowserWin.gCustomizeMode.enter(); aBrowserWin.gCustomizeMode.enter();
aBrowserWin.gNavToolbox.addEventListener("customizationready", function UI_loaded() { aBrowserWin.gNavToolbox.addEventListener("customizationready", function() {
aBrowserWin.gNavToolbox.removeEventListener("customizationready", UI_loaded);
executeSoon(function() { executeSoon(function() {
aCallback(aBrowserWin) aCallback(aBrowserWin)
}); });
}); }, {once: true});
} }
function closeToolbarCustomizationUI(aCallback, aBrowserWin) { function closeToolbarCustomizationUI(aCallback, aBrowserWin) {
aBrowserWin.gNavToolbox.addEventListener("aftercustomization", function unloaded() { aBrowserWin.gNavToolbox.addEventListener("aftercustomization", function() {
aBrowserWin.gNavToolbox.removeEventListener("aftercustomization", unloaded);
executeSoon(aCallback); executeSoon(aCallback);
}); }, {once: true});
aBrowserWin.gCustomizeMode.exit(); aBrowserWin.gCustomizeMode.exit();
} }
@ -235,10 +233,9 @@ function resetBlocklist() {
function whenNewWindowLoaded(aOptions, aCallback) { function whenNewWindowLoaded(aOptions, aCallback) {
let win = OpenBrowserWindow(aOptions); let win = OpenBrowserWindow(aOptions);
win.addEventListener("load", function onLoad() { win.addEventListener("load", function() {
win.removeEventListener("load", onLoad);
aCallback(win); aCallback(win);
}); }, {once: true});
} }
function promiseWindowWillBeClosed(win) { function promiseWindowWillBeClosed(win) {
@ -271,10 +268,9 @@ function promiseOpenAndLoadWindow(aOptions, aWaitForDelayedStartup = false) {
}, "browser-delayed-startup-finished", false); }, "browser-delayed-startup-finished", false);
} else { } else {
win.addEventListener("load", function onLoad() { win.addEventListener("load", function() {
win.removeEventListener("load", onLoad);
deferred.resolve(win); deferred.resolve(win);
}); }, {once: true});
} }
return deferred.promise; return deferred.promise;
} }
@ -574,12 +570,11 @@ var FullZoomHelper = {
let didPs = false; let didPs = false;
let didZoom = false; let didZoom = false;
gBrowser.addEventListener("pageshow", function listener(event) { gBrowser.addEventListener("pageshow", function(event) {
gBrowser.removeEventListener("pageshow", listener, true);
didPs = true; didPs = true;
if (didZoom) if (didZoom)
resolve(); resolve();
}, true); }, {capture: true, once: true});
if (direction == this.BACK) if (direction == this.BACK)
gBrowser.goBack(); gBrowser.goBack();

View file

@ -428,10 +428,9 @@ function* simulateExternalDrop(aDestIndex) {
resolve(); resolve();
} }
iframe.addEventListener("load", function onLoad() { iframe.addEventListener("load", function() {
iframe.removeEventListener("load", onLoad);
content.setTimeout(iframeLoaded, 0); content.setTimeout(iframeLoaded, 0);
}); }, {once: true});
iframe.setAttribute("src", url); iframe.setAttribute("src", url);
iframe.style.width = "50px"; iframe.style.width = "50px";

View file

@ -363,10 +363,9 @@ function waitForNotificationShown(notification, callback) {
executeSoon(callback); executeSoon(callback);
return; return;
} }
PopupNotifications.panel.addEventListener("popupshown", function onShown(e) { PopupNotifications.panel.addEventListener("popupshown", function(e) {
PopupNotifications.panel.removeEventListener("popupshown", onShown);
callback(); callback();
}); }, {once: true});
notification.reshow(); notification.reshow();
} }

View file

@ -286,8 +286,7 @@ function triggerSecondaryCommand(popup, index) {
// Extra secondary actions appear in a menu. // Extra secondary actions appear in a menu.
notification.secondaryButton.nextSibling.nextSibling.focus(); notification.secondaryButton.nextSibling.nextSibling.focus();
popup.addEventListener("popupshown", function handle() { popup.addEventListener("popupshown", function() {
popup.removeEventListener("popupshown", handle);
info("Command popup open for notification " + notification.id); info("Command popup open for notification " + notification.id);
// Press down until the desired command is selected. Decrease index by one // Press down until the desired command is selected. Decrease index by one
// since the secondary action was handled above. // since the secondary action was handled above.
@ -296,7 +295,7 @@ function triggerSecondaryCommand(popup, index) {
} }
// Activate // Activate
EventUtils.synthesizeKey("VK_RETURN", {}); EventUtils.synthesizeKey("VK_RETURN", {});
}); }, {once: true});
// One down event to open the popup // One down event to open the popup
info("Open the popup to trigger secondary command for notification " + notification.id); info("Open the popup to trigger secondary command for notification " + notification.id);

View file

@ -25,9 +25,7 @@ function startNewTabTestCase(aTestNumber) {
let menu = gTestWindow.document.getElementById("context-openlinkinusercontext-menu"); let menu = gTestWindow.document.getElementById("context-openlinkinusercontext-menu");
let menupopup = menu.menupopup; let menupopup = menu.menupopup;
menu.addEventListener("popupshown", function onPopupShown() { menu.addEventListener("popupshown", function() {
menu.removeEventListener("popupshown", onPopupShown);
is(menupopup.nodeType, Node.ELEMENT_NODE, "We have a menupopup."); is(menupopup.nodeType, Node.ELEMENT_NODE, "We have a menupopup.");
ok(menupopup.firstChild, "We have a first container entry."); ok(menupopup.firstChild, "We have a first container entry.");
@ -35,13 +33,12 @@ function startNewTabTestCase(aTestNumber) {
is(firstContext.nodeType, Node.ELEMENT_NODE, "We have a first container entry."); is(firstContext.nodeType, Node.ELEMENT_NODE, "We have a first container entry.");
ok(firstContext.hasAttribute("data-usercontextid"), "We have a usercontextid value."); ok(firstContext.hasAttribute("data-usercontextid"), "We have a usercontextid value.");
aContextMenu.addEventListener("popuphidden", function onPopupHidden() { aContextMenu.addEventListener("popuphidden", function() {
aContextMenu.removeEventListener("popuphidden", onPopupHidden);
firstContext.doCommand(); firstContext.doCommand();
}); }, {once: true});
aContextMenu.hidePopup(); aContextMenu.hidePopup();
}); }, {once: true});
menupopup.showPopup(); menupopup.showPopup();
}); });

View file

@ -28,9 +28,7 @@ function startNewTabTestCase(aTestNumber) {
let menu = gTestWindow.document.getElementById("context-openlinkinusercontext-menu"); let menu = gTestWindow.document.getElementById("context-openlinkinusercontext-menu");
let menupopup = menu.menupopup; let menupopup = menu.menupopup;
menu.addEventListener("popupshown", function onPopupShown() { menu.addEventListener("popupshown", function() {
menu.removeEventListener("popupshown", onPopupShown);
is(menupopup.nodeType, Node.ELEMENT_NODE, "We have a menupopup."); is(menupopup.nodeType, Node.ELEMENT_NODE, "We have a menupopup.");
ok(menupopup.firstChild, "We have a first container entry."); ok(menupopup.firstChild, "We have a first container entry.");
@ -39,13 +37,12 @@ function startNewTabTestCase(aTestNumber) {
ok(firstContext.hasAttribute("data-usercontextid"), "We have a usercontextid value."); ok(firstContext.hasAttribute("data-usercontextid"), "We have a usercontextid value.");
is("0", firstContext.getAttribute("data-usercontextid"), "We have the right usercontextid value."); is("0", firstContext.getAttribute("data-usercontextid"), "We have the right usercontextid value.");
aContextMenu.addEventListener("popuphidden", function onPopupHidden() { aContextMenu.addEventListener("popuphidden", function() {
aContextMenu.removeEventListener("popuphidden", onPopupHidden);
firstContext.doCommand(); firstContext.doCommand();
}); }, {once: true});
aContextMenu.hidePopup(); aContextMenu.hidePopup();
}); }, {once: true});
menupopup.showPopup(); menupopup.showPopup();
}); });

View file

@ -157,15 +157,12 @@ var tests = {
let domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor) let domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow); .getInterface(Ci.nsIDOMWindow);
domwindow.addEventListener("load", function _load() { domwindow.addEventListener("load", function() {
domwindow.removeEventListener("load", _load); domwindow.addEventListener("unload", function() {
domwindow.addEventListener("unload", function _unload() {
domwindow.removeEventListener("unload", _unload);
info("blocklist window was closed"); info("blocklist window was closed");
Services.wm.removeListener(listener); Services.wm.removeListener(listener);
next(); next();
}); }, {once: true});
is(domwindow.document.location.href, URI_EXTENSION_BLOCKLIST_DIALOG, "dialog opened and focused"); is(domwindow.document.location.href, URI_EXTENSION_BLOCKLIST_DIALOG, "dialog opened and focused");
// wait until after load to cancel so the dialog has initalized. we // wait until after load to cancel so the dialog has initalized. we
@ -175,7 +172,7 @@ var tests = {
info("***** hit the cancel button\n"); info("***** hit the cancel button\n");
cancelButton.doCommand(); cancelButton.doCommand();
}); });
}); }, {once: true});
}, },
onCloseWindow(aXULWindow) { }, onCloseWindow(aXULWindow) { },
onWindowTitleChange(aXULWindow, aNewTitle) { } onWindowTitleChange(aXULWindow, aNewTitle) { }

View file

@ -370,15 +370,14 @@ var tests = {
EventUtils.sendKey("i"); EventUtils.sendKey("i");
EventUtils.sendKey("l"); EventUtils.sendKey("l");
SocialShare.panel.addEventListener("popuphidden", function hidden(evt) { SocialShare.panel.addEventListener("popuphidden", function(evt) {
SocialShare.panel.removeEventListener("popuphidden", hidden);
let topwin = Services.wm.getMostRecentWindow(null); let topwin = Services.wm.getMostRecentWindow(null);
is(topwin, window, "no dialog is open"); is(topwin, window, "no dialog is open");
BrowserTestUtils.removeTab(testTab).then(() => { BrowserTestUtils.removeTab(testTab).then(() => {
SocialService.disableProvider(manifest.origin, next); SocialService.disableProvider(manifest.origin, next);
}); });
}); }, {once: true});
SocialShare.iframe.messageManager.sendAsyncMessage("closeself", {}); SocialShare.iframe.messageManager.sendAsyncMessage("closeself", {});
}); });

View file

@ -242,8 +242,7 @@ var tests = {
let addonsTab = gBrowser.addTab(); let addonsTab = gBrowser.addTab();
gBrowser.selectedTab = addonsTab; gBrowser.selectedTab = addonsTab;
BrowserOpenAddonsMgr("addons://list/service"); BrowserOpenAddonsMgr("addons://list/service");
gBrowser.selectedBrowser.addEventListener("load", function tabLoad() { gBrowser.selectedBrowser.addEventListener("load", function() {
gBrowser.selectedBrowser.removeEventListener("load", tabLoad, true);
is(addonsTab.linkedBrowser.currentURI.spec, "about:addons", "about:addons should load into blank tab."); is(addonsTab.linkedBrowser.currentURI.spec, "about:addons", "about:addons should load into blank tab.");
activateOneProvider(gProviders[0], true, function() { activateOneProvider(gProviders[0], true, function() {
@ -277,6 +276,6 @@ var tests = {
}); });
}); });
}); });
}, true); }, {capture: true, once: true});
} }
} }

View file

@ -81,19 +81,17 @@ function openToolbarCustomizationUI(aCallback, aBrowserWin) {
aBrowserWin.gCustomizeMode.enter(); aBrowserWin.gCustomizeMode.enter();
aBrowserWin.gNavToolbox.addEventListener("customizationready", function UI_loaded() { aBrowserWin.gNavToolbox.addEventListener("customizationready", function() {
aBrowserWin.gNavToolbox.removeEventListener("customizationready", UI_loaded);
executeSoon(function() { executeSoon(function() {
aCallback(aBrowserWin) aCallback(aBrowserWin)
}); });
}); }, {once: true});
} }
function closeToolbarCustomizationUI(aCallback, aBrowserWin) { function closeToolbarCustomizationUI(aCallback, aBrowserWin) {
aBrowserWin.gNavToolbox.addEventListener("aftercustomization", function unloaded() { aBrowserWin.gNavToolbox.addEventListener("aftercustomization", function() {
aBrowserWin.gNavToolbox.removeEventListener("aftercustomization", unloaded);
executeSoon(aCallback); executeSoon(aCallback);
}); }, {once: true});
aBrowserWin.gCustomizeMode.exit(); aBrowserWin.gCustomizeMode.exit();
} }

View file

@ -16,11 +16,10 @@ add_task(function* test_switchtab_decodeuri() {
info("switch-to-tab"); info("switch-to-tab");
yield new Promise((resolve, reject) => { yield new Promise((resolve, reject) => {
// In case of success it should switch tab. // In case of success it should switch tab.
gBrowser.tabContainer.addEventListener("TabSelect", function select() { gBrowser.tabContainer.addEventListener("TabSelect", function() {
gBrowser.tabContainer.removeEventListener("TabSelect", select);
is(gBrowser.selectedTab, tab, "Should have switched to the right tab"); is(gBrowser.selectedTab, tab, "Should have switched to the right tab");
resolve(); resolve();
}); }, {once: true});
EventUtils.synthesizeKey("VK_RETURN", { }); EventUtils.synthesizeKey("VK_RETURN", { });
}); });

View file

@ -45,9 +45,8 @@ add_task(function* () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
gBrowser.selectedBrowser.focus(); gBrowser.selectedBrowser.focus();
gURLBar.addEventListener("input", function() { gURLBar.addEventListener("input", function() {
gURLBar.removeEventListener("input", arguments.callee);
resolve(); resolve();
}); }, {once: true});
gURLBar.focus(); gURLBar.focus();
EventUtils.synthesizeKey("VK_BACK_SPACE", {}); EventUtils.synthesizeKey("VK_BACK_SPACE", {});
}); });

View file

@ -196,10 +196,9 @@ function* promiseOpenNewTab(url = "about:blank") {
function promiseNewTabSwitched() { function promiseNewTabSwitched() {
return new Promise(resolve => { return new Promise(resolve => {
gBrowser.addEventListener("TabSwitchDone", function onSwitch() { gBrowser.addEventListener("TabSwitchDone", function() {
gBrowser.removeEventListener("TabSwitchDone", onSwitch);
executeSoon(resolve); executeSoon(resolve);
}); }, {once: true});
}); });
} }

View file

@ -22,10 +22,9 @@ function urlClick(url) {
function promiseNewTabSwitched() { function promiseNewTabSwitched() {
return new Promise(resolve => { return new Promise(resolve => {
gBrowser.addEventListener("TabSwitchDone", function onSwitch() { gBrowser.addEventListener("TabSwitchDone", function() {
gBrowser.removeEventListener("TabSwitchDone", onSwitch);
executeSoon(resolve); executeSoon(resolve);
}); }, {once: true});
}); });
} }

View file

@ -11,10 +11,9 @@ add_task(function* clearURLBarAfterParentProcessURL() {
let tab = yield new Promise(resolve => { let tab = yield new Promise(resolve => {
gBrowser.selectedTab = gBrowser.addTab("about:preferences"); gBrowser.selectedTab = gBrowser.addTab("about:preferences");
let newTabBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab); let newTabBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
newTabBrowser.addEventListener("Initialized", function onInit() { newTabBrowser.addEventListener("Initialized", function() {
newTabBrowser.removeEventListener("Initialized", onInit, true);
resolve(gBrowser.selectedTab); resolve(gBrowser.selectedTab);
}, true); }, {capture: true, once: true});
}); });
document.getElementById("home-button").click(); document.getElementById("home-button").click();
yield BrowserTestUtils.browserLoaded(tab.linkedBrowser); yield BrowserTestUtils.browserLoaded(tab.linkedBrowser);
@ -31,10 +30,9 @@ add_task(function* clearURLBarAfterParentProcessURLInExistingTab() {
let tab = yield new Promise(resolve => { let tab = yield new Promise(resolve => {
gBrowser.selectedTab = gBrowser.addTab(); gBrowser.selectedTab = gBrowser.addTab();
let newTabBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab); let newTabBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
newTabBrowser.addEventListener("Initialized", function onInit() { newTabBrowser.addEventListener("Initialized", function() {
newTabBrowser.removeEventListener("Initialized", onInit, true);
resolve(gBrowser.selectedTab); resolve(gBrowser.selectedTab);
}, true); }, {capture: true, once: true});
newTabBrowser.loadURI("about:preferences"); newTabBrowser.loadURI("about:preferences");
}); });
document.getElementById("home-button").click(); document.getElementById("home-button").click();

View file

@ -244,11 +244,10 @@ function assertVisible(visible, win = window) {
function promiseTransition(win = window) { function promiseTransition(win = window) {
return new Promise(resolve => { return new Promise(resolve => {
win.gURLBar.popup.addEventListener("transitionend", function onEnd() { win.gURLBar.popup.addEventListener("transitionend", function() {
win.gURLBar.popup.removeEventListener("transitionend", onEnd, true);
// The urlbar needs to handle the transitionend first, but that happens // The urlbar needs to handle the transitionend first, but that happens
// naturally since promises are resolved at the end of the current tick. // naturally since promises are resolved at the end of the current tick.
resolve(); resolve();
}, true); }, {capture: true, once: true});
}); });
} }

View file

@ -588,9 +588,7 @@ function test() {
browser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true); browser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true);
browser.addEventListener("load", function onload() { browser.addEventListener("load", function() {
browser.removeEventListener("load", onload, true);
is(PopupNotifications._currentNotifications.length, 0, is(PopupNotifications._currentNotifications.length, 0,
"should start the test without any prior popup notification"); "should start the test without any prior popup notification");
ok(gIdentityHandler._identityPopup.hidden, ok(gIdentityHandler._identityPopup.hidden,
@ -611,7 +609,7 @@ function test() {
ok(false, "Unexpected Exception: " + ex); ok(false, "Unexpected Exception: " + ex);
finish(); finish();
}); });
}, true); }, {capture: true, once: true});
let rootDir = getRootDirectory(gTestPath); let rootDir = getRootDirectory(gTestPath);
rootDir = rootDir.replace("chrome://mochitests/content/", rootDir = rootDir.replace("chrome://mochitests/content/",
"https://example.com/"); "https://example.com/");

View file

@ -85,9 +85,7 @@ function test() {
browser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true); browser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true);
browser.addEventListener("load", function onload() { browser.addEventListener("load", function() {
browser.removeEventListener("load", onload, true);
is(PopupNotifications._currentNotifications.length, 0, is(PopupNotifications._currentNotifications.length, 0,
"should start the test without any prior popup notification"); "should start the test without any prior popup notification");
@ -103,7 +101,7 @@ function test() {
ok(false, "Unexpected Exception: " + ex); ok(false, "Unexpected Exception: " + ex);
finish(); finish();
}); });
}, true); }, {capture: true, once: true});
let rootDir = getRootDirectory(gTestPath); let rootDir = getRootDirectory(gTestPath);
rootDir = rootDir.replace("chrome://mochitests/content/", rootDir = rootDir.replace("chrome://mochitests/content/",
"https://example.com/"); "https://example.com/");

View file

@ -225,9 +225,7 @@ function test() {
browser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true); browser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true);
browser.addEventListener("load", function onload() { browser.addEventListener("load", function() {
browser.removeEventListener("load", onload, true);
is(PopupNotifications._currentNotifications.length, 0, is(PopupNotifications._currentNotifications.length, 0,
"should start the test without any prior popup notification"); "should start the test without any prior popup notification");
@ -246,7 +244,7 @@ function test() {
ok(false, "Unexpected Exception: " + ex); ok(false, "Unexpected Exception: " + ex);
finish(); finish();
}); });
}, true); }, {capture: true, once: true});
let rootDir = getRootDirectory(gTestPath); let rootDir = getRootDirectory(gTestPath);
rootDir = rootDir.replace("chrome://mochitests/content/", rootDir = rootDir.replace("chrome://mochitests/content/",
"https://example.com/"); "https://example.com/");

View file

@ -586,9 +586,7 @@ function test() {
browser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true); browser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true);
browser.addEventListener("load", function onload() { browser.addEventListener("load", function() {
browser.removeEventListener("load", onload, true);
is(PopupNotifications._currentNotifications.length, 0, is(PopupNotifications._currentNotifications.length, 0,
"should start the test without any prior popup notification"); "should start the test without any prior popup notification");
ok(gIdentityHandler._identityPopup.hidden, ok(gIdentityHandler._identityPopup.hidden,
@ -609,7 +607,7 @@ function test() {
ok(false, "Unexpected Exception: " + ex); ok(false, "Unexpected Exception: " + ex);
finish(); finish();
}); });
}, true); }, {capture: true, once: true});
let rootDir = getRootDirectory(gTestPath); let rootDir = getRootDirectory(gTestPath);
rootDir = rootDir.replace("chrome://mochitests/content/", rootDir = rootDir.replace("chrome://mochitests/content/",
"https://example.com/"); "https://example.com/");

View file

@ -78,9 +78,7 @@ function runTest() {
browser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true); browser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true);
browser.addEventListener("load", function onload() { browser.addEventListener("load", function() {
browser.removeEventListener("load", onload, true);
is(PopupNotifications._currentNotifications.length, 0, is(PopupNotifications._currentNotifications.length, 0,
"should start the test without any prior popup notification"); "should start the test without any prior popup notification");
ok(gIdentityHandler._identityPopup.hidden, ok(gIdentityHandler._identityPopup.hidden,
@ -101,7 +99,7 @@ function runTest() {
ok(false, "Unexpected Exception: " + ex); ok(false, "Unexpected Exception: " + ex);
finish(); finish();
}); });
}, true); }, {capture: true, once: true});
let rootDir = getRootDirectory(gTestPath); let rootDir = getRootDirectory(gTestPath);
rootDir = rootDir.replace("chrome://mochitests/content/", rootDir = rootDir.replace("chrome://mochitests/content/",
"https://example.com/"); "https://example.com/");

View file

@ -260,9 +260,7 @@ function test() {
browser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true); browser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true);
browser.addEventListener("load", function onload() { browser.addEventListener("load", function() {
browser.removeEventListener("load", onload, true);
is(PopupNotifications._currentNotifications.length, 0, is(PopupNotifications._currentNotifications.length, 0,
"should start the test without any prior popup notification"); "should start the test without any prior popup notification");
ok(gIdentityHandler._identityPopup.hidden, ok(gIdentityHandler._identityPopup.hidden,
@ -283,7 +281,7 @@ function test() {
ok(false, "Unexpected Exception: " + ex); ok(false, "Unexpected Exception: " + ex);
finish(); finish();
}); });
}, true); }, {capture: true, once: true});
let rootDir = getRootDirectory(gTestPath); let rootDir = getRootDirectory(gTestPath);
rootDir = rootDir.replace("chrome://mochitests/content/", rootDir = rootDir.replace("chrome://mochitests/content/",
"https://example.com/"); "https://example.com/");

View file

@ -219,9 +219,7 @@ function test() {
browser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true); browser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true);
browser.addEventListener("load", function onload() { browser.addEventListener("load", function() {
browser.removeEventListener("load", onload, true);
is(PopupNotifications._currentNotifications.length, 0, is(PopupNotifications._currentNotifications.length, 0,
"should start the test without any prior popup notification"); "should start the test without any prior popup notification");
@ -240,7 +238,7 @@ function test() {
ok(false, "Unexpected Exception: " + ex); ok(false, "Unexpected Exception: " + ex);
finish(); finish();
}); });
}, true); }, {capture: true, once: true});
let rootDir = getRootDirectory(gTestPath); let rootDir = getRootDirectory(gTestPath);
rootDir = rootDir.replace("chrome://mochitests/content/", rootDir = rootDir.replace("chrome://mochitests/content/",
"https://example.com/"); "https://example.com/");

Some files were not shown because too many files have changed in this diff Show more