Finds correct window/notification box for fallback message
This commit is contained in:
parent
e17d828b64
commit
4de0d31318
@ -219,9 +219,26 @@ ChromeActions.prototype = {
|
|||||||
var strings = getLocalizedStrings('chrome.properties');
|
var strings = getLocalizedStrings('chrome.properties');
|
||||||
var message = getLocalizedString(strings, 'unsupported_feature');
|
var message = getLocalizedString(strings, 'unsupported_feature');
|
||||||
|
|
||||||
var win = Services.wm.getMostRecentWindow('navigator:browser');
|
var notificationBox = null;
|
||||||
var browser = win.gBrowser.getBrowserForDocument(domWindow.top.document);
|
// Multiple browser windows can be opened, finding one for notification box
|
||||||
var notificationBox = win.gBrowser.getNotificationBox(browser);
|
var windowsEnum = Services.wm
|
||||||
|
.getZOrderDOMWindowEnumerator('navigator:browser', true);
|
||||||
|
while (windowsEnum.hasMoreElements()) {
|
||||||
|
var win = windowsEnum.getNext();
|
||||||
|
if (win.closed)
|
||||||
|
continue;
|
||||||
|
var browser = win.gBrowser.getBrowserForDocument(domWindow.top.document);
|
||||||
|
if (browser) {
|
||||||
|
// right window/browser is found, getting the notification box
|
||||||
|
notificationBox = win.gBrowser.getNotificationBox(browser);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!notificationBox) {
|
||||||
|
log('Unable to get a notification box for the fallback message');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Flag so we don't call the response callback twice, since if the user
|
// Flag so we don't call the response callback twice, since if the user
|
||||||
// clicks open with different viewer both the button callback and
|
// clicks open with different viewer both the button callback and
|
||||||
// eventCallback will be called.
|
// eventCallback will be called.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user