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 373445 6854ec0231cc3c1c487dc7eff0c8a2a7aa271915
parent 373444 c7dde633fa869fe470ad8c78a011546c84323036
child 373446 535faaf4f99de639662df11e2aa9867696302f08
push id32303
push usercbook@mozilla.com
push dateWed, 09 Aug 2017 09:34:07 +0000
treeherdermozilla-central@c93fa2271ee7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssole
bugs1386550
milestone57.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 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");