Bug 1399346: Make sure channel is QIed to nsIChannel before wrapping. r=trivial
authorKris Maglione <maglione.k@gmail.com>
Mon, 11 Sep 2017 21:44:30 -0700
changeset 430319 563cd69c6fd95df76555e944fe597edb2f3ba9d1
parent 430318 2cc3aa0395485e7139c5ab1fd5b515f976f5c074
child 430320 49862e6cc323f6d3a3f498b803436e32cddc9824
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstrivial
bugs1399346
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1399346: Make sure channel is QIed to nsIChannel before wrapping. r=trivial MozReview-Commit-ID: EyKcc9irD8H
toolkit/modules/addons/WebRequest.jsm
--- a/toolkit/modules/addons/WebRequest.jsm
+++ b/toolkit/modules/addons/WebRequest.jsm
@@ -634,16 +634,21 @@ HttpObserverManager = {
       }
     }
     delete this.activityErrorsMap;
     this.activityErrorsMap = map;
     return this.activityErrorsMap;
   },
   GOOD_LAST_ACTIVITY: nsIHttpActivityObserver.ACTIVITY_SUBTYPE_RESPONSE_HEADER,
   observeActivity(nativeChannel, activityType, activitySubtype /* , aTimestamp, aExtraSizeData, aExtraStringData */) {
+    // Sometimes we get a NullHttpChannel, which implements
+    // nsIHttpChannel but not nsIChannel.
+    if (!(nativeChannel instanceof Ci.nsIChannel)) {
+      return;
+    }
     let channel = ChannelWrapper.get(nativeChannel);
 
     // StartStopListener has to be activated early in the request to catch
     // SSL connection issues which do not get reported via nsIHttpActivityObserver.
     if (activityType == nsIHttpActivityObserver.ACTIVITY_TYPE_HTTP_TRANSACTION &&
         activitySubtype == nsIHttpActivityObserver.ACTIVITY_SUBTYPE_REQUEST_HEADER) {
       this.attachStartStopListener(channel);
     }