Bug 1241050 - Convert DeveloperToolbar.jsm to commonjs module. r=jwalker

--HG--
rename : devtools/client/shared/DeveloperToolbar.jsm => devtools/client/shared/developer-toolbar.js
This commit is contained in:
Alexandre Poirot 2016-02-16 07:23:56 -08:00
parent b02c5b4832
commit 03af4376f7
5 changed files with 11 additions and 13 deletions

View File

@ -157,9 +157,9 @@ XPCOMUtils.defineLazyGetter(this, "PopupNotifications", function () {
});
XPCOMUtils.defineLazyGetter(this, "DeveloperToolbar", function() {
let tmp = {};
Cu.import("resource://devtools/client/shared/DeveloperToolbar.jsm", tmp);
return new tmp.DeveloperToolbar(window, document.getElementById("developer-toolbar"));
let { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
let { DeveloperToolbar } = require("devtools/client/shared/developer-toolbar");
return new DeveloperToolbar(window, document.getElementById("developer-toolbar"));
});
XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function() {

View File

@ -28,8 +28,6 @@ Cu.import("resource://devtools/client/scratchpad/scratchpad-manager.jsm");
Cu.import("resource://devtools/client/shared/DOMHelpers.jsm");
Cu.import("resource://gre/modules/Task.jsm");
loader.lazyImporter(this, "CommandUtils",
"resource://devtools/client/shared/DeveloperToolbar.jsm");
loader.lazyGetter(this, "toolboxStrings", () => {
const properties = "chrome://devtools/locale/toolbox.properties";
const bundle = Services.strings.createBundle(properties);
@ -45,6 +43,8 @@ loader.lazyGetter(this, "toolboxStrings", () => {
}
};
});
loader.lazyRequireGetter(this, "CommandUtils",
"devtools/client/shared/developer-toolbar", true);
loader.lazyRequireGetter(this, "getHighlighterUtils",
"devtools/client/framework/toolbox-highlighter-utils", true);
loader.lazyRequireGetter(this, "Hosts",

View File

@ -36,7 +36,7 @@ loader.lazyGetter(this, "clipboardHelper", () => {
return Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper);
});
loader.lazyImporter(this, "CommandUtils", "resource://devtools/client/shared/DeveloperToolbar.jsm");
loader.lazyRequireGetter(this, "CommandUtils", "devtools/client/shared/developer-toolbar", true);
/**
* Represents an open instance of the Inspector for a tab.

View File

@ -4,16 +4,13 @@
"use strict";
this.EXPORTED_SYMBOLS = [ "DeveloperToolbar", "CommandUtils" ];
const NS_XHTML = "http://www.w3.org/1999/xhtml";
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
const { Cc, Ci, Cu } = require("chrome");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
const { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
const { TargetFactory } = require("devtools/client/framework/target");
const promise = require("promise");
@ -233,7 +230,7 @@ var CommandUtils = {
},
};
this.CommandUtils = CommandUtils;
exports.CommandUtils = CommandUtils;
/**
* Due to a number of panel bugs we need a way to check if we are running on
@ -257,7 +254,7 @@ XPCOMUtils.defineLazyGetter(this, "OS", function() {
* @param aChromeWindow The browser window to which this toolbar is attached
* @param aToolbarElement See browser.xul:<toolbar id="developer-toolbar">
*/
this.DeveloperToolbar = function DeveloperToolbar(aChromeWindow, aToolbarElement)
function DeveloperToolbar(aChromeWindow, aToolbarElement)
{
this._chromeWindow = aChromeWindow;
@ -278,6 +275,7 @@ this.DeveloperToolbar = function DeveloperToolbar(aChromeWindow, aToolbarElement
EventEmitter.decorate(this);
}
exports.DeveloperToolbar = DeveloperToolbar;
/**
* Inspector notifications dispatched through the nsIObserverService

View File

@ -21,7 +21,7 @@ DevToolsModules(
'css-parsing-utils.js',
'Curl.jsm',
'demangle.js',
'DeveloperToolbar.jsm',
'developer-toolbar.js',
'devices.js',
'DOMHelpers.jsm',
'doorhanger.js',