[Pkg-mozext-commits] [requestpolicy] 214/280: fix issue: scheme notification was not shown

David Prévot taffit at moszumanska.debian.org
Sat May 2 20:30:29 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository requestpolicy.

commit 1eb01fb4d0b36b6f4fb17dd5844355a71f1d59d4
Author: Martin Kimmerle <dev at 256k.de>
Date:   Tue Feb 10 03:27:49 2015 +0100

    fix issue: scheme notification was not shown
---
 src/content/lib/request.jsm       |  5 +++--
 src/content/lib/utils/windows.jsm | 16 ++++++++++++----
 src/content/ui/overlay.js         |  5 ++---
 3 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/src/content/lib/request.jsm b/src/content/lib/request.jsm
index b5929c6..dbeea9c 100644
--- a/src/content/lib/request.jsm
+++ b/src/content/lib/request.jsm
@@ -346,13 +346,14 @@ NormalRequest.prototype.checkURISchemes = function() {
         throw "The chrome window could not be extracted from aContext.";
       }
       let overlay = chromeWin.requestpolicy.overlay;
+      let browser = this.getBrowser();
       Utils.runAsync(function() {
-        overlay.showSchemeNotification(win, scheme);
+        overlay.showSchemeNotification(browser, scheme);
       });
     } catch (e) {
       Logger.warning(Logger.TYPE_ERROR,
                      "The user could not be informed about the " +
-                     "unknown scheme. Error was: " + e);
+                     "unknown scheme. Error was: " + e, e);
     }
   }
 
diff --git a/src/content/lib/utils/windows.jsm b/src/content/lib/utils/windows.jsm
index 8e76693..9364d1e 100644
--- a/src/content/lib/utils/windows.jsm
+++ b/src/content/lib/utils/windows.jsm
@@ -46,10 +46,14 @@ let WindowUtils = (function() {
 
   self.getBrowserForWindow = function(aContentWindow) {
     let win = self.getChromeWindow(aContentWindow);
-    let tab = self.getTabBrowser(win)
-                  ._getTabForContentWindow(aContentWindow.top);
-    return tab.linkedBrowser;
-  }
+    let tabs = self.getTabsForWindow(win);
+    for (let tab of tabs) {
+      if (tab.linkedBrowser.contentWindow === aContentWindow.top) {
+        return tab.linkedBrowser;
+      }
+    }
+    return null;
+  };
 
   self.getChromeWindowForDocShell = function(aDocShell) {
     return aDocShell.QueryInterface(Ci.nsIDocShellTreeItem)
@@ -63,6 +67,10 @@ let WindowUtils = (function() {
     return window.gBrowser || window.getBrowser();
   };
 
+  self.getTabsForWindow = function(window) {
+    return self.getTabBrowser(window).tabContainer.children;
+  };
+
   //
   // Private Browsing
   //
diff --git a/src/content/ui/overlay.js b/src/content/ui/overlay.js
index 5776118..cb2a86f 100644
--- a/src/content/ui/overlay.js
+++ b/src/content/ui/overlay.js
@@ -385,11 +385,10 @@ requestpolicy.overlay = (function() {
    *
    * issue: https://github.com/RequestPolicyContinued/requestpolicy/issues/447
    *
-   * @param {nsIDOMWindow} contentWindow
+   * @param {browser} browser
    * @param {String} scheme
    */
-  self.showSchemeNotification = function(contentWindow, scheme) {
-    let browser = gBrowser.getBrowserForContentWindow(contentWindow);
+  self.showSchemeNotification = function(browser, scheme) {
     let notificationBox = gBrowser.getNotificationBox(browser)
     let notificationValue = "requestpolicy-scheme-notification";
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git



More information about the Pkg-mozext-commits mailing list