Bug 1336291 - Lots of 'TypeError: this._browsers is null' browser_remotenewtab_pageloads.js. r=felipe draft
authorMarco Bonardo <mbonardo@mozilla.com>
Mon, 06 Feb 2017 18:54:54 +0100
changeset 479436 35a33bff6569b2b6d14e132c6dc3fcda6d7d0d75
parent 479417 7f1b358fb17dfd982c5e18c34d5735cd481c7f7c
child 544686 cd588d4913aa8b02d8401909af59f5a11eef4f29
push id44256
push usermak77@bonardo.net
push dateMon, 06 Feb 2017 17:56:22 +0000
reviewersfelipe
bugs1336291
milestone54.0a1
Bug 1336291 - Lots of 'TypeError: this._browsers is null' browser_remotenewtab_pageloads.js. r=felipe 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();