mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1062388: Add add-on signedState to telemetry environment. r=vladan, r=gfritzsche
This commit is contained in:
parent
b0bcc9ef55
commit
6ccd7b7016
@ -495,7 +495,11 @@ EnvironmentAddonBuilder.prototype = {
|
||||
hasBinaryComponents: addon.hasBinaryComponents,
|
||||
installDay: Utils.millisecondsToDays(installDate.getTime()),
|
||||
updateDay: Utils.millisecondsToDays(updateDate.getTime()),
|
||||
signedState: addon.signedState,
|
||||
};
|
||||
|
||||
if (addon.signedState !== undefined)
|
||||
activeAddons[addon.id].signedState = addon.signedState;
|
||||
}
|
||||
|
||||
return activeAddons;
|
||||
|
@ -145,6 +145,7 @@ Structure::
|
||||
hasBinaryComponents: <bool>
|
||||
installDay: <number>, // days since UNIX epoch, 0 on failure
|
||||
updateDay: <number>, // days since UNIX epoch, 0 on failure
|
||||
signedState: <integer>, // whether the add-on is signed by AMO, only present for extensions
|
||||
},
|
||||
...
|
||||
},
|
||||
|
@ -0,0 +1,7 @@
|
||||
Manifest-Version: 1.0
|
||||
|
||||
Name: install.rdf
|
||||
Digest-Algorithms: MD5 SHA1
|
||||
MD5-Digest: YEilRfaecTg2bMNPoYqexQ==
|
||||
SHA1-Digest: GEnQKM8Coyw83phx/z1oNh327+0=
|
||||
|
Binary file not shown.
@ -0,0 +1,4 @@
|
||||
Signature-Version: 1.0
|
||||
MD5-Digest-Manifest: Ko2bKTrwTXCdstWHWqCR4w==
|
||||
SHA1-Digest-Manifest: k6+jfNGFxXtDd1cSX0ZoIyQ1cww=
|
||||
|
24
toolkit/components/telemetry/tests/addons/signed/install.rdf
Normal file
24
toolkit/components/telemetry/tests/addons/signed/install.rdf
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>tel-signed-xpi@tests.mozilla.org</em:id>
|
||||
<em:version>1.0</em:version>
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>toolkit@mozilla.org</em:id>
|
||||
<em:minVersion>0</em:minVersion>
|
||||
<em:maxVersion>*</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Front End MetaData -->
|
||||
<em:name>XPI Telemetry Signed Test</em:name>
|
||||
<em:description>A signed addon which gets enabled without a reboot.</em:description>
|
||||
<em:bootstrap>true</em:bootstrap>
|
||||
|
||||
</Description>
|
||||
</RDF>
|
@ -441,6 +441,7 @@ function checkActiveAddon(data){
|
||||
hasBinaryComponents: "boolean",
|
||||
installDay: "number",
|
||||
updateDay: "number",
|
||||
signedState: "number",
|
||||
};
|
||||
|
||||
for (let f in EXPECTED_ADDON_FIELDS_TYPES) {
|
||||
@ -857,6 +858,7 @@ add_task(function* test_addonsAndPlugins() {
|
||||
hasBinaryComponents: false,
|
||||
installDay: ADDON_INSTALL_DATE,
|
||||
updateDay: ADDON_INSTALL_DATE,
|
||||
signedState: AddonManager.SIGNEDSTATE_MISSING,
|
||||
};
|
||||
|
||||
const EXPECTED_PLUGIN_DATA = {
|
||||
@ -903,6 +905,49 @@ add_task(function* test_addonsAndPlugins() {
|
||||
Assert.equal(data.addons.persona, personaId, "The correct Persona Id must be reported.");
|
||||
});
|
||||
|
||||
add_task(function* test_signedAddon() {
|
||||
const ADDON_INSTALL_URL = gDataRoot + "signed.xpi";
|
||||
const ADDON_ID = "tel-signed-xpi@tests.mozilla.org";
|
||||
const ADDON_INSTALL_DATE = truncateToDays(Date.now());
|
||||
const EXPECTED_ADDON_DATA = {
|
||||
blocklisted: false,
|
||||
description: "A signed addon which gets enabled without a reboot.",
|
||||
name: "XPI Telemetry Signed Test",
|
||||
userDisabled: false,
|
||||
appDisabled: false,
|
||||
version: "1.0",
|
||||
scope: 1,
|
||||
type: "extension",
|
||||
foreignInstall: false,
|
||||
hasBinaryComponents: false,
|
||||
installDay: ADDON_INSTALL_DATE,
|
||||
updateDay: ADDON_INSTALL_DATE,
|
||||
signedState: AddonManager.SIGNEDSTATE_SIGNED,
|
||||
};
|
||||
|
||||
// Set the clock in the future so our changes don't get throttled.
|
||||
gNow = fakeNow(futureDate(gNow, 10 * MILLISECONDS_PER_MINUTE));
|
||||
let deferred = PromiseUtils.defer();
|
||||
TelemetryEnvironment.registerChangeListener("test_signedAddon", deferred.resolve);
|
||||
|
||||
// Install the addon.
|
||||
yield AddonTestUtils.installXPIFromURL(ADDON_INSTALL_URL);
|
||||
|
||||
yield deferred.promise;
|
||||
// Unregister the listener.
|
||||
TelemetryEnvironment.unregisterChangeListener("test_signedAddon");
|
||||
|
||||
let data = TelemetryEnvironment.currentEnvironment;
|
||||
checkEnvironmentData(data);
|
||||
|
||||
// Check addon data.
|
||||
Assert.ok(ADDON_ID in data.addons.activeAddons, "Add-on should be in the environment.");
|
||||
let targetAddon = data.addons.activeAddons[ADDON_ID];
|
||||
for (let f in EXPECTED_ADDON_DATA) {
|
||||
Assert.equal(targetAddon[f], EXPECTED_ADDON_DATA[f], f + " must have the correct value.");
|
||||
}
|
||||
});
|
||||
|
||||
add_task(function* test_changeThrottling() {
|
||||
const PREF_TEST = "toolkit.telemetry.test.pref1";
|
||||
const PREFS_TO_WATCH = new Map([
|
||||
|
Loading…
Reference in New Issue
Block a user