Bug 1792824 - Convert ObjectUtils.jsm to an ES module. r=barret,necko-reviewers,devtools-reviewers,kershaw

Depends on D183308

Differential Revision: https://phabricator.services.mozilla.com/D183309
This commit is contained in:
Mark Banner 2023-07-12 08:07:23 +00:00
Родитель 3a71af9693
Коммит 182b6db303
35 изменённых файлов: 49 добавлений и 124 удалений

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

@ -1,11 +1,7 @@
"use strict"; "use strict";
ChromeUtils.defineModuleGetter(
this,
"ObjectUtils",
"resource://gre/modules/ObjectUtils.jsm"
);
ChromeUtils.defineESModuleGetters(this, { ChromeUtils.defineESModuleGetters(this, {
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
PlacesTestUtils: "resource://testing-common/PlacesTestUtils.sys.mjs", PlacesTestUtils: "resource://testing-common/PlacesTestUtils.sys.mjs",
}); });
ChromeUtils.defineModuleGetter( ChromeUtils.defineModuleGetter(

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

@ -1,8 +1,8 @@
/* Any copyright is dedicated to the Public Domain. /* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */ http://creativecommons.org/publicdomain/zero/1.0/ */
const { ObjectUtils } = ChromeUtils.import( const { ObjectUtils } = ChromeUtils.importESModule(
"resource://gre/modules/ObjectUtils.jsm" "resource://gre/modules/ObjectUtils.sys.mjs"
); );
const MESSAGES = [ const MESSAGES = [

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

@ -30,9 +30,8 @@
/* :::::::: Constants and Helpers ::::::::::::::: */ /* :::::::: Constants and Helpers ::::::::::::::: */
const lazy = {}; const lazy = {};
const { AppConstants } = ChromeUtils.import( import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
"resource://gre/modules/AppConstants.jsm"
);
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
CrashMonitor: "resource://gre/modules/CrashMonitor.sys.mjs", CrashMonitor: "resource://gre/modules/CrashMonitor.sys.mjs",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs", PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",

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

@ -13,6 +13,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
BrowserUIUtils: "resource:///modules/BrowserUIUtils.sys.mjs", BrowserUIUtils: "resource:///modules/BrowserUIUtils.sys.mjs",
ExtensionSearchHandler: ExtensionSearchHandler:
"resource://gre/modules/ExtensionSearchHandler.sys.mjs", "resource://gre/modules/ExtensionSearchHandler.sys.mjs",
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
PartnerLinkAttribution: "resource:///modules/PartnerLinkAttribution.sys.mjs", PartnerLinkAttribution: "resource:///modules/PartnerLinkAttribution.sys.mjs",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs", PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs", PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs",
@ -30,10 +31,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
UrlbarView: "resource:///modules/UrlbarView.sys.mjs", UrlbarView: "resource:///modules/UrlbarView.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(lazy, {
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
});
XPCOMUtils.defineLazyServiceGetter( XPCOMUtils.defineLazyServiceGetter(
lazy, lazy,
"ClipboardHelper", "ClipboardHelper",

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

@ -114,6 +114,7 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
KeywordUtils: "resource://gre/modules/KeywordUtils.sys.mjs", KeywordUtils: "resource://gre/modules/KeywordUtils.sys.mjs",
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs", PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs", PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs",
Sqlite: "resource://gre/modules/Sqlite.sys.mjs", Sqlite: "resource://gre/modules/Sqlite.sys.mjs",
@ -125,10 +126,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
UrlbarTokenizer: "resource:///modules/UrlbarTokenizer.sys.mjs", UrlbarTokenizer: "resource:///modules/UrlbarTokenizer.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(lazy, {
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
});
function setTimeout(callback, ms) { function setTimeout(callback, ms) {
let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
timer.initWithCallback(callback, ms, timer.TYPE_ONE_SHOT); timer.initWithCallback(callback, ms, timer.TYPE_ONE_SHOT);

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

@ -12,6 +12,7 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs", PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
SkippableTimer: "resource:///modules/UrlbarUtils.sys.mjs", SkippableTimer: "resource:///modules/UrlbarUtils.sys.mjs",
UrlbarMuxer: "resource:///modules/UrlbarUtils.sys.mjs", UrlbarMuxer: "resource:///modules/UrlbarUtils.sys.mjs",
@ -22,10 +23,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
UrlbarUtils: "resource:///modules/UrlbarUtils.sys.mjs", UrlbarUtils: "resource:///modules/UrlbarUtils.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(lazy, {
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () => XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
lazy.UrlbarUtils.getLogger({ prefix: "ProvidersManager" }) lazy.UrlbarUtils.getLogger({ prefix: "ProvidersManager" })
); );

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

@ -10,6 +10,7 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.sys.mjs", BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.sys.mjs",
L10nCache: "resource:///modules/UrlbarUtils.sys.mjs", L10nCache: "resource:///modules/UrlbarUtils.sys.mjs",
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
UrlbarPrefs: "resource:///modules/UrlbarPrefs.sys.mjs", UrlbarPrefs: "resource:///modules/UrlbarPrefs.sys.mjs",
UrlbarProviderQuickSuggest: UrlbarProviderQuickSuggest:
"resource:///modules/UrlbarProviderQuickSuggest.sys.mjs", "resource:///modules/UrlbarProviderQuickSuggest.sys.mjs",
@ -22,10 +23,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
UrlbarUtils: "resource:///modules/UrlbarUtils.sys.mjs", UrlbarUtils: "resource:///modules/UrlbarUtils.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(lazy, {
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
});
XPCOMUtils.defineLazyServiceGetter( XPCOMUtils.defineLazyServiceGetter(
lazy, lazy,
"styleSheetService", "styleSheetService",

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

@ -11,6 +11,7 @@ ChromeUtils.defineESModuleGetters(this, {
AboutNewTab: "resource:///modules/AboutNewTab.sys.mjs", AboutNewTab: "resource:///modules/AboutNewTab.sys.mjs",
ExperimentAPI: "resource://nimbus/ExperimentAPI.sys.mjs", ExperimentAPI: "resource://nimbus/ExperimentAPI.sys.mjs",
ExperimentFakes: "resource://testing-common/NimbusTestUtils.sys.mjs", ExperimentFakes: "resource://testing-common/NimbusTestUtils.sys.mjs",
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs", PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs",
PromptTestUtils: "resource://testing-common/PromptTestUtils.sys.mjs", PromptTestUtils: "resource://testing-common/PromptTestUtils.sys.mjs",
ResetProfile: "resource://gre/modules/ResetProfile.sys.mjs", ResetProfile: "resource://gre/modules/ResetProfile.sys.mjs",
@ -25,10 +26,6 @@ ChromeUtils.defineESModuleGetters(this, {
sinon: "resource://testing-common/Sinon.sys.mjs", sinon: "resource://testing-common/Sinon.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(this, {
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
});
XPCOMUtils.defineLazyGetter(this, "PlacesFrecencyRecalculator", () => { XPCOMUtils.defineLazyGetter(this, "PlacesFrecencyRecalculator", () => {
return Cc["@mozilla.org/places/frecency-recalculator;1"].getService( return Cc["@mozilla.org/places/frecency-recalculator;1"].getService(
Ci.nsIObserver Ci.nsIObserver

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

@ -7,14 +7,11 @@
"use strict"; "use strict";
ChromeUtils.defineESModuleGetters(this, { ChromeUtils.defineESModuleGetters(this, {
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
SuggestionsMap: SuggestionsMap:
"resource:///modules/urlbar/private/QuickSuggestRemoteSettings.sys.mjs", "resource:///modules/urlbar/private/QuickSuggestRemoteSettings.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(this, {
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
});
// This overrides `SuggestionsMap.chunkSize`. Testing the actual value can make // This overrides `SuggestionsMap.chunkSize`. Testing the actual value can make
// the test run too long. This is OK because the correctness of the chunking // the test run too long. This is OK because the correctness of the chunking
// behavior doesn't depend on the chunk size. // behavior doesn't depend on the chunk size.

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

@ -7,8 +7,8 @@
var { XPCOMUtils } = ChromeUtils.importESModule( var { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
var { ObjectUtils } = ChromeUtils.import( var { ObjectUtils } = ChromeUtils.importESModule(
"resource://gre/modules/ObjectUtils.jsm" "resource://gre/modules/ObjectUtils.sys.mjs"
); );
var { FormLikeFactory } = ChromeUtils.importESModule( var { FormLikeFactory } = ChromeUtils.importESModule(
"resource://gre/modules/FormLikeFactory.sys.mjs" "resource://gre/modules/FormLikeFactory.sys.mjs"

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

@ -7,9 +7,12 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, { XPCOMUtils.defineLazyModuleGetters(lazy, {
ActivityStream: "resource://activity-stream/lib/ActivityStream.jsm", ActivityStream: "resource://activity-stream/lib/ActivityStream.jsm",
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
}); });
const ABOUT_URL = "about:newtab"; const ABOUT_URL = "about:newtab";

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

@ -23,8 +23,8 @@ ChromeUtils.defineESModuleGetters(this, {
"resource:///modules/BrowserUsageTelemetry.sys.mjs", "resource:///modules/BrowserUsageTelemetry.sys.mjs",
}); });
const { ObjectUtils } = ChromeUtils.import( const { ObjectUtils } = ChromeUtils.importESModule(
"resource://gre/modules/ObjectUtils.jsm" "resource://gre/modules/ObjectUtils.sys.mjs"
); );
BrowserUsageTelemetry._onTabsOpenedTask._timeoutMs = 0; BrowserUsageTelemetry._onTabsOpenedTask._timeoutMs = 0;

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

@ -20,14 +20,9 @@ ChromeUtils.defineESModuleGetters(lazy, {
FileUtils: "resource://gre/modules/FileUtils.sys.mjs", FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
NetworkHelper: NetworkHelper:
"resource://devtools/shared/network-observer/NetworkHelper.sys.mjs", "resource://devtools/shared/network-observer/NetworkHelper.sys.mjs",
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
}); });
ChromeUtils.defineModuleGetter(
lazy,
"ObjectUtils",
"resource://gre/modules/ObjectUtils.jsm"
);
// Native getters which are considered to be side effect free. // Native getters which are considered to be side effect free.
ChromeUtils.defineLazyGetter(lazy, "sideEffectFreeGetters", () => { ChromeUtils.defineLazyGetter(lazy, "sideEffectFreeGetters", () => {
const { const {

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

@ -11,13 +11,9 @@ import { PushCrypto } from "resource://gre/modules/PushCrypto.sys.mjs";
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
pushBroadcastService: "resource://gre/modules/PushBroadcastService.sys.mjs", pushBroadcastService: "resource://gre/modules/PushBroadcastService.sys.mjs",
}); });
ChromeUtils.defineModuleGetter(
lazy,
"ObjectUtils",
"resource://gre/modules/ObjectUtils.jsm"
);
const kPUSHWSDB_DB_NAME = "pushapi"; const kPUSHWSDB_DB_NAME = "pushapi";
const kPUSHWSDB_DB_VERSION = 5; // Change this if the IndexedDB format changes const kPUSHWSDB_DB_VERSION = 5; // Change this if the IndexedDB format changes

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

@ -8,6 +8,7 @@ var { XPCOMUtils } = ChromeUtils.importESModule(
); );
ChromeUtils.defineESModuleGetters(this, { ChromeUtils.defineESModuleGetters(this, {
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
PermissionTestUtils: "resource://testing-common/PermissionTestUtils.sys.mjs", PermissionTestUtils: "resource://testing-common/PermissionTestUtils.sys.mjs",
PlacesTestUtils: "resource://testing-common/PlacesTestUtils.sys.mjs", PlacesTestUtils: "resource://testing-common/PlacesTestUtils.sys.mjs",
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs", PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
@ -19,9 +20,6 @@ ChromeUtils.defineESModuleGetters(this, {
pushBroadcastService: "resource://gre/modules/PushBroadcastService.sys.mjs", pushBroadcastService: "resource://gre/modules/PushBroadcastService.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(this, {
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
});
var { var {
clearInterval, clearInterval,
clearTimeout, clearTimeout,

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

@ -9,8 +9,8 @@
/* import-globals-from head_channels.js */ /* import-globals-from head_channels.js */
/* import-globals-from head_servers.js */ /* import-globals-from head_servers.js */
XPCOMUtils.defineLazyModuleGetters(this, { ChromeUtils.defineESModuleGetters(this, {
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm", ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
}); });
add_setup(async function () { add_setup(async function () {

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

@ -10,12 +10,10 @@ ChromeUtils.defineESModuleGetters(lazy, {
AsyncShutdown: "resource://gre/modules/AsyncShutdown.sys.mjs", AsyncShutdown: "resource://gre/modules/AsyncShutdown.sys.mjs",
CommonUtils: "resource://services-common/utils.sys.mjs", CommonUtils: "resource://services-common/utils.sys.mjs",
IDBHelpers: "resource://services-settings/IDBHelpers.sys.mjs", IDBHelpers: "resource://services-settings/IDBHelpers.sys.mjs",
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
Utils: "resource://services-settings/Utils.sys.mjs", Utils: "resource://services-settings/Utils.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(lazy, {
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
});
XPCOMUtils.defineLazyGetter(lazy, "console", () => lazy.Utils.log); XPCOMUtils.defineLazyGetter(lazy, "console", () => lazy.Utils.log);
/** /**

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

@ -15,6 +15,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
Database: "resource://services-settings/Database.sys.mjs", Database: "resource://services-settings/Database.sys.mjs",
IDBHelpers: "resource://services-settings/IDBHelpers.sys.mjs", IDBHelpers: "resource://services-settings/IDBHelpers.sys.mjs",
KintoHttpClient: "resource://services-common/kinto-http-client.sys.mjs", KintoHttpClient: "resource://services-common/kinto-http-client.sys.mjs",
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
RemoteSettingsWorker: RemoteSettingsWorker:
"resource://services-settings/RemoteSettingsWorker.sys.mjs", "resource://services-settings/RemoteSettingsWorker.sys.mjs",
SharedUtils: "resource://services-settings/SharedUtils.sys.mjs", SharedUtils: "resource://services-settings/SharedUtils.sys.mjs",
@ -22,10 +23,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
Utils: "resource://services-settings/Utils.sys.mjs", Utils: "resource://services-settings/Utils.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(lazy, {
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
});
const TELEMETRY_COMPONENT = "remotesettings"; const TELEMETRY_COMPONENT = "remotesettings";
XPCOMUtils.defineLazyGetter(lazy, "console", () => lazy.Utils.log); XPCOMUtils.defineLazyGetter(lazy, "console", () => lazy.Utils.log);

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

@ -3,8 +3,8 @@
const { AppConstants } = ChromeUtils.importESModule( const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs" "resource://gre/modules/AppConstants.sys.mjs"
); );
const { ObjectUtils } = ChromeUtils.import( const { ObjectUtils } = ChromeUtils.importESModule(
"resource://gre/modules/ObjectUtils.jsm" "resource://gre/modules/ObjectUtils.sys.mjs"
); );
const { setTimeout } = ChromeUtils.importESModule( const { setTimeout } = ChromeUtils.importESModule(
"resource://gre/modules/Timer.sys.mjs" "resource://gre/modules/Timer.sys.mjs"

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

@ -22,6 +22,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
Async: "resource://services-common/async.sys.mjs", Async: "resource://services-common/async.sys.mjs",
AuthenticationError: "resource://services-sync/sync_auth.sys.mjs", AuthenticationError: "resource://services-sync/sync_auth.sys.mjs",
FxAccounts: "resource://gre/modules/FxAccounts.sys.mjs", FxAccounts: "resource://gre/modules/FxAccounts.sys.mjs",
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
Observers: "resource://services-common/observers.sys.mjs", Observers: "resource://services-common/observers.sys.mjs",
Resource: "resource://services-sync/resource.sys.mjs", Resource: "resource://services-sync/resource.sys.mjs",
Status: "resource://services-sync/status.sys.mjs", Status: "resource://services-sync/status.sys.mjs",
@ -32,10 +33,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
Weave: "resource://services-sync/main.sys.mjs", Weave: "resource://services-sync/main.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(lazy, {
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
});
XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => { XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => {
return ChromeUtils.importESModule( return ChromeUtils.importESModule(
"resource://gre/modules/FxAccounts.sys.mjs" "resource://gre/modules/FxAccounts.sys.mjs"

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

@ -36,8 +36,8 @@ var { PlacesUtils } = ChromeUtils.importESModule(
var { PlacesSyncUtils } = ChromeUtils.importESModule( var { PlacesSyncUtils } = ChromeUtils.importESModule(
"resource://gre/modules/PlacesSyncUtils.sys.mjs" "resource://gre/modules/PlacesSyncUtils.sys.mjs"
); );
var { ObjectUtils } = ChromeUtils.import( var { ObjectUtils } = ChromeUtils.importESModule(
"resource://gre/modules/ObjectUtils.jsm" "resource://gre/modules/ObjectUtils.sys.mjs"
); );
var { var {
MockFxaStorageManager, MockFxaStorageManager,

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

@ -7,12 +7,10 @@
Only the following listed symbols will exposed on import, and only when Only the following listed symbols will exposed on import, and only when
and where imported. */ and where imported. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {}; const lazy = {};
XPCOMUtils.defineLazyModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm", ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
}); });
export var Logger = { export var Logger = {

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

@ -6,9 +6,7 @@
// Copyright (c) 2009 Thomas Robinson <280north.com> // Copyright (c) 2009 Thomas Robinson <280north.com>
// MIT license: http://opensource.org/licenses/MIT // MIT license: http://opensource.org/licenses/MIT
const { ObjectUtils } = ChromeUtils.import( import { ObjectUtils } from "resource://gre/modules/ObjectUtils.sys.mjs";
"resource://gre/modules/ObjectUtils.jsm"
);
/** /**
* This module is based on the * This module is based on the

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

@ -7,14 +7,10 @@ const { sinon } = ChromeUtils.importESModule(
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
ChromeUtils.defineModuleGetter(
this,
"ObjectUtils",
"resource://gre/modules/ObjectUtils.jsm"
);
ChromeUtils.defineESModuleGetters(this, { ChromeUtils.defineESModuleGetters(this, {
ExperimentFakes: "resource://testing-common/NimbusTestUtils.sys.mjs", ExperimentFakes: "resource://testing-common/NimbusTestUtils.sys.mjs",
ExperimentTestUtils: "resource://testing-common/NimbusTestUtils.sys.mjs", ExperimentTestUtils: "resource://testing-common/NimbusTestUtils.sys.mjs",
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
}); });
// Sinon does not support Set or Map in spy.calledWith() // Sinon does not support Set or Map in spy.calledWith()

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

@ -14,16 +14,11 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
AsyncShutdown: "resource://gre/modules/AsyncShutdown.sys.mjs", AsyncShutdown: "resource://gre/modules/AsyncShutdown.sys.mjs",
DeferredTask: "resource://gre/modules/DeferredTask.sys.mjs", DeferredTask: "resource://gre/modules/DeferredTask.sys.mjs",
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs", PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs", PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs",
}); });
ChromeUtils.defineModuleGetter(
lazy,
"ObjectUtils",
"resource://gre/modules/ObjectUtils.jsm"
);
XPCOMUtils.defineLazyGetter(lazy, "logger", function () { XPCOMUtils.defineLazyGetter(lazy, "logger", function () {
return lazy.PlacesUtils.getLogger({ prefix: "FrecencyRecalculator" }); return lazy.PlacesUtils.getLogger({ prefix: "FrecencyRecalculator" });
}); });

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

@ -3,17 +3,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs", PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
requestIdleCallback: "resource://gre/modules/Timer.sys.mjs", requestIdleCallback: "resource://gre/modules/Timer.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(lazy, {
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
});
function isRedirectType(visitType) { function isRedirectType(visitType) {
const { TRANSITIONS } = lazy.PlacesUtils.history; const { TRANSITIONS } = lazy.PlacesUtils.history;

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

@ -35,6 +35,7 @@ ChromeUtils.defineESModuleGetters(this, {
BookmarkJSONUtils: "resource://gre/modules/BookmarkJSONUtils.sys.mjs", BookmarkJSONUtils: "resource://gre/modules/BookmarkJSONUtils.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs", FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
NetUtil: "resource://gre/modules/NetUtil.sys.mjs", NetUtil: "resource://gre/modules/NetUtil.sys.mjs",
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
PlacesBackups: "resource://gre/modules/PlacesBackups.sys.mjs", PlacesBackups: "resource://gre/modules/PlacesBackups.sys.mjs",
PlacesDBUtils: "resource://gre/modules/PlacesDBUtils.sys.mjs", PlacesDBUtils: "resource://gre/modules/PlacesDBUtils.sys.mjs",
PlacesTestUtils: "resource://testing-common/PlacesTestUtils.sys.mjs", PlacesTestUtils: "resource://testing-common/PlacesTestUtils.sys.mjs",
@ -46,10 +47,6 @@ ChromeUtils.defineESModuleGetters(this, {
TestUtils: "resource://testing-common/TestUtils.sys.mjs", TestUtils: "resource://testing-common/TestUtils.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(this, {
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
});
XPCOMUtils.defineLazyGetter(this, "SMALLPNG_DATA_URI", function () { XPCOMUtils.defineLazyGetter(this, "SMALLPNG_DATA_URI", function () {
return NetUtil.newURI( return NetUtil.newURI(
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAA" + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAA" +

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

@ -8,13 +8,10 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
DeferredTask: "resource://gre/modules/DeferredTask.sys.mjs", DeferredTask: "resource://gre/modules/DeferredTask.sys.mjs",
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
SearchUtils: "resource://gre/modules/SearchUtils.sys.mjs", SearchUtils: "resource://gre/modules/SearchUtils.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(lazy, {
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
});
XPCOMUtils.defineLazyGetter(lazy, "logConsole", () => { XPCOMUtils.defineLazyGetter(lazy, "logConsole", () => {
return console.createInstance({ return console.createInstance({
prefix: "SearchSettings", prefix: "SearchSettings",

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

@ -10,6 +10,7 @@ const { XPCOMUtils } = ChromeUtils.importESModule(
ChromeUtils.defineESModuleGetters(this, { ChromeUtils.defineESModuleGetters(this, {
AddonManager: "resource://gre/modules/AddonManager.sys.mjs", AddonManager: "resource://gre/modules/AddonManager.sys.mjs",
AddonTestUtils: "resource://testing-common/AddonTestUtils.sys.mjs", AddonTestUtils: "resource://testing-common/AddonTestUtils.sys.mjs",
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
Region: "resource://gre/modules/Region.sys.mjs", Region: "resource://gre/modules/Region.sys.mjs",
RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", RemoteSettings: "resource://services-settings/remote-settings.sys.mjs",
SearchEngine: "resource://gre/modules/SearchEngine.sys.mjs", SearchEngine: "resource://gre/modules/SearchEngine.sys.mjs",
@ -19,10 +20,6 @@ ChromeUtils.defineESModuleGetters(this, {
sinon: "resource://testing-common/Sinon.sys.mjs", sinon: "resource://testing-common/Sinon.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(this, {
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
});
XPCOMUtils.defineLazyGlobalGetters(this, ["fetch"]); XPCOMUtils.defineLazyGlobalGetters(this, ["fetch"]);
const GLOBAL_SCOPE = this; const GLOBAL_SCOPE = this;

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

@ -6,9 +6,7 @@ import { Log } from "resource://gre/modules/Log.sys.mjs";
import { TelemetryUtils } from "resource://gre/modules/TelemetryUtils.sys.mjs"; import { TelemetryUtils } from "resource://gre/modules/TelemetryUtils.sys.mjs";
const { ObjectUtils } = ChromeUtils.import( import { ObjectUtils } from "resource://gre/modules/ObjectUtils.sys.mjs";
"resource://gre/modules/ObjectUtils.jsm"
);
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
import { UpdateUtils } from "resource://gre/modules/UpdateUtils.sys.mjs"; import { UpdateUtils } from "resource://gre/modules/UpdateUtils.sys.mjs";

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

@ -24,13 +24,9 @@ const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs" "resource://gre/modules/AppConstants.sys.mjs"
); );
ChromeUtils.defineESModuleGetters(this, { ChromeUtils.defineESModuleGetters(this, {
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
Preferences: "resource://gre/modules/Preferences.sys.mjs", Preferences: "resource://gre/modules/Preferences.sys.mjs",
}); });
ChromeUtils.defineModuleGetter(
this,
"ObjectUtils",
"resource://gre/modules/ObjectUtils.jsm"
);
const Telemetry = Services.telemetry; const Telemetry = Services.telemetry;

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

@ -6,15 +6,11 @@
// Copyright (c) 2009 Thomas Robinson <280north.com> // Copyright (c) 2009 Thomas Robinson <280north.com>
// MIT license: http://opensource.org/licenses/MIT // MIT license: http://opensource.org/licenses/MIT
"use strict";
var EXPORTED_SYMBOLS = ["ObjectUtils"];
// Used only to cause test failures. // Used only to cause test failures.
var pSlice = Array.prototype.slice; var pSlice = Array.prototype.slice;
var ObjectUtils = { export var ObjectUtils = {
/** /**
* This tests objects & values for deep equality. * This tests objects & values for deep equality.
* *

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

@ -96,7 +96,7 @@ with Files("NLP.sys.mjs"):
with Files("NewTabUtils.sys.mjs"): with Files("NewTabUtils.sys.mjs"):
BUG_COMPONENT = ("Firefox", "Tabbed Browser") BUG_COMPONENT = ("Firefox", "Tabbed Browser")
with Files("ObjectUtils.jsm"): with Files("ObjectUtils.sys.mjs"):
BUG_COMPONENT = ("Toolkit", "Telemetry") BUG_COMPONENT = ("Toolkit", "Telemetry")
with Files("PermissionsUtils.sys.mjs"): with Files("PermissionsUtils.sys.mjs"):
@ -188,7 +188,7 @@ EXTRA_JS_MODULES += [
"Log.sys.mjs", "Log.sys.mjs",
"NewTabUtils.sys.mjs", "NewTabUtils.sys.mjs",
"NLP.sys.mjs", "NLP.sys.mjs",
"ObjectUtils.jsm", "ObjectUtils.sys.mjs",
"OsEnvironment.sys.mjs", "OsEnvironment.sys.mjs",
"OSKeyStore.sys.mjs", "OSKeyStore.sys.mjs",
"PermissionsUtils.sys.mjs", "PermissionsUtils.sys.mjs",

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

@ -1,5 +1,5 @@
const { ObjectUtils } = ChromeUtils.import( const { ObjectUtils } = ChromeUtils.importESModule(
"resource://gre/modules/ObjectUtils.jsm" "resource://gre/modules/ObjectUtils.sys.mjs"
); );
add_task(async function test_deepEqual() { add_task(async function test_deepEqual() {

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

@ -1,7 +1,7 @@
"use strict"; "use strict";
var { ObjectUtils } = ChromeUtils.import( var { ObjectUtils } = ChromeUtils.importESModule(
"resource://gre/modules/ObjectUtils.jsm" "resource://gre/modules/ObjectUtils.sys.mjs"
); );
var { PromiseTestUtils } = ChromeUtils.importESModule( var { PromiseTestUtils } = ChromeUtils.importESModule(
"resource://testing-common/PromiseTestUtils.sys.mjs" "resource://testing-common/PromiseTestUtils.sys.mjs"