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 359022 056b0e09741cc69064ff4bb15457ce8025a78a8f
parent 359021 e625fef0f4bbd0b8388b5bef32a7f1bb9a0875cc
child 359023 e2db8d3a574582dfcf14629f0787ec89e96e7ac9
push id10701
push userryanvm@gmail.com
push dateWed, 08 Feb 2017 18:51:01 +0000
treeherdermozilla-aurora@c51d7c9daa24 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersFelipe, jcristau
bugs1336291
milestone53.0a2
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();