Bug 1222047 - Remove unused visible/hidden events on target. r=yulia
authorAlexandre Poirot <poirot.alex@gmail.com>
Mon, 13 Aug 2018 07:13:10 -0700
changeset 831050 105a304b29222a6ba569e6ee20a2841b6407e4a3
parent 831049 72a737dd8639ab72ddc96d1144f44b06507b915e
child 831051 203dbb34de0471725426c47b1a06ae5550268e2a
push id118868
push userbmo:zjz@zjz.name
push dateFri, 24 Aug 2018 07:04:39 +0000
reviewersyulia
bugs1222047
milestone63.0a1
Bug 1222047 - Remove unused visible/hidden events on target. r=yulia Tags: #secure-revision Bug #: 1222047 Differential Revision: https://phabricator.services.mozilla.com/D3314 MozReview-Commit-ID: DSH0UmPrlxR
devtools/client/framework/target.js
devtools/client/framework/test/browser_target_events.js
--- a/devtools/client/framework/target.js
+++ b/devtools/client/framework/target.js
@@ -501,28 +501,26 @@ TabTarget.prototype = {
     return this._remote;
   },
 
   /**
    * Listen to the different events.
    */
   _setupListeners: function() {
     this.tab.addEventListener("TabClose", this);
-    this.tab.parentNode.addEventListener("TabSelect", this);
     this.tab.ownerDocument.defaultView.addEventListener("unload", this);
     this.tab.addEventListener("TabRemotenessChange", this);
   },
 
   /**
    * Teardown event listeners.
    */
   _teardownListeners: function() {
     this._tab.ownerDocument.defaultView.removeEventListener("unload", this);
     this._tab.removeEventListener("TabClose", this);
-    this._tab.parentNode.removeEventListener("TabSelect", this);
     this._tab.removeEventListener("TabRemotenessChange", this);
   },
 
   /**
    * Setup listeners for remote debugging, updating existing ones as necessary.
    */
   _setupRemoteListeners: function() {
     this.client.addListener("closed", this.destroy);
@@ -594,23 +592,16 @@ TabTarget.prototype = {
    * Handle tabs events.
    */
   handleEvent: function(event) {
     switch (event.type) {
       case "TabClose":
       case "unload":
         this.destroy();
         break;
-      case "TabSelect":
-        if (this.tab.selected) {
-          this.emit("visible", event);
-        } else {
-          this.emit("hidden", event);
-        }
-        break;
       case "TabRemotenessChange":
         this.onRemotenessChange();
         break;
     }
   },
 
   /**
    * Automatically respawn the toolbox when the tab changes between being
--- a/devtools/client/framework/test/browser_target_events.js
+++ b/devtools/client/framework/test/browser_target_events.js
@@ -4,26 +4,16 @@
 add_task(async function() {
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
   await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
 
   const target = TargetFactory.forTab(gBrowser.selectedTab);
   await target.makeRemote();
   is(target.tab, gBrowser.selectedTab, "Target linked to the right tab.");
 
-  const hidden = once(target, "hidden");
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  await hidden;
-  ok(true, "Hidden event received");
-
-  const visible = once(target, "visible");
-  gBrowser.removeCurrentTab();
-  await visible;
-  ok(true, "Visible event received");
-
   const willNavigate = once(target, "will-navigate");
   const navigate = once(target, "navigate");
   ContentTask.spawn(gBrowser.selectedBrowser, null, () => {
     content.location = "data:text/html,<meta charset='utf8'/>test navigation";
   });
   await willNavigate;
   ok(true, "will-navigate event received");
   await navigate;