Bug 1515817 - Check if contentWindow is a dead wrapper in the InnerWindowReference invalidate method. r=robwu
authorLuca Greco <lgreco@mozilla.com>
Mon, 18 Feb 2019 16:23:27 +0000
changeset 459799 6e630f7bd8b47187cbfba4a4640fa408f02cb241
parent 459798 09e06443d63a424f09c707d1130405e32ced9997
child 459800 c590fd06f7cb325e3b446f7cd5fb98c6d0a26ad1
push id35572
push usercbrindusan@mozilla.com
push dateMon, 18 Feb 2019 21:43:34 +0000
treeherdermozilla-central@c590fd06f7cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrobwu
bugs1515817
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1515817 - Check if contentWindow is a dead wrapper in the InnerWindowReference invalidate method. r=robwu Differential Revision: https://phabricator.services.mozilla.com/D20185
toolkit/components/extensions/ExtensionCommon.jsm
--- a/toolkit/components/extensions/ExtensionCommon.jsm
+++ b/toolkit/components/extensions/ExtensionCommon.jsm
@@ -378,17 +378,17 @@ class InnerWindowReference {
     }
     return null;
   }
 
   invalidate() {
     // If invalidate() is called while the inner window is in the bfcache, then
     // we are unable to remove the event listener, and handleEvent will be
     // called once more if the page is revived from the bfcache.
-    if (this.contentWindow) {
+    if (this.contentWindow && !Cu.isDeadWrapper(this.contentWindow)) {
       this.contentWindow.removeEventListener("pagehide", this, {mozSystemGroup: true});
       this.contentWindow.removeEventListener("pageshow", this, {mozSystemGroup: true});
     }
     this.contentWindow = null;
     this.needWindowIDCheck = false;
   }
 
   handleEvent(event) {