Bug 1132566 - Make test e10s compatible: browser_privatebrowsing_cookieacceptdialog.js. r=billm, a=test-only
This commit is contained in:
@@ -59,6 +59,23 @@ this.BrowserTestUtils = {
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {Promise}
|
||||
* A Promise which resolves when a "domwindowopened" notification
|
||||
* has been fired by the window watcher.
|
||||
*/
|
||||
domWindowOpened() {
|
||||
return new Promise(resolve => {
|
||||
function observer(subject, topic, data) {
|
||||
if (topic != "domwindowopened") { return; }
|
||||
|
||||
Services.ww.unregisterNotification(observer);
|
||||
resolve(subject.QueryInterface(Ci.nsIDOMWindow));
|
||||
}
|
||||
Services.ww.registerNotification(observer);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} options
|
||||
* {
|
||||
@@ -89,6 +106,29 @@ this.BrowserTestUtils = {
|
||||
subject => subject == win).then(() => win);
|
||||
},
|
||||
|
||||
/**
|
||||
* Closes a window.
|
||||
*
|
||||
* @param {Window}
|
||||
* A window to close.
|
||||
*
|
||||
* @return {Promise}
|
||||
* Resolves when the provided window has been closed.
|
||||
*/
|
||||
closeWindow(win) {
|
||||
return new Promise(resolve => {
|
||||
function observer(subject, topic, data) {
|
||||
if (topic == "domwindowclosed" && subject === win) {
|
||||
Services.ww.unregisterNotification(observer);
|
||||
resolve();
|
||||
}
|
||||
}
|
||||
Services.ww.registerNotification(observer);
|
||||
win.close();
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Waits a specified number of miliseconds for a specified event to be
|
||||
* fired on a specified element.
|
||||
|
||||
Reference in New Issue
Block a user