--- a/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap.js
@@ -180,16 +180,17 @@ function check_test_1(installSyncGUID) {
AddonManager.getAddonByID(ID1, function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "1.0");
do_check_neq(b1.syncGUID, null);
do_check_eq(b1.syncGUID, installSyncGUID);
do_check_false(b1.appDisabled);
do_check_false(b1.userDisabled);
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
BootstrapMonitor.checkAddonStarted(ID1, "1.0");
do_check_eq(getStartupReason(), ADDON_INSTALL);
do_check_eq(getStartupOldVersion(), undefined);
do_check_true(b1.hasResource("install.rdf"));
do_check_true(b1.hasResource("bootstrap.js"));
do_check_false(b1.hasResource("foo.bar"));
do_check_in_crash_annotation(ID1, "1.0");
@@ -286,16 +287,17 @@ function run_test_4() {
b1.userDisabled = false;
ensure_test_completed();
do_check_neq(b1, null);
do_check_eq(b1.version, "1.0");
do_check_false(b1.appDisabled);
do_check_false(b1.userDisabled);
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
BootstrapMonitor.checkAddonStarted(ID1, "1.0");
do_check_eq(getStartupReason(), ADDON_ENABLE);
do_check_eq(getStartupOldVersion(), undefined);
do_check_in_crash_annotation(ID1, "1.0");
AddonManager.getAddonByID(ID1, function(newb1) {
do_check_neq(newb1, null);
@@ -328,16 +330,17 @@ function run_test_5() {
do_check_in_crash_annotation(ID1, "1.0");
AddonManager.getAddonByID(ID1, function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "1.0");
do_check_false(b1.appDisabled);
do_check_false(b1.userDisabled);
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
do_check_false(isExtensionInAddonsList(profileDir, b1.id));
do_check_bootstrappedPref(run_test_6);
});
}
// Tests that installing an upgrade doesn't require a restart
function run_test_6() {
@@ -371,16 +374,17 @@ function run_test_6() {
function check_test_6() {
AddonManager.getAddonByID(ID1, function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "2.0");
do_check_false(b1.appDisabled);
do_check_false(b1.userDisabled);
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
BootstrapMonitor.checkAddonInstalled(ID1, "2.0");
BootstrapMonitor.checkAddonStarted(ID1, "2.0");
do_check_eq(getStartupReason(), ADDON_UPGRADE);
do_check_eq(getInstallOldVersion(), 1);
do_check_eq(getStartupOldVersion(), 1);
do_check_eq(getShutdownReason(), ADDON_UPGRADE);
do_check_eq(getShutdownNewVersion(), 2);
do_check_eq(getUninstallNewVersion(), 2);
@@ -441,16 +445,17 @@ function run_test_8() {
startupManager(false);
AddonManager.getAddonByID(ID1, function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "1.0");
do_check_false(b1.appDisabled);
do_check_false(b1.userDisabled);
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
BootstrapMonitor.checkAddonStarted(ID1, "1.0");
do_check_eq(getStartupReason(), ADDON_INSTALL);
do_check_eq(getStartupOldVersion(), undefined);
do_check_in_crash_annotation(ID1, "1.0");
do_check_bootstrappedPref(run_test_9);
});
@@ -511,16 +516,17 @@ function run_test_10() {
function check_test_10_pt1() {
AddonManager.getAddonByID(ID1, function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "2.0");
do_check_false(b1.appDisabled);
do_check_false(b1.userDisabled);
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
BootstrapMonitor.checkAddonInstalled(ID1, "2.0");
BootstrapMonitor.checkAddonStarted(ID1, "2.0");
do_check_eq(getStartupReason(), ADDON_INSTALL);
do_check_eq(getStartupOldVersion(), undefined);
do_check_true(b1.hasResource("install.rdf"));
do_check_true(b1.hasResource("bootstrap.js"));
do_check_false(b1.hasResource("foo.bar"));
do_check_in_crash_annotation(ID1, "2.0");
@@ -555,16 +561,17 @@ function check_test_10_pt1() {
function check_test_10_pt2() {
AddonManager.getAddonByID(ID1, function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "1.0");
do_check_false(b1.appDisabled);
do_check_false(b1.userDisabled);
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
BootstrapMonitor.checkAddonStarted(ID1, "1.0");
do_check_eq(getStartupReason(), ADDON_DOWNGRADE);
do_check_eq(getInstallOldVersion(), 2);
do_check_eq(getStartupOldVersion(), 2);
do_check_eq(getShutdownReason(), ADDON_DOWNGRADE);
do_check_eq(getShutdownNewVersion(), 1);
do_check_eq(getUninstallNewVersion(), 1);
@@ -621,16 +628,17 @@ function run_test_12() {
startupManager(true);
AddonManager.getAddonByID(ID1, function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "1.0");
do_check_false(b1.appDisabled);
do_check_false(b1.userDisabled);
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
BootstrapMonitor.checkAddonStarted(ID1, "1.0");
do_check_eq(getStartupReason(), ADDON_INSTALL);
do_check_eq(getStartupOldVersion(), undefined);
do_check_in_crash_annotation(ID1, "1.0");
b1.uninstall();
do_execute_soon(test_12_restart);
@@ -749,16 +757,17 @@ function run_test_14() {
function run_test_15() {
BootstrapMonitor.promiseAddonStartup(ID1).then(function test_15_after_startup() {
AddonManager.getAddonByID(ID1, function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "1.0");
do_check_false(b1.appDisabled);
do_check_false(b1.userDisabled);
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
BootstrapMonitor.checkAddonStarted(ID1, "1.0");
b1.userDisabled = true;
do_check_false(b1.isActive);
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
BootstrapMonitor.checkAddonNotStarted(ID1);
@@ -821,16 +830,17 @@ function check_test_15() {
// Tests that bootstrapped extensions don't get loaded when in safe mode
function run_test_16() {
BootstrapMonitor.promiseAddonStartup(ID1).then(function test_16_after_startup() {
AddonManager.getAddonByID(ID1, callback_soon(function(b1) {
// Should have installed and started
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
BootstrapMonitor.checkAddonStarted(ID1, "1.0");
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
do_check_eq(b1.iconURL, "chrome://foo/skin/icon.png");
do_check_eq(b1.aboutURL, "chrome://foo/content/about.xul");
do_check_eq(b1.optionsURL, "chrome://foo/content/options.xul");
shutdownManager();
// Should have stopped
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
@@ -878,32 +888,34 @@ function run_test_17() {
AddonManager.getAddonByID(ID1, function(b1) {
// Should have installed and started
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
BootstrapMonitor.checkAddonStarted(ID1, "1.0");
do_check_neq(b1, null);
do_check_eq(b1.version, "1.0");
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
do_check_bootstrappedPref(run_test_18);
});
}
// Check that installing a new bootstrapped extension in the profile replaces
// the existing one
function run_test_18() {
BootstrapMonitor.promiseAddonStartup(ID1).then(function test_18_after_startup() {
AddonManager.getAddonByID(ID1, function(b1) {
// Should have installed and started
BootstrapMonitor.checkAddonInstalled(ID1, "2.0");
BootstrapMonitor.checkAddonStarted(ID1, "2.0");
do_check_neq(b1, null);
do_check_eq(b1.version, "2.0");
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
do_check_eq(getShutdownReason(), ADDON_UPGRADE);
do_check_eq(getUninstallReason(), ADDON_UPGRADE);
do_check_eq(getInstallReason(), ADDON_UPGRADE);
do_check_eq(getStartupReason(), ADDON_UPGRADE);
do_check_eq(getShutdownNewVersion(), 2);
do_check_eq(getUninstallNewVersion(), 2);
@@ -936,16 +948,17 @@ function run_test_19() {
function check_test_19() {
AddonManager.getAddonByID(ID1, function(b1) {
// Should have reverted to the older version
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
BootstrapMonitor.checkAddonStarted(ID1, "1.0");
do_check_neq(b1, null);
do_check_eq(b1.version, "1.0");
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
// TODO these reasons really should be ADDON_DOWNGRADE (bug 607818)
do_check_eq(getShutdownReason(), ADDON_UNINSTALL);
do_check_eq(getUninstallReason(), ADDON_UNINSTALL);
do_check_eq(getInstallReason(), ADDON_INSTALL);
do_check_eq(getStartupReason(), ADDON_INSTALL);
do_check_eq(getShutdownNewVersion(), undefined);
@@ -969,16 +982,17 @@ function run_test_20() {
AddonManager.getAddonByID(ID1, function(b1) {
// Should have installed and started
BootstrapMonitor.checkAddonInstalled(ID1, "2.0");
BootstrapMonitor.checkAddonStarted(ID1, "2.0");
do_check_neq(b1, null);
do_check_eq(b1.version, "2.0");
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
do_check_eq(getShutdownReason(), APP_SHUTDOWN);
do_check_eq(getUninstallReason(), ADDON_UPGRADE);
do_check_eq(getInstallReason(), ADDON_UPGRADE);
do_check_eq(getStartupReason(), APP_STARTUP);
do_check_eq(getShutdownNewVersion(), undefined);
do_check_eq(getUninstallNewVersion(), 2);
@@ -1003,16 +1017,17 @@ function run_test_21() {
AddonManager.getAddonByID(ID1, function(b1) {
// Should have installed and started
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
BootstrapMonitor.checkAddonStarted(ID1, "1.0");
do_check_neq(b1, null);
do_check_eq(b1.version, "1.0");
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
// This won't be set as the bootstrap script was gone so we couldn't
// uninstall it properly
do_check_eq(getUninstallReason(), undefined);
do_check_eq(getUninstallNewVersion(), undefined);
do_check_eq(getInstallReason(), ADDON_DOWNGRADE);
do_check_eq(getInstallOldVersion(), 2);
@@ -1046,16 +1061,17 @@ function run_test_22() {
AddonManager.getAddonByID(ID1, callback_soon(function(b1) {
// Should have installed and started
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
BootstrapMonitor.checkAddonStarted(ID1, "1.0");
do_check_neq(b1, null);
do_check_eq(b1.version, "1.0");
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
shutdownManager();
do_check_eq(getShutdownReason(), APP_SHUTDOWN);
do_check_eq(getShutdownNewVersion(), undefined);
manuallyUninstall(profileDir, ID1);
BootstrapMonitor.clear(ID1);
@@ -1066,16 +1082,17 @@ function run_test_22() {
AddonManager.getAddonByID(ID1, function(b1) {
// Should have installed and started
BootstrapMonitor.checkAddonInstalled(ID1, "2.0");
BootstrapMonitor.checkAddonStarted(ID1, "2.0");
do_check_neq(b1, null);
do_check_eq(b1.version, "2.0");
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
// This won't be set as the bootstrap script was gone so we couldn't
// uninstall it properly
do_check_eq(getUninstallReason(), undefined);
do_check_eq(getUninstallNewVersion(), undefined);
do_check_eq(getInstallReason(), ADDON_UPGRADE);
do_check_eq(getInstallOldVersion(), 1);
@@ -1145,16 +1162,17 @@ function check_test_23() {
AddonManager.getAddonByID(ID1, function(b1) {
do_execute_soon(function test_23_after_startup() {
do_check_neq(b1, null);
do_check_eq(b1.version, "1.0");
do_check_false(b1.appDisabled);
do_check_false(b1.userDisabled);
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
BootstrapMonitor.checkAddonStarted(ID1, "1.0");
do_check_eq(getStartupReason(), ADDON_INSTALL);
do_check_eq(getStartupOldVersion(), undefined);
do_check_true(b1.hasResource("install.rdf"));
do_check_true(b1.hasResource("bootstrap.js"));
do_check_false(b1.hasResource("foo.bar"));
do_check_in_crash_annotation(ID1, "1.0");
@@ -1233,29 +1251,31 @@ function run_test_25() {
// Needs a restart to complete this so the old version stays running
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
BootstrapMonitor.checkAddonStarted(ID1, "1.0");
AddonManager.getAddonByID(ID1, callback_soon(function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "1.0");
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
do_check_true(hasFlag(b1.pendingOperations, AddonManager.PENDING_UPGRADE));
restartManager();
BootstrapMonitor.checkAddonNotInstalled(ID1);
do_check_eq(getUninstallReason(), ADDON_UPGRADE);
do_check_eq(getUninstallNewVersion(), 4);
BootstrapMonitor.checkAddonNotStarted(ID1);
AddonManager.getAddonByID(ID1, function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "4.0");
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE);
do_check_bootstrappedPref(run_test_26);
});
}));
});
});
installAllFiles([do_get_addon("test_bootstrap1_1")], function test_25_installed() {
@@ -1270,29 +1290,31 @@ function run_test_26() {
// Needs a restart to complete this
BootstrapMonitor.checkAddonNotInstalled(ID1);
BootstrapMonitor.checkAddonNotStarted(ID1);
AddonManager.getAddonByID(ID1, callback_soon(function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "4.0");
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
do_check_true(hasFlag(b1.pendingOperations, AddonManager.PENDING_UPGRADE));
restartManager();
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
do_check_eq(getInstallReason(), ADDON_DOWNGRADE);
do_check_eq(getInstallOldVersion(), 4);
BootstrapMonitor.checkAddonStarted(ID1, "1.0");
AddonManager.getAddonByID(ID1, function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "1.0");
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE);
do_check_bootstrappedPref(run_test_27);
});
}));
});
}
@@ -1363,16 +1385,17 @@ function run_test_28() {
BootstrapMonitor.checkAddonNotStarted(ID1);
AddonManager.getAddonByID(ID1, function(b1) {
do_check_neq(b1, null);
do_check_true(b1.userDisabled);
b1.userDisabled = false;
do_check_eq(b1.version, "1.0");
do_check_true(b1.isActive);
+ do_check_false(b1.isSystem);
do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE);
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
BootstrapMonitor.checkAddonStarted(ID1, "1.0");
do_check_bootstrappedPref(do_test_finished);
});
}));
});