Bug 1602371 - Stop listening to tab unload in LocalTabTargetFront r=ochameau
authorJulian Descottes <jdescottes@mozilla.com>
Fri, 13 Dec 2019 09:59:00 +0000
changeset 506874 09beec6ec35dfe9e8420d2923860094293fd136b
parent 506873 4e035d5e8d6cbc13c3332a4aa2253474045d9417
child 506875 8ab51c4822d4059d03a0021524a8e6145adf7bcb
push id103129
push userjdescottes@mozilla.com
push dateFri, 13 Dec 2019 10:39:08 +0000
treeherderautoland@f8c1648fb4d0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1602371
milestone73.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 1602371 - Stop listening to tab unload in LocalTabTargetFront r=ochameau It is not clear why tab unload should be listened to on the client, and only destroy the target front. Tentatively removing to simplify the local tab target. Differential Revision: https://phabricator.services.mozilla.com/D56327
devtools/shared/fronts/targets/local-tab.js
--- a/devtools/shared/fronts/targets/local-tab.js
+++ b/devtools/shared/fronts/targets/local-tab.js
@@ -57,33 +57,23 @@ class LocalTabTargetFront extends Browsi
     return `Target:${this.tab}`;
   }
 
   /**
    * Listen to the different events.
    */
   _setupTabListeners() {
     this.tab.addEventListener("TabClose", this._handleTabEvent);
-    this.tab.ownerDocument.defaultView.addEventListener(
-      "unload",
-      this._handleTabEvent
-    );
     this.tab.addEventListener("TabRemotenessChange", this._handleTabEvent);
   }
 
   /**
    * Teardown event listeners.
    */
   _teardownTabListeners() {
-    if (this.tab.ownerDocument.defaultView) {
-      this.tab.ownerDocument.defaultView.removeEventListener(
-        "unload",
-        this._handleTabEvent
-      );
-    }
     this.tab.removeEventListener("TabClose", this._handleTabEvent);
     this.tab.removeEventListener("TabRemotenessChange", this._handleTabEvent);
   }
 
   /**
    * Handle tabs events.
    */
   async _handleTabEvent(event) {
@@ -98,19 +88,16 @@ class LocalTabTargetFront extends Browsi
         // toolbox. In this case, the toobox won't destroy the target, so we
         // do it from here. But ultimately, the target should destroy itself
         // from the actor side anyway.
         if (toolbox) {
           // Toolbox.destroy will call target.destroy eventually.
           await toolbox.destroy();
         }
         break;
-      case "unload":
-        this.destroy();
-        break;
       case "TabRemotenessChange":
         this._onRemotenessChange();
         break;
     }
   }
 
   /**
    * Automatically respawn the toolbox when the tab changes between being