Bug 859372 - Refactor Services.jsm;r=past

This commit is contained in:
Eddy Bruel 2014-03-13 16:01:32 +01:00
Родитель c75ff964a1
Коммит ec60cb318f
17 изменённых файлов: 24 добавлений и 35 удалений

Просмотреть файл

@ -49,6 +49,7 @@ BuiltinProvider.prototype = {
load: function() {
this.loader = new loader.Loader({
modules: {
"Services": Object.create(Services),
"toolkit/loader": loader,
"source-map": SourceMap,
},
@ -123,6 +124,7 @@ SrcdirProvider.prototype = {
let acornWalkURI = OS.Path.join(acornURI, "walk.js");
this.loader = new loader.Loader({
modules: {
"Services": Object.create(Services),
"toolkit/loader": loader,
"source-map": SourceMap,
},

Просмотреть файл

@ -3,12 +3,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const {Cc, Ci, Cu, CC} = require("chrome");
const Services = require("Services");
const protocol = require("devtools/server/protocol");
const {method, RetVal} = protocol;
const promise = require("sdk/core/promise");
const {LongStringActor} = require("devtools/server/actors/string");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/PermissionsTable.jsm")
Cu.import('resource://gre/modules/devtools/dbg-server.jsm');

Просмотреть файл

@ -9,13 +9,12 @@
*/
const {Ci, Cu} = require("chrome");
const Services = require("Services");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
const protocol = require("devtools/server/protocol");
const {method, Arg, RetVal} = protocol;
const events = require("sdk/event/core");
Cu.import("resource://gre/modules/Services.jsm");
exports.register = function(handle) {
handle.addGlobalActor(EventLoopLagActor, "eventLoopLagActor");
handle.addTabActor(EventLoopLagActor, "eventLoopLagActor");

Просмотреть файл

@ -11,8 +11,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "console",
"resource://gre/modules/devtools/Console.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "CommandUtils",
"resource:///modules/devtools/DeveloperToolbar.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyGetter(this, "Requisition", function() {
return require("gcli/cli").Requisition;

Просмотреть файл

@ -5,6 +5,7 @@
"use strict";
const {Cu, Cc, Ci} = require("chrome");
const Services = require("Services");
const protocol = require("devtools/server/protocol");
const {Arg, Option, method} = protocol;
const events = require("sdk/event/core");
@ -13,7 +14,6 @@ require("devtools/server/actors/inspector");
Cu.import("resource://gre/modules/devtools/LayoutHelpers.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
// FIXME: add ":visited" and ":link" after bug 713106 is fixed
const PSEUDO_CLASSES = [":hover", ":active", ":focus"];

Просмотреть файл

@ -51,7 +51,7 @@
*/
const {Cc, Ci, Cu, Cr} = require("chrome");
const Services = require("Services");
const protocol = require("devtools/server/protocol");
const {Arg, Option, method, RetVal, types} = protocol;
const {LongStringActor, ShortLongString} = require("devtools/server/actors/string");
@ -103,7 +103,6 @@ const PSEUDO_SELECTORS = [
let HELPER_SHEET = ".__fx-devtools-hide-shortcut__ { visibility: hidden !important } ";
HELPER_SHEET += ":-moz-devtools-highlighted { outline: 2px dashed #F06!important; outline-offset: -2px!important } ";
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/devtools/LayoutHelpers.jsm");
loader.lazyGetter(this, "DOMParser", function() {

Просмотреть файл

@ -8,8 +8,6 @@
/* Root actor for the remote debugging protocol. */
Cu.import("resource://gre/modules/Services.jsm");
/**
* Methods shared between RootActor and BrowserTabActor.
*/

Просмотреть файл

@ -4,10 +4,10 @@
"use strict";
let { components, Cc, Ci, Cu } = require('chrome');
let { components, Cc, Ci, Cu } = require("chrome");
let Services = require("Services");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/devtools/SourceMap.jsm");

Просмотреть файл

@ -5,6 +5,7 @@
"use strict";
const {Cc, Ci} = require("chrome");
const Services = require("Services");
const promise = require("sdk/core/promise");
const protocol = require("devtools/server/protocol");
const {Arg, Option, method, RetVal, types} = protocol;
@ -13,7 +14,6 @@ const object = require("sdk/util/object");
const { Class } = require("sdk/core/heritage");
const { StyleSheetActor } = require("devtools/server/actors/stylesheets");
loader.lazyImporter(this, "Services", "resource://gre/modules/Services.jsm");
loader.lazyGetter(this, "CssLogic", () => require("devtools/styleinspector/css-logic").CssLogic);
loader.lazyGetter(this, "DOMUtils", () => Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils));

Просмотреть файл

@ -4,10 +4,10 @@
"use strict";
let { components, Cc, Ci, Cu } = require('chrome');
let { components, Cc, Ci, Cu } = require("chrome");
let Services = require("Services");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/devtools/SourceMap.jsm");

Просмотреть файл

@ -124,7 +124,6 @@ function WebappsActor(aConnection) {
Cu.import("resource://gre/modules/Webapps.jsm");
Cu.import("resource://gre/modules/AppsUtils.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import('resource://gre/modules/Services.jsm');
promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js").Promise;
// Keep reference of already created app actors.

Просмотреть файл

@ -7,7 +7,6 @@
"use strict";
let promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {}).Promise;
XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AddonManager", "resource://gre/modules/AddonManager.jsm");
/**

Просмотреть файл

@ -4,9 +4,7 @@
"use strict";
const {Cc, Ci, Cu, Cr} = require("chrome");
Cu.import("resource://gre/modules/Services.jsm");
const Services = require("Services");
const events = require("sdk/event/core");
const protocol = require("devtools/server/protocol");

Просмотреть файл

@ -10,6 +10,7 @@
* debugging global.
*/
let DevToolsUtils = require("devtools/toolkit/DevToolsUtils.js");
let Services = require("Services");
// Until all Debugger server code is converted to SDK modules,
// imports Components.* alias from chrome module.
@ -23,6 +24,7 @@ this.CC = CC;
this.Cu = Cu;
this.Cr = Cr;
this.DevToolsUtils = DevToolsUtils;
this.Services = Services;
// Overload `Components` to prevent SDK loader exception on Components
// object usage
@ -34,7 +36,6 @@ const DBG_STRINGS_URI = "chrome://global/locale/devtools/debugger.properties";
const nsFile = CC("@mozilla.org/file/local;1", "nsIFile", "initWithPath");
Cu.import("resource://gre/modules/reflect.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
let wantLogging = Services.prefs.getBoolPref("devtools.debugger.log");

Просмотреть файл

@ -5,16 +5,13 @@
"use strict";
let {Cu} = require("chrome");
let Services = require("Services");
let promise = require("sdk/core/promise");
let {Class} = require("sdk/core/heritage");
let {EventTarget} = require("sdk/event/target");
let events = require("sdk/event/core");
let object = require("sdk/util/object");
// For telemetry
Cu.import("resource://gre/modules/Services.jsm");
// Waiting for promise.done() to be added, see bug 851321
function promiseDone(err) {
console.error(err);

Просмотреть файл

@ -1,6 +1,11 @@
var Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/devtools/Loader.jsm");
Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
const Services = devtools.require("Services");
const {_documentWalker} = devtools.require("devtools/server/actors/inspector");
// Always log packets when running tests.
Services.prefs.setBoolPref("devtools.debugger.log", true);
@ -8,11 +13,6 @@ SimpleTest.registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.debugger.log");
});
Cu.import("resource://gre/modules/devtools/Loader.jsm");
Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
const {_documentWalker} = devtools.require("devtools/server/actors/inspector");
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);

Просмотреть файл

@ -7,7 +7,9 @@ const Ci = Components.interfaces;
const Cu = Components.utils;
const Cr = Components.results;
Cu.import("resource://gre/modules/Services.jsm");
const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
const DevToolsUtils = devtools.require("devtools/toolkit/DevToolsUtils.js");
const Services = devtools.require("Services");
// Always log packets when running tests. runxpcshelltests.py will throw
// the output away anyway, unless you give it the --verbose flag.
@ -15,9 +17,6 @@ Services.prefs.setBoolPref("devtools.debugger.log", true);
// Enable remote debugging for the relevant tests.
Services.prefs.setBoolPref("devtools.debugger.remote-enabled", true);
const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
const DevToolsUtils = devtools.require("devtools/toolkit/DevToolsUtils.js");
function tryImport(url) {
try {
Cu.import(url);