Bug 1473513 - reduce number of poolFor calls; r=ochameau
☠☠ backed out by 98b5ff9533ee ☠ ☠
authoryulia <ystartsev@mozilla.com>
Tue, 21 Aug 2018 11:45:42 +0200
changeset 490592 deb8812556ef956417c81f6db7df15ff04dbbe9f
parent 490591 5bf38cfa04f93fbf001a1625735f9787d232e760
child 490593 5874c9b590a03fa983421cc5d74b0b4a8a759351
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1473513
milestone63.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 1473513 - reduce number of poolFor calls; r=ochameau MozReview-Commit-ID: 9VqKPauAP9j
devtools/shared/protocol.js
--- a/devtools/shared/protocol.js
+++ b/devtools/shared/protocol.js
@@ -854,26 +854,28 @@ Pool.prototype = extend(EventEmitter.pro
   },
 
   /**
    * Add an actor as a child of this pool.
    */
   manage: function(actor) {
     if (!actor.actorID) {
       actor.actorID = this.conn.allocID(actor.actorPrefix || actor.typeName);
-    }
+    } else {
+      // If the actor is already registerd in a pool, remove it without destroying it.
+      // This happens for example when an addon is reloaded. To see this behavior, take a
+      // look at devtools/server/tests/unit/test_addon_reload.js
 
-    // If the actor is already in a pool, remove it without destroying it.
-    // TODO: not all actors have been moved to protocol.js, so they do not all have
-    // a parent field. Remove the check for the parent once the conversion is finished
-    const parent = this.poolFor(actor.actorID);
-    if (parent) {
-      parent.unmanage(actor);
+      // TODO: not all actors have been moved to protocol.js, so they do not all have
+      // a parent field. Remove the check for the parent once the conversion is finished
+      const parent = this.poolFor(actor.actorID);
+      if (parent) {
+        parent.unmanage(actor);
+      }
     }
-
     this._poolMap.set(actor.actorID, actor);
     return actor;
   },
 
   /**
    * Remove an actor as a child of this pool.
    */
   unmanage: function(actor) {