Bug 1302702 - Check if the threadActor is attached before using it in tab actor's _windowReady. draft
authorLuca Greco <lgreco@mozilla.com>
Thu, 11 May 2017 18:54:26 +0200
changeset 579754 a83edbc482e3bce36f6ca447fad07ab0e5cee475
parent 579753 09fac56bbaf090954a730ebdcaf80f0c6cafafaf
child 629111 532c072282acc78e40d172f73b730a6521dc0811
push id59363
push userluca.greco@alcacoop.it
push dateWed, 17 May 2017 19:17:20 +0000
bugs1302702
milestone55.0a1
Bug 1302702 - Check if the threadActor is attached before using it in tab actor's _windowReady. MozReview-Commit-ID: IexaXRL27Lu
devtools/server/actors/tab.js
--- a/devtools/server/actors/tab.js
+++ b/devtools/server/actors/tab.js
@@ -1163,16 +1163,22 @@ TabActor.prototype = {
 
     this._windowDestroyed(this.window, null, true);
 
     // Immediately change the window as this window, if in process of unload
     // may already be non working on the next cycle and start throwing
     this._setWindow(window);
 
     DevToolsUtils.executeSoon(() => {
+      // No need to do anything more if the actor is not attached anymore
+      // e.g. the client has been closed and the actors destroyed in the meantime.
+      if (!this.attached) {
+        return;
+      }
+
       // Then fake window-ready and navigate on the given document
       this._windowReady(window, true);
       DevToolsUtils.executeSoon(() => {
         this._navigate(window, true);
       });
     });
   },