]> git.parisson.com Git - pdf.js.git/commitdiff
Fix notification from showing up in wrong window.
authorBrendan Dahl <brendan.dahl@gmail.com>
Wed, 23 May 2012 23:54:55 +0000 (16:54 -0700)
committerBrendan Dahl <brendan.dahl@gmail.com>
Wed, 23 May 2012 23:54:55 +0000 (16:54 -0700)
extensions/firefox/components/PdfStreamConverter.js

index d4a375ccce8c287f19c7b9657258a482763794d9..550fbf2713754c6316f4ec0ca59a7fa4af1b599b 100644 (file)
@@ -100,7 +100,8 @@ function getLocalizedString(strings, id) {
 }
 
 // All the priviledged actions.
-function ChromeActions() {
+function ChromeActions(domWindow) {
+  this.domWindow = domWindow;
 }
 
 ChromeActions.prototype = {
@@ -170,11 +171,15 @@ ChromeActions.prototype = {
     return getBoolPref(EXT_PREFIX + '.pdfBugEnabled', false);
   },
   fallback: function(url) {
-    var strings = getLocalizedStrings('chrome.properties');
     var self = this;
+    var domWindow = this.domWindow;
+    var strings = getLocalizedStrings('chrome.properties');
     var message = getLocalizedString(strings, 'unsupported_feature');
+
     var win = Services.wm.getMostRecentWindow('navigator:browser');
-    var notificationBox = win.gBrowser.getNotificationBox();
+    var browser = win.gBrowser.getBrowserForDocument(domWindow.top.document);
+    var notificationBox = win.gBrowser.getNotificationBox(browser);
+
     var buttons = [{
       label: getLocalizedString(strings, 'open_with_different_viewer'),
       accessKey: null,
@@ -290,7 +295,8 @@ PdfStreamConverter.prototype = {
         var domWindow = getDOMWindow(channel);
         // Double check the url is still the correct one.
         if (domWindow.document.documentURIObject.equals(aRequest.URI)) {
-          let requestListener = new RequestListener(new ChromeActions);
+          let requestListener = new RequestListener(
+                                      new ChromeActions(domWindow));
           domWindow.addEventListener(PDFJS_EVENT_ID, function(event) {
             requestListener.receive(event);
           }, false, true);