зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1438489
- Enable ESLint rule mozilla/use-services for devtools/. r=jdescottes
MozReview-Commit-ID: FZscEA6Q3Kb --HG-- extra : rebase_source : b1b8699288a3595e52bcff3c7684bfe095f41dd1
This commit is contained in:
Родитель
0e0df51227
Коммит
21e6e270a4
|
@ -43,7 +43,6 @@ module.exports = {
|
|||
// XXX Bug 1421969. These files/directories are still being fixed,
|
||||
// so turn off mozilla/use-services for them for now.
|
||||
"files": [
|
||||
"devtools/**",
|
||||
"extensions/pref/**",
|
||||
"mobile/android/**",
|
||||
"testing/**",
|
||||
|
|
|
@ -491,7 +491,6 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
|
|||
setSlowScriptDebugHandler() {
|
||||
let debugService = Cc["@mozilla.org/dom/slow-script-debug;1"]
|
||||
.getService(Ci.nsISlowScriptDebug);
|
||||
let tm = Cc["@mozilla.org/thread-manager;1"].getService(Ci.nsIThreadManager);
|
||||
|
||||
function slowScriptDebugHandler(tab, callback) {
|
||||
let target = TargetFactory.forTab(tab);
|
||||
|
@ -550,7 +549,7 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
|
|||
let utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
utils.enterModalState();
|
||||
tm.spinEventLoopUntil(() => {
|
||||
Services.tm.spinEventLoopUntil(() => {
|
||||
return setupFinished;
|
||||
});
|
||||
utils.leaveModalState();
|
||||
|
|
|
@ -12,11 +12,8 @@
|
|||
|
||||
<script>
|
||||
"use strict";
|
||||
var gIOService = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(SpecialPowers.Ci.nsIIOService);
|
||||
|
||||
var style = "data:text/css,a { background-color: seagreen; }";
|
||||
var uri = gIOService.newURI(style);
|
||||
var uri = SpecialPowers.Services.io.newURI(style);
|
||||
var windowUtils = SpecialPowers.wrap(window)
|
||||
.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
|
||||
.getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
|
||||
|
|
|
@ -13,12 +13,8 @@
|
|||
const TEST_URI_HTML = TEST_URL_ROOT + "doc_content_stylesheet.html";
|
||||
const TEST_URI_AUTHOR = TEST_URL_ROOT + "doc_author-sheet.html";
|
||||
const TEST_URI_XUL = TEST_URL_ROOT + "doc_content_stylesheet.xul";
|
||||
const XUL_URI = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService)
|
||||
.newURI(TEST_URI_XUL);
|
||||
var ssm = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
const XUL_PRINCIPAL = ssm.createCodebasePrincipal(XUL_URI, {});
|
||||
const XUL_URI = Services.io.newURI(TEST_URI_XUL);
|
||||
const XUL_PRINCIPAL = Services.scriptSecurityManager.createCodebasePrincipal(XUL_URI, {});
|
||||
|
||||
add_task(function* () {
|
||||
requestLongerTimeout(2);
|
||||
|
@ -53,15 +49,13 @@ add_task(function* () {
|
|||
});
|
||||
|
||||
function allowXUL() {
|
||||
Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager)
|
||||
.addFromPrincipal(XUL_PRINCIPAL, "allowXULXBL",
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
Services.perms.addFromPrincipal(XUL_PRINCIPAL, "allowXULXBL",
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
}
|
||||
|
||||
function disallowXUL() {
|
||||
Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager)
|
||||
.addFromPrincipal(XUL_PRINCIPAL, "allowXULXBL",
|
||||
Ci.nsIPermissionManager.DENY_ACTION);
|
||||
Services.perms.addFromPrincipal(XUL_PRINCIPAL, "allowXULXBL",
|
||||
Ci.nsIPermissionManager.DENY_ACTION);
|
||||
}
|
||||
|
||||
function* checkSheets(targetSelector, testActor) {
|
||||
|
|
|
@ -10,11 +10,8 @@
|
|||
</style>
|
||||
<script>
|
||||
"use strict";
|
||||
var gIOService = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(SpecialPowers.Ci.nsIIOService);
|
||||
|
||||
var style = "data:text/css,div { background-color: seagreen; }";
|
||||
var uri = gIOService.newURI(style);
|
||||
var uri = SpecialPowers.Services.io.newURI(style);
|
||||
var windowUtils = SpecialPowers.wrap(window)
|
||||
.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
|
||||
.getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
|
||||
|
|
|
@ -302,8 +302,6 @@ function setupClipboard(data, type) {
|
|||
* The code below is a simplified version of the sdk/clipboard helper set() method.
|
||||
*/
|
||||
function copyImageToClipboard(data) {
|
||||
let clipboardService = Cc["@mozilla.org/widget/clipboard;1"]
|
||||
.getService(Ci.nsIClipboard);
|
||||
let imageTools = Cc["@mozilla.org/image/tools;1"]
|
||||
.getService(Ci.imgITools);
|
||||
|
||||
|
@ -320,5 +318,5 @@ function copyImageToClipboard(data) {
|
|||
xferable.addDataFlavor("image/png");
|
||||
xferable.setTransferData("image/png", imgPtr, -1);
|
||||
|
||||
clipboardService.setData(xferable, null, clipboardService.kGlobalClipboard);
|
||||
Services.clipboard.setData(xferable, null, Services.clipboard.kGlobalClipboard);
|
||||
}
|
||||
|
|
|
@ -13,10 +13,9 @@ let { MockFilePicker } = SpecialPowers;
|
|||
MockFilePicker.init(window);
|
||||
MockFilePicker.returnValue = MockFilePicker.returnOK;
|
||||
|
||||
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Ci.mozIJSSubScriptLoader)
|
||||
.loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
|
||||
this);
|
||||
Services.scriptloader
|
||||
.loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
|
||||
this);
|
||||
|
||||
function click(selector) {
|
||||
return BrowserTestUtils.synthesizeMouseAtCenter(selector, {}, gBrowser.selectedBrowser);
|
||||
|
@ -65,9 +64,7 @@ function getFileContents(file) {
|
|||
}
|
||||
|
||||
function createTemporarySaveDirectory() {
|
||||
let saveDir = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("TmpD", Ci.nsIFile);
|
||||
let saveDir = Services.dirsvc.get("TmpD", Ci.nsIFile);
|
||||
saveDir.append("jsonview-testsavedir");
|
||||
if (!saveDir.exists()) {
|
||||
info("Creating temporary save directory.");
|
||||
|
|
|
@ -11,11 +11,6 @@ const { Ci, Cc, CC } = require("chrome");
|
|||
const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
|
||||
const { gDevTools } = require("devtools/client/framework/devtools");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "dirService", function () {
|
||||
return Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties);
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ZipWriter", function () {
|
||||
return CC("@mozilla.org/zipwriter;1", "nsIZipWriter");
|
||||
});
|
||||
|
@ -159,7 +154,7 @@ var HarUtils = {
|
|||
let dir;
|
||||
|
||||
if (!path) {
|
||||
dir = dirService.get("ProfD", Ci.nsIFile);
|
||||
dir = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
dir.append("har");
|
||||
dir.append("logs");
|
||||
} else {
|
||||
|
|
|
@ -80,9 +80,7 @@ const key = (id, win = window) => {
|
|||
// avoid at least some leaks on OSX. Theoretically the module should never
|
||||
// be active at this point. We shouldn't have to do this, but rather
|
||||
// find and fix the leak in the module itself. Bug 1257439.
|
||||
let nsIProfilerModule = Cc["@mozilla.org/tools/profiler;1"]
|
||||
.getService(Ci.nsIProfiler);
|
||||
nsIProfilerModule.StopProfiler();
|
||||
Services.profiler.StopProfiler();
|
||||
|
||||
// Forces GC, CC and shrinking GC to get rid of disconnected docshells
|
||||
// and windows.
|
||||
|
|
|
@ -4,16 +4,13 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { Cc, Ci } = require("chrome");
|
||||
const Services = require("Services");
|
||||
|
||||
loader.lazyRequireGetter(this, "ResponsiveUIManager", "devtools/client/responsive.html/manager", true);
|
||||
|
||||
const BRAND_SHORT_NAME = Cc["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Ci.nsIStringBundleService)
|
||||
.createBundle("chrome://branding/locale/brand.properties")
|
||||
.GetStringFromName("brandShortName");
|
||||
const BRAND_SHORT_NAME = Services.strings.createBundle("chrome://branding/locale/brand.properties")
|
||||
.GetStringFromName("brandShortName");
|
||||
|
||||
const Services = require("Services");
|
||||
const osString = Services.appinfo.OS;
|
||||
const l10n = require("gcli/l10n");
|
||||
|
||||
|
|
|
@ -5,12 +5,9 @@
|
|||
/* eslint-env browser */
|
||||
/* global addMessageListener, sendAsyncMessage, content */
|
||||
"use strict";
|
||||
const {require, loader} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const { Task } = require("devtools/shared/task");
|
||||
|
||||
loader.lazyGetter(this, "nsIProfilerModule", () => {
|
||||
return Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler);
|
||||
});
|
||||
const Services = require("Services");
|
||||
|
||||
addMessageListener("devtools:test:history", function ({ data }) {
|
||||
content.history[data.direction]();
|
||||
|
@ -118,7 +115,7 @@ addMessageListener("devtools:test:xhr", Task.async(function* ({ data }) {
|
|||
|
||||
addMessageListener("devtools:test:profiler", function ({ data }) {
|
||||
let { method, args, id } = data;
|
||||
let result = nsIProfilerModule[method](...args);
|
||||
let result = Services.profiler[method](...args);
|
||||
sendAsyncMessage("devtools:test:profiler:response", {
|
||||
data: result,
|
||||
id: id
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
|
||||
// A helper actor for inspector and markupview tests.
|
||||
|
||||
const { Cc, Ci, Cu } = require("chrome");
|
||||
const { Ci, Cu } = require("chrome");
|
||||
const Services = require("Services");
|
||||
const {
|
||||
getRect, getAdjustedQuads, getWindowDimensions
|
||||
} = require("devtools/shared/layout/utils");
|
||||
|
@ -18,8 +19,6 @@ const {
|
|||
isContentStylesheet,
|
||||
getCSSStyleRules
|
||||
} = require("devtools/shared/inspector/css-logic");
|
||||
const loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Ci.mozIJSSubScriptLoader);
|
||||
const InspectorUtils = require("InspectorUtils");
|
||||
|
||||
// Set up a dummy environment so that EventUtils works. We need to be careful to
|
||||
|
@ -32,7 +31,7 @@ EventUtils.parent = {};
|
|||
EventUtils._EU_Ci = Components.interfaces;
|
||||
EventUtils._EU_Cc = Components.classes;
|
||||
/* eslint-disable camelcase */
|
||||
loader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
|
||||
Services.scriptloader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
|
||||
|
||||
const protocol = require("devtools/shared/protocol");
|
||||
const {Arg, RetVal} = protocol;
|
||||
|
|
|
@ -939,12 +939,8 @@ function getCookieId(name, domain, path) {
|
|||
function setPermission(url, permission) {
|
||||
const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
|
||||
|
||||
let uri = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService)
|
||||
.newURI(url);
|
||||
let ssm = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
let principal = ssm.createCodebasePrincipal(uri, {});
|
||||
let uri = Services.io.newURI(url);
|
||||
let principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
|
||||
|
||||
Components.classes["@mozilla.org/permissionmanager;1"]
|
||||
.getService(nsIPermissionManager)
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
const TEST_URL = "http://" + TEST_HOST + "/browser/devtools/client/" +
|
||||
"styleeditor/test/test_private.html";
|
||||
const cache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
|
||||
.getService(Ci.nsICacheStorageService);
|
||||
|
||||
add_task(function* () {
|
||||
info("Opening a new private window");
|
||||
|
@ -18,7 +16,7 @@ add_task(function* () {
|
|||
yield waitForDelayedStartupFinished(win);
|
||||
|
||||
info("Clearing the browser cache");
|
||||
cache.clear();
|
||||
Services.cache2.clear();
|
||||
|
||||
let { toolbox, ui } = yield openStyleEditorForURL(TEST_URL, win);
|
||||
|
||||
|
@ -62,7 +60,8 @@ function checkDiskCacheFor(host) {
|
|||
};
|
||||
function Visitor() {}
|
||||
|
||||
let storage = cache.diskCacheStorage(Services.loadContextInfo.default, false);
|
||||
let storage =
|
||||
Services.cache2.diskCacheStorage(Services.loadContextInfo.default, false);
|
||||
storage.asyncVisitStorage(new Visitor(),
|
||||
/* Do walk entries */
|
||||
true);
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
var gCount = 0;
|
||||
const MAX = 10;
|
||||
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm", {});
|
||||
var inspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector);
|
||||
var tm = Cc["@mozilla.org/thread-manager;1"].getService(Ci.nsIThreadManager);
|
||||
|
||||
// Emulate 10 simultaneously-debugged windows from 3 separate client connections.
|
||||
var requestor = (count) => ({
|
||||
|
@ -23,7 +23,7 @@ function run_test() {
|
|||
function test_nesting() {
|
||||
Assert.equal(inspector.eventLoopNestLevel, 0);
|
||||
|
||||
tm.dispatchToMainThread({ run: enterEventLoop});
|
||||
Services.tm.dispatchToMainThread({ run: enterEventLoop});
|
||||
|
||||
Assert.equal(inspector.enterNestedEventLoop(requestor(gCount)), 0);
|
||||
Assert.equal(inspector.eventLoopNestLevel, 0);
|
||||
|
@ -32,7 +32,7 @@ function test_nesting() {
|
|||
|
||||
function enterEventLoop() {
|
||||
if (gCount++ < MAX) {
|
||||
tm.dispatchToMainThread({ run: enterEventLoop});
|
||||
Services.tm.dispatchToMainThread({ run: enterEventLoop});
|
||||
|
||||
Object.create(requestor(gCount));
|
||||
|
||||
|
@ -43,7 +43,7 @@ function enterEventLoop() {
|
|||
Assert.equal(inspector.enterNestedEventLoop(requestor(gCount)), gCount);
|
||||
} else {
|
||||
Assert.equal(gCount, MAX + 1);
|
||||
tm.dispatchToMainThread({ run: exitEventLoop});
|
||||
Services.tm.dispatchToMainThread({ run: exitEventLoop});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ function exitEventLoop() {
|
|||
Assert.equal(inspector.lastNestRequestor.connection,
|
||||
requestor(gCount - 1).connection);
|
||||
if (gCount-- > 1) {
|
||||
tm.dispatchToMainThread({ run: exitEventLoop});
|
||||
Services.tm.dispatchToMainThread({ run: exitEventLoop});
|
||||
}
|
||||
|
||||
Assert.equal(inspector.exitNestedEventLoop(), gCount);
|
||||
|
|
|
@ -6,13 +6,9 @@
|
|||
const protocol = require("devtools/shared/protocol");
|
||||
const { ActorClassWithSpec, Actor } = protocol;
|
||||
const { perfSpec } = require("devtools/shared/specs/perf");
|
||||
const { Cc, Ci } = require("chrome");
|
||||
const { Ci } = require("chrome");
|
||||
const Services = require("Services");
|
||||
|
||||
loader.lazyGetter(this, "geckoProfiler", () => {
|
||||
return Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler);
|
||||
});
|
||||
|
||||
loader.lazyImporter(this, "PrivateBrowsingUtils",
|
||||
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
|
||||
|
@ -65,7 +61,7 @@ exports.PerfActor = ActorClassWithSpec(perfSpec, {
|
|||
|
||||
try {
|
||||
// This can throw an error if the profiler is in the wrong state.
|
||||
geckoProfiler.StartProfiler(
|
||||
Services.profiler.StartProfiler(
|
||||
settings.entries,
|
||||
settings.interval,
|
||||
settings.features,
|
||||
|
@ -85,7 +81,7 @@ exports.PerfActor = ActorClassWithSpec(perfSpec, {
|
|||
if (!IS_SUPPORTED_PLATFORM) {
|
||||
return;
|
||||
}
|
||||
geckoProfiler.StopProfiler();
|
||||
Services.profiler.StopProfiler();
|
||||
},
|
||||
|
||||
async getProfileAndStopProfiler() {
|
||||
|
@ -95,10 +91,10 @@ exports.PerfActor = ActorClassWithSpec(perfSpec, {
|
|||
let profile;
|
||||
try {
|
||||
// Attempt to pull out the data.
|
||||
profile = await geckoProfiler.getProfileDataAsync();
|
||||
profile = await Services.profiler.getProfileDataAsync();
|
||||
|
||||
// Stop and discard the buffers.
|
||||
geckoProfiler.StopProfiler();
|
||||
Services.profiler.StopProfiler();
|
||||
} catch (e) {
|
||||
// If there was any kind of error, bailout with no profile.
|
||||
return null;
|
||||
|
@ -116,7 +112,7 @@ exports.PerfActor = ActorClassWithSpec(perfSpec, {
|
|||
if (!IS_SUPPORTED_PLATFORM) {
|
||||
return false;
|
||||
}
|
||||
return geckoProfiler.IsActive();
|
||||
return Services.profiler.IsActive();
|
||||
},
|
||||
|
||||
isSupportedPlatform() {
|
||||
|
@ -127,7 +123,7 @@ exports.PerfActor = ActorClassWithSpec(perfSpec, {
|
|||
if (!IS_SUPPORTED_PLATFORM) {
|
||||
return false;
|
||||
}
|
||||
return !geckoProfiler.CanProfile();
|
||||
return !Services.profiler.CanProfile();
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -662,8 +662,7 @@ TabActor.prototype = {
|
|||
let scriptError = scriptErrorClass.createInstance(Ci.nsIScriptError);
|
||||
scriptError.initWithWindowID(text, null, null, 0, 0, 1,
|
||||
category, getInnerId(this.window));
|
||||
let console = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService);
|
||||
console.logMessage(scriptError);
|
||||
Services.console.logMessage(scriptError);
|
||||
return {};
|
||||
},
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"use strict";
|
||||
|
||||
const Services = require("Services");
|
||||
const { Cc, Ci, Cr } = require("chrome");
|
||||
const { Cr } = require("chrome");
|
||||
const { ActorPool, GeneratedLocation } = require("devtools/server/actors/common");
|
||||
const { createValueGrip, longStringGrip } = require("devtools/server/actors/object");
|
||||
const { ActorClassWithSpec } = require("devtools/shared/protocol");
|
||||
|
@ -626,9 +626,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
|||
(events == "*" ||
|
||||
(Array.isArray(events) && events.length))) {
|
||||
this._pauseOnDOMEvents = events;
|
||||
let els = Cc["@mozilla.org/eventlistenerservice;1"]
|
||||
.getService(Ci.nsIEventListenerService);
|
||||
els.addListenerForAllEvents(this.global, this._allEventsListener, true);
|
||||
Services.els.addListenerForAllEvents(this.global, this._allEventsListener, true);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -777,14 +775,11 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
|||
* @returns Array
|
||||
*/
|
||||
_getAllEventListeners: function (eventTarget) {
|
||||
let els = Cc["@mozilla.org/eventlistenerservice;1"]
|
||||
.getService(Ci.nsIEventListenerService);
|
||||
|
||||
let targets = els.getEventTargetChainFor(eventTarget, true);
|
||||
let targets = Services.els.getEventTargetChainFor(eventTarget, true);
|
||||
let listeners = [];
|
||||
|
||||
for (let target of targets) {
|
||||
let handlers = els.getListenerInfoFor(target);
|
||||
let handlers = Services.els.getListenerInfoFor(target);
|
||||
for (let handler of handlers) {
|
||||
// Null is returned for all-events handlers, and native event listeners
|
||||
// don't provide any listenerObject, which makes them not that useful to
|
||||
|
@ -1081,15 +1076,12 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
|||
};
|
||||
}
|
||||
|
||||
let els = Cc["@mozilla.org/eventlistenerservice;1"]
|
||||
.getService(Ci.nsIEventListenerService);
|
||||
|
||||
let nodes = this.global.document.getElementsByTagName("*");
|
||||
nodes = [this.global].concat([].slice.call(nodes));
|
||||
let listeners = [];
|
||||
|
||||
for (let node of nodes) {
|
||||
let handlers = els.getListenerInfoFor(node);
|
||||
let handlers = Services.els.getListenerInfoFor(node);
|
||||
|
||||
for (let handler of handlers) {
|
||||
// Create a form object for serializing the listener via the protocol.
|
||||
|
@ -1190,9 +1182,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
|||
// XPCShell tests don't use actual DOM windows for globals and cause
|
||||
// removeListenerForAllEvents to throw.
|
||||
if (!isWorker && this.global && !this.global.toString().includes("Sandbox")) {
|
||||
let els = Cc["@mozilla.org/eventlistenerservice;1"]
|
||||
.getService(Ci.nsIEventListenerService);
|
||||
els.removeListenerForAllEvents(this.global, this._allEventsListener, true);
|
||||
Services.els.removeListenerForAllEvents(this.global, this._allEventsListener, true);
|
||||
for (let [, bp] of this._hiddenBreakpoints) {
|
||||
bp.delete();
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
/* global XPCNativeWrapper */
|
||||
|
||||
const { Cu, Cc, Ci } = require("chrome");
|
||||
const { Cu } = require("chrome");
|
||||
|
||||
const protocol = require("devtools/shared/protocol");
|
||||
const { CallWatcherActor } = require("devtools/server/actors/call-watcher");
|
||||
|
@ -17,8 +17,7 @@ const {
|
|||
} = require("devtools/shared/specs/webaudio");
|
||||
const { WebAudioFront } = require("devtools/shared/fronts/webaudio");
|
||||
|
||||
const observerService = Cc["@mozilla.org/observer-service;1"]
|
||||
.getService(Ci.nsIObserverService);
|
||||
const Services = require("Services");
|
||||
|
||||
const AUDIO_NODE_DEFINITION = require("devtools/server/actors/utils/audionodes.json");
|
||||
const ENABLE_AUTOMATION = false;
|
||||
|
@ -557,7 +556,7 @@ exports.WebAudioActor = protocol.ActorClassWithSpec(webAudioSpec, {
|
|||
this._initialized = false;
|
||||
|
||||
try {
|
||||
observerService.removeObserver(this, "webaudio-node-demise");
|
||||
Services.obs.removeObserver(this, "webaudio-node-demise");
|
||||
} catch (e) {
|
||||
// Maybe we've shutdown already and it's too late to remove the observer. So avoid
|
||||
// NS_ERROR_FAILURE errors with this silent try/catch.
|
||||
|
@ -625,7 +624,7 @@ exports.WebAudioActor = protocol.ActorClassWithSpec(webAudioSpec, {
|
|||
* Called on first audio node creation, signifying audio context usage
|
||||
*/
|
||||
_onStartContext: function () {
|
||||
observerService.addObserver(this, "webaudio-node-demise");
|
||||
Services.obs.addObserver(this, "webaudio-node-demise");
|
||||
this.emit("start-context");
|
||||
},
|
||||
|
||||
|
@ -753,7 +752,7 @@ exports.WebAudioActor = protocol.ActorClassWithSpec(webAudioSpec, {
|
|||
if (this._nativeToActorID) {
|
||||
this._nativeToActorID.clear();
|
||||
}
|
||||
observerService.removeObserver(this, "webaudio-node-demise");
|
||||
Services.obs.removeObserver(this, "webaudio-node-demise");
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -7,16 +7,11 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const {Cc, Ci} = require("chrome");
|
||||
const Services = require("Services");
|
||||
|
||||
// eslint-disable-next-line
|
||||
const JQUERY_LIVE_REGEX = /return typeof \w+.*.event\.triggered[\s\S]*\.event\.(dispatch|handle).*arguments/;
|
||||
|
||||
loader.lazyGetter(this, "eventListenerService", () => {
|
||||
return Cc["@mozilla.org/eventlistenerservice;1"]
|
||||
.getService(Ci.nsIEventListenerService);
|
||||
});
|
||||
|
||||
var parsers = [
|
||||
{
|
||||
id: "jQuery events",
|
||||
|
@ -170,15 +165,15 @@ var parsers = [
|
|||
|
||||
if (node.nodeName.toLowerCase() === "html") {
|
||||
let winListeners =
|
||||
eventListenerService.getListenerInfoFor(node.ownerGlobal) || [];
|
||||
Services.els.getListenerInfoFor(node.ownerGlobal) || [];
|
||||
let docElementListeners =
|
||||
eventListenerService.getListenerInfoFor(node) || [];
|
||||
Services.els.getListenerInfoFor(node) || [];
|
||||
let docListeners =
|
||||
eventListenerService.getListenerInfoFor(node.parentNode) || [];
|
||||
Services.els.getListenerInfoFor(node.parentNode) || [];
|
||||
|
||||
listeners = [...winListeners, ...docElementListeners, ...docListeners];
|
||||
} else {
|
||||
listeners = eventListenerService.getListenerInfoFor(node) || [];
|
||||
listeners = Services.els.getListenerInfoFor(node) || [];
|
||||
}
|
||||
|
||||
for (let listener of listeners) {
|
||||
|
@ -191,7 +186,7 @@ var parsers = [
|
|||
},
|
||||
getListeners: function (node) {
|
||||
let handlers = [];
|
||||
let listeners = eventListenerService.getListenerInfoFor(node);
|
||||
let listeners = Services.els.getListenerInfoFor(node);
|
||||
|
||||
// The Node actor's getEventListenerInfo knows that when an html tag has
|
||||
// been passed we need the window object so we don't need to account for
|
||||
|
|
|
@ -59,9 +59,7 @@ const CONTENT_PROCESS_DBG_SERVER_SCRIPT =
|
|||
|
||||
function loadSubScript(url) {
|
||||
try {
|
||||
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Ci.mozIJSSubScriptLoader);
|
||||
loader.loadSubScript(url, this);
|
||||
Services.scriptloader.loadSubScript(url, this);
|
||||
} catch (e) {
|
||||
let errorStr = "Error loading: " + url + ":\n" +
|
||||
(e.fileName ? "at " + e.fileName + " : " + e.lineNumber + "\n" : "") +
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
const { Cc, Ci, Cu } = require("chrome");
|
||||
const { Cu } = require("chrome");
|
||||
const Services = require("Services");
|
||||
|
||||
loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
|
||||
|
@ -20,10 +20,6 @@ const PROFILER_SYSTEM_EVENTS = [
|
|||
// How often the "profiler-status" is emitted by default (in ms)
|
||||
const BUFFER_STATUS_INTERVAL_DEFAULT = 5000;
|
||||
|
||||
loader.lazyGetter(this, "nsIProfilerModule", () => {
|
||||
return Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler);
|
||||
});
|
||||
|
||||
var DEFAULT_PROFILER_OPTIONS = {
|
||||
// When using the DevTools Performance Tools, this will be overridden
|
||||
// by the pref `devtools.performance.profiler.buffer-size`.
|
||||
|
@ -109,10 +105,10 @@ const ProfilerManager = (function () {
|
|||
|
||||
// The start time should be before any samples we might be
|
||||
// interested in.
|
||||
let currentTime = nsIProfilerModule.getElapsedTime();
|
||||
let currentTime = Services.profiler.getElapsedTime();
|
||||
|
||||
try {
|
||||
nsIProfilerModule.StartProfiler(
|
||||
Services.profiler.StartProfiler(
|
||||
config.entries,
|
||||
config.interval,
|
||||
config.features,
|
||||
|
@ -146,7 +142,7 @@ const ProfilerManager = (function () {
|
|||
// actually started it. This is to prevent stopping the profiler initiated
|
||||
// by some other code, like Talos.
|
||||
if (this.length <= 1 && this.started) {
|
||||
nsIProfilerModule.StopProfiler();
|
||||
Services.profiler.StopProfiler();
|
||||
this.started = false;
|
||||
}
|
||||
this._updateProfilerStatusPolling();
|
||||
|
@ -190,10 +186,10 @@ const ProfilerManager = (function () {
|
|||
getProfile: function (options) {
|
||||
let startTime = options.startTime || 0;
|
||||
let profile = options.stringify ?
|
||||
nsIProfilerModule.GetProfile(startTime) :
|
||||
nsIProfilerModule.getProfileData(startTime);
|
||||
Services.profiler.GetProfile(startTime) :
|
||||
Services.profiler.getProfileData(startTime);
|
||||
|
||||
return { profile: profile, currentTime: nsIProfilerModule.getElapsedTime() };
|
||||
return { profile: profile, currentTime: Services.profiler.getElapsedTime() };
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -204,7 +200,7 @@ const ProfilerManager = (function () {
|
|||
* @return {object}
|
||||
*/
|
||||
getFeatures: function () {
|
||||
return { features: nsIProfilerModule.GetFeatures([]) };
|
||||
return { features: Services.profiler.GetFeatures([]) };
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -216,7 +212,7 @@ const ProfilerManager = (function () {
|
|||
*/
|
||||
getBufferInfo: function () {
|
||||
let position = {}, totalSize = {}, generation = {};
|
||||
nsIProfilerModule.GetBufferInfo(position, totalSize, generation);
|
||||
Services.profiler.GetBufferInfo(position, totalSize, generation);
|
||||
return {
|
||||
position: position.value,
|
||||
totalSize: totalSize.value,
|
||||
|
@ -241,8 +237,8 @@ const ProfilerManager = (function () {
|
|||
* @return {object}
|
||||
*/
|
||||
isActive: function () {
|
||||
let isActive = nsIProfilerModule.IsActive();
|
||||
let elapsedTime = isActive ? nsIProfilerModule.getElapsedTime() : undefined;
|
||||
let isActive = Services.profiler.IsActive();
|
||||
let elapsedTime = isActive ? Services.profiler.getElapsedTime() : undefined;
|
||||
let { position, totalSize, generation } = this.getBufferInfo();
|
||||
return {
|
||||
isActive,
|
||||
|
@ -260,7 +256,7 @@ const ProfilerManager = (function () {
|
|||
*/
|
||||
get sharedLibraries() {
|
||||
return {
|
||||
sharedLibraries: nsIProfilerModule.sharedLibraries
|
||||
sharedLibraries: Services.profiler.sharedLibraries
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -391,7 +387,7 @@ const ProfilerManager = (function () {
|
|||
* if there are subscribers and if the profiler is current recording.
|
||||
*/
|
||||
_updateProfilerStatusPolling: function () {
|
||||
if (this._profilerStatusSubscribers > 0 && nsIProfilerModule.IsActive()) {
|
||||
if (this._profilerStatusSubscribers > 0 && Services.profiler.IsActive()) {
|
||||
if (!this._poller) {
|
||||
this._poller = new DeferredTask(this._emitProfilerStatus.bind(this),
|
||||
this._profilerStatusInterval, 0);
|
||||
|
@ -542,7 +538,7 @@ class Profiler {
|
|||
* @return boolean
|
||||
*/
|
||||
static canProfile() {
|
||||
return nsIProfilerModule.CanProfile();
|
||||
return Services.profiler.CanProfile();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ add_task(async function () {
|
|||
const {front, client} = await initPerfFront();
|
||||
|
||||
// Simulate other tools by getting an independent handle on the Gecko Profiler.
|
||||
// eslint-disable-next-line mozilla/use-services
|
||||
const geckoProfiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler);
|
||||
|
||||
is(await front.isActive(), false, "The profiler hasn't been started yet.");
|
||||
|
|
|
@ -43,9 +43,7 @@ const { addDebuggerToGlobal } = ChromeUtils.import("resource://gre/modules/jsdeb
|
|||
const systemPrincipal = Cc["@mozilla.org/systemprincipal;1"]
|
||||
.createInstance(Ci.nsIPrincipal);
|
||||
|
||||
var { loadSubScript, loadSubScriptWithOptions } =
|
||||
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Ci.mozIJSSubScriptLoader);
|
||||
var { loadSubScript, loadSubScriptWithOptions } = Services.scriptloader;
|
||||
|
||||
/**
|
||||
* Initializes any test that needs to work with add-ons.
|
||||
|
@ -317,8 +315,7 @@ var listener = {
|
|||
}
|
||||
};
|
||||
|
||||
var consoleService = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService);
|
||||
consoleService.registerListener(listener);
|
||||
Services.console.registerListener(listener);
|
||||
|
||||
function check_except(func) {
|
||||
try {
|
||||
|
|
|
@ -12,10 +12,8 @@ this.EXPORTED_SYMBOLS = ["Loader", "resolveURI", "Module", "Require", "unload"];
|
|||
const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu,
|
||||
results: Cr, manager: Cm } = Components;
|
||||
const systemPrincipal = CC("@mozilla.org/systemprincipal;1", "nsIPrincipal")();
|
||||
const { loadSubScript } = Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Ci.mozIJSSubScriptLoader);
|
||||
const { notifyObservers } = Cc["@mozilla.org/observer-service;1"]
|
||||
.getService(Ci.nsIObserverService);
|
||||
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm", {});
|
||||
const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm", {});
|
||||
const { normalize, dirname } = ChromeUtils.import("resource://gre/modules/osfile/ospath_unix.jsm", {});
|
||||
|
||||
|
@ -230,7 +228,7 @@ function load(loader, module) {
|
|||
|
||||
let originalExports = module.exports;
|
||||
try {
|
||||
loadSubScript(module.uri, sandbox, "UTF-8");
|
||||
Services.scriptloader.loadSubScript(module.uri, sandbox, "UTF-8");
|
||||
} catch (error) {
|
||||
let { message, fileName, lineNumber } = error;
|
||||
let stack = error.stack || Error().stack;
|
||||
|
@ -574,7 +572,7 @@ function unload(loader, reason) {
|
|||
// some modules may do cleanup in subsequent turns of event loop. Destroying
|
||||
// cache may cause module identity problems in such cases.
|
||||
let subject = { wrappedJSObject: loader.destructor };
|
||||
notifyObservers(subject, "sdk:loader:destroy", reason);
|
||||
Services.obs.notifyObservers(subject, "sdk:loader:destroy", reason);
|
||||
}
|
||||
|
||||
// Function makes new loader that can be used to load CommonJS modules.
|
||||
|
|
|
@ -5,18 +5,13 @@
|
|||
"use strict";
|
||||
|
||||
const { Cc, Ci, Cu } = require("chrome");
|
||||
const Services = require("Services");
|
||||
const { OS } = require("resource://gre/modules/osfile.jsm");
|
||||
const { Task } = require("devtools/shared/task");
|
||||
|
||||
const gcli = require("gcli/index");
|
||||
const l10n = require("gcli/l10n");
|
||||
|
||||
loader.lazyGetter(this, "prefBranch", function () {
|
||||
let prefService = Cc["@mozilla.org/preferences-service;1"]
|
||||
.getService(Ci.nsIPrefService);
|
||||
return prefService.getBranch(null).QueryInterface(Ci.nsIPrefBranch);
|
||||
});
|
||||
|
||||
loader.lazyImporter(this, "NetUtil", "resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
const PREF_DIR = "devtools.commands.dir";
|
||||
|
@ -27,16 +22,14 @@ const PREF_DIR = "devtools.commands.dir";
|
|||
* using in gcli.addItemsByModule
|
||||
*/
|
||||
function loadItemsFromMozDir() {
|
||||
let dirName = prefBranch.getStringPref(PREF_DIR).trim();
|
||||
let dirName = Services.prefs.getStringPref(PREF_DIR).trim();
|
||||
if (dirName == "") {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
// replaces ~ with the home directory path in unix and windows
|
||||
if (dirName.indexOf("~") == 0) {
|
||||
let dirService = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties);
|
||||
let homeDirFile = dirService.get("Home", Ci.nsIFile);
|
||||
let homeDirFile = Services.dirsvc.get("Home", Ci.nsIFile);
|
||||
let homeDir = homeDirFile.path;
|
||||
dirName = dirName.substr(1);
|
||||
dirName = homeDir + dirName;
|
||||
|
@ -123,7 +116,7 @@ exports.items = [
|
|||
{
|
||||
name: "cmd",
|
||||
get hidden() {
|
||||
return !prefBranch.prefHasUserValue(PREF_DIR);
|
||||
return !Services.prefs.prefHasUserValue(PREF_DIR);
|
||||
},
|
||||
description: l10n.lookup("cmdDesc")
|
||||
},
|
||||
|
@ -133,12 +126,12 @@ exports.items = [
|
|||
name: "cmd refresh",
|
||||
description: l10n.lookup("cmdRefreshDesc"),
|
||||
get hidden() {
|
||||
return !prefBranch.prefHasUserValue(PREF_DIR);
|
||||
return !Services.prefs.prefHasUserValue(PREF_DIR);
|
||||
},
|
||||
exec: function (args, context) {
|
||||
gcli.load();
|
||||
|
||||
let dirName = prefBranch.getStringPref(PREF_DIR).trim();
|
||||
let dirName = Services.prefs.getStringPref(PREF_DIR).trim();
|
||||
return l10n.lookupFormat("cmdStatus3", [ dirName ]);
|
||||
}
|
||||
},
|
||||
|
@ -162,11 +155,11 @@ exports.items = [
|
|||
],
|
||||
returnType: "string",
|
||||
get hidden() {
|
||||
// !prefBranch.prefHasUserValue(PREF_DIR);
|
||||
// !Services.prefs.prefHasUserValue(PREF_DIR);
|
||||
return true;
|
||||
},
|
||||
exec: function (args, context) {
|
||||
prefBranch.setStringPref(PREF_DIR, args.directory);
|
||||
Services.prefs.setStringPref(PREF_DIR, args.directory);
|
||||
|
||||
gcli.load();
|
||||
|
||||
|
|
|
@ -20,13 +20,9 @@
|
|||
* This way, they'll always run in the parent process.
|
||||
*/
|
||||
|
||||
const { Ci, Cc } = require("chrome");
|
||||
const { Ci } = require("chrome");
|
||||
const Services = require("Services");
|
||||
const l10n = require("gcli/l10n");
|
||||
const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cookieMgr", function () {
|
||||
return Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager);
|
||||
});
|
||||
|
||||
/**
|
||||
* Check host value and remove port part as it is not used
|
||||
|
@ -95,7 +91,7 @@ exports.items = [
|
|||
let contentWindow = context.environment.window;
|
||||
host = sanitizeHost(host);
|
||||
let { originAttributes } = contentWindow.document.nodePrincipal;
|
||||
let enm = cookieMgr.getCookiesFromHost(host, originAttributes);
|
||||
let enm = Services.cookies.getCookiesFromHost(host, originAttributes);
|
||||
|
||||
let cookies = [];
|
||||
while (enm.hasMoreElements()) {
|
||||
|
@ -139,14 +135,14 @@ exports.items = [
|
|||
let contentWindow = context.environment.window;
|
||||
host = sanitizeHost(host);
|
||||
let { originAttributes } = contentWindow.document.nodePrincipal;
|
||||
let enm = cookieMgr.getCookiesFromHost(host, originAttributes);
|
||||
let enm = Services.cookies.getCookiesFromHost(host, originAttributes);
|
||||
|
||||
while (enm.hasMoreElements()) {
|
||||
let cookie = enm.getNext().QueryInterface(Ci.nsICookie);
|
||||
if (isCookieAtHost(cookie, host)) {
|
||||
if (cookie.name == args.name) {
|
||||
cookieMgr.remove(cookie.host, cookie.name, cookie.path,
|
||||
false, cookie.originAttributes);
|
||||
Services.cookies.remove(cookie.host, cookie.name, cookie.path,
|
||||
false, cookie.originAttributes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -282,15 +278,15 @@ exports.items = [
|
|||
host = sanitizeHost(host);
|
||||
let time = Date.parse(args.expires) / 1000;
|
||||
let contentWindow = context.environment.window;
|
||||
cookieMgr.add(args.domain ? "." + args.domain : host,
|
||||
args.path ? args.path : "/",
|
||||
args.name,
|
||||
args.value,
|
||||
args.secure,
|
||||
args.httpOnly,
|
||||
args.session,
|
||||
time,
|
||||
contentWindow.document.nodePrincipal.originAttributes);
|
||||
Services.cookies.add(args.domain ? "." + args.domain : host,
|
||||
args.path ? args.path : "/",
|
||||
args.name,
|
||||
args.value,
|
||||
args.secure,
|
||||
args.httpOnly,
|
||||
args.session,
|
||||
time,
|
||||
contentWindow.document.nodePrincipal.originAttributes);
|
||||
}
|
||||
}
|
||||
];
|
||||
|
|
|
@ -4,11 +4,9 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { Cc, Ci, CC } = require("chrome");
|
||||
const { Ci, CC } = require("chrome");
|
||||
const Services = require("Services");
|
||||
const l10n = require("gcli/l10n");
|
||||
const dirService = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties);
|
||||
|
||||
function showFolder(path) {
|
||||
let NSLocalFile = CC("@mozilla.org/file/local;1", "nsIFile",
|
||||
|
@ -51,7 +49,7 @@ exports.items = [
|
|||
|
||||
// replaces ~ with the home directory path in unix and windows
|
||||
if (dirName.indexOf("~") == 0) {
|
||||
let homeDirFile = dirService.get("Home", Ci.nsIFile);
|
||||
let homeDirFile = Services.dirsvc.get("Home", Ci.nsIFile);
|
||||
let homeDir = homeDirFile.path;
|
||||
dirName = dirName.substr(1);
|
||||
dirName = homeDir + dirName;
|
||||
|
|
|
@ -4,16 +4,14 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { Cc, Ci } = require("chrome");
|
||||
const Services = require("Services");
|
||||
const l10n = require("gcli/l10n");
|
||||
const { DevToolsLoader } = require("resource://devtools/shared/Loader.jsm");
|
||||
const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
const BRAND_SHORT_NAME = Cc["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Ci.nsIStringBundleService)
|
||||
.createBundle("chrome://branding/locale/brand.properties")
|
||||
.GetStringFromName("brandShortName");
|
||||
const BRAND_SHORT_NAME =
|
||||
Services.strings.createBundle("chrome://branding/locale/brand.properties")
|
||||
.GetStringFromName("brandShortName");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "debuggerServer", () => {
|
||||
// Create a separate loader instance, so that we can be sure to receive
|
||||
|
|
|
@ -8,10 +8,9 @@ const { Cc, Ci } = require("chrome");
|
|||
const l10n = require("gcli/l10n");
|
||||
const Services = require("Services");
|
||||
|
||||
const BRAND_SHORT_NAME = Cc["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Ci.nsIStringBundleService)
|
||||
.createBundle("chrome://branding/locale/brand.properties")
|
||||
.GetStringFromName("brandShortName");
|
||||
const BRAND_SHORT_NAME =
|
||||
Services.strings.createBundle("chrome://branding/locale/brand.properties")
|
||||
.GetStringFromName("brandShortName");
|
||||
|
||||
/**
|
||||
* Restart command
|
||||
|
@ -60,15 +59,12 @@ exports.items = [
|
|||
Services.appinfo.invalidateCachesOnRestart();
|
||||
}
|
||||
|
||||
const appStartup = Cc["@mozilla.org/toolkit/app-startup;1"]
|
||||
.getService(Ci.nsIAppStartup);
|
||||
|
||||
if (args.safemode) {
|
||||
// restart in safemode
|
||||
appStartup.restartInSafeMode(Ci.nsIAppStartup.eAttemptQuit);
|
||||
Services.startup.restartInSafeMode(Ci.nsIAppStartup.eAttemptQuit);
|
||||
} else {
|
||||
// restart normally
|
||||
appStartup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
|
||||
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
|
||||
}
|
||||
|
||||
return l10n.lookupFormat("restartBrowserRestarting", [ BRAND_SHORT_NAME ]);
|
||||
|
|
|
@ -397,9 +397,7 @@ function saveToClipboard(context, reply) {
|
|||
trans.addDataFlavor(channel.contentType);
|
||||
trans.setTransferData(channel.contentType, wrapped, -1);
|
||||
|
||||
const clip = Cc["@mozilla.org/widget/clipboard;1"]
|
||||
.getService(Ci.nsIClipboard);
|
||||
clip.setData(trans, null, Ci.nsIClipboard.kGlobalClipboard);
|
||||
Services.clipboard.setData(trans, null, Ci.nsIClipboard.kGlobalClipboard);
|
||||
|
||||
reply.destinations.push(l10n.lookup("screenshotCopied"));
|
||||
} catch (ex) {
|
||||
|
|
|
@ -9,16 +9,12 @@
|
|||
* a principal dedicated to DevTools.
|
||||
*/
|
||||
|
||||
const { Cc, Ci } = require("chrome");
|
||||
const Services = require("Services");
|
||||
|
||||
const PSEUDOURI = "indexeddb://fx-devtools";
|
||||
const principaluri = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService).newURI(PSEUDOURI);
|
||||
|
||||
const ssm = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
|
||||
const principal = ssm.createCodebasePrincipal(principaluri, {});
|
||||
const principaluri = Services.io.newURI(PSEUDOURI);
|
||||
const principal =
|
||||
Services.scriptSecurityManager.createCodebasePrincipal(principaluri, {});
|
||||
|
||||
/**
|
||||
* Create the DevTools dedicated DB, by relying on the real indexedDB object passed as a
|
||||
|
|
|
@ -7,10 +7,9 @@
|
|||
"use strict";
|
||||
|
||||
const {Cc, Ci} = require("chrome");
|
||||
const Services = require("Services");
|
||||
const clipboardHelper = Cc["@mozilla.org/widget/clipboardhelper;1"]
|
||||
.getService(Ci.nsIClipboardHelper);
|
||||
const clipboardService = Cc["@mozilla.org/widget/clipboard;1"]
|
||||
.getService(Ci.nsIClipboard);
|
||||
|
||||
function copyString(string) {
|
||||
clipboardHelper.copyString(string);
|
||||
|
@ -36,9 +35,9 @@ function getText() {
|
|||
xferable.addDataFlavor(flavor);
|
||||
|
||||
// Get the data into our transferable.
|
||||
clipboardService.getData(
|
||||
Services.clipboard.getData(
|
||||
xferable,
|
||||
clipboardService.kGlobalClipboard
|
||||
Services.clipboard.kGlobalClipboard
|
||||
);
|
||||
|
||||
let data = {};
|
||||
|
|
|
@ -76,9 +76,7 @@ var listener = {
|
|||
}
|
||||
};
|
||||
|
||||
var consoleService = Cc["@mozilla.org/consoleservice;1"]
|
||||
.getService(Ci.nsIConsoleService);
|
||||
consoleService.registerListener(listener);
|
||||
Services.console.registerListener(listener);
|
||||
|
||||
/**
|
||||
* Initialize the testing debugger server.
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"use strict";
|
||||
|
||||
const { require, DevToolsLoader } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const Services = require("Services");
|
||||
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
||||
const flags = require("devtools/shared/flags");
|
||||
|
||||
|
@ -51,5 +52,4 @@ var listener = {
|
|||
}
|
||||
};
|
||||
|
||||
var consoleService = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService);
|
||||
consoleService.registerListener(listener);
|
||||
Services.console.registerListener(listener);
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
const { console, ConsoleAPI } = require("resource://gre/modules/Console.jsm");
|
||||
const { ConsoleAPIListener } = require("devtools/server/actors/webconsole/listeners");
|
||||
const Services = require("Services");
|
||||
|
||||
var seenMessages = 0;
|
||||
var seenTypes = 0;
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
var { executeSoon } = require("devtools/shared/DevToolsUtils");
|
||||
var defer = require("devtools/shared/defer");
|
||||
var Services = require("Services");
|
||||
|
||||
var asyncStackEnabled =
|
||||
Services.prefs.getBoolPref("javascript.options.asyncstack");
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const Services = require("Services");
|
||||
const {
|
||||
EXPAND_TAB,
|
||||
TAB_SIZE,
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
"use strict";
|
||||
|
||||
const {prettifyCSS} = require("devtools/shared/inspector/css-logic");
|
||||
const Services = require("Services");
|
||||
|
||||
const EXPAND_TAB = "devtools.editor.expandtab";
|
||||
|
||||
|
|
|
@ -86,9 +86,7 @@ var listener = {
|
|||
}
|
||||
};
|
||||
|
||||
var consoleService = Cc["@mozilla.org/consoleservice;1"]
|
||||
.getService(Ci.nsIConsoleService);
|
||||
consoleService.registerListener(listener);
|
||||
Services.console.registerListener(listener);
|
||||
|
||||
/**
|
||||
* Initialize the testing debugger server.
|
||||
|
|
|
@ -480,6 +480,7 @@ var {
|
|||
|
||||
let rpc = undefined;
|
||||
|
||||
// eslint-disable-next-line mozilla/use-services
|
||||
let subScriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Ci.mozIJSSubScriptLoader);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче