Bug 1378821 - Stop using sdk/window/utils in DevTools; r=zer0
authorJan Odvarko <odvarko@gmail.com>
Mon, 10 Jul 2017 10:55:40 +0200
changeset 611668 6a297d875e0e59a4434f22d3834c04f78d953d9f
parent 611667 cfb0810a9bf3a9f3bd00a74d84207259d474f74b
child 611669 0f0faf30c690f7f24ab5d51c450b3e1f0255d496
push id69287
push userCallek@gmail.com
push dateThu, 20 Jul 2017 01:11:37 +0000
reviewerszer0
bugs1378821
milestone56.0a1
Bug 1378821 - Stop using sdk/window/utils in DevTools; r=zer0 MozReview-Commit-ID: BD3EGMWtDv1
devtools/client/shared/doorhanger.js
devtools/shared/gcli/commands/rulers.js
devtools/shared/worker/worker.js
--- a/devtools/client/shared/doorhanger.js
+++ b/devtools/client/shared/doorhanger.js
@@ -3,17 +3,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const Services = require("Services");
 const { DOMHelpers } = require("resource://devtools/client/shared/DOMHelpers.jsm");
 const { Task } = require("devtools/shared/task");
 const defer = require("devtools/shared/defer");
-const { getMostRecentBrowserWindow } = require("sdk/window/utils");
 
 const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 const DEV_EDITION_PROMO_URL = "chrome://devtools/content/framework/dev-edition-promo/dev-edition-promo.xul";
 const DEV_EDITION_PROMO_ENABLED_PREF = "devtools.devedition.promo.enabled";
 const DEV_EDITION_PROMO_SHOWN_PREF = "devtools.devedition.promo.shown";
 const DEV_EDITION_PROMO_URL_PREF = "devtools.devedition.promo.url";
 
 /**
@@ -145,16 +144,16 @@ function onFrameLoad(frame) {
     };
     frame.addEventListener("DOMContentLoaded", callback);
   }
 
   return promise;
 }
 
 function getGBrowser() {
-  return getMostRecentBrowserWindow().gBrowser;
+  return Services.wm.getMostRecentWindow("navigator:browser").gBrowser;
 }
 
 function wait(n) {
   let { resolve, promise } = defer();
   setTimeout(resolve, n);
   return promise;
 }
--- a/devtools/shared/gcli/commands/rulers.js
+++ b/devtools/shared/gcli/commands/rulers.js
@@ -1,17 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const events = require("sdk/event/core");
 
-loader.lazyRequireGetter(this, "getOuterId", "sdk/window/utils", true);
 loader.lazyRequireGetter(this, "CommandState",
   "devtools/shared/gcli/command-state", true);
 
 const l10n = require("gcli/l10n");
 require("devtools/server/actors/inspector");
 const { RulersHighlighter, HighlighterEnvironment } =
   require("devtools/server/actors/highlighters");
 
--- a/devtools/shared/worker/worker.js
+++ b/devtools/shared/worker/worker.js
@@ -134,20 +134,19 @@
    *
    * @param {function} fn
    * @return {function}
    */
   function workerify(fn) {
     console.warn("`workerify` should only be used in tests or measuring performance. " +
                  "This creates an object URL on the browser window, and should not be " +
                  "used in production.");
-    // Fetch via window/utils here as we don't want to include
-    // this module normally.
-    let { getMostRecentBrowserWindow } = require("sdk/window/utils");
-    let { URL, Blob } = getMostRecentBrowserWindow();
+    // Fetch modules here as we don't want to include it normally.
+    const Services = require("Services");
+    let { URL, Blob } = Services.wm.getMostRecentWindow("navigator:browser");
     let stringifiedFn = createWorkerString(fn);
     let blob = new Blob([stringifiedFn]);
     let url = URL.createObjectURL(blob);
     let worker = new DevToolsWorker(url);
 
     let wrapperFn = data => worker.performTask("workerifiedTask", data);
 
     wrapperFn.destroy = function () {