mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 956442 - Include version in desktop Sync client records. r=gps
This commit is contained in:
parent
dd92ad5d5b
commit
4b428980e6
@ -27,7 +27,7 @@ ClientsRec.prototype = {
|
||||
ttl: CLIENTS_TTL
|
||||
};
|
||||
|
||||
Utils.deferGetSet(ClientsRec, "cleartext", ["name", "type", "commands"]);
|
||||
Utils.deferGetSet(ClientsRec, "cleartext", ["name", "type", "commands", "version"]);
|
||||
|
||||
|
||||
this.ClientEngine = function ClientEngine(service) {
|
||||
@ -386,6 +386,7 @@ ClientStore.prototype = {
|
||||
record.name = this.engine.localName;
|
||||
record.type = this.engine.localType;
|
||||
record.commands = this.engine.localCommands;
|
||||
record.version = Services.appinfo.version;
|
||||
}
|
||||
else
|
||||
record.cleartext = this._remoteClients[id];
|
||||
|
@ -4,6 +4,7 @@
|
||||
Cu.import("resource://services-sync/constants.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");
|
||||
Cu.import("resource://testing-common/services/sync/utils.js");
|
||||
@ -13,6 +14,26 @@ const LESS_THAN_CLIENTS_TTL_REFRESH = 86400; // 1 day
|
||||
|
||||
let engine = Service.clientsEngine;
|
||||
|
||||
/**
|
||||
* Unpack the record with this ID, and verify that it has the same version that
|
||||
* we should be putting into records.
|
||||
*/
|
||||
function check_record_version(user, id) {
|
||||
let payload = JSON.parse(user.collection("clients").wbo(id).payload);
|
||||
|
||||
let rec = new CryptoWrapper();
|
||||
rec.id = id;
|
||||
rec.collection = "clients";
|
||||
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));
|
||||
do_check_eq(Services.appinfo.version, cleartext.version);
|
||||
}
|
||||
|
||||
add_test(function test_bad_hmac() {
|
||||
_("Ensure that Clients engine deletes corrupt records.");
|
||||
let contents = {
|
||||
@ -70,6 +91,9 @@ add_test(function test_bad_hmac() {
|
||||
check_clients_count(1);
|
||||
do_check_true(engine.lastRecordUpload > 0);
|
||||
|
||||
// Our uploaded record has a version.
|
||||
check_record_version(user, engine.localID);
|
||||
|
||||
// Initial setup can wipe the server, so clean up.
|
||||
deletedCollections = [];
|
||||
deletedItems = [];
|
||||
|
Loading…
Reference in New Issue
Block a user