diff --git a/devtools/docs/contributor/preferences.md b/devtools/docs/contributor/preferences.md index b99e70969f61..a9c28661f2b8 100644 --- a/devtools/docs/contributor/preferences.md +++ b/devtools/docs/contributor/preferences.md @@ -50,11 +50,7 @@ To require Services and use Services.pref, you can normally use the following sn const Services = require("Services"); ``` -In the rare event where you don't have access to the DevTools' require method, you can use - -```javascript -const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); -``` +In the rare event where you don't have access to the DevTools' `require` method, if it's chrome-privileged environment, the `Services` object should already be available in the global variable. ### Services.pref.get* and Services.pref.set* diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla/lazy-getter-object-name.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla/lazy-getter-object-name.rst index dab122def55e..090f445b699e 100644 --- a/docs/code-quality/lint/linters/eslint-plugin-mozilla/lazy-getter-object-name.rst +++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla/lazy-getter-object-name.rst @@ -11,7 +11,7 @@ Examples of incorrect code for this rule: const obj = {}; ChromeUtils.defineESModuleGetters(obj, { - Services: “resource://gre/modules/Services.sys.mjs”, + AppConstants: “resource://gre/modules/AppConstants.sys.mjs”, }); Examples of correct code for this rule: @@ -21,5 +21,5 @@ Examples of correct code for this rule: const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { - Services: “resource://gre/modules/Services.sys.mjs”, + AppConstants: “resource://gre/modules/AppConstants.sys.mjs”, }); diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-chromeutils-import-params.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-chromeutils-import-params.rst index 8653c27f595d..4710878f8d28 100644 --- a/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-chromeutils-import-params.rst +++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-chromeutils-import-params.rst @@ -10,13 +10,13 @@ Examples of incorrect code for this rule: .. code-block:: js - ChromeUtils.import("resource://gre/modules/Services.jsm", this); - ChromeUtils.import("resource://gre/modules/Services.jsm", null); - ChromeUtils.import("resource://gre/modules/Services.jsm", {}); + ChromeUtils.import("resource://gre/modules/AppConstants.jsm", this); + ChromeUtils.import("resource://gre/modules/AppConstants.jsm", null); + ChromeUtils.import("resource://gre/modules/AppConstants.jsm", {}); Examples of correct code for this rule: --------------------------------------- .. code-block:: js - const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); + const { AppConstants } = ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-eager-module-in-lazy-getter.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-eager-module-in-lazy-getter.rst index 32973b39a089..fd81793690c2 100644 --- a/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-eager-module-in-lazy-getter.rst +++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-eager-module-in-lazy-getter.rst @@ -10,7 +10,7 @@ Examples of incorrect code for this rule: .. code-block:: js ChromeUtils.defineESModuleGetters(lazy, { - Services: "resource://gre/modules/Services.sys.mjs", + AppConstants: "resource://gre/modules/AppConstants.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(lazy, { XPCOMUtils: "resource://gre/modules/XPCOMUtils.jsm", @@ -26,7 +26,7 @@ Examples of correct code for this rule: .. code-block:: js - import { Services } from "resource://gre/modules/Services.sys.mjs"; + import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; const { XPCOMUtils } = ChromeUtils.import( "resource://gre/modules/XPCOMUtils.jsm" ); diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-globalThis-modification.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-globalThis-modification.rst index 402cf133cb4b..6d8a11d18e2b 100644 --- a/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-globalThis-modification.rst +++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-globalThis-modification.rst @@ -15,5 +15,5 @@ Examples of incorrect code for this rule: globalThis.foo = 10; Object.defineProperty(globalThis, "bar", { value: 20}); XPCOMUtils.defineLazyModuleGetters(globalThis, { - Services: "resource://gre/modules/Services.jsm", + AppConstants: "resource://gre/modules/AppConstants.jsm", }); diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-import-system-module-from-non-system.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-import-system-module-from-non-system.rst index 51fd7c62f9af..be0a85df4448 100644 --- a/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-import-system-module-from-non-system.rst +++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-import-system-module-from-non-system.rst @@ -16,7 +16,7 @@ Inside a non-system module: .. code-block:: js - import { Services } from "resource://gre/modules/Services.sys.mjs"; + import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; Examples of correct code for this rule: --------------------------------------- @@ -25,12 +25,12 @@ Inside a non-system module: .. code-block:: js - const { Services } = ChromeUtils.importESM( - "resource://gre/modules/Services.sys.mjs" + const { AppConstants } = ChromeUtils.importESM( + "resource://gre/modules/AppConstants.sys.mjs" ); Inside a system module: .. code-block:: js - import { Services } from "resource://gre/modules/Services.sys.mjs"; + import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla/use-chromeutils-import.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla/use-chromeutils-import.rst index 9aef244df66e..c38304193ada 100644 --- a/docs/code-quality/lint/linters/eslint-plugin-mozilla/use-chromeutils-import.rst +++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla/use-chromeutils-import.rst @@ -10,15 +10,15 @@ Examples of incorrect code for this rule: .. code-block:: js - Components.utils.import("resource://gre/modules/Services.jsm", this); - XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm"); + Components.utils.import("resource://gre/modules/AppConstants.jsm", this); + XPCOMUtils.defineLazyModuleGetter(this, "AppConstants", "resource://gre/modules/AppConstants.jsm"); Examples of correct code for this rule: --------------------------------------- .. code-block:: js - ChromeUtils.import("resource://gre/modules/Services.jsm", this); - ChromeUtils.defineModuleGetter(this, "Services", "resource://gre/modules/Services.jsm"); + ChromeUtils.import("resource://gre/modules/AppConstants.jsm", this); + ChromeUtils.defineModuleGetter(this, "AppConstants", "resource://gre/modules/AppConstants.jsm"); // 4 argument version of defineLazyModuleGetter is allowed. - XPCOMUtils.defineLazyModuleGetter(this, "Services","resource://gre/modules/Service.jsm","Foo"); + XPCOMUtils.defineLazyModuleGetter(this, "AppConstants","resource://gre/modules/AppConstants.jsm","Foo"); diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla/use-services.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla/use-services.rst index 89db04a224a9..1a57e3da108f 100644 --- a/docs/code-quality/lint/linters/eslint-plugin-mozilla/use-services.rst +++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla/use-services.rst @@ -1,8 +1,8 @@ use-services ============ -Requires the use of ``Services.jsm`` rather than ``Cc[].getService()`` where a -service is already defined in ``Services.jsm``. +Requires the use of ``Services`` rather than ``Cc[].getService()`` where a +service is already defined in ``Services``. Examples of incorrect code for this rule: ----------------------------------------- diff --git a/netwerk/docs/http/lifecycle.rst b/netwerk/docs/http/lifecycle.rst index bbfb50dd1428..007d35e57912 100644 --- a/netwerk/docs/http/lifecycle.rst +++ b/netwerk/docs/http/lifecycle.rst @@ -46,7 +46,6 @@ Attaching a listener for a request is pretty simple:: } } - const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); Services.obs.addObserver(observer, "http-on-modify-request", false); See nsIObserverService_ for the details. @@ -85,7 +84,6 @@ The response: http-on-examine-response Firefox fires a "http-on-examine-response" observer notification after parsing the HTTP response status and headers, but **before** reading the response body. Attaching a listener for this phase is also very easy:: - const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); Services.obs.addObserver(observer, "http-on-examine-response", false); If you use the same observer for "http-on-modify-request" and "http-on-examine-response", make sure you check the topic argument before interacting with the channel. diff --git a/toolkit/components/crashes/docs/index.rst b/toolkit/components/crashes/docs/index.rst index b050894cf85f..9554a3a8f2bd 100644 --- a/toolkit/components/crashes/docs/index.rst +++ b/toolkit/components/crashes/docs/index.rst @@ -9,9 +9,6 @@ data within the Gecko application. From JavaScript, the service can be accessed via:: - const { Services } = ChromeUtils.import( - "resource://gre/modules/Services.jsm" - ); let crashManager = Services.crashmanager; That will give you an instance of ``CrashManager`` from ``CrashManager.jsm``.