mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1010449: Add telemetry for add-on compatibility changes, upgrades during startup time add-on update check; r=unfocused
This commit is contained in:
parent
3a63dd3962
commit
c3d07ebc37
@ -40,6 +40,14 @@ var gUpdateWizard = {
|
||||
// keyed by add-on ID
|
||||
addonInstalls: new Map(),
|
||||
shuttingDown: false,
|
||||
// Count the add-ons disabled by this update, enabled/disabled by
|
||||
// metadata checks, and upgraded.
|
||||
disabled: 0,
|
||||
metadataEnabled: 0,
|
||||
metadataDisabled: 0,
|
||||
upgraded: 0,
|
||||
upgradeFailed: 0,
|
||||
upgradeDeclined: 0,
|
||||
|
||||
init: function gUpdateWizard_init()
|
||||
{
|
||||
@ -151,6 +159,18 @@ var gOfflinePage = {
|
||||
}
|
||||
}
|
||||
|
||||
// Addon listener to count addons enabled/disabled by metadata checks
|
||||
let listener = {
|
||||
onDisabled: function listener_onDisabled(aAddon) {
|
||||
logger.debug("onDisabled for ${id}", aAddon);
|
||||
gUpdateWizard.metadataDisabled++;
|
||||
},
|
||||
onEnabled: function listener_onEnabled(aAddon) {
|
||||
logger.debug("onEnabled for ${id}", aAddon);
|
||||
gUpdateWizard.metadataEnabled++;
|
||||
}
|
||||
};
|
||||
|
||||
var gVersionInfoPage = {
|
||||
_completeCount: 0,
|
||||
_totalCount: 0,
|
||||
@ -177,10 +197,19 @@ var gVersionInfoPage = {
|
||||
|
||||
gVersionInfoPage._totalCount = gUpdateWizard.addons.length;
|
||||
|
||||
// Count the add-ons newly disabled by this application update
|
||||
for (let addon of gUpdateWizard.addons) {
|
||||
if (gUpdateWizard.inactiveAddonIDs.indexOf(addon.id) != -1) {
|
||||
gUpdateWizard.disabled++;
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure compatibility overrides are up to date before checking for
|
||||
// individual addon updates.
|
||||
let ids = [addon.id for (addon of gUpdateWizard.addons)];
|
||||
|
||||
// Do the metadata ping, listening for any newly enabled/disabled add-ons.
|
||||
AddonManager.addAddonListener(listener);
|
||||
AddonRepository.repopulateCache(ids, function gVersionInfoPage_repopulateCache() {
|
||||
|
||||
if (gUpdateWizard.shuttingDown) {
|
||||
@ -196,6 +225,18 @@ var gVersionInfoPage = {
|
||||
},
|
||||
|
||||
onAllUpdatesFinished: function gVersionInfoPage_onAllUpdatesFinished() {
|
||||
AddonManager.removeAddonListener(listener);
|
||||
AddonManagerPrivate.recordSimpleMeasure("appUpdate_disabled",
|
||||
gUpdateWizard.disabled);
|
||||
AddonManagerPrivate.recordSimpleMeasure("appUpdate_metadata_enabled",
|
||||
gUpdateWizard.metadataEnabled);
|
||||
AddonManagerPrivate.recordSimpleMeasure("appUpdate_metadata_disabled",
|
||||
gUpdateWizard.metadataDisabled);
|
||||
// Record 0 for these here in case we exit early; values will be replaced
|
||||
// later if we actually upgrade any.
|
||||
AddonManagerPrivate.recordSimpleMeasure("appUpdate_upgraded", 0);
|
||||
AddonManagerPrivate.recordSimpleMeasure("appUpdate_upgradeFailed", 0);
|
||||
AddonManagerPrivate.recordSimpleMeasure("appUpdate_upgradeDeclined", 0);
|
||||
// Filter out any add-ons that were disabled before the application was
|
||||
// upgraded or are already compatible
|
||||
logger.debug("VersionInfo updates finished: inactive " +
|
||||
@ -259,8 +300,10 @@ var gVersionInfoPage = {
|
||||
if (!gUpdateWizard.shuttingDown) {
|
||||
// If we're still in the update check window and the add-on is now active
|
||||
// then it won't have been disabled by startup
|
||||
if (aAddon.active)
|
||||
if (aAddon.active) {
|
||||
AddonManagerPrivate.removeStartupChange("disabled", aAddon.id);
|
||||
gUpdateWizard.metadataEnabled++;
|
||||
}
|
||||
|
||||
// Update the status text and progress bar
|
||||
var updateStrings = document.getElementById("updateStrings");
|
||||
@ -461,6 +504,7 @@ var gInstallingPage = {
|
||||
for (let update of updates) {
|
||||
if (!update.checked) {
|
||||
logger.info("User chose to cancel update of " + update.label);
|
||||
gUpdateWizard.upgradeDeclined++;
|
||||
update.install.cancel();
|
||||
continue;
|
||||
}
|
||||
@ -480,6 +524,12 @@ var gInstallingPage = {
|
||||
|
||||
if (this._installs.length == this._currentInstall) {
|
||||
Services.obs.notifyObservers(null, "TEST:all-updates-done", null);
|
||||
AddonManagerPrivate.recordSimpleMeasure("appUpdate_upgraded",
|
||||
gUpdateWizard.upgraded);
|
||||
AddonManagerPrivate.recordSimpleMeasure("appUpdate_upgradeFailed",
|
||||
gUpdateWizard.upgradeFailed);
|
||||
AddonManagerPrivate.recordSimpleMeasure("appUpdate_upgradeDeclined",
|
||||
gUpdateWizard.upgradeDeclined);
|
||||
this._installing = false;
|
||||
if (gUpdateWizard.shuttingDown) {
|
||||
return;
|
||||
@ -494,6 +544,7 @@ var gInstallingPage = {
|
||||
|
||||
if (gUpdateWizard.shuttingDown && !AddonManager.shouldAutoUpdate(install.existingAddon)) {
|
||||
logger.debug("Don't update " + install.existingAddon.id + " in background");
|
||||
gUpdateWizard.upgradeDeclined++;
|
||||
install.cancel();
|
||||
this.startNextInstall();
|
||||
return;
|
||||
@ -528,6 +579,7 @@ var gInstallingPage = {
|
||||
onDownloadFailed: function gInstallingPage_onDownloadFailed(aInstall) {
|
||||
this._errors.push(aInstall);
|
||||
|
||||
gUpdateWizard.upgradeFailed++;
|
||||
this.startNextInstall();
|
||||
},
|
||||
|
||||
@ -548,12 +600,14 @@ var gInstallingPage = {
|
||||
aAddon.id);
|
||||
}
|
||||
|
||||
gUpdateWizard.upgraded++;
|
||||
this.startNextInstall();
|
||||
},
|
||||
|
||||
onInstallFailed: function gInstallingPage_onInstallFailed(aInstall) {
|
||||
this._errors.push(aInstall);
|
||||
|
||||
gUpdateWizard.upgradeFailed++;
|
||||
this.startNextInstall();
|
||||
}
|
||||
};
|
||||
|
@ -2,8 +2,8 @@
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Test that the compatibility dialog that normally displays during startup
|
||||
// appears to work correctly.
|
||||
// Test the compatibility dialog that displays during startup when the browser
|
||||
// version changes.
|
||||
|
||||
const URI_EXTENSION_UPDATE_DIALOG = "chrome://mozapps/content/extensions/update.xul";
|
||||
|
||||
@ -11,6 +11,10 @@ const PREF_GETADDONS_BYIDS = "extensions.getAddons.get.url";
|
||||
const PREF_MIN_PLATFORM_COMPAT = "extensions.minCompatiblePlatformVersion";
|
||||
|
||||
Services.prefs.setBoolPref(PREF_STRICT_COMPAT, true);
|
||||
// avoid the 'leaked window property' check
|
||||
let scope = {};
|
||||
Components.utils.import("resource://gre/modules/TelemetryPing.jsm", scope);
|
||||
let TelemetryPing = scope.TelemetryPing;
|
||||
|
||||
/**
|
||||
* Test add-ons:
|
||||
@ -169,6 +173,24 @@ function get_list_names(aList) {
|
||||
return items;
|
||||
}
|
||||
|
||||
function check_telemetry({disabled, metaenabled, metadisabled, upgraded, failed, declined}) {
|
||||
let ping = TelemetryPing.getPayload();
|
||||
// info(JSON.stringify(ping));
|
||||
let am = ping.simpleMeasurements.addonManager;
|
||||
if (disabled !== undefined)
|
||||
is(am.appUpdate_disabled, disabled, disabled + " add-ons disabled by version change");
|
||||
if (metaenabled !== undefined)
|
||||
is(am.appUpdate_metadata_enabled, metaenabled, metaenabled + " add-ons enabled by metadata");
|
||||
if (metadisabled !== undefined)
|
||||
is(am.appUpdate_metadata_disabled, metadisabled, metadisabled + " add-ons disabled by metadata");
|
||||
if (upgraded !== undefined)
|
||||
is(am.appUpdate_upgraded, upgraded, upgraded + " add-ons upgraded");
|
||||
if (failed !== undefined)
|
||||
is(am.appUpdate_upgradeFailed, failed, failed + " upgrades failed");
|
||||
if (declined !== undefined)
|
||||
is(am.appUpdate_upgradeDeclined, declined, declined + " upgrades declined");
|
||||
}
|
||||
|
||||
// Tests that the right add-ons show up in the mismatch dialog and updates can
|
||||
// be installed
|
||||
add_test(function() {
|
||||
@ -181,10 +203,10 @@ add_test(function() {
|
||||
"addon10@tests.mozilla.org"
|
||||
];
|
||||
|
||||
// Check that compatibility updates were applied.
|
||||
AddonManager.getAddonsByIDs(["addon5@tests.mozilla.org",
|
||||
"addon6@tests.mozilla.org"],
|
||||
function([a5, a6]) {
|
||||
// Check starting (pre-update) conditions
|
||||
ok(!a5.isCompatible, "addon5 should not be compatible");
|
||||
ok(!a6.isCompatible, "addon6 should not be compatible");
|
||||
|
||||
@ -192,6 +214,7 @@ add_test(function() {
|
||||
var doc = aWindow.document;
|
||||
wait_for_page(aWindow, "mismatch", function(aWindow) {
|
||||
var items = get_list_names(doc.getElementById("mismatch.incompatible"));
|
||||
// Check that compatibility updates from individual add-on update checks were applied.
|
||||
is(items.length, 4, "Should have seen 4 still incompatible items");
|
||||
is(items[0], "Addon3 1.0", "Should have seen addon3 still incompatible");
|
||||
is(items[1], "Addon7 1.0", "Should have seen addon7 still incompatible");
|
||||
@ -199,7 +222,7 @@ add_test(function() {
|
||||
is(items[3], "Addon9 1.0", "Should have seen addon9 still incompatible");
|
||||
|
||||
ok(a5.isCompatible, "addon5 should be compatible");
|
||||
ok(a6.isCompatible, "addon5 should be compatible");
|
||||
ok(a6.isCompatible, "addon6 should be compatible");
|
||||
|
||||
var button = doc.documentElement.getButton("next");
|
||||
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
|
||||
@ -247,6 +270,9 @@ add_test(function() {
|
||||
is(a8.version, "2.0", "addon8 should have updated");
|
||||
is(a9.version, "2.0", "addon9 should have updated");
|
||||
|
||||
check_telemetry({disabled: 4, metaenabled: 2, metadisabled: 0,
|
||||
upgraded: 2, failed: 0, declined: 1});
|
||||
|
||||
uninstall_test_addons(run_next_test);
|
||||
});
|
||||
});
|
||||
@ -287,7 +313,7 @@ add_test(function() {
|
||||
"addon6@tests.mozilla.org"],
|
||||
function([a5, a6]) {
|
||||
ok(a5.isCompatible, "addon5 should be compatible");
|
||||
ok(a6.isCompatible, "addon5 should be compatible");
|
||||
ok(a6.isCompatible, "addon6 should be compatible");
|
||||
|
||||
var button = doc.documentElement.getButton("next");
|
||||
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
|
||||
@ -330,6 +356,9 @@ add_test(function() {
|
||||
uninstall_test_addons(run_next_test);
|
||||
});
|
||||
|
||||
check_telemetry({disabled: 4, metaenabled: 2, metadisabled: 0,
|
||||
upgraded: 0, failed: 1, declined: 2});
|
||||
|
||||
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
|
||||
});
|
||||
});
|
||||
@ -478,6 +507,9 @@ add_test(function() {
|
||||
uninstall_test_addons(run_next_test);
|
||||
});
|
||||
|
||||
check_telemetry({disabled: 0, metaenabled: 0, metadisabled: 1,
|
||||
upgraded: 0, failed: 0, declined: 0});
|
||||
|
||||
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user