зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1804661 - Convert browser/components/BrowserContentHandler.jsm to an ES module. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D164205
This commit is contained in:
Родитель
53ce0faad1
Коммит
55b80efd43
|
@ -2,17 +2,8 @@
|
|||
* 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/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = [
|
||||
"nsBrowserContentHandler",
|
||||
"nsDefaultCommandLineHandler",
|
||||
];
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { AppConstants } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/AppConstants.sys.mjs"
|
||||
);
|
||||
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const lazy = {};
|
||||
|
||||
|
@ -389,12 +380,13 @@ async function doSearch(searchTerm, cmdLine) {
|
|||
).catch(Cu.reportError);
|
||||
}
|
||||
|
||||
function nsBrowserContentHandler() {
|
||||
export function nsBrowserContentHandler() {
|
||||
if (!gBrowserContentHandler) {
|
||||
gBrowserContentHandler = this;
|
||||
}
|
||||
return gBrowserContentHandler;
|
||||
}
|
||||
|
||||
nsBrowserContentHandler.prototype = {
|
||||
/* nsISupports */
|
||||
QueryInterface: ChromeUtils.generateQI([
|
||||
|
@ -1025,7 +1017,7 @@ function maybeRecordToHandleTelemetry(uri, isLaunch) {
|
|||
}
|
||||
}
|
||||
|
||||
function nsDefaultCommandLineHandler() {}
|
||||
export function nsDefaultCommandLineHandler() {}
|
||||
|
||||
nsDefaultCommandLineHandler.prototype = {
|
||||
/* nsISupports */
|
|
@ -25,7 +25,7 @@ Classes = [
|
|||
'@mozilla.org/uriloader/content-handler;1?type=text/rdf',
|
||||
'@mozilla.org/uriloader/content-handler;1?type=text/xml',
|
||||
],
|
||||
'jsm': 'resource:///modules/BrowserContentHandler.jsm',
|
||||
'esModule': 'resource:///modules/BrowserContentHandler.sys.mjs',
|
||||
'constructor': 'nsBrowserContentHandler',
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
'categories': {
|
||||
|
@ -36,7 +36,7 @@ Classes = [
|
|||
{
|
||||
'cid': '{47cd0651-b1be-4a0f-b5c4-10e5a573ef71}',
|
||||
'contract_ids': ['@mozilla.org/browser/final-clh;1'],
|
||||
'jsm': 'resource:///modules/BrowserContentHandler.jsm',
|
||||
'esModule': 'resource:///modules/BrowserContentHandler.sys.mjs',
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
'constructor': 'nsDefaultCommandLineHandler',
|
||||
'categories': {'command-line-handler': 'x-default'},
|
||||
|
|
|
@ -87,7 +87,7 @@ EXTRA_COMPONENTS += [
|
|||
]
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
"BrowserContentHandler.jsm",
|
||||
"BrowserContentHandler.sys.mjs",
|
||||
"BrowserGlue.sys.mjs",
|
||||
"distribution.js",
|
||||
]
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
<!-- Keep synchronized with
|
||||
https://searchfox.org/mozilla-central/source/browser/installer/windows/nsis/shared.nsh
|
||||
and `os.environment.launched_to_handle` and `os.environment.invoked_to_handle` telemetry in
|
||||
https://searchfox.org/mozilla-central/source/browser/components/BrowserContentHandler.jsm. -->
|
||||
https://searchfox.org/mozilla-central/source/browser/components/BrowserContentHandler.sys.mjs. -->
|
||||
<uap:FileType>.avif</uap:FileType>
|
||||
<uap:FileType>.htm</uap:FileType>
|
||||
<uap:FileType>.html</uap:FileType>
|
||||
|
|
|
@ -525,7 +525,7 @@ ${RemoveDefaultBrowserAgentShortcut}
|
|||
; Keep this list synchronized with
|
||||
; https://searchfox.org/mozilla-central/source/browser/installer/windows/msix/AppxManifest.xml.in.
|
||||
; and `os.environment.launched_to_handle` and `os.environment.invoked_to_handle` telemetry in
|
||||
; https://searchfox.org/mozilla-central/source/browser/components/BrowserContentHandler.jsm.
|
||||
; https://searchfox.org/mozilla-central/source/browser/components/BrowserContentHandler.sys.mjs.
|
||||
${AddAssociationIfNoneExist} ".oga" "FirefoxHTML$5"
|
||||
${AddAssociationIfNoneExist} ".ogg" "FirefoxHTML$5"
|
||||
${AddAssociationIfNoneExist} ".ogv" "FirefoxHTML$5"
|
||||
|
|
|
@ -1622,9 +1622,9 @@ static Result<Ok, PreXULSkeletonUIError> ValidateCmdlineArguments(
|
|||
const char* flag = NormalizeFlag(argv[i]);
|
||||
if (!flag) {
|
||||
// If this is not a flag, then we interpret it as a URL, similar to
|
||||
// BrowserContentHandler.jsm. Some command line options take additional
|
||||
// arguments, which may or may not be URLs. We don't need to know this,
|
||||
// because we don't need to parse them out; we just rely on the
|
||||
// BrowserContentHandler.sys.mjs. Some command line options take
|
||||
// additional arguments, which may or may not be URLs. We don't need to
|
||||
// know this, because we don't need to parse them out; we just rely on the
|
||||
// assumption that if arg X is actually a parameter for the preceding
|
||||
// arg Y, then X must not look like a flag (starting with "--", "-",
|
||||
// or "/").
|
||||
|
|
|
@ -83,7 +83,7 @@ It is possible to run background tasks in non-emphemeral, i.e., persistent, prof
|
|||
|
||||
The technical mechanism that keeps background tasks "lightweight" is very simple. XPCOM declares a number of observer notifications for loosely coupling components via the observer service. Some of those observer notifications are declared as category notifications which allow consumers to register themselves in static components.conf registration files (or in now deprecated chrome.manifest files). In background task mode, category notifications are not registered by default.
|
||||
|
||||
For Firefox in particular, this means that [`BrowserContentHandler.jsm`](https://searchfox.org/mozilla-central/source/browser/components/BrowserContentHandler.jsm) is not registered as a command-line-handler. This means that [`BrowserGlue.sys.mjs`](https://searchfox.org/mozilla-central/source/browser/components/BrowserGlue.sys.mjs) is not loaded, and this short circuits regular headed browsing startup.
|
||||
For Firefox in particular, this means that [`BrowserContentHandler.sys.mjs`](https://searchfox.org/mozilla-central/source/browser/components/BrowserContentHandler.sys.mjs) is not registered as a command-line-handler. This means that [`BrowserGlue.sys.mjs`](https://searchfox.org/mozilla-central/source/browser/components/BrowserGlue.sys.mjs) is not loaded, and this short circuits regular headed browsing startup.
|
||||
|
||||
See the [documentation for defining static components](https://firefox-source-docs.mozilla.org/build/buildsystem/defining-xpcom-components.html) for how to change this default behaviour, and [Bug 1675848](https://bugzilla.mozilla.org/show_bug.cgi?id=1675848) for details of the implementation.
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#define IDI_NEWWINDOW 3
|
||||
#define IDI_NEWTAB 4
|
||||
// If IDI_PBMODE's index changes, PRIVATE_BROWSING_ICON_INDEX
|
||||
// in BrowserContentHandler.jsm must also be updated.
|
||||
// in BrowserContentHandler.sys.mjs must also be updated.
|
||||
#define IDI_PBMODE 5
|
||||
#define IDI_DOCUMENT_PDF 6
|
||||
#ifndef IDI_APPLICATION
|
||||
|
|
Загрузка…
Ссылка в новой задаче