Bug 1386550 - remove usage of sdk/system/events in DevTools test;r=sole
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 02 Aug 2017 12:01:24 +0200
changeset 642641 6854ec0231cc3c1c487dc7eff0c8a2a7aa271915
parent 642640 c7dde633fa869fe470ad8c78a011546c84323036
child 642642 535faaf4f99de639662df11e2aa9867696302f08
push id72833
push userbmo:emilio+bugs@crisal.io
push dateTue, 08 Aug 2017 16:50:16 +0000
reviewerssole
bugs1386550
milestone57.0a1
Bug 1386550 - remove usage of sdk/system/events in DevTools test;r=sole MozReview-Commit-ID: FM1AjShYmkj
devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon3/lib/main.js
--- a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon3/lib/main.js
+++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon3/lib/main.js
@@ -1,13 +1,20 @@
 var { Cc, Ci } = require("chrome");
-var { once } = require("sdk/system/events");
+var observerService = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
 
-var observerService = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
 var observer = {
   observe: function () {
     debugger;
   }
 };
 
-once("sdk:loader:destroy", () => observerService.removeObserver(observer, "debuggerAttached"));
+observerService.addObserver(observer, "debuggerAttached");
 
-observerService.addObserver(observer, "debuggerAttached");
+var sdkLoaderDestroyObserver = {
+  observe: function () {
+    // Remove all observers on sdk:loader:destroy
+    observerService.removeObserver(observer, "debuggerAttached");
+    observerService.removeObserver(sdkLoaderDestroyObserver, "sdk:loader:destroy");
+  }
+};
+
+observerService.addObserver(sdkLoaderDestroyObserver, "sdk:loader:destroy");