Bug 1378821 - Stop using sdk/window/utils in DevTools; r=zer0
MozReview-Commit-ID: BD3EGMWtDv1
--- 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 () {