Backed out changeset 470368b135b7 (bug 1118279)

This commit is contained in:
Tim Taubert 2015-02-06 11:36:07 +01:00
parent 7912ab9f32
commit 50e5e3f6ac

View File

@ -1,41 +1,35 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/*
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
*/
add_task(function* () {
let win = yield promiseOpenAndLoadWindow({}, true /* wait for delayed startup */);
// Remove the navigation toolbar.
win.document.getElementById("nav-bar").remove();
yield new Promise(resolve => waitForFocus(resolve, win));
yield promiseBrowserLoaded(win.gBrowser.browsers[0]);
function test() {
waitForExplicitFinish();
let newWin = OpenBrowserWindow();
registerCleanupFunction(() => {
newWin.close()
newWin = null;
});
whenDelayedStartupFinished(newWin, function () {
// Remove the URL bar
newWin.gURLBar.parentNode.removeChild(newWin.gURLBar);
waitForFocus(function () {
let PN = newWin.PopupNotifications;
try {
let PN = win.PopupNotifications;
let panelPromise = promisePopupShown(PN.panel);
let notification = PN.show(win.gBrowser.selectedBrowser, "some-notification", "Some message");
ok(notification, "show() succeeded");
yield panelPromise;
let notification = PN.show(newWin.gBrowser.selectedBrowser, "some-notification", "Some message");
panelPromise.then(function() {
ok(notification, "showed the notification");
ok(PN.isPanelOpen, "panel is open");
is(PN.panel.anchorNode, win.gBrowser.selectedTab, "notification is correctly anchored to the tab");
is(PN.panel.anchorNode, newWin.gBrowser.selectedTab, "notification is correctly anchored to the tab");
PN.panel.hidePopup();
finish();
});
} catch (ex) {
ok(false, "threw exception: " + ex);
finish();
}
yield promiseWindowClosed(win);
});
function promiseBrowserLoaded(browser) {
if (browser.contentDocument.readyState == "complete") {
return Promise.resolve();
}
return new Promise(resolve => {
browser.addEventListener("load", function onLoad() {
browser.removeEventListener("load", onLoad, true);
resolve();
}, true);
}, newWin);
});
}