Bug 1336291 - Lots of 'TypeError: this._browsers is null' browser_remotenewtab_pageloads.js. r=felipe
MozReview-Commit-ID: HrQm0Rh9vCN
--- 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();