diff --git a/services/common/hawkrequest.js b/services/common/hawkrequest.js index 82adfe89a9b6..0d14dc151bcc 100644 --- a/services/common/hawkrequest.js +++ b/services/common/hawkrequest.js @@ -82,8 +82,6 @@ var HAWKAuthenticatedRESTRequest = function HawkAuthenticatedRESTRequest( this._intl = getIntl(); }; HAWKAuthenticatedRESTRequest.prototype = { - __proto__: RESTRequest.prototype, - async dispatch(method, data) { let contentType = "text/plain"; if (method == "POST" || method == "PUT" || method == "PATCH") { @@ -117,6 +115,11 @@ HAWKAuthenticatedRESTRequest.prototype = { }, }; +Object.setPrototypeOf( + HAWKAuthenticatedRESTRequest.prototype, + RESTRequest.prototype +); + /** * Generic function to derive Hawk credentials. * diff --git a/services/common/modules-testing/logging.js b/services/common/modules-testing/logging.js index b03ba970d25a..797f76843cfa 100644 --- a/services/common/modules-testing/logging.js +++ b/services/common/modules-testing/logging.js @@ -32,7 +32,7 @@ function initTestLogging(level) { ); }, }; - LogStats.prototype.__proto__ = new Log.BasicFormatter(); + Object.setPrototypeOf(LogStats.prototype, new Log.BasicFormatter()); let log = Log.repository.rootLogger; let logStats = new LogStats(); diff --git a/services/common/rest.js b/services/common/rest.js index 952619868b1d..9a9daeb52796 100644 --- a/services/common/rest.js +++ b/services/common/rest.js @@ -710,8 +710,6 @@ function TokenAuthenticatedRESTRequest(uri, authToken, extra) { this.extra = extra || {}; } TokenAuthenticatedRESTRequest.prototype = { - __proto__: RESTRequest.prototype, - async dispatch(method, data) { let sig = await lazy.CryptoUtils.computeHTTPMACSHA1( this.authToken.id, @@ -726,3 +724,8 @@ TokenAuthenticatedRESTRequest.prototype = { return super.dispatch(method, data); }, }; + +Object.setPrototypeOf( + TokenAuthenticatedRESTRequest.prototype, + RESTRequest.prototype +); diff --git a/services/fxaccounts/tests/xpcshell/test_accounts.js b/services/fxaccounts/tests/xpcshell/test_accounts.js index 50ad3bdb3e0a..ab4fb58b0767 100644 --- a/services/fxaccounts/tests/xpcshell/test_accounts.js +++ b/services/fxaccounts/tests/xpcshell/test_accounts.js @@ -178,10 +178,11 @@ function MockFxAccountsClient() { FxAccountsClient.apply(this); } -MockFxAccountsClient.prototype = { - __proto__: FxAccountsClient.prototype, -}; - +MockFxAccountsClient.prototype = {}; +Object.setPrototypeOf( + MockFxAccountsClient.prototype, + FxAccountsClient.prototype +); /* * We need to mock the FxAccounts module's interfaces to external * services, such as storage and the FxAccounts client. We also diff --git a/services/fxaccounts/tests/xpcshell/test_accounts_device_registration.js b/services/fxaccounts/tests/xpcshell/test_accounts_device_registration.js index 011156bb3aec..613d1ec5b4c2 100644 --- a/services/fxaccounts/tests/xpcshell/test_accounts_device_registration.js +++ b/services/fxaccounts/tests/xpcshell/test_accounts_device_registration.js @@ -120,9 +120,11 @@ function MockFxAccountsClient(device) { FxAccountsClient.apply(this); } -MockFxAccountsClient.prototype = { - __proto__: FxAccountsClient.prototype, -}; +MockFxAccountsClient.prototype = {}; +Object.setPrototypeOf( + MockFxAccountsClient.prototype, + FxAccountsClient.prototype +); async function MockFxAccounts(credentials, device = {}) { let fxa = new FxAccounts({ diff --git a/services/fxaccounts/tests/xpcshell/test_commands.js b/services/fxaccounts/tests/xpcshell/test_commands.js index ffb33d97a819..e58bc4e6d6aa 100644 --- a/services/fxaccounts/tests/xpcshell/test_commands.js +++ b/services/fxaccounts/tests/xpcshell/test_commands.js @@ -45,9 +45,11 @@ function MockFxAccountsClient() { FxAccountsClient.apply(this); } -MockFxAccountsClient.prototype = { - __proto__: FxAccountsClient.prototype, -}; +MockFxAccountsClient.prototype = {}; +Object.setPrototypeOf( + MockFxAccountsClient.prototype, + FxAccountsClient.prototype +); add_task(async function test_sendtab_isDeviceCompatible() { const sendTab = new SendTab(null, null); diff --git a/services/fxaccounts/tests/xpcshell/test_oauth_token_storage.js b/services/fxaccounts/tests/xpcshell/test_oauth_token_storage.js index 1eb188ef7b76..ecd6cafb7fb3 100644 --- a/services/fxaccounts/tests/xpcshell/test_oauth_token_storage.js +++ b/services/fxaccounts/tests/xpcshell/test_oauth_token_storage.js @@ -88,9 +88,11 @@ function MockFxAccountsClient() { FxAccountsClient.apply(this); } -MockFxAccountsClient.prototype = { - __proto__: FxAccountsClient.prototype, -}; +MockFxAccountsClient.prototype = {}; +Object.setPrototypeOf( + MockFxAccountsClient.prototype, + FxAccountsClient.prototype +); function MockFxAccounts(device = {}) { return new FxAccounts({ diff --git a/services/fxaccounts/tests/xpcshell/test_oauth_tokens.js b/services/fxaccounts/tests/xpcshell/test_oauth_tokens.js index 24835979cbc9..ee7eeb85892a 100644 --- a/services/fxaccounts/tests/xpcshell/test_oauth_tokens.js +++ b/services/fxaccounts/tests/xpcshell/test_oauth_tokens.js @@ -108,9 +108,11 @@ function MockFxAccountsClient(activeTokens) { FxAccountsClient.apply(this); } -MockFxAccountsClient.prototype = { - __proto__: FxAccountsClient.prototype, -}; +MockFxAccountsClient.prototype = {}; +Object.setPrototypeOf( + MockFxAccountsClient.prototype, + FxAccountsClient.prototype +); function MockFxAccounts() { // The FxA "auth" and "oauth" servers both share the same db of tokens, diff --git a/services/sync/modules-testing/rotaryengine.js b/services/sync/modules-testing/rotaryengine.js index 888c7fe6f278..e8d4293c5afa 100644 --- a/services/sync/modules-testing/rotaryengine.js +++ b/services/sync/modules-testing/rotaryengine.js @@ -31,9 +31,8 @@ const { SerializableSet, Utils } = ChromeUtils.import( function RotaryRecord(collection, id) { CryptoWrapper.call(this, collection, id); } -RotaryRecord.prototype = { - __proto__: CryptoWrapper.prototype, -}; +RotaryRecord.prototype = {}; +Object.setPrototypeOf(RotaryRecord.prototype, CryptoWrapper.prototype); Utils.deferGetSet(RotaryRecord, "cleartext", ["denomination"]); function RotaryStore(name, engine) { @@ -41,8 +40,6 @@ function RotaryStore(name, engine) { this.items = {}; } RotaryStore.prototype = { - __proto__: Store.prototype, - async create(record) { this.items[record.id] = record.denomination; }, @@ -92,12 +89,13 @@ RotaryStore.prototype = { }, }; +Object.setPrototypeOf(RotaryStore.prototype, Store.prototype); + function RotaryTracker(name, engine) { LegacyTracker.call(this, name, engine); } -RotaryTracker.prototype = { - __proto__: LegacyTracker.prototype, -}; +RotaryTracker.prototype = {}; +Object.setPrototypeOf(RotaryTracker.prototype, LegacyTracker.prototype); function RotaryEngine(service) { SyncEngine.call(this, "Rotary", service); @@ -106,7 +104,6 @@ function RotaryEngine(service) { this.previousFailed = new SerializableSet(); } RotaryEngine.prototype = { - __proto__: SyncEngine.prototype, _storeObj: RotaryStore, _trackerObj: RotaryTracker, _recordObj: RotaryRecord, @@ -126,3 +123,4 @@ RotaryEngine.prototype = { return null; }, }; +Object.setPrototypeOf(RotaryEngine.prototype, SyncEngine.prototype); diff --git a/services/sync/modules-testing/utils.js b/services/sync/modules-testing/utils.js index a81467398d58..38bd5186b7b6 100644 --- a/services/sync/modules-testing/utils.js +++ b/services/sync/modules-testing/utils.js @@ -251,11 +251,14 @@ var configureFxAccountIdentity = function( FxAccountsClient.apply(this); }; MockFxAccountsClient.prototype = { - __proto__: FxAccountsClient.prototype, accountStatus() { return Promise.resolve(true); }, }; + Object.setPrototypeOf( + MockFxAccountsClient.prototype, + FxAccountsClient.prototype + ); let mockFxAClient = new MockFxAccountsClient(); fxa._internal._fxAccountsClient = mockFxAClient; diff --git a/services/sync/modules/bridged_engine.js b/services/sync/modules/bridged_engine.js index aa3a98a86308..9882f4db59aa 100644 --- a/services/sync/modules/bridged_engine.js +++ b/services/sync/modules/bridged_engine.js @@ -317,8 +317,6 @@ function BridgedEngine(name, service) { } BridgedEngine.prototype = { - __proto__: SyncEngine.prototype, - /** * The Rust implemented bridge. Must be set by the engine which subclasses us. */ @@ -494,6 +492,7 @@ BridgedEngine.prototype = { await this._bridge.reset(); }, }; +Object.setPrototypeOf(BridgedEngine.prototype, SyncEngine.prototype); function transformError(code, message) { switch (code) { diff --git a/services/sync/modules/engines.js b/services/sync/modules/engines.js index 755b68a26302..64e2aff284b2 100644 --- a/services/sync/modules/engines.js +++ b/services/sync/modules/engines.js @@ -220,8 +220,6 @@ function LegacyTracker(name, engine) { } LegacyTracker.prototype = { - __proto__: Tracker.prototype, - get ignoreAll() { return this._ignoreAll; }, @@ -333,6 +331,7 @@ LegacyTracker.prototype = { await this._storage.finalize(); }, }; +Object.setPrototypeOf(LegacyTracker.prototype, Tracker.prototype); /** * The Store serves as the interface between Sync and stored data. diff --git a/services/sync/modules/engines/addons.js b/services/sync/modules/engines/addons.js index 1fc0f9b5a830..8d81c79686f3 100644 --- a/services/sync/modules/engines/addons.js +++ b/services/sync/modules/engines/addons.js @@ -110,9 +110,9 @@ function AddonRecord(collection, id) { CryptoWrapper.call(this, collection, id); } AddonRecord.prototype = { - __proto__: CryptoWrapper.prototype, _logName: "Record.Addon", }; +Object.setPrototypeOf(AddonRecord.prototype, CryptoWrapper.prototype); Utils.deferGetSet(AddonRecord, "cleartext", [ "addonID", @@ -137,7 +137,6 @@ function AddonsEngine(service) { this._reconciler = new AddonsReconciler(this._tracker.asyncObserver); } AddonsEngine.prototype = { - __proto__: SyncEngine.prototype, _storeObj: AddonsStore, _trackerObj: AddonsTracker, _recordObj: AddonRecord, @@ -266,6 +265,7 @@ AddonsEngine.prototype = { return this._store.isAddonSyncable(addon, ignoreRepoCheck); }, }; +Object.setPrototypeOf(AddonsEngine.prototype, SyncEngine.prototype); /** * This is the primary interface between Sync and the Addons Manager. @@ -277,8 +277,6 @@ function AddonsStore(name, engine) { Store.call(this, name, engine); } AddonsStore.prototype = { - __proto__: Store.prototype, - // Define the add-on types (.type) that we support. _syncableTypes: ["extension", "theme"], @@ -728,6 +726,8 @@ AddonsStore.prototype = { }, }; +Object.setPrototypeOf(AddonsStore.prototype, Store.prototype); + /** * The add-ons tracker keeps track of real-time changes to add-ons. * @@ -737,8 +737,6 @@ function AddonsTracker(name, engine) { LegacyTracker.call(this, name, engine); } AddonsTracker.prototype = { - __proto__: LegacyTracker.prototype, - get reconciler() { return this.engine._reconciler; }, @@ -782,6 +780,8 @@ AddonsTracker.prototype = { }, }; +Object.setPrototypeOf(AddonsTracker.prototype, LegacyTracker.prototype); + class AddonValidator extends CollectionValidator { constructor(engine = null) { super("addons", "id", ["addonID", "enabled", "applicationID", "source"]); diff --git a/services/sync/modules/engines/bookmarks.js b/services/sync/modules/engines/bookmarks.js index 405ef1b83248..85e1f0825718 100644 --- a/services/sync/modules/engines/bookmarks.js +++ b/services/sync/modules/engines/bookmarks.js @@ -116,7 +116,7 @@ PlacesItem.prototype = { // Convert the abstract places item to the actual object type if (!this.deleted) { - this.__proto__ = this.getTypeObject(this.type).prototype; + Object.setPrototypeOf(this, this.getTypeObject(this.type).prototype); } return clear; @@ -130,7 +130,6 @@ PlacesItem.prototype = { return recordObj; }, - __proto__: CryptoWrapper.prototype, _logName: "Sync.Record.PlacesItem", // Converts the record to a Sync bookmark object that can be passed to @@ -162,6 +161,8 @@ PlacesItem.prototype = { }, }; +Object.setPrototypeOf(PlacesItem.prototype, CryptoWrapper.prototype); + Utils.deferGetSet(PlacesItem, "cleartext", [ "hasDupe", "parentid", @@ -174,7 +175,6 @@ function Bookmark(collection, id, type) { PlacesItem.call(this, collection, id, type || "bookmark"); } Bookmark.prototype = { - __proto__: PlacesItem.prototype, _logName: "Sync.Record.Bookmark", toSyncBookmark() { @@ -197,6 +197,8 @@ Bookmark.prototype = { }, }; +Object.setPrototypeOf(Bookmark.prototype, PlacesItem.prototype); + Utils.deferGetSet(Bookmark, "cleartext", [ "title", "bmkUri", @@ -209,7 +211,6 @@ function BookmarkQuery(collection, id) { Bookmark.call(this, collection, id, "query"); } BookmarkQuery.prototype = { - __proto__: Bookmark.prototype, _logName: "Sync.Record.BookmarkQuery", toSyncBookmark() { @@ -226,13 +227,14 @@ BookmarkQuery.prototype = { }, }; +Object.setPrototypeOf(BookmarkQuery.prototype, Bookmark.prototype); + Utils.deferGetSet(BookmarkQuery, "cleartext", ["folderName", "queryId"]); function BookmarkFolder(collection, id, type) { PlacesItem.call(this, collection, id, type || "folder"); } BookmarkFolder.prototype = { - __proto__: PlacesItem.prototype, _logName: "Sync.Record.Folder", toSyncBookmark() { @@ -250,6 +252,8 @@ BookmarkFolder.prototype = { }, }; +Object.setPrototypeOf(BookmarkFolder.prototype, PlacesItem.prototype); + Utils.deferGetSet(BookmarkFolder, "cleartext", [ "description", "title", @@ -260,7 +264,6 @@ function Livemark(collection, id) { BookmarkFolder.call(this, collection, id, "livemark"); } Livemark.prototype = { - __proto__: BookmarkFolder.prototype, _logName: "Sync.Record.Livemark", toSyncBookmark() { @@ -279,13 +282,14 @@ Livemark.prototype = { }, }; +Object.setPrototypeOf(Livemark.prototype, BookmarkFolder.prototype); + Utils.deferGetSet(Livemark, "cleartext", ["siteUri", "feedUri"]); function BookmarkSeparator(collection, id) { PlacesItem.call(this, collection, id, "separator"); } BookmarkSeparator.prototype = { - __proto__: PlacesItem.prototype, _logName: "Sync.Record.Separator", fromSyncBookmark(item) { @@ -294,6 +298,8 @@ BookmarkSeparator.prototype = { }, }; +Object.setPrototypeOf(BookmarkSeparator.prototype, PlacesItem.prototype); + Utils.deferGetSet(BookmarkSeparator, "cleartext", "pos"); /** @@ -306,7 +312,6 @@ function BookmarksEngine(service) { SyncEngine.call(this, "Bookmarks", service); } BookmarksEngine.prototype = { - __proto__: SyncEngine.prototype, _recordObj: PlacesItem, _trackerObj: BookmarksTracker, _storeObj: BookmarksStore, @@ -628,6 +633,8 @@ BookmarksEngine.prototype = { }, }; +Object.setPrototypeOf(BookmarksEngine.prototype, SyncEngine.prototype); + /** * The bookmarks store delegates to the mirror for staging and applying * records. Most `Store` methods intentionally remain abstract, so you can't use @@ -639,8 +646,6 @@ function BookmarksStore(name, engine) { } BookmarksStore.prototype = { - __proto__: Store.prototype, - _openMirrorPromise: null, // For tests. @@ -787,6 +792,8 @@ BookmarksStore.prototype = { }, }; +Object.setPrototypeOf(BookmarksStore.prototype, Store.prototype); + // The bookmarks tracker is a special flower. Instead of listening for changes // via observer notifications, it queries Places for the set of items that have // changed since the last sync. Because it's a "pull-based" tracker, it ignores @@ -796,8 +803,6 @@ function BookmarksTracker(name, engine) { Tracker.call(this, name, engine); } BookmarksTracker.prototype = { - __proto__: Tracker.prototype, - onStart() { lazy.PlacesUtils.bookmarks.addObserver(this, true); this._placesListener = new PlacesWeakCallbackWrapper( @@ -941,6 +946,8 @@ BookmarksTracker.prototype = { }, }; +Object.setPrototypeOf(BookmarksTracker.prototype, Tracker.prototype); + /** * A changeset that stores extra metadata in a change record for each ID. The * engine updates this metadata when uploading Sync records, and writes it back diff --git a/services/sync/modules/engines/clients.js b/services/sync/modules/engines/clients.js index 5ec5398b5c9e..1c241a52664d 100644 --- a/services/sync/modules/engines/clients.js +++ b/services/sync/modules/engines/clients.js @@ -88,10 +88,10 @@ function ClientsRec(collection, id) { CryptoWrapper.call(this, collection, id); } ClientsRec.prototype = { - __proto__: CryptoWrapper.prototype, _logName: "Sync.Record.Clients", ttl: CLIENTS_TTL, }; +Object.setPrototypeOf(ClientsRec.prototype, CryptoWrapper.prototype); Utils.deferGetSet(ClientsRec, "cleartext", [ "name", @@ -115,7 +115,6 @@ function ClientEngine(service) { Utils.defineLazyIDProperty(this, "localID", "services.sync.client.GUID"); } ClientEngine.prototype = { - __proto__: SyncEngine.prototype, _storeObj: ClientStore, _recordObj: ClientsRec, _trackerObj: ClientsTracker, @@ -949,13 +948,12 @@ ClientEngine.prototype = { this._modified.delete(id); }, }; +Object.setPrototypeOf(ClientEngine.prototype, SyncEngine.prototype); function ClientStore(name, engine) { Store.call(this, name, engine); } ClientStore.prototype = { - __proto__: Store.prototype, - _remoteClients: {}, async create(record) { @@ -1088,13 +1086,12 @@ ClientStore.prototype = { this._remoteClients = {}; }, }; +Object.setPrototypeOf(ClientStore.prototype, Store.prototype); function ClientsTracker(name, engine) { LegacyTracker.call(this, name, engine); } ClientsTracker.prototype = { - __proto__: LegacyTracker.prototype, - _enabled: false, onStart() { @@ -1124,3 +1121,4 @@ ClientsTracker.prototype = { } }, }; +Object.setPrototypeOf(ClientsTracker.prototype, LegacyTracker.prototype); diff --git a/services/sync/modules/engines/extension-storage.js b/services/sync/modules/engines/extension-storage.js index 5c1feea27b88..ed93c376dd42 100644 --- a/services/sync/modules/engines/extension-storage.js +++ b/services/sync/modules/engines/extension-storage.js @@ -87,7 +87,6 @@ function ExtensionStorageEngineBridge(service) { } ExtensionStorageEngineBridge.prototype = { - __proto__: BridgedEngine.prototype, syncPriority: 10, // Used to override the engine name in telemetry, so that we can distinguish . @@ -185,6 +184,10 @@ ExtensionStorageEngineBridge.prototype = { setEngineEnabled(enabled); }, }; +Object.setPrototypeOf( + ExtensionStorageEngineBridge.prototype, + BridgedEngine.prototype +); /** ***************************************************************************** @@ -212,7 +215,6 @@ function ExtensionStorageEngineKinto(service) { ); } ExtensionStorageEngineKinto.prototype = { - __proto__: SyncEngine.prototype, _trackerObj: ExtensionStorageTracker, // we don't need these since we implement our own sync logic _storeObj: undefined, @@ -266,14 +268,16 @@ ExtensionStorageEngineKinto.prototype = { return shouldSkip; }, }; +Object.setPrototypeOf( + ExtensionStorageEngineKinto.prototype, + SyncEngine.prototype +); function ExtensionStorageTracker(name, engine) { Tracker.call(this, name, engine); this._ignoreAll = false; } ExtensionStorageTracker.prototype = { - __proto__: Tracker.prototype, - get ignoreAll() { return this._ignoreAll; }, @@ -304,3 +308,4 @@ ExtensionStorageTracker.prototype = { this.score += lazy.SCORE_INCREMENT_MEDIUM; }, }; +Object.setPrototypeOf(ExtensionStorageTracker.prototype, Tracker.prototype); diff --git a/services/sync/modules/engines/forms.js b/services/sync/modules/engines/forms.js index 82d41648da95..da970eb92e12 100644 --- a/services/sync/modules/engines/forms.js +++ b/services/sync/modules/engines/forms.js @@ -32,10 +32,10 @@ function FormRec(collection, id) { CryptoWrapper.call(this, collection, id); } FormRec.prototype = { - __proto__: CryptoWrapper.prototype, _logName: "Sync.Record.Form", ttl: FORMS_TTL, }; +Object.setPrototypeOf(FormRec.prototype, CryptoWrapper.prototype); Utils.deferGetSet(FormRec, "cleartext", ["name", "value"]); @@ -91,7 +91,6 @@ function FormEngine(service) { SyncEngine.call(this, "Forms", service); } FormEngine.prototype = { - __proto__: SyncEngine.prototype, _storeObj: FormStore, _trackerObj: FormTracker, _recordObj: FormRec, @@ -106,13 +105,12 @@ FormEngine.prototype = { return FormWrapper.getGUID(item.name, item.value); }, }; +Object.setPrototypeOf(FormEngine.prototype, SyncEngine.prototype); function FormStore(name, engine) { Store.call(this, name, engine); } FormStore.prototype = { - __proto__: Store.prototype, - async _processChange(change) { // If this._changes is defined, then we are applying a batch, so we // can defer it. @@ -197,13 +195,12 @@ FormStore.prototype = { await FormWrapper._update(change); }, }; +Object.setPrototypeOf(FormStore.prototype, Store.prototype); function FormTracker(name, engine) { LegacyTracker.call(this, name, engine); } FormTracker.prototype = { - __proto__: LegacyTracker.prototype, - QueryInterface: ChromeUtils.generateQI([ "nsIObserver", "nsISupportsWeakReference", @@ -238,6 +235,7 @@ FormTracker.prototype = { } }, }; +Object.setPrototypeOf(FormTracker.prototype, LegacyTracker.prototype); class FormsProblemData extends CollectionProblemData { getSummary() { diff --git a/services/sync/modules/engines/history.js b/services/sync/modules/engines/history.js index 2a1d5e9cac87..d23c72e8e845 100644 --- a/services/sync/modules/engines/history.js +++ b/services/sync/modules/engines/history.js @@ -36,10 +36,10 @@ function HistoryRec(collection, id) { CryptoWrapper.call(this, collection, id); } HistoryRec.prototype = { - __proto__: CryptoWrapper.prototype, _logName: "Sync.Record.History", ttl: HISTORY_TTL, }; +Object.setPrototypeOf(HistoryRec.prototype, CryptoWrapper.prototype); Utils.deferGetSet(HistoryRec, "cleartext", ["histUri", "title", "visits"]); @@ -47,7 +47,6 @@ function HistoryEngine(service) { SyncEngine.call(this, "History", service); } HistoryEngine.prototype = { - __proto__: SyncEngine.prototype, _recordObj: HistoryRec, _storeObj: HistoryStore, _trackerObj: HistoryTracker, @@ -115,14 +114,13 @@ HistoryEngine.prototype = { await lazy.PlacesSyncUtils.history.reset(); }, }; +Object.setPrototypeOf(HistoryEngine.prototype, SyncEngine.prototype); function HistoryStore(name, engine) { Store.call(this, name, engine); } HistoryStore.prototype = { - __proto__: Store.prototype, - // We try and only update this many visits at one time. MAX_VISITS_PER_INSERT: 500, @@ -499,13 +497,12 @@ HistoryStore.prototype = { return lazy.PlacesSyncUtils.history.wipe(); }, }; +Object.setPrototypeOf(HistoryStore.prototype, Store.prototype); function HistoryTracker(name, engine) { LegacyTracker.call(this, name, engine); } HistoryTracker.prototype = { - __proto__: LegacyTracker.prototype, - onStart() { this._log.info("Adding Places observer."); this._placesObserver = new PlacesWeakCallbackWrapper( @@ -582,3 +579,4 @@ HistoryTracker.prototype = { } }, }; +Object.setPrototypeOf(HistoryTracker.prototype, LegacyTracker.prototype); diff --git a/services/sync/modules/engines/passwords.js b/services/sync/modules/engines/passwords.js index fc6cb03e93f1..3345209a0272 100644 --- a/services/sync/modules/engines/passwords.js +++ b/services/sync/modules/engines/passwords.js @@ -54,7 +54,6 @@ function LoginRec(collection, id) { CryptoWrapper.call(this, collection, id); } LoginRec.prototype = { - __proto__: CryptoWrapper.prototype, _logName: "Sync.Record.Login", cleartextToString() { @@ -65,6 +64,7 @@ LoginRec.prototype = { return JSON.stringify(o); }, }; +Object.setPrototypeOf(LoginRec.prototype, CryptoWrapper.prototype); Utils.deferGetSet(LoginRec, "cleartext", [ "hostname", @@ -82,7 +82,6 @@ function PasswordEngine(service) { SyncEngine.call(this, "Passwords", service); } PasswordEngine.prototype = { - __proto__: SyncEngine.prototype, _storeObj: PasswordStore, _trackerObj: PasswordTracker, _recordObj: LoginRec, @@ -185,6 +184,7 @@ PasswordEngine.prototype = { return new PasswordValidator(); }, }; +Object.setPrototypeOf(PasswordEngine.prototype, SyncEngine.prototype); function PasswordStore(name, engine) { Store.call(this, name, engine); @@ -195,8 +195,6 @@ function PasswordStore(name, engine) { ); } PasswordStore.prototype = { - __proto__: Store.prototype, - _newPropertyBag() { return Cc["@mozilla.org/hash-property-bag;1"].createInstance( Ci.nsIWritablePropertyBag2 @@ -382,13 +380,12 @@ PasswordStore.prototype = { Services.logins.removeAllUserFacingLogins(); }, }; +Object.setPrototypeOf(PasswordStore.prototype, Store.prototype); function PasswordTracker(name, engine) { LegacyTracker.call(this, name, engine); } PasswordTracker.prototype = { - __proto__: LegacyTracker.prototype, - onStart() { Svc.Obs.add("passwordmgr-storage-changed", this.asyncObserver); }, @@ -461,6 +458,7 @@ PasswordTracker.prototype = { return true; }, }; +Object.setPrototypeOf(PasswordTracker.prototype, LegacyTracker.prototype); class PasswordValidator extends CollectionValidator { constructor() { diff --git a/services/sync/modules/engines/prefs.js b/services/sync/modules/engines/prefs.js index 3ef93628985d..3e62ea560d81 100644 --- a/services/sync/modules/engines/prefs.js +++ b/services/sync/modules/engines/prefs.js @@ -108,9 +108,9 @@ function PrefRec(collection, id) { CryptoWrapper.call(this, collection, id); } PrefRec.prototype = { - __proto__: CryptoWrapper.prototype, _logName: "Sync.Record.Pref", }; +Object.setPrototypeOf(PrefRec.prototype, CryptoWrapper.prototype); Utils.deferGetSet(PrefRec, "cleartext", ["value"]); @@ -118,7 +118,6 @@ function PrefsEngine(service) { SyncEngine.call(this, "Prefs", service); } PrefsEngine.prototype = { - __proto__: SyncEngine.prototype, _storeObj: PrefStore, _trackerObj: PrefTracker, _recordObj: PrefRec, @@ -156,6 +155,7 @@ PrefsEngine.prototype = { } }, }; +Object.setPrototypeOf(PrefsEngine.prototype, SyncEngine.prototype); // We don't use services.sync.engine.tabs.filteredSchemes since it includes // about: pages and the like, which we want to be syncable in preferences. @@ -181,8 +181,6 @@ function PrefStore(name, engine) { ); } PrefStore.prototype = { - __proto__: Store.prototype, - __prefs: null, get _prefs() { if (!this.__prefs) { @@ -404,6 +402,7 @@ PrefStore.prototype = { this._log.trace("Ignoring wipe request"); }, }; +Object.setPrototypeOf(PrefStore.prototype, Store.prototype); function PrefTracker(name, engine) { Tracker.call(this, name, engine); @@ -411,8 +410,6 @@ function PrefTracker(name, engine) { Svc.Obs.add("profile-before-change", this.asyncObserver); } PrefTracker.prototype = { - __proto__: Tracker.prototype, - get ignoreAll() { return this._ignoreAll; }, @@ -472,6 +469,7 @@ PrefTracker.prototype = { } }, }; +Object.setPrototypeOf(PrefTracker.prototype, Tracker.prototype); function getPrefsGUIDForTest() { return lazy.PREFS_GUID; diff --git a/services/sync/modules/engines/tabs.js b/services/sync/modules/engines/tabs.js index 042ab1847b50..04f25eff4fd9 100644 --- a/services/sync/modules/engines/tabs.js +++ b/services/sync/modules/engines/tabs.js @@ -78,7 +78,6 @@ function TabEngine(service) { } TabEngine.prototype = { - __proto__: BridgedEngine.prototype, _trackerObj: TabTracker, syncPriority: 3, @@ -342,6 +341,7 @@ TabEngine.prototype = { } }, }; +Object.setPrototypeOf(TabEngine.prototype, BridgedEngine.prototype); const TabProvider = { getWindowEnumerator() { @@ -425,8 +425,6 @@ function TabTracker(name, engine) { this._unregisterListeners = Utils.bind2(this, this._unregisterListeners); } TabTracker.prototype = { - __proto__: Tracker.prototype, - QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), clearChangedIDs() { @@ -609,3 +607,4 @@ TabTracker.prototype = { } }, }; +Object.setPrototypeOf(TabTracker.prototype, Tracker.prototype); diff --git a/services/sync/modules/keys.js b/services/sync/modules/keys.js index 7e5986d82391..5bdc5f83991e 100644 --- a/services/sync/modules/keys.js +++ b/services/sync/modules/keys.js @@ -132,8 +132,6 @@ BulkKeyBundle.fromJWK = function(jwk) { }; BulkKeyBundle.prototype = { - __proto__: KeyBundle.prototype, - get collection() { return this._collection; }, @@ -171,3 +169,5 @@ BulkKeyBundle.prototype = { this.hmacKey = CommonUtils.safeAtoB(value[1]); }, }; + +Object.setPrototypeOf(BulkKeyBundle.prototype, KeyBundle.prototype); diff --git a/services/sync/modules/record.js b/services/sync/modules/record.js index ea061af6cc68..2ed876054d18 100644 --- a/services/sync/modules/record.js +++ b/services/sync/modules/record.js @@ -175,7 +175,6 @@ function RawCryptoWrapper(collection, id) { this.ciphertext = null; } RawCryptoWrapper.prototype = { - __proto__: WBORecord.prototype, _logName: "Sync.Record.RawCryptoWrapper", /** @@ -280,6 +279,8 @@ RawCryptoWrapper.prototype = { }, }; +Object.setPrototypeOf(RawCryptoWrapper.prototype, WBORecord.prototype); + Utils.deferGetSet(RawCryptoWrapper, "payload", ["ciphertext", "IV", "hmac"]); /** @@ -294,7 +295,6 @@ function CryptoWrapper(collection, id) { RawCryptoWrapper.call(this, collection, id); } CryptoWrapper.prototype = { - __proto__: RawCryptoWrapper.prototype, _logName: "Sync.Record.CryptoWrapper", defaultCleartext() { @@ -365,6 +365,8 @@ CryptoWrapper.prototype = { }, }; +Object.setPrototypeOf(CryptoWrapper.prototype, RawCryptoWrapper.prototype); + Utils.deferGetSet(CryptoWrapper, "cleartext", "deleted"); /** @@ -779,7 +781,6 @@ function Collection(uri, recordObj, service) { this._offset = null; } Collection.prototype = { - __proto__: Resource.prototype, _logName: "Sync.Collection", _rebuildURL: function Coll__rebuildURL() { @@ -1010,6 +1011,8 @@ Collection.prototype = { }, }; +Object.setPrototypeOf(Collection.prototype, Resource.prototype); + // These are limits for requests provided by the server at the // info/configuration endpoint -- server documentation is available here: // http://moz-services-docs.readthedocs.io/en/latest/storage/apis-1.5.html#api-instructions diff --git a/services/sync/tests/unit/head_errorhandler_common.js b/services/sync/tests/unit/head_errorhandler_common.js index 2dae0c0028a8..2296c9d51137 100644 --- a/services/sync/tests/unit/head_errorhandler_common.js +++ b/services/sync/tests/unit/head_errorhandler_common.js @@ -161,7 +161,6 @@ const EHTestsCommon = { SyncEngine.call(this, "Catapult", Service); } CatapultEngine.prototype = { - __proto__: SyncEngine.prototype, exception: null, // tests fill this in async _sync() { if (this.exception) { @@ -169,6 +168,7 @@ const EHTestsCommon = { } }, }; + Object.setPrototypeOf(CatapultEngine.prototype, SyncEngine.prototype); return CatapultEngine; })(), diff --git a/services/sync/tests/unit/head_http_server.js b/services/sync/tests/unit/head_http_server.js index 559834a5430b..9cc0c81af86d 100644 --- a/services/sync/tests/unit/head_http_server.js +++ b/services/sync/tests/unit/head_http_server.js @@ -704,7 +704,7 @@ var SyncServerCallback = { * SyncServerCallback) as input. */ function SyncServer(callback) { - this.callback = callback || { __proto__: SyncServerCallback }; + this.callback = callback || Object.create(SyncServerCallback); this.server = new HttpServer(); this.started = false; this.users = {}; diff --git a/services/sync/tests/unit/test_addon_utils.js b/services/sync/tests/unit/test_addon_utils.js index 53d9079e6da1..c8b6825cc68a 100644 --- a/services/sync/tests/unit/test_addon_utils.js +++ b/services/sync/tests/unit/test_addon_utils.js @@ -119,10 +119,13 @@ add_task(async function test_source_uri_rewrite() { // skewed. // We resort to monkeypatching because of the API design. - let oldFunction = AddonUtils.__proto__.installAddonFromSearchResult; + let oldFunction = Object.getPrototypeOf(AddonUtils) + .installAddonFromSearchResult; let installCalled = false; - AddonUtils.__proto__.installAddonFromSearchResult = async function testInstallAddon( + Object.getPrototypeOf( + AddonUtils + ).installAddonFromSearchResult = async function testInstallAddon( addon, metadata ) { @@ -156,7 +159,7 @@ add_task(async function test_source_uri_rewrite() { await AddonUtils.installAddons([installOptions]); Assert.ok(installCalled); - AddonUtils.__proto__.installAddonFromSearchResult = oldFunction; + Object.getPrototypeOf(AddonUtils).installAddonFromSearchResult = oldFunction; await promiseStopServer(server); }); diff --git a/services/sync/tests/unit/test_clients_engine.js b/services/sync/tests/unit/test_clients_engine.js index 9dc8f08849fa..f93318a81496 100644 --- a/services/sync/tests/unit/test_clients_engine.js +++ b/services/sync/tests/unit/test_clients_engine.js @@ -76,7 +76,6 @@ add_task(async function test_bad_hmac() { let deletedCollections = []; let deletedItems = []; let callback = { - __proto__: SyncServerCallback, onItemDeleted(username, coll, wboID) { deletedItems.push(coll + "/" + wboID); }, @@ -84,6 +83,7 @@ add_task(async function test_bad_hmac() { deletedCollections.push(coll); }, }; + Object.setPrototypeOf(callback, SyncServerCallback); let server = await serverForFoo(engine, callback); let user = server.user("foo"); diff --git a/services/sync/tests/unit/test_declined.js b/services/sync/tests/unit/test_declined.js index c179243cd5f3..0edd88512f59 100644 --- a/services/sync/tests/unit/test_declined.js +++ b/services/sync/tests/unit/test_declined.js @@ -22,7 +22,8 @@ function DummyEngine() {} DummyEngine.prototype.name = "dummy"; function ActualEngine() {} -ActualEngine.prototype = { __proto__: SyncEngine.prototype, name: "actual" }; +ActualEngine.prototype.name = "actual"; +Object.setPrototypeOf(ActualEngine.prototype, SyncEngine.prototype); function getEngineManager() { let manager = new EngineManager(Service); diff --git a/services/sync/tests/unit/test_engine.js b/services/sync/tests/unit/test_engine.js index 2661a005b084..0f84662877d1 100644 --- a/services/sync/tests/unit/test_engine.js +++ b/services/sync/tests/unit/test_engine.js @@ -14,19 +14,16 @@ function SteamStore(engine) { this.wasWiped = false; } SteamStore.prototype = { - __proto__: Store.prototype, - async wipe() { this.wasWiped = true; }, }; +Object.setPrototypeOf(SteamStore.prototype, Store.prototype); function SteamTracker(name, engine) { LegacyTracker.call(this, name || "Steam", engine); } -SteamTracker.prototype = { - __proto__: LegacyTracker.prototype, -}; +Object.setPrototypeOf(SteamTracker.prototype, LegacyTracker.prototype); function SteamEngine(name, service) { SyncEngine.call(this, name, service); @@ -34,7 +31,6 @@ function SteamEngine(name, service) { this.wasSynced = false; } SteamEngine.prototype = { - __proto__: SyncEngine.prototype, _storeObj: SteamStore, _trackerObj: SteamTracker, @@ -46,6 +42,7 @@ SteamEngine.prototype = { this.wasSynced = true; }, }; +Object.setPrototypeOf(SteamEngine.prototype, SyncEngine.prototype); var engineObserver = { topics: [], diff --git a/services/sync/tests/unit/test_errorhandler_sync_checkServerError.js b/services/sync/tests/unit/test_errorhandler_sync_checkServerError.js index bd0f6974cb25..0552916719b1 100644 --- a/services/sync/tests/unit/test_errorhandler_sync_checkServerError.js +++ b/services/sync/tests/unit/test_errorhandler_sync_checkServerError.js @@ -13,12 +13,12 @@ function CatapultEngine() { SyncEngine.call(this, "Catapult", Service); } CatapultEngine.prototype = { - __proto__: SyncEngine.prototype, exception: null, // tests fill this in async _sync() { throw this.exception; }, }; +Object.setPrototypeOf(CatapultEngine.prototype, SyncEngine.prototype); async function sync_httpd_setup() { let collectionsHelper = track_collections_helper(); diff --git a/services/sync/tests/unit/test_extension_storage_engine_kinto.js b/services/sync/tests/unit/test_extension_storage_engine_kinto.js index c244ea1f9100..b5b3f9e3cc74 100644 --- a/services/sync/tests/unit/test_extension_storage_engine_kinto.js +++ b/services/sync/tests/unit/test_extension_storage_engine_kinto.js @@ -21,12 +21,13 @@ function mock(options) { calls.push(arguments); return options.returns; }; - Object.setPrototypeOf(ret, { - __proto__: Function.prototype, + let proto = { get calls() { return calls; }, - }); + }; + Object.setPrototypeOf(proto, Function.prototype); + Object.setPrototypeOf(ret, proto); return ret; } diff --git a/services/sync/tests/unit/test_fxa_node_reassignment.js b/services/sync/tests/unit/test_fxa_node_reassignment.js index 6a2b49cbe865..d4b914b216cd 100644 --- a/services/sync/tests/unit/test_fxa_node_reassignment.js +++ b/services/sync/tests/unit/test_fxa_node_reassignment.js @@ -45,7 +45,6 @@ function prepareServer(cbAfterTokenFetch) { // A server callback to ensure we don't accidentally hit the wrong endpoint // after a node reassignment. let callback = { - __proto__: SyncServerCallback, onRequest(req, resp) { let full = `${req.scheme}://${req.host}:${req.port}${req.path}`; let expected = config.fxaccount.token.endpoint; @@ -55,6 +54,7 @@ function prepareServer(cbAfterTokenFetch) { ); }, }; + Object.setPrototypeOf(callback, SyncServerCallback); let server = new SyncServer(callback); server.registerUser("johndoe"); server.start(); diff --git a/services/sync/tests/unit/test_httpd_sync_server.js b/services/sync/tests/unit/test_httpd_sync_server.js index 71ee7dde2612..22b933ce4d8e 100644 --- a/services/sync/tests/unit/test_httpd_sync_server.js +++ b/services/sync/tests/unit/test_httpd_sync_server.js @@ -3,9 +3,7 @@ add_test(function test_creation() { // Explicit callback for this one. - let server = new SyncServer({ - __proto__: SyncServerCallback, - }); + let server = new SyncServer(Object.create(SyncServerCallback)); Assert.ok(!!server); // Just so we have a check. server.start(null, function() { _("Started on " + server.port); @@ -83,9 +81,7 @@ add_task(async function test_basic_http() { }); add_task(async function test_info_collections() { - let server = new SyncServer({ - __proto__: SyncServerCallback, - }); + let server = new SyncServer(Object.create(SyncServerCallback)); function responseHasCorrectHeaders(r) { Assert.equal(r.status, 200); Assert.equal(r.headers["content-type"], "application/json"); diff --git a/services/sync/tests/unit/test_service_startOver.js b/services/sync/tests/unit/test_service_startOver.js index 92acd6cf0554..51e5dcee7ec3 100644 --- a/services/sync/tests/unit/test_service_startOver.js +++ b/services/sync/tests/unit/test_service_startOver.js @@ -7,13 +7,12 @@ function BlaEngine() { SyncEngine.call(this, "Bla", Service); } BlaEngine.prototype = { - __proto__: SyncEngine.prototype, - removed: false, async removeClientData() { this.removed = true; }, }; +Object.setPrototypeOf(BlaEngine.prototype, SyncEngine.prototype); add_task(async function setup() { await Service.engineManager.register(BlaEngine); diff --git a/services/sync/tests/unit/test_service_sync_specified.js b/services/sync/tests/unit/test_service_sync_specified.js index 18c2efe49857..5f01e5297d3e 100644 --- a/services/sync/tests/unit/test_service_sync_specified.js +++ b/services/sync/tests/unit/test_service_sync_specified.js @@ -9,21 +9,21 @@ function SteamEngine() { SyncEngine.call(this, "Steam", Service); } SteamEngine.prototype = { - __proto__: SyncEngine.prototype, async _sync() { syncedEngines.push(this.name); }, }; +Object.setPrototypeOf(SteamEngine.prototype, SyncEngine.prototype); function StirlingEngine() { SyncEngine.call(this, "Stirling", Service); } StirlingEngine.prototype = { - __proto__: SteamEngine.prototype, async _sync() { syncedEngines.push(this.name); }, }; +Object.setPrototypeOf(StirlingEngine.prototype, SteamEngine.prototype); // Tracking info/collections. var collectionsHelper = track_collections_helper(); diff --git a/services/sync/tests/unit/test_service_sync_updateEnabledEngines.js b/services/sync/tests/unit/test_service_sync_updateEnabledEngines.js index e91d4055453c..c207c08f8840 100644 --- a/services/sync/tests/unit/test_service_sync_updateEnabledEngines.js +++ b/services/sync/tests/unit/test_service_sync_updateEnabledEngines.js @@ -20,7 +20,6 @@ function SteamEngine() { SyncEngine.call(this, "Steam", Service); } SteamEngine.prototype = { - __proto__: SyncEngine.prototype, // We're not interested in engine sync but what the service does. _storeObj: QuietStore, @@ -28,17 +27,18 @@ SteamEngine.prototype = { await this._syncStartup(); }, }; +Object.setPrototypeOf(SteamEngine.prototype, SyncEngine.prototype); function StirlingEngine() { SyncEngine.call(this, "Stirling", Service); } StirlingEngine.prototype = { - __proto__: SteamEngine.prototype, // This engine's enabled state is the same as the SteamEngine's. get prefName() { return "steam"; }, }; +Object.setPrototypeOf(StirlingEngine.prototype, SteamEngine.prototype); // Tracking info/collections. var collectionsHelper = track_collections_helper(); diff --git a/services/sync/tests/unit/test_service_wipeClient.js b/services/sync/tests/unit/test_service_wipeClient.js index 7aadeb3eeee3..12134e6a4155 100644 --- a/services/sync/tests/unit/test_service_wipeClient.js +++ b/services/sync/tests/unit/test_service_wipeClient.js @@ -7,8 +7,6 @@ function CanDecryptEngine() { SyncEngine.call(this, "CanDecrypt", Service); } CanDecryptEngine.prototype = { - __proto__: SyncEngine.prototype, - // Override these methods with mocks for the test async canDecrypt() { return true; @@ -19,13 +17,12 @@ CanDecryptEngine.prototype = { this.wasWiped = true; }, }; +Object.setPrototypeOf(CanDecryptEngine.prototype, SyncEngine.prototype); function CannotDecryptEngine() { SyncEngine.call(this, "CannotDecrypt", Service); } CannotDecryptEngine.prototype = { - __proto__: SyncEngine.prototype, - // Override these methods with mocks for the test async canDecrypt() { return false; @@ -36,6 +33,7 @@ CannotDecryptEngine.prototype = { this.wasWiped = true; }, }; +Object.setPrototypeOf(CannotDecryptEngine.prototype, SyncEngine.prototype); let canDecryptEngine; let cannotDecryptEngine; diff --git a/services/sync/tests/unit/test_sync_auth_manager.js b/services/sync/tests/unit/test_sync_auth_manager.js index 85a861fc9acc..ff287fa8d763 100644 --- a/services/sync/tests/unit/test_sync_auth_manager.js +++ b/services/sync/tests/unit/test_sync_auth_manager.js @@ -49,7 +49,6 @@ var MockFxAccountsClient = function() { FxAccountsClient.apply(this); }; MockFxAccountsClient.prototype = { - __proto__: FxAccountsClient.prototype, accountStatus() { return Promise.resolve(true); }, @@ -64,6 +63,10 @@ MockFxAccountsClient.prototype = { }); }, }; +Object.setPrototypeOf( + MockFxAccountsClient.prototype, + FxAccountsClient.prototype +); add_test(function test_initial_state() { _("Verify initial state"); @@ -150,7 +153,6 @@ add_task(async function test_initialializeWithAuthErrorAndDeletedAccount() { FxAccountsClient.apply(this); }; AuthErrorMockFxAClient.prototype = { - __proto__: FxAccountsClient.prototype, accessTokenWithSessionToken() { accessTokenWithSessionTokenCalled = true; return Promise.reject({ @@ -167,6 +169,10 @@ add_task(async function test_initialializeWithAuthErrorAndDeletedAccount() { return Promise.resolve(false); }, }; + Object.setPrototypeOf( + AuthErrorMockFxAClient.prototype, + FxAccountsClient.prototype + ); let mockFxAClient = new AuthErrorMockFxAClient(); syncAuthManager._fxaService._internal._fxAccountsClient = mockFxAClient; @@ -478,12 +484,15 @@ add_task(async function test_refreshAccessTokenOn401() { FxAccountsClient.apply(this); }; CheckSignMockFxAClient.prototype = { - __proto__: FxAccountsClient.prototype, accessTokenWithSessionToken() { ++getTokenCount; return Promise.resolve({ access_token: "token" }); }, }; + Object.setPrototypeOf( + CheckSignMockFxAClient.prototype, + FxAccountsClient.prototype + ); let mockFxAClient = new CheckSignMockFxAClient(); syncAuthManager._fxaService._internal._fxAccountsClient = mockFxAClient; diff --git a/services/sync/tests/unit/test_syncscheduler.js b/services/sync/tests/unit/test_syncscheduler.js index 50c4462841b1..b9b90369b058 100644 --- a/services/sync/tests/unit/test_syncscheduler.js +++ b/services/sync/tests/unit/test_syncscheduler.js @@ -17,12 +17,12 @@ function CatapultEngine() { SyncEngine.call(this, "Catapult", Service); } CatapultEngine.prototype = { - __proto__: SyncEngine.prototype, exception: null, // tests fill this in async _sync() { throw this.exception; }, }; +Object.setPrototypeOf(CatapultEngine.prototype, SyncEngine.prototype); var scheduler = new SyncScheduler(Service); let clientsEngine; @@ -192,7 +192,6 @@ add_task(async function test_sync_skipped_low_score_no_resync() { } SkipEngine.prototype = { - __proto__: SyncEngine.prototype, _sync() { do_throw("Should have been skipped"); }, @@ -200,6 +199,7 @@ add_task(async function test_sync_skipped_low_score_no_resync() { return true; }, }; + Object.setPrototypeOf(SkipEngine.prototype, SyncEngine.prototype); await Service.engineManager.register(SkipEngine); let engine = Service.engineManager.get("skip"); diff --git a/services/sync/tests/unit/test_telemetry.js b/services/sync/tests/unit/test_telemetry.js index e62eed0fe42f..08f53b15e316 100644 --- a/services/sync/tests/unit/test_telemetry.js +++ b/services/sync/tests/unit/test_telemetry.js @@ -15,25 +15,18 @@ const fxAccounts = getFxAccountsSingleton(); function SteamStore(engine) { Store.call(this, "Steam", engine); } - -SteamStore.prototype = { - __proto__: Store.prototype, -}; +Object.setPrototypeOf(SteamStore.prototype, Store.prototype); function SteamTracker(name, engine) { LegacyTracker.call(this, name || "Steam", engine); } - -SteamTracker.prototype = { - __proto__: LegacyTracker.prototype, -}; +Object.setPrototypeOf(SteamTracker.prototype, LegacyTracker.prototype); function SteamEngine(service) { SyncEngine.call(this, "steam", service); } SteamEngine.prototype = { - __proto__: SyncEngine.prototype, _storeObj: SteamStore, _trackerObj: SteamTracker, _errToThrow: null, @@ -47,6 +40,7 @@ SteamEngine.prototype = { return new SteamValidator(); }, }; +Object.setPrototypeOf(SteamEngine.prototype, SyncEngine.prototype); function BogusEngine(service) { SyncEngine.call(this, "bogus", service); diff --git a/services/sync/tps/extensions/tps/resource/modules/bookmarks.jsm b/services/sync/tps/extensions/tps/resource/modules/bookmarks.jsm index 458f9c740199..84d6de91c86b 100644 --- a/services/sync/tps/extensions/tps/resource/modules/bookmarks.jsm +++ b/services/sync/tps/extensions/tps/resource/modules/bookmarks.jsm @@ -37,7 +37,7 @@ async function DumpBookmarks() { * extend, causes a child object to inherit from a parent */ function extend(child, supertype) { - child.prototype.__proto__ = supertype.prototype; + Object.setPrototypeOf(child.prototype, supertype.prototype); } /** * PlacesItemProps object, holds properties for places items