зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1803800, r=markh
Differential Revision: https://phabricator.services.mozilla.com/D163931
This commit is contained in:
Родитель
50464994b8
Коммит
a0053c2dfd
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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"]);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
})(),
|
||||
|
|
|
@ -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 = {};
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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: [],
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче