Bug 1345023 - Changed SYNC_API_VERSION to 1.5 and updated SUPPORTED_PROTOCOL_VERSIONS to reflect this change. r?markh draft
authorJoseph Cameron <jcameron97@btinternet.com>
Wed, 15 Mar 2017 22:18:43 -0400
changeset 499658 c3c6342adb03b40a71950ff49b9b58778817086d
parent 499512 ff04d410e74b69acfab17ef7e73e7397602d5a68
child 549407 44eafad0c8cec3ac5af763483711414df64c7d8f
push id49468
push userbmo:jcameron97@btinternet.com
push dateThu, 16 Mar 2017 02:23:32 +0000
reviewersmarkh
bugs1345023
milestone55.0a1
Bug 1345023 - Changed SYNC_API_VERSION to 1.5 and updated SUPPORTED_PROTOCOL_VERSIONS to reflect this change. r?markh MozReview-Commit-ID: 98knOLicr9E
services/sync/modules/constants.js
services/sync/modules/engines/clients.js
services/sync/tests/unit/head_http_server.js
services/sync/tests/unit/test_clients_engine.js
--- a/services/sync/modules/constants.js
+++ b/services/sync/modules/constants.js
@@ -5,17 +5,17 @@
 
 // Process each item in the "constants hash" to add to "global" and give a name
 this.EXPORTED_SYMBOLS = [];
 for (let [key, val] of Object.entries({
 
 WEAVE_VERSION:                         "@weave_version@",
 
 // Sync Server API version that the client supports.
-SYNC_API_VERSION:                      "1.1",
+SYNC_API_VERSION:                      "1.5",
 
 // Version of the data format this client supports. The data format describes
 // how records are packaged; this is separate from the Server API version and
 // the per-engine cleartext formats.
 STORAGE_VERSION:                       5,
 PREFS_BRANCH:                          "services.sync.",
 
 // Host "key" to access Weave Identity in the password manager
--- a/services/sync/modules/engines/clients.js
+++ b/services/sync/modules/engines/clients.js
@@ -43,17 +43,17 @@ XPCOMUtils.defineLazyModuleGetter(this, 
 
 XPCOMUtils.defineLazyModuleGetter(this, "getRepairResponder",
   "resource://services-sync/collection_repair.js");
 
 const CLIENTS_TTL = 1814400; // 21 days
 const CLIENTS_TTL_REFRESH = 604800; // 7 days
 const STALE_CLIENT_REMOTE_AGE = 604800; // 7 days
 
-const SUPPORTED_PROTOCOL_VERSIONS = ["1.1", "1.5"];
+const SUPPORTED_PROTOCOL_VERSIONS = [SYNC_API_VERSION];
 
 function hasDupeCommand(commands, action) {
   if (!commands) {
     return false;
   }
   return commands.some(other => other.command == action.command &&
     Utils.deepEquals(other.args, action.args));
 }
--- a/services/sync/tests/unit/head_http_server.js
+++ b/services/sync/tests/unit/head_http_server.js
@@ -2,16 +2,19 @@
 /* import-globals-from ../../../common/tests/unit/head_helpers.js */
 /* import-globals-from head_helpers.js */
 
 var Cm = Components.manager;
 
 // Shared logging for all HTTP server functions.
 Cu.import("resource://gre/modules/Log.jsm");
 const SYNC_HTTP_LOGGER = "Sync.Test.Server";
+
+// While the sync code itself uses 1.5, the tests hard-code 1.1,
+// so we're sticking with 1.1 here.
 const SYNC_API_VERSION = "1.1";
 
 // Use the same method that record.js does, which mirrors the server.
 // The server returns timestamps with 1/100 sec granularity. Note that this is
 // subject to change: see Bug 650435.
 function new_timestamp() {
   return Math.round(Date.now() / 10) / 100;
 }
--- a/services/sync/tests/unit/test_clients_engine.js
+++ b/services/sync/tests/unit/test_clients_engine.js
@@ -27,19 +27,18 @@ function check_record_version(user, id) 
     rec.ciphertext = payload.ciphertext;
     rec.hmac = payload.hmac;
     rec.IV = payload.IV;
 
     let cleartext = rec.decrypt(Service.collectionKeys.keyForCollection("clients"));
 
     _("Payload is " + JSON.stringify(cleartext));
     equal(Services.appinfo.version, cleartext.version);
-    equal(2, cleartext.protocols.length);
-    equal("1.1", cleartext.protocols[0]);
-    equal("1.5", cleartext.protocols[1]);
+    equal(1, cleartext.protocols.length);
+    equal("1.5", cleartext.protocols[0]);
 }
 
 // compare 2 different command arrays, taking into account that a flowID
 // attribute must exist, be unique in the commands, but isn't specified in
 // "expected" as the value isn't known.
 function compareCommands(actual, expected, description) {
   let tweakedActual = JSON.parse(JSON.stringify(actual));
   tweakedActual.map(elt => delete elt.flowID);
@@ -975,17 +974,17 @@ add_task(async function test_receive_dis
   equal(data, null);
 
   cleanup();
 });
 
 add_task(async function test_optional_client_fields() {
   _("Ensure that we produce records with the fields added in Bug 1097222.");
 
-  const SUPPORTED_PROTOCOL_VERSIONS = ["1.1", "1.5"];
+  const SUPPORTED_PROTOCOL_VERSIONS = ["1.5"];
   let local = engine._store.createRecord(engine.localID, "clients");
   equal(local.name, engine.localName);
   equal(local.type, engine.localType);
   equal(local.version, Services.appinfo.version);
   deepEqual(local.protocols, SUPPORTED_PROTOCOL_VERSIONS);
 
   // Optional fields.
   // Make sure they're what they ought to be...