mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Count open browser windows for bug 528776
This commit is contained in:
parent
7bf0e0c4ea
commit
80f39a0574
@ -104,7 +104,22 @@
|
||||
* nsSessionStore restore a window next time it gets a chance and will post
|
||||
* notifications. The latter won't.
|
||||
*/
|
||||
|
||||
function browserWindowsCount() {
|
||||
let count = 0;
|
||||
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Ci.nsIWindowMediator)
|
||||
.getEnumerator("navigator:browser");
|
||||
while (e.hasMoreElements()) {
|
||||
if (!e.getNext().closed)
|
||||
++count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
function test() {
|
||||
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
// Some urls that might be opened in tabs and/or popups
|
||||
@ -217,9 +232,9 @@ function test() {
|
||||
newWin.removeEventListener("load", arguments.callee, false);
|
||||
newWin.gBrowser.addEventListener("load", function(aEvent) {
|
||||
newWin.gBrowser.removeEventListener("load", arguments.callee, true);
|
||||
for each (let url in TEST_URLS) {
|
||||
TEST_URLS.forEach(function (url) {
|
||||
newWin.gBrowser.addTab(url);
|
||||
}
|
||||
});
|
||||
|
||||
executeSoon(function() testFn(newWin));
|
||||
}, true);
|
||||
@ -498,7 +513,11 @@ function test() {
|
||||
// Mac tests
|
||||
testMacNotifications(
|
||||
function() testNotificationCount(
|
||||
function() cleanupTestsuite() + finish()
|
||||
function() {
|
||||
cleanupTestsuite();
|
||||
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
|
||||
finish();
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -510,7 +529,11 @@ function test() {
|
||||
function() testOpenCloseOnlyPopup(
|
||||
function() testOpenCloseRestoreFromPopup (
|
||||
function() testNotificationCount(
|
||||
function() cleanupTestsuite() + finish()
|
||||
function() {
|
||||
cleanupTestsuite();
|
||||
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
|
||||
finish();
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user