[Pkg-mozext-commits] [requestpolicy] 169/280: catch if the <browser> can't be determined

David Prévot taffit at moszumanska.debian.org
Sat May 2 20:30:18 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 7a3e09981f89499aa30c9393c6569023aa0e781b
Author: Martin Kimmerle <dev at 256k.de>
Date:   Thu Jan 22 18:53:52 2015 +0100

    catch if the <browser> can't be determined
---
 src/content/lib/request-processor.redirects.js | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/content/lib/request-processor.redirects.js b/src/content/lib/request-processor.redirects.js
index d9f0c25..afe42c6 100644
--- a/src/content/lib/request-processor.redirects.js
+++ b/src/content/lib/request-processor.redirects.js
@@ -224,14 +224,19 @@ let RequestProcessor = (function(self) {
 
         let browser = request.browser;
 
-        // TODO: use WeakMap instead of putting data into the <browser> object
-        // see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap
-
-        // save all blocked redirects directly in the browser element. the
-        // blocked elements will be checked later when the DOM content
-        // finished loading.
-        browser.requestpolicy = browser.requestpolicy || {blockedRedirects: {}};
-        browser.requestpolicy.blockedRedirects[originURI] = destURI;
+        if (browser !== null) {
+          // `browser` is null if it could not be found. One known
+          // example is a favicon request that is redirected.
+
+          // TODO: do not put data into the <browser> object. Maybe use
+          //       Map instead?
+
+          // save all blocked redirects directly in the browser element. the
+          // blocked elements will be checked later when the DOM content
+          // finished loading.
+          browser.requestpolicy = browser.requestpolicy || {blockedRedirects: {}};
+          browser.requestpolicy.blockedRedirects[originURI] = destURI;
+        }
 
         // Cancel the request. As of Fx 37, this causes the location bar to
         // show the URL of the previously displayed page.

-- 
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