Bug 1386533 fix host permitted matching, r?kmag draft
authorShane Caraveo <scaraveo@mozilla.com>
Wed, 02 Aug 2017 15:33:17 -0700
changeset 619954 3260f141351ba53ab69d5fbe569031d3911f66e5
parent 618757 44121dbcac6a9d3ff18ed087a09b3205e5a04db1
child 640557 757a9495b94546f8b3085cfa6d60bd6d3145e202
push id71885
push usermixedpuppy@gmail.com
push dateWed, 02 Aug 2017 22:33:47 +0000
reviewerskmag
bugs1386533
milestone56.0a1
Bug 1386533 fix host permitted matching, r?kmag MozReview-Commit-ID: 81ANT5R1671
toolkit/modules/addons/WebRequest.jsm
--- a/toolkit/modules/addons/WebRequest.jsm
+++ b/toolkit/modules/addons/WebRequest.jsm
@@ -843,18 +843,22 @@ HttpObserverManager = {
     let URI = getFinalChannelURI(channel);
     if (URI && isHostPermitted(URI.host)) {
       return false;
     }
 
     let {loadInfo} = channel;
     if (loadInfo && loadInfo.loadingPrincipal) {
       let {loadingPrincipal} = loadInfo;
-
-      return loadingPrincipal.URI && !isHostPermitted(loadingPrincipal.URI.host);
+      try {
+        return loadingPrincipal.URI && !isHostPermitted(loadingPrincipal.URI.host);
+      } catch (e) {
+        // about:newtab and other non-host URIs will throw.  Those wont be in
+        // the host permitted list, so we pass on the error.
+      }
     }
 
     return true;
   },
 
   runChannelListener(channel, loadContext = null, kind, extraData = null) {
     let handlerResults = [];
     let requestHeaders;