зеркало из https://github.com/mozilla/gecko-dev.git
Count open browser windows for bug 528776
This commit is contained in:
Родитель
f77d321e86
Коммит
42bf4e772d
|
@ -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();
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
Загрузка…
Ссылка в новой задаче