Bug 787273 - Part 1: Remove Records singleton; r=rnewman

RecordManager is now an instance of the Service singleton and holds a
reference back to the service which is used to obtain needed "global"
state.
This commit is contained in:
Gregory Szorc 2012-09-14 16:02:32 -07:00
parent c5dd115026
commit ee08725aba
15 changed files with 125 additions and 101 deletions

View File

@ -674,7 +674,7 @@ SyncEngine.prototype = {
_syncStartup: function SyncEngine__syncStartup() {
// Determine if we need to wipe on outdated versions
let metaGlobal = Records.get(this.metaURL);
let metaGlobal = this.service.recordManager.get(this.metaURL);
let engines = metaGlobal.payload.engines || {};
let engineData = engines[this.name] || {};

View File

@ -2,8 +2,13 @@
* 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/. */
const EXPORTED_SYMBOLS = ["WBORecord", "RecordManager", "Records",
"CryptoWrapper", "CollectionKeys", "Collection"];
const EXPORTED_SYMBOLS = [
"WBORecord",
"RecordManager",
"CryptoWrapper",
"CollectionKeys",
"Collection",
];
const Cc = Components.classes;
const Ci = Components.interfaces;
@ -93,11 +98,12 @@ WBORecord.prototype = {
Utils.deferGetSet(WBORecord, "data", ["id", "modified", "sortindex", "payload"]);
XPCOMUtils.defineLazyGetter(this, "Records", function () {
return new RecordManager();
});
/**
* An interface and caching layer for records.
*/
function RecordManager(service) {
this.service = service;
function RecordManager() {
this._log = Log4Moz.repository.getLogger(this._logName);
this._records = {};
}

View File

@ -318,6 +318,7 @@ WeaveSvc.prototype = {
this._log.info("Loading Weave " + WEAVE_VERSION);
this._clusterManager = new ClusterManager(this);
this.recordManager = new RecordManager(this);
this.enabled = true;
@ -953,7 +954,7 @@ WeaveSvc.prototype = {
let reset = false;
this._log.debug("Fetching global metadata record");
let meta = Records.get(this.metaURL);
let meta = this.recordManager.get(this.metaURL);
// Checking modified time of the meta record.
if (infoResponse &&
@ -965,12 +966,12 @@ WeaveSvc.prototype = {
JSON.stringify(this.metaModified) + ", setting to " +
JSON.stringify(infoResponse.obj.meta));
Records.del(this.metaURL);
this.recordManager.del(this.metaURL);
// ... fetch the current record from the server, and COPY THE FLAGS.
let newMeta = Records.get(this.metaURL);
let newMeta = this.recordManager.get(this.metaURL);
if (!Records.response.success || !newMeta) {
if (!this.recordManager.response.success || !newMeta) {
this._log.debug("No meta/global record on the server. Creating one.");
newMeta = new WBORecord("meta", "global");
newMeta.payload.syncID = this.syncID;
@ -978,7 +979,7 @@ WeaveSvc.prototype = {
newMeta.isNew = true;
Records.set(this.metaURL, newMeta);
this.recordManager.set(this.metaURL, newMeta);
if (!newMeta.upload(this.metaURL).success) {
this._log.warn("Unable to upload new meta/global. Failing remote setup.");
return false;
@ -1008,10 +1009,10 @@ WeaveSvc.prototype = {
this._log.info("One of: no meta, no meta storageVersion, or no meta syncID. Fresh start needed.");
// abort the server wipe if the GET status was anything other than 404 or 200
let status = Records.response.status;
let status = this.recordManager.response.status;
if (status != 200 && status != 404) {
Status.sync = METARECORD_DOWNLOAD_FAIL;
this.errorHandler.checkServerError(Records.response);
this.errorHandler.checkServerError(this.recordManager.response);
this._log.warn("Unknown error while downloading metadata record. " +
"Aborting sync.");
return false;
@ -1231,7 +1232,7 @@ WeaveSvc.prototype = {
// racing is probably busy uploading stuff right now anyway.
throw resp;
}
Records.set(this.metaURL, meta);
this.recordManager.set(this.metaURL, meta);
// Wipe everything we know about except meta because we just uploaded it
let engines = [this.clientsEngine].concat(this.engineManager.getAll());
@ -1367,7 +1368,7 @@ WeaveSvc.prototype = {
// Pretend we've never synced to the server and drop cached data
this.syncID = "";
Records.clearCache();
this.recordManager.clearCache();
})();
},

View File

@ -14,7 +14,6 @@ Cu.import("resource://services-common/log4moz.js");
Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/policies.js");
Cu.import("resource://services-sync/record.js");
Cu.import("resource://services-sync/resource.js");
Cu.import("resource://services-sync/status.js");
Cu.import("resource://services-sync/util.js");
@ -164,7 +163,7 @@ EngineSynchronizer.prototype = {
}
// Upload meta/global if any engines changed anything
let meta = Records.get(this.service.metaURL);
let meta = this.service.recordManager.get(this.service.metaURL);
if (meta.isNew || meta.changed) {
new Resource(this.service.metaURL).put(meta);
delete meta.isNew;
@ -211,7 +210,7 @@ EngineSynchronizer.prototype = {
_updateEnabledEngines: function _updateEnabledEngines() {
this._log.info("Updating enabled engines: " +
this.service.scheduler.numClients + " clients.");
let meta = Records.get(this.service.metaURL);
let meta = this.service.recordManager.get(this.service.metaURL);
if (meta.isNew || !meta.payload.engines)
return;

View File

@ -6,7 +6,6 @@ Cu.import("resource://services-common/async.js");
Cu.import("resource://services-common/log4moz.js");
Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/engines/bookmarks.js");
Cu.import("resource://services-sync/record.js");
Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js");
@ -157,7 +156,7 @@ add_test(function test_processIncoming_error_orderChildren() {
} finally {
store.wipe();
Svc.Prefs.resetBranch("");
Records.clearCache();
Service.recordManager.clearCache();
server.stop(run_next_test);
}
});
@ -288,7 +287,7 @@ add_test(function test_restorePromptsReupload() {
} finally {
store.wipe();
Svc.Prefs.resetBranch("");
Records.clearCache();
Service.recordManager.clearCache();
server.stop(run_next_test);
}
});
@ -364,7 +363,7 @@ add_test(function test_mismatched_types() {
} finally {
store.wipe();
Svc.Prefs.resetBranch("");
Records.clearCache();
Service.recordManager.clearCache();
server.stop(run_next_test);
}
});

View File

@ -1,11 +1,12 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
Cu.import("resource://gre/modules/PlacesUtils.jsm");
Cu.import("resource://services-common/log4moz.js");
Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/engines/bookmarks.js");
Cu.import("resource://services-sync/record.js");
Cu.import("resource://services-common/log4moz.js");
Cu.import("resource://services-sync/util.js");
Cu.import("resource://services-sync/service.js");
Cu.import("resource://gre/modules/PlacesUtils.jsm");
Cu.import("resource://services-sync/util.js");
const SMART_BOOKMARKS_ANNO = "Places/SmartBookmark";
var IOService = Cc["@mozilla.org/network/io-service;1"]
@ -167,7 +168,7 @@ add_test(function test_annotation_uploaded() {
// Clean up.
store.wipe();
Svc.Prefs.resetBranch("");
Records.clearCache();
Service.recordManager.clearCache();
server.stop(run_next_test);
}
});
@ -221,7 +222,7 @@ add_test(function test_smart_bookmarks_duped() {
store.wipe();
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
Service.recordManager.clearCache();
}
});

View File

@ -5,7 +5,6 @@ Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/identity.js");
Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/engines/clients.js");
Cu.import("resource://services-sync/record.js");
Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js");
@ -147,7 +146,7 @@ add_test(function test_bad_hmac() {
} finally {
Svc.Prefs.resetBranch("");
Records.clearCache();
Service.recordManager.clearCache();
server.stop(run_next_test);
}
});
@ -216,7 +215,7 @@ add_test(function test_sync() {
} finally {
Svc.Prefs.resetBranch("");
Records.clearCache();
Service.recordManager.clearCache();
server.stop(run_next_test);
}
});
@ -460,7 +459,7 @@ add_test(function test_command_sync() {
} finally {
Svc.Prefs.resetBranch("");
Records.clearCache();
Service.recordManager.clearCache();
server.stop(run_next_test);
}
});

View File

@ -13,7 +13,8 @@ add_test(function test_processIncoming_abort() {
let engine = new RotaryEngine(Service);
_("Create some server data.");
let meta_global = Records.set(engine.metaURL, new WBORecord(engine.metaURL));
let meta_global = Service.recordManager.set(engine.metaURL,
new WBORecord(engine.metaURL));
meta_global.payload.engines = {rotary: {version: engine.version,
syncID: engine.syncID}};
@ -58,7 +59,7 @@ add_test(function test_processIncoming_abort() {
server.stop(run_next_test);
Svc.Prefs.resetBranch("");
Records.clearCache();
Service.recordManager.clearCache();
});
function run_test() {

View File

@ -5,10 +5,11 @@ Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/engines/history.js");
Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/identity.js");
Cu.import("resource://services-sync/record.js");
Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js");
Service.engineManager.clear();
add_test(function test_processIncoming_mobile_history_batched() {
_("SyncEngine._processIncoming works on history engine.");
@ -52,8 +53,9 @@ add_test(function test_processIncoming_mobile_history_batched() {
"/1.1/foo/storage/history": collection.handler()
});
let engine = new HistoryEngine("history");
let meta_global = Records.set(engine.metaURL, new WBORecord(engine.metaURL));
let engine = Service.engineManager.get("history");
let meta_global = Service.recordManager.set(engine.metaURL,
new WBORecord(engine.metaURL));
meta_global.payload.engines = {history: {version: engine.version,
syncID: engine.syncID}};
@ -128,7 +130,7 @@ add_test(function test_processIncoming_mobile_history_batched() {
PlacesUtils.history.removeAllPages();
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
Service.recordManager.clearCache();
}
});

View File

@ -2,7 +2,6 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/record.js");
Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js");
@ -95,7 +94,7 @@ add_test(function hmac_error_during_404() {
do_check_eq(hmacErrorCount, 0)
} finally {
Svc.Prefs.resetBranch("");
Records.clearCache();
Service.recordManager.clearCache();
server.stop(run_next_test);
}
});
@ -226,7 +225,7 @@ add_test(function hmac_error_during_node_reassignment() {
Svc.Obs.remove("weave:service:sync:error", obs);
Svc.Prefs.resetBranch("");
Records.clearCache();
Service.recordManager.clearCache();
server.stop(run_next_test);
};

View File

@ -273,7 +273,7 @@ add_test(function test_back_triggers_sync() {
Svc.Obs.add("weave:service:sync:finish", function onSyncFinish() {
Svc.Obs.remove("weave:service:sync:finish", onSyncFinish);
Records.clearCache();
Service.recordManager.clearCache();
Svc.Prefs.resetBranch("");
scheduler.setDefaults();
clientsEngine.resetClient();

View File

@ -1,6 +1,10 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
Cu.import("resource://services-sync/record.js");
Cu.import("resource://services-sync/identity.js");
Cu.import("resource://services-sync/resource.js");
Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js");
@ -55,12 +59,12 @@ function test_fetch() {
do_check_eq(rec.payload.cheese, "roquefort");
_("Fetching a WBO record using the record manager");
let rec2 = Records.get("http://localhost:8080/record2");
let rec2 = Service.recordManager.get("http://localhost:8080/record2");
do_check_eq(rec2.id, "record2");
do_check_eq(rec2.modified, 2454725.98284);
do_check_eq(typeof(rec2.payload), "object");
do_check_eq(rec2.payload.cheese, "gruyere");
do_check_eq(Records.response.status, 200);
do_check_eq(Service.recordManager.response.status, 200);
// Testing collection extraction.
_("Extracting collection.");

View File

@ -1,13 +1,11 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
Cu.import("resource://services-sync/main.js");
Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/util.js");
Cu.import("resource://services-sync/status.js");
Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/record.js");
Cu.import("resource://services-sync/keys.js");
Cu.import("resource://services-sync/engines/tabs.js");
Cu.import("resource://services-common/log4moz.js");
@ -67,13 +65,13 @@ add_test(function v4_upgrade() {
Status.resetSync();
_("Logging in.");
Weave.Service.serverURL = TEST_SERVER_URL;
Weave.Service.clusterURL = TEST_CLUSTER_URL;
Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = TEST_CLUSTER_URL;
Weave.Service.login("johndoe", "ilovejane", passphrase);
do_check_true(Weave.Service.isLoggedIn);
Weave.Service.verifyAndFetchSymmetricKeys();
do_check_true(Weave.Service._remoteSetup());
Service.login("johndoe", "ilovejane", passphrase);
do_check_true(Service.isLoggedIn);
Service.verifyAndFetchSymmetricKeys();
do_check_true(Service._remoteSetup());
function test_out_of_date() {
_("Old meta/global: " + JSON.stringify(meta_global));
@ -81,9 +79,9 @@ add_test(function v4_upgrade() {
"storageVersion": STORAGE_VERSION + 1});
collections.meta = Date.now() / 1000;
_("New meta/global: " + JSON.stringify(meta_global));
Records.set(Weave.Service.metaURL, meta_global);
Service.recordManager.set(Service.metaURL, meta_global);
try {
Weave.Service.sync();
Service.sync();
}
catch (ex) {
}
@ -96,23 +94,23 @@ add_test(function v4_upgrade() {
// Same should happen after a wipe.
_("Syncing after server has been upgraded and wiped.");
Weave.Service.wipeServer();
Service.wipeServer();
test_out_of_date();
// Now's a great time to test what happens when keys get replaced.
_("Syncing afresh...");
Weave.Service.logout();
Service.logout();
CollectionKeys.clear();
Weave.Service.serverURL = TEST_SERVER_URL;
Weave.Service.clusterURL = TEST_CLUSTER_URL;
Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = TEST_CLUSTER_URL;
meta_global.payload = JSON.stringify({"syncID": "foooooooooooooobbbbbbbbbbbb",
"storageVersion": STORAGE_VERSION});
collections.meta = Date.now() / 1000;
Records.set(Weave.Service.metaURL, meta_global);
Weave.Service.login("johndoe", "ilovejane", passphrase);
do_check_true(Weave.Service.isLoggedIn);
Weave.Service.sync();
do_check_true(Weave.Service.isLoggedIn);
Service.recordManager.set(Service.metaURL, meta_global);
Service.login("johndoe", "ilovejane", passphrase);
do_check_true(Service.isLoggedIn);
Service.sync();
do_check_true(Service.isLoggedIn);
let serverDecrypted;
let serverKeys;
@ -123,10 +121,10 @@ add_test(function v4_upgrade() {
serverKeys = serverResp = serverDecrypted = null;
serverKeys = new CryptoWrapper("crypto", "keys");
serverResp = serverKeys.fetch(Weave.Service.cryptoKeysURL).response;
serverResp = serverKeys.fetch(Service.cryptoKeysURL).response;
do_check_true(serverResp.success);
serverDecrypted = serverKeys.decrypt(Weave.Identity.syncKeyBundle);
serverDecrypted = serverKeys.decrypt(Identity.syncKeyBundle);
_("Retrieved WBO: " + JSON.stringify(serverDecrypted));
_("serverKeys: " + JSON.stringify(serverKeys));
@ -150,8 +148,8 @@ add_test(function v4_upgrade() {
function set_server_keys(pair) {
serverDecrypted.default = pair;
serverKeys.cleartext = serverDecrypted;
serverKeys.encrypt(Weave.Identity.syncKeyBundle);
serverKeys.upload(Weave.Service.cryptoKeysURL);
serverKeys.encrypt(Identity.syncKeyBundle);
serverKeys.upload(Service.cryptoKeysURL);
}
_("Checking we have the latest keys.");
@ -172,8 +170,8 @@ add_test(function v4_upgrade() {
let oldClientsModified = collections.clients;
let oldTabsModified = collections.tabs;
Weave.Service.login("johndoe", "ilovejane", passphrase);
Weave.Service.sync();
Service.login("johndoe", "ilovejane", passphrase);
Service.sync();
_("New key should have forced upload of data.");
_("Tabs: " + oldTabsModified + " < " + collections.tabs);
_("Clients: " + oldClientsModified + " < " + collections.clients);
@ -184,10 +182,10 @@ add_test(function v4_upgrade() {
retrieve_and_compare_default(true);
// Clean up.
Weave.Service.startOver();
Service.startOver();
} finally {
Weave.Svc.Prefs.resetBranch("");
Svc.Prefs.resetBranch("");
server.stop(run_next_test);
}
});
@ -240,8 +238,8 @@ add_test(function v5_upgrade() {
Status.resetSync();
setBasicCredentials("johndoe", "ilovejane", passphrase);
Weave.Service.serverURL = TEST_SERVER_URL;
Weave.Service.clusterURL = TEST_CLUSTER_URL;
Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = TEST_CLUSTER_URL;
// Test an upgrade where the contents of the server would cause us to error
// -- keys decrypted with a different sync key, for example.
@ -250,7 +248,7 @@ add_test(function v5_upgrade() {
generateNewKeys();
serverKeys = CollectionKeys.asWBO("crypto", wboName);
serverKeys.encrypt(syncKeyBundle);
do_check_true(serverKeys.upload(Weave.Service.storageURL + collWBO).success);
do_check_true(serverKeys.upload(Service.storageURL + collWBO).success);
}
_("Bumping version.");
@ -258,7 +256,7 @@ add_test(function v5_upgrade() {
let m = new WBORecord("meta", "global");
m.payload = {"syncID": "foooooooooooooooooooooooooo",
"storageVersion": STORAGE_VERSION + 1};
m.upload(Weave.Service.metaURL);
m.upload(Service.metaURL);
_("New meta/global: " + JSON.stringify(meta_global));
@ -275,20 +273,20 @@ add_test(function v5_upgrade() {
_("Logging in.");
try {
Weave.Service.login("johndoe", "ilovejane", passphrase);
Service.login("johndoe", "ilovejane", passphrase);
}
catch (e) {
_("Exception: " + e);
}
_("Status: " + Status);
do_check_false(Weave.Service.isLoggedIn);
do_check_false(Service.isLoggedIn);
do_check_eq(VERSION_OUT_OF_DATE, Status.sync);
// Clean up.
Weave.Service.startOver();
Service.startOver();
} finally {
Weave.Svc.Prefs.resetBranch("");
Svc.Prefs.resetBranch("");
server.stop(run_next_test);
}
});

View File

@ -86,7 +86,7 @@ function run_test() {
do_check_true(Service.isLoggedIn);
_("Checking that remoteSetup returns true when credentials have changed.");
Records.get(Service.metaURL).payload.syncID = "foobar";
Service.recordManager.get(Service.metaURL).payload.syncID = "foobar";
do_check_true(Service._remoteSetup());
_("Do an initial sync.");

View File

@ -5,7 +5,6 @@ Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/identity.js");
Cu.import("resource://services-sync/policies.js");
Cu.import("resource://services-sync/record.js");
Cu.import("resource://services-sync/resource.js");
Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js");
@ -17,7 +16,7 @@ function makeRotaryEngine() {
function cleanAndGo(server) {
Svc.Prefs.resetBranch("");
Svc.Prefs.set("log.logger.engine.rotary", "Trace");
Records.clearCache();
Service.recordManager.clearCache();
server.stop(run_next_test);
}
@ -98,7 +97,7 @@ add_test(function test_syncStartup_emptyOrOutdatedGlobalsResetsSync() {
// Confirm initial environment
do_check_eq(engine._tracker.changedIDs["rekolok"], undefined);
let metaGlobal = Records.get(engine.metaURL);
let metaGlobal = Service.recordManager.get(engine.metaURL);
do_check_eq(metaGlobal.payload.engines, undefined);
do_check_true(!!collection.payload("flying"));
do_check_true(!!collection.payload("scotsman"));
@ -251,7 +250,8 @@ add_test(function test_processIncoming_createFromServer() {
});
let engine = makeRotaryEngine();
let meta_global = Records.set(engine.metaURL, new WBORecord(engine.metaURL));
let meta_global = Service.recordManager.set(engine.metaURL,
new WBORecord(engine.metaURL));
meta_global.payload.engines = {rotary: {version: engine.version,
syncID: engine.syncID}};
@ -345,7 +345,8 @@ add_test(function test_processIncoming_reconcile() {
// This record has been changed 2 mins later than the one on the server
engine._tracker.addChangedID('olderidentical', Date.now()/1000);
let meta_global = Records.set(engine.metaURL, new WBORecord(engine.metaURL));
let meta_global = Service.recordManager.set(engine.metaURL,
new WBORecord(engine.metaURL));
meta_global.payload.engines = {rotary: {version: engine.version,
syncID: engine.syncID}};
@ -635,7 +636,8 @@ add_test(function test_processIncoming_mobile_batchSize() {
});
let engine = makeRotaryEngine();
let meta_global = Records.set(engine.metaURL, new WBORecord(engine.metaURL));
let meta_global = Service.recordManager.set(engine.metaURL,
new WBORecord(engine.metaURL));
meta_global.payload.engines = {rotary: {version: engine.version,
syncID: engine.syncID}};
@ -705,7 +707,8 @@ add_test(function test_processIncoming_store_toFetch() {
let engine = makeRotaryEngine();
engine.enabled = true;
let meta_global = Records.set(engine.metaURL, new WBORecord(engine.metaURL));
let meta_global = Service.recordManager.set(engine.metaURL,
new WBORecord(engine.metaURL));
meta_global.payload.engines = {rotary: {version: engine.version,
syncID: engine.syncID}};
let server = sync_httpd_setup({
@ -779,7 +782,8 @@ add_test(function test_processIncoming_resume_toFetch() {
engine.toFetch = ["flying", "scotsman"];
engine.previousFailed = ["failed0", "failed1", "failed2"];
let meta_global = Records.set(engine.metaURL, new WBORecord(engine.metaURL));
let meta_global = Service.recordManager.set(engine.metaURL,
new WBORecord(engine.metaURL));
meta_global.payload.engines = {rotary: {version: engine.version,
syncID: engine.syncID}};
let server = sync_httpd_setup({
@ -837,7 +841,8 @@ add_test(function test_processIncoming_applyIncomingBatchSize_smaller() {
collection.insert(id, payload);
}
let meta_global = Records.set(engine.metaURL, new WBORecord(engine.metaURL));
let meta_global = Service.recordManager.set(engine.metaURL,
new WBORecord(engine.metaURL));
meta_global.payload.engines = {rotary: {version: engine.version,
syncID: engine.syncID}};
let server = sync_httpd_setup({
@ -892,7 +897,8 @@ add_test(function test_processIncoming_applyIncomingBatchSize_multiple() {
collection.insert(id, payload);
}
let meta_global = Records.set(engine.metaURL, new WBORecord(engine.metaURL));
let meta_global = Service.recordManager.set(engine.metaURL,
new WBORecord(engine.metaURL));
meta_global.payload.engines = {rotary: {version: engine.version,
syncID: engine.syncID}};
let server = sync_httpd_setup({
@ -944,7 +950,8 @@ add_test(function test_processIncoming_notify_count() {
collection.insert(id, payload);
}
let meta_global = Records.set(engine.metaURL, new WBORecord(engine.metaURL));
let meta_global = Service.recordManager.set(engine.metaURL,
new WBORecord(engine.metaURL));
meta_global.payload.engines = {rotary: {version: engine.version,
syncID: engine.syncID}};
let server = sync_httpd_setup({
@ -1034,7 +1041,8 @@ add_test(function test_processIncoming_previousFailed() {
collection.insert(id, payload);
}
let meta_global = Records.set(engine.metaURL, new WBORecord(engine.metaURL));
let meta_global = Service.recordManager.set(engine.metaURL,
new WBORecord(engine.metaURL));
meta_global.payload.engines = {rotary: {version: engine.version,
syncID: engine.syncID}};
let server = sync_httpd_setup({
@ -1139,7 +1147,8 @@ add_test(function test_processIncoming_failed_records() {
return this._applyIncoming.apply(this, arguments);
};
let meta_global = Records.set(engine.metaURL, new WBORecord(engine.metaURL));
let meta_global = Service.recordManager.set(engine.metaURL,
new WBORecord(engine.metaURL));
meta_global.payload.engines = {rotary: {version: engine.version,
syncID: engine.syncID}};
@ -1263,7 +1272,8 @@ add_test(function test_processIncoming_decrypt_failed() {
engine._store.items = {nojson: "Valid JSON",
nodecrypt: "Valid ciphertext"};
let meta_global = Records.set(engine.metaURL, new WBORecord(engine.metaURL));
let meta_global = Service.recordManager.set(engine.metaURL,
new WBORecord(engine.metaURL));
meta_global.payload.engines = {rotary: {version: engine.version,
syncID: engine.syncID}};
let server = sync_httpd_setup({
@ -1329,7 +1339,8 @@ add_test(function test_uploadOutgoing_toEmptyServer() {
// Mark one of these records as changed
engine._tracker.addChangedID('scotsman', 0);
let meta_global = Records.set(engine.metaURL, new WBORecord(engine.metaURL));
let meta_global = Service.recordManager.set(engine.metaURL,
new WBORecord(engine.metaURL));
meta_global.payload.engines = {rotary: {version: engine.version,
syncID: engine.syncID}};
@ -1392,7 +1403,8 @@ add_test(function test_uploadOutgoing_failed() {
engine._tracker.addChangedID('scotsman', SCOTSMAN_CHANGED);
engine._tracker.addChangedID('peppercorn', PEPPERCORN_CHANGED);
let meta_global = Records.set(engine.metaURL, new WBORecord(engine.metaURL));
let meta_global = Service.recordManager.set(engine.metaURL,
new WBORecord(engine.metaURL));
meta_global.payload.engines = {rotary: {version: engine.version,
syncID: engine.syncID}};
@ -1453,7 +1465,8 @@ add_test(function test_uploadOutgoing_MAX_UPLOAD_RECORDS() {
collection.insert(id);
}
let meta_global = Records.set(engine.metaURL, new WBORecord(engine.metaURL));
let meta_global = Service.recordManager.set(engine.metaURL,
new WBORecord(engine.metaURL));
meta_global.payload.engines = {rotary: {version: engine.version,
syncID: engine.syncID}};
@ -1652,7 +1665,8 @@ add_test(function test_sync_partialUpload() {
}
}
let meta_global = Records.set(engine.metaURL, new WBORecord(engine.metaURL));
let meta_global = Service.recordManager.set(engine.metaURL,
new WBORecord(engine.metaURL));
meta_global.payload.engines = {rotary: {version: engine.version,
syncID: engine.syncID}};
@ -1764,7 +1778,8 @@ add_test(function test_syncapplied_observer() {
collection.insert(id, payload);
}
let meta_global = Records.set(engine.metaURL, new WBORecord(engine.metaURL));
let meta_global = Service.recordManager.set(engine.metaURL,
new WBORecord(engine.metaURL));
meta_global.payload.engines = {rotary: {version: engine.version,
syncID: engine.syncID}};
let server = httpd_setup({