mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1097222 - Extend client record format on desktop. r=markh
This commit is contained in:
parent
17f7932e3f
commit
211d806cc1
@ -29,7 +29,11 @@ ClientsRec.prototype = {
|
|||||||
ttl: CLIENTS_TTL
|
ttl: CLIENTS_TTL
|
||||||
};
|
};
|
||||||
|
|
||||||
Utils.deferGetSet(ClientsRec, "cleartext", ["name", "type", "commands", "version", "protocols"]);
|
Utils.deferGetSet(ClientsRec,
|
||||||
|
"cleartext",
|
||||||
|
["name", "type", "commands",
|
||||||
|
"version", "protocols",
|
||||||
|
"formfactor", "os", "appPackage", "application", "device"]);
|
||||||
|
|
||||||
|
|
||||||
this.ClientEngine = function ClientEngine(service) {
|
this.ClientEngine = function ClientEngine(service) {
|
||||||
@ -100,6 +104,11 @@ ClientEngine.prototype = {
|
|||||||
},
|
},
|
||||||
set localID(value) Svc.Prefs.set("client.GUID", value),
|
set localID(value) Svc.Prefs.set("client.GUID", value),
|
||||||
|
|
||||||
|
get brandName() {
|
||||||
|
let brand = new StringBundle("chrome://branding/locale/brand.properties");
|
||||||
|
return brand.get("brandShortName");
|
||||||
|
},
|
||||||
|
|
||||||
get localName() {
|
get localName() {
|
||||||
let localName = Svc.Prefs.get("client.name", "");
|
let localName = Svc.Prefs.get("client.name", "");
|
||||||
if (localName != "")
|
if (localName != "")
|
||||||
@ -111,9 +120,8 @@ ClientEngine.prototype = {
|
|||||||
let user = env.get("USER") || env.get("USERNAME") ||
|
let user = env.get("USER") || env.get("USERNAME") ||
|
||||||
Svc.Prefs.get("account") || Svc.Prefs.get("username");
|
Svc.Prefs.get("account") || Svc.Prefs.get("username");
|
||||||
|
|
||||||
|
let brandName = this.brandName;
|
||||||
let appName;
|
let appName;
|
||||||
let brand = new StringBundle("chrome://branding/locale/brand.properties");
|
|
||||||
let brandName = brand.get("brandShortName");
|
|
||||||
try {
|
try {
|
||||||
let syncStrings = new StringBundle("chrome://browser/locale/sync.properties");
|
let syncStrings = new StringBundle("chrome://browser/locale/sync.properties");
|
||||||
appName = syncStrings.getFormattedString("sync.defaultAccountApplication", [brandName]);
|
appName = syncStrings.getFormattedString("sync.defaultAccountApplication", [brandName]);
|
||||||
@ -412,9 +420,18 @@ ClientStore.prototype = {
|
|||||||
record.commands = this.engine.localCommands;
|
record.commands = this.engine.localCommands;
|
||||||
record.version = Services.appinfo.version;
|
record.version = Services.appinfo.version;
|
||||||
record.protocols = SUPPORTED_PROTOCOL_VERSIONS;
|
record.protocols = SUPPORTED_PROTOCOL_VERSIONS;
|
||||||
}
|
|
||||||
else
|
// Optional fields.
|
||||||
|
record.os = Services.appinfo.OS; // "Darwin"
|
||||||
|
record.appPackage = Services.appinfo.ID;
|
||||||
|
record.application = this.engine.brandName // "Nightly"
|
||||||
|
|
||||||
|
// We can't compute these yet.
|
||||||
|
// record.device = ""; // Bug 1100723
|
||||||
|
// record.formfactor = ""; // Bug 1100722
|
||||||
|
} else {
|
||||||
record.cleartext = this._remoteClients[id];
|
record.cleartext = this._remoteClients[id];
|
||||||
|
}
|
||||||
|
|
||||||
return record;
|
return record;
|
||||||
},
|
},
|
||||||
|
@ -577,6 +577,32 @@ add_test(function test_receive_display_uri() {
|
|||||||
do_check_true(engine.processIncomingCommands());
|
do_check_true(engine.processIncomingCommands());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
add_test(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"];
|
||||||
|
let local = engine._store.createRecord(engine.localID, "clients");
|
||||||
|
do_check_eq(local.name, engine.localName);
|
||||||
|
do_check_eq(local.type, engine.localType);
|
||||||
|
do_check_eq(local.version, Services.appinfo.version);
|
||||||
|
do_check_array_eq(local.protocols, SUPPORTED_PROTOCOL_VERSIONS);
|
||||||
|
|
||||||
|
// Optional fields.
|
||||||
|
// Make sure they're what they ought to be...
|
||||||
|
do_check_eq(local.os, Services.appinfo.OS);
|
||||||
|
do_check_eq(local.appPackage, Services.appinfo.ID);
|
||||||
|
|
||||||
|
// ... and also that they're non-empty.
|
||||||
|
do_check_true(!!local.os);
|
||||||
|
do_check_true(!!local.appPackage);
|
||||||
|
do_check_true(!!local.application);
|
||||||
|
|
||||||
|
// We don't currently populate device or formfactor.
|
||||||
|
// See Bug 1100722, Bug 1100723.
|
||||||
|
|
||||||
|
run_next_test();
|
||||||
|
});
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
initTestLogging("Trace");
|
initTestLogging("Trace");
|
||||||
Log.repository.getLogger("Sync.Engine.Clients").level = Log.Level.Trace;
|
Log.repository.getLogger("Sync.Engine.Clients").level = Log.Level.Trace;
|
||||||
|
Loading…
Reference in New Issue
Block a user