Bug 1336291 - Lots of 'TypeError: this._browsers is null' browser_remotenewtab_pageloads.js. r=Felipe, a=jcristau
authorMarco Bonardo <mbonardo@mozilla.com>
Mon, 06 Feb 2017 18:54:54 +0100
changeset 354128 e6c3c117e08b29bbc11fa2215fefbdf394ac86f3
parent 354127 2c8c1e19219607be9d39464c1c0359118f32a5db
child 354129 722b9597f736647bf50c9455c7b84928e2be369d
push id6892
push userryanvm@gmail.com
push dateTue, 14 Feb 2017 16:13:02 +0000
treeherdermozilla-esr52@35e191e72900 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersFelipe, jcristau
bugs1336291
milestone52.0
Bug 1336291 - Lots of 'TypeError: this._browsers is null' browser_remotenewtab_pageloads.js. r=Felipe, a=jcristau MozReview-Commit-ID: HrQm0Rh9vCN
browser/components/newtab/NewTabWebChannel.jsm
--- a/browser/components/newtab/NewTabWebChannel.jsm
+++ b/browser/components/newtab/NewTabWebChannel.jsm
@@ -140,16 +140,20 @@ NewTabWebChannelImpl.prototype = {
 
     return false;
   },
 
   /*
    * Obtains all known browser refs
    */
   _getBrowserRefs() {
+    // Some code may try to emit messages after teardown.
+    if (!this._browsers) {
+      return [];
+    }
     let refs = [];
     for (let bRef of this._browsers) {
       /*
        * even though we hold a weak ref to browser, it seems that browser
        * objects aren't gc'd immediately after a tab closes. They stick around
        * in memory, but thankfully they don't have a documentURI in that case
        */
       let browser = bRef.get();