Bug 854937: Fix reason code for bootstrap addon dropped in profile extensions folder. r=Mossop,Unfocused

This commit is contained in:
Alexandre Poirot 2013-04-03 00:29:37 +13:00
parent 83ed853ee8
commit b8fb16353d
2 changed files with 9 additions and 3 deletions

View File

@ -1672,9 +1672,15 @@ var XPIProvider = {
for (let id in this.bootstrappedAddons) {
let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.persistentDescriptor = this.bootstrappedAddons[id].descriptor;
let reason = BOOTSTRAP_REASONS.APP_STARTUP;
// Eventually set INSTALLED reason when a bootstrap addon
// is dropped in profile folder and automatically installed
if (AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_INSTALLED)
.indexOf(id) !== -1)
reason = BOOTSTRAP_REASONS.ADDON_INSTALL;
this.callBootstrapMethod(id, this.bootstrappedAddons[id].version,
this.bootstrappedAddons[id].type, file,
"startup", BOOTSTRAP_REASONS.APP_STARTUP);
"startup", reason);
}
AddonManagerPrivate.recordTimestamp("XPI_bootstrap_addons_end");

View File

@ -487,7 +487,7 @@ function run_test_8() {
do_check_true(b1.isActive);
do_check_eq(getInstalledVersion(), 1);
do_check_eq(getActiveVersion(), 1);
do_check_eq(getStartupReason(), APP_STARTUP);
do_check_eq(getStartupReason(), ADDON_INSTALL);
do_check_eq(getStartupOldVersion(), 0);
do_check_in_crash_annotation("bootstrap1@tests.mozilla.org", "1.0");
@ -666,7 +666,7 @@ function run_test_12() {
do_check_true(b1.isActive);
do_check_eq(getInstalledVersion(), 1);
do_check_eq(getActiveVersion(), 1);
do_check_eq(getStartupReason(), APP_STARTUP);
do_check_eq(getStartupReason(), ADDON_INSTALL);
do_check_eq(getStartupOldVersion(), 0);
do_check_in_crash_annotation("bootstrap1@tests.mozilla.org", "1.0");