Bug 1325158: Part 3 - Don't create a reference cycle via HTTP channel property bag. r=mixedpuppy draft
authorKris Maglione <maglione.k@gmail.com>
Sat, 24 Dec 2016 18:26:03 -0800
changeset 454928 1ad1f43b7da1bb0be3b04814347396fc29fbb4f6
parent 454927 447f2e11e9e3f59f984de56689681780d85b7bd3
child 454929 baa8c9f409da54c06cea5fac4dfa6462e2a06697
push id40082
push usermaglione.k@gmail.com
push dateFri, 30 Dec 2016 19:18:45 +0000
reviewersmixedpuppy
bugs1325158
milestone53.0a1
Bug 1325158: Part 3 - Don't create a reference cycle via HTTP channel property bag. r=mixedpuppy MozReview-Commit-ID: 40Ox7BDlgwy
toolkit/modules/addons/WebRequest.jsm
--- a/toolkit/modules/addons/WebRequest.jsm
+++ b/toolkit/modules/addons/WebRequest.jsm
@@ -808,24 +808,24 @@ HttpObserverManager = {
 
   examine(channel, topic, data) {
     let loadContext = this.getLoadContext(channel);
 
     if (this.needTracing) {
       // Check whether we've already added a listener to this channel,
       // so we don't wind up chaining multiple listeners.
       let channelData = getData(channel);
-      if (!channelData.listener && channel instanceof Ci.nsITraceableChannel) {
+      if (!channelData.hasListener && channel instanceof Ci.nsITraceableChannel) {
         let responseStatus = channel.responseStatus;
         // skip redirections, https://bugzilla.mozilla.org/show_bug.cgi?id=728901#c8
         if (responseStatus < 300 || responseStatus >= 400) {
           let listener = new StartStopListener(this, loadContext);
           let orig = channel.setNewListener(listener);
           listener.orig = orig;
-          channelData.listener = listener;
+          channelData.hasListener = true;
         }
       }
     }
 
     this.runChannelListener(channel, loadContext, "headersReceived");
   },
 
   onChannelReplaced(oldChannel, newChannel) {