зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1821305 - Convert toolkit/components/crashmonitor/ to ES modules. r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D172357
This commit is contained in:
Родитель
dbc23e4b1e
Коммит
d3d2c2d1b5
|
@ -32,16 +32,12 @@
|
|||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
CrashMonitor: "resource://gre/modules/CrashMonitor.sys.mjs",
|
||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
|
||||
SessionFile: "resource:///modules/sessionstore/SessionFile.sys.mjs",
|
||||
StartupPerformance:
|
||||
"resource:///modules/sessionstore/StartupPerformance.sys.mjs",
|
||||
});
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"CrashMonitor",
|
||||
"resource://gre/modules/CrashMonitor.jsm"
|
||||
);
|
||||
|
||||
const STATE_RUNNING_STR = "running";
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ function afterSessionStartupInitialization(cb) {
|
|||
|
||||
// We need the Crash Monitor initialized for sessionstartup to run
|
||||
// successfully.
|
||||
const { CrashMonitor } = ChromeUtils.import(
|
||||
"resource://gre/modules/CrashMonitor.jsm"
|
||||
const { CrashMonitor } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/CrashMonitor.sys.mjs"
|
||||
);
|
||||
CrashMonitor.init();
|
||||
|
||||
|
|
|
@ -31,14 +31,8 @@
|
|||
* does not necessarily tell us that the checkpoint wasn't reached.
|
||||
*/
|
||||
|
||||
var EXPORTED_SYMBOLS = ["CrashMonitor"];
|
||||
|
||||
const { PrivateBrowsingUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/PrivateBrowsingUtils.sys.mjs"
|
||||
);
|
||||
const { PromiseUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/PromiseUtils.sys.mjs"
|
||||
);
|
||||
import { PrivateBrowsingUtils } from "resource://gre/modules/PrivateBrowsingUtils.sys.mjs";
|
||||
import { PromiseUtils } from "resource://gre/modules/PromiseUtils.sys.mjs";
|
||||
|
||||
const SESSIONSTORE_WINDOWS_RESTORED_TOPIC = "sessionstore-windows-restored";
|
||||
const SESSIONSTORE_FINAL_STATE_WRITE_COMPLETE_TOPIC =
|
||||
|
@ -130,7 +124,7 @@ var CrashMonitorInternal = {
|
|||
},
|
||||
};
|
||||
|
||||
var CrashMonitor = {
|
||||
export var CrashMonitor = {
|
||||
/**
|
||||
* Notifications received during previous session.
|
||||
*
|
||||
|
@ -238,4 +232,5 @@ var CrashMonitor = {
|
|||
}
|
||||
},
|
||||
};
|
||||
|
||||
Object.freeze(CrashMonitor);
|
|
@ -8,7 +8,7 @@ Classes = [
|
|||
{
|
||||
'cid': '{d9d75e86-8f17-4c57-993e-f738f0d86d42}',
|
||||
'contract_ids': ['@mozilla.org/toolkit/crashmonitor;1'],
|
||||
'jsm': 'resource://gre/modules/nsCrashMonitor.jsm',
|
||||
'esModule': 'resource://gre/modules/nsCrashMonitor.sys.mjs',
|
||||
'constructor': 'CrashMonitor',
|
||||
'categories': {'profile-after-change': 'CrashMonitor'},
|
||||
},
|
||||
|
|
|
@ -10,8 +10,8 @@ with Files("**"):
|
|||
XPCSHELL_TESTS_MANIFESTS += ["test/unit/xpcshell.ini"]
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
"CrashMonitor.jsm",
|
||||
"nsCrashMonitor.jsm",
|
||||
"CrashMonitor.sys.mjs",
|
||||
"nsCrashMonitor.sys.mjs",
|
||||
]
|
||||
|
||||
XPCOM_MANIFESTS += [
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
* 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 MonitorAPI = ChromeUtils.import("resource://gre/modules/CrashMonitor.jsm")
|
||||
.CrashMonitor;
|
||||
var MonitorAPI = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/CrashMonitor.sys.mjs"
|
||||
).CrashMonitor;
|
||||
|
||||
function CrashMonitor() {}
|
||||
export function CrashMonitor() {}
|
||||
|
||||
CrashMonitor.prototype = {
|
||||
classID: Components.ID("{d9d75e86-8f17-4c57-993e-f738f0d86d42}"),
|
||||
|
@ -20,5 +21,3 @@ CrashMonitor.prototype = {
|
|||
}
|
||||
},
|
||||
};
|
||||
|
||||
var EXPORTED_SYMBOLS = ["CrashMonitor"];
|
|
@ -19,8 +19,8 @@ function run_test() {
|
|||
PathUtils.profileDir,
|
||||
"sessionCheckpoints.json"
|
||||
);
|
||||
({ CrashMonitor } = ChromeUtils.import(
|
||||
"resource://gre/modules/CrashMonitor.jsm"
|
||||
({ CrashMonitor } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/CrashMonitor.sys.mjs"
|
||||
));
|
||||
run_next_test();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче