mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 913855. Fix consumers of window mediator to be more consistent in their checking for closed windows. r=dolske
Note that we can't just stop returning closed windows from the window mediator, because some consumers (e.g. session restore) rely on seeing closed windows in the list so they can remove them from their internal data structures expeditiouly.
This commit is contained in:
parent
32b997e516
commit
a48b619d92
@ -297,6 +297,7 @@ function windows(type, options) {
|
||||
let window = winEnum.getNext().QueryInterface(Ci.nsIDOMWindow);
|
||||
// Only add non-private windows when pb permission isn't set,
|
||||
// unless an option forces the addition of them.
|
||||
// XXXbz should this be checking window.closed?
|
||||
if (options.includePrivate || !isWindowPrivate(window)) {
|
||||
list.push(window);
|
||||
}
|
||||
|
@ -2177,6 +2177,9 @@ function BrowserPageInfo(doc, initialTab, imageElement) {
|
||||
// Check for windows matching the url
|
||||
while (windows.hasMoreElements()) {
|
||||
var currentWindow = windows.getNext();
|
||||
if (currentWindow.closed) {
|
||||
continue;
|
||||
}
|
||||
if (currentWindow.document.documentElement.getAttribute("relatedUrl") == documentURL) {
|
||||
currentWindow.focus();
|
||||
currentWindow.resetPageInfo(args);
|
||||
@ -6040,7 +6043,7 @@ function warnAboutClosingWindow() {
|
||||
let nonPopupPresent = false;
|
||||
while (e.hasMoreElements()) {
|
||||
let win = e.getNext();
|
||||
if (win != window) {
|
||||
if (!win.closed && win != window) {
|
||||
if (isPBWindow && PrivateBrowsingUtils.isWindowPrivate(win))
|
||||
otherPBWindowExists = true;
|
||||
if (win.toolbar.visible)
|
||||
|
@ -454,6 +454,9 @@ function openAboutDialog() {
|
||||
while (enumerator.hasMoreElements()) {
|
||||
// Only open one about window (Bug 599573)
|
||||
let win = enumerator.getNext();
|
||||
if (win.closed) {
|
||||
continue;
|
||||
}
|
||||
win.focus();
|
||||
return;
|
||||
}
|
||||
|
@ -769,6 +769,7 @@ BrowserGlue.prototype = {
|
||||
var browserEnum = Services.wm.getEnumerator("navigator:browser");
|
||||
let allWindowsPrivate = true;
|
||||
while (browserEnum.hasMoreElements()) {
|
||||
// XXXbz should we skip closed windows here?
|
||||
windowcount++;
|
||||
|
||||
var browser = browserEnum.getNext();
|
||||
|
@ -2608,7 +2608,7 @@ WebConsoleFrame.prototype = {
|
||||
while (wins.hasMoreElements()) {
|
||||
let win = wins.getNext();
|
||||
|
||||
if (win.Scratchpad.uniqueName === aSourceURL) {
|
||||
if (!win.closed && win.Scratchpad.uniqueName === aSourceURL) {
|
||||
win.focus();
|
||||
return;
|
||||
}
|
||||
|
@ -81,6 +81,9 @@ this.webappsUI = {
|
||||
let found = false;
|
||||
while (!found && browserEnumerator.hasMoreElements()) {
|
||||
let browserWin = browserEnumerator.getNext();
|
||||
if (browserWin.closed) {
|
||||
continue;
|
||||
}
|
||||
let tabbrowser = browserWin.gBrowser;
|
||||
|
||||
// Check each tab of this browser instance
|
||||
|
@ -919,7 +919,7 @@ var BrowserApp = {
|
||||
let e = Services.wm.getEnumerator("navigator:browser");
|
||||
while (e.hasMoreElements() && lastBrowser) {
|
||||
let win = e.getNext();
|
||||
if (win != window)
|
||||
if (!win.closed && win != window)
|
||||
lastBrowser = false;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ function locateHelpWindow(contentPack) {
|
||||
# pack.
|
||||
while (iterator.hasMoreElements()) {
|
||||
aWindow = iterator.getNext();
|
||||
if (aWindow.getHelpFileURI() == contentPack) {
|
||||
if (!aWindow.closed && aWindow.getHelpFileURI() == contentPack) {
|
||||
topWindow = aWindow;
|
||||
}
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ function findChromeWindowForChats(preferredWindow) {
|
||||
}
|
||||
while (enumerator.hasMoreElements()) {
|
||||
let win = enumerator.getNext();
|
||||
if (win && isWindowGoodForChats(win))
|
||||
if (!win.closed && isWindowGoodForChats(win))
|
||||
topMost = win;
|
||||
}
|
||||
return topMost;
|
||||
|
@ -13,6 +13,9 @@ function closeWindow(aClose, aPromptFunction)
|
||||
|
||||
while (e.hasMoreElements()) {
|
||||
var w = e.getNext();
|
||||
if (w.closed) {
|
||||
continue;
|
||||
}
|
||||
if (++windowCount == 2)
|
||||
break;
|
||||
}
|
||||
|
@ -927,6 +927,9 @@ var gViewController = {
|
||||
var windows = Services.wm.getEnumerator(null);
|
||||
while (windows.hasMoreElements()) {
|
||||
var win = windows.getNext();
|
||||
if (win.closed) {
|
||||
continue;
|
||||
}
|
||||
if (win.document.documentURI == optionsURL) {
|
||||
win.focus();
|
||||
return;
|
||||
|
@ -29,7 +29,9 @@ interface nsIWindowMediator: nsISupports
|
||||
* windows of this type. ("type" is the
|
||||
* |windowtype| attribute of the XML <window> element.)
|
||||
* If null, all windows will be enumerated.
|
||||
* @return an enumerator of nsIDOMWindows
|
||||
* @return an enumerator of nsIDOMWindows. Note that windows close
|
||||
* asynchronously in many cases, so windows returned from this
|
||||
* enumerator can have .closed set to true. Caveat enumerator!
|
||||
*/
|
||||
nsISimpleEnumerator getEnumerator(in wstring aWindowType);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user