Bug 1132566 - Make test e10s compatible: browser_privatebrowsing_cookieacceptdialog.js. r=billm, a=test-only

This commit is contained in:
Steven MacLeod
2015-03-05 11:06:10 -05:00
parent 6e19dd1c31
commit 93c82afc7d
2 changed files with 114 additions and 107 deletions

View File

@@ -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.