mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1232222 - Provide telemetry environment data on which addons are system addons. r=gfritzsche
This commit is contained in:
parent
ac19cfd3f9
commit
4f343b2949
@ -540,6 +540,7 @@ EnvironmentAddonBuilder.prototype = {
|
||||
installDay: Utils.millisecondsToDays(installDate.getTime()),
|
||||
updateDay: Utils.millisecondsToDays(updateDate.getTime()),
|
||||
signedState: addon.signedState,
|
||||
isSystem: addon.isSystem,
|
||||
};
|
||||
|
||||
if (addon.signedState !== undefined)
|
||||
|
@ -195,6 +195,7 @@ Structure::
|
||||
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
|
||||
isSystem: <bool>, // true if this is a System Add-on
|
||||
},
|
||||
...
|
||||
},
|
||||
|
@ -166,6 +166,10 @@ function loadAddonManager(id, name, version, platformVersion) {
|
||||
let uri = ns.Services.io.newFileURI(file);
|
||||
ns.Services.scriptloader.loadSubScript(uri.spec, gGlobalScope);
|
||||
createAppInfo(id, name, version, platformVersion);
|
||||
// As we're not running in application, we need to setup the features directory
|
||||
// used by system add-ons.
|
||||
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "app0"], true);
|
||||
registerDirectory("XREAppFeat", distroDir);
|
||||
startupManager();
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
|
||||
Cu.import("resource://testing-common/AddonManagerTesting.jsm");
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://testing-common/MockRegistrar.jsm", this);
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
|
||||
// Lazy load |LightweightThemeManager|, we won't be using it on Gonk.
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager",
|
||||
@ -571,6 +572,11 @@ function checkSystemSection(data) {
|
||||
}
|
||||
|
||||
function checkActiveAddon(data){
|
||||
let signedState = mozinfo.addon_signing ? "number" : "undefined";
|
||||
// system add-ons have an undefined signState
|
||||
if (data.isSystem)
|
||||
signedState = "undefined";
|
||||
|
||||
const EXPECTED_ADDON_FIELDS_TYPES = {
|
||||
blocklisted: "boolean",
|
||||
name: "string",
|
||||
@ -583,7 +589,8 @@ function checkActiveAddon(data){
|
||||
hasBinaryComponents: "boolean",
|
||||
installDay: "number",
|
||||
updateDay: "number",
|
||||
signedState: mozinfo.addon_signing ? "number" : "undefined",
|
||||
signedState: signedState,
|
||||
isSystem: "boolean",
|
||||
};
|
||||
|
||||
for (let f in EXPECTED_ADDON_FIELDS_TYPES) {
|
||||
@ -715,6 +722,10 @@ function run_test() {
|
||||
do_test_pending();
|
||||
spoofGfxAdapter();
|
||||
do_get_profile();
|
||||
|
||||
// The system add-on must be installed before AddonManager is started.
|
||||
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "app0"], true);
|
||||
do_get_file("system.xpi").copyTo(distroDir, "tel-system-xpi@tests.mozilla.org.xpi");
|
||||
loadAddonManager(APP_ID, APP_NAME, APP_VERSION, PLATFORM_VERSION);
|
||||
|
||||
// Spoof the persona ID, but not on Gonk.
|
||||
@ -1016,6 +1027,25 @@ add_task(function* test_addonsAndPlugins() {
|
||||
installDay: ADDON_INSTALL_DATE,
|
||||
updateDay: ADDON_INSTALL_DATE,
|
||||
signedState: mozinfo.addon_signing ? AddonManager.SIGNEDSTATE_MISSING : AddonManager.SIGNEDSTATE_NOT_REQUIRED,
|
||||
isSystem: false,
|
||||
};
|
||||
const SYSTEM_ADDON_ID = "tel-system-xpi@tests.mozilla.org";
|
||||
const SYSTEM_ADDON_INSTALL_DATE = truncateToDays(Date.now());
|
||||
const EXPECTED_SYSTEM_ADDON_DATA = {
|
||||
blocklisted: false,
|
||||
description: "A system addon which is shipped with Firefox.",
|
||||
name: "XPI Telemetry System Add-on Test",
|
||||
userDisabled: false,
|
||||
appDisabled: false,
|
||||
version: "1.0",
|
||||
scope: 1,
|
||||
type: "extension",
|
||||
foreignInstall: false,
|
||||
hasBinaryComponents: false,
|
||||
installDay: SYSTEM_ADDON_INSTALL_DATE,
|
||||
updateDay: SYSTEM_ADDON_INSTALL_DATE,
|
||||
signedState: undefined,
|
||||
isSystem: true,
|
||||
};
|
||||
|
||||
const EXPECTED_PLUGIN_DATA = {
|
||||
@ -1040,6 +1070,13 @@ add_task(function* test_addonsAndPlugins() {
|
||||
Assert.equal(targetAddon[f], EXPECTED_ADDON_DATA[f], f + " must have the correct value.");
|
||||
}
|
||||
|
||||
// Check system add-on data.
|
||||
Assert.ok(SYSTEM_ADDON_ID in data.addons.activeAddons, "We must have one active system addon.");
|
||||
let targetSystemAddon = data.addons.activeAddons[SYSTEM_ADDON_ID];
|
||||
for (let f in EXPECTED_SYSTEM_ADDON_DATA) {
|
||||
Assert.equal(targetSystemAddon[f], EXPECTED_SYSTEM_ADDON_DATA[f], f + " must have the correct value.");
|
||||
}
|
||||
|
||||
// Check theme data.
|
||||
let theme = data.addons.theme;
|
||||
Assert.equal(theme.id, (PERSONA_ID + PERSONA_ID_SUFFIX));
|
||||
|
@ -12,6 +12,7 @@ support-files =
|
||||
experiment.xpi
|
||||
extension.xpi
|
||||
extension-2.xpi
|
||||
system.xpi
|
||||
restartless.xpi
|
||||
theme.xpi
|
||||
generated-files =
|
||||
@ -19,6 +20,7 @@ generated-files =
|
||||
experiment.xpi
|
||||
extension.xpi
|
||||
extension-2.xpi
|
||||
system.xpi
|
||||
restartless.xpi
|
||||
theme.xpi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user