File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed
extensions/firefox/components Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -219,9 +219,26 @@ ChromeActions.prototype = {
219
219
var strings = getLocalizedStrings ('chrome.properties' );
220
220
var message = getLocalizedString (strings , 'unsupported_feature' );
221
221
222
- var win = Services .wm .getMostRecentWindow ('navigator:browser' );
223
- var browser = win .gBrowser .getBrowserForDocument (domWindow .top .document );
224
- var notificationBox = win .gBrowser .getNotificationBox (browser );
222
+ var notificationBox = null ;
223
+ // Multiple browser windows can be opened, finding one for notification box
224
+ var windowsEnum = Services .wm
225
+ .getZOrderDOMWindowEnumerator ('navigator:browser' , true );
226
+ while (windowsEnum .hasMoreElements ()) {
227
+ var win = windowsEnum .getNext ();
228
+ if (win .closed )
229
+ continue ;
230
+ var browser = win .gBrowser .getBrowserForDocument (domWindow .top .document );
231
+ if (browser ) {
232
+ // right window/browser is found, getting the notification box
233
+ notificationBox = win .gBrowser .getNotificationBox (browser );
234
+ break ;
235
+ }
236
+ }
237
+ if (!notificationBox ) {
238
+ log ('Unable to get a notification box for the fallback message' );
239
+ return ;
240
+ }
241
+
225
242
// Flag so we don't call the response callback twice, since if the user
226
243
// clicks open with different viewer both the button callback and
227
244
// eventCallback will be called.
You can’t perform that action at this time.
0 commit comments