author | Dave Townsend <dtownsend@oxymoronical.com> |
Mon, 11 May 2015 12:29:44 -0700 | |
changeset 243960 | c19c7176325efc3cb8c1b754def70a1a46c3b958 |
parent 243959 | c113a12800202e13d07c52f7b28a02383ea7f5f2 |
child 243961 | efa0dda1fa8803257d1aa44e9c8209f3f41a622e |
push id | 28761 |
push user | cbook@mozilla.com |
push date | Fri, 15 May 2015 14:50:10 +0000 |
treeherder | mozilla-central@c0e709a5baca [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1156985 |
milestone | 41.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/toolkit/mozapps/extensions/test/xpcshell/test_signed_inject.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_signed_inject.js @@ -44,16 +44,23 @@ function resetPrefs() { Services.prefs.setIntPref("bootstraptest.install_reason", -1); Services.prefs.setIntPref("bootstraptest.uninstall_reason", -1); Services.prefs.setIntPref("bootstraptest.startup_oldversion", -1); Services.prefs.setIntPref("bootstraptest.shutdown_newversion", -1); Services.prefs.setIntPref("bootstraptest.install_oldversion", -1); Services.prefs.setIntPref("bootstraptest.uninstall_newversion", -1); } +function clearCache(file) { + if (TEST_UNPACKED) + return; + + Services.obs.notifyObservers(file, "flush-cache-entry", null); +} + function getActiveVersion() { return Services.prefs.getIntPref("bootstraptest.active_version"); } function run_test() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "4", "4"); // Start and stop the manager to initialise everything in the profile before @@ -62,97 +69,101 @@ function run_test() { shutdownManager(); resetPrefs(); run_next_test(); } // Injecting into profile (bootstrap) add_task(function*() { - manuallyInstall(do_get_file(DATA + ADDONS.bootstrap.unsigned), profileDir, ID); + let file = manuallyInstall(do_get_file(DATA + ADDONS.bootstrap.unsigned), profileDir, ID); startupManager(); // Currently we leave the sideloaded add-on there but just don't run it let addon = yield promiseAddonByID(ID); do_check_neq(addon, null); do_check_true(addon.appDisabled); do_check_false(addon.isActive); do_check_eq(addon.signedState, AddonManager.SIGNEDSTATE_MISSING); do_check_eq(getActiveVersion(), -1); addon.uninstall(); yield promiseShutdownManager(); resetPrefs(); - do_check_false(getFileForAddon(profileDir, ID).exists()); + do_check_false(file.exists()); + clearCache(file); }); add_task(function*() { - manuallyInstall(do_get_file(DATA + ADDONS.bootstrap.signed), profileDir, ID); - breakAddon(getFileForAddon(profileDir, ID)); + let file = manuallyInstall(do_get_file(DATA + ADDONS.bootstrap.signed), profileDir, ID); + breakAddon(file); startupManager(); // Currently we leave the sideloaded add-on there but just don't run it let addon = yield promiseAddonByID(ID); do_check_neq(addon, null); do_check_true(addon.appDisabled); do_check_false(addon.isActive); do_check_eq(addon.signedState, AddonManager.SIGNEDSTATE_BROKEN); do_check_eq(getActiveVersion(), -1); addon.uninstall(); yield promiseShutdownManager(); resetPrefs(); - do_check_false(getFileForAddon(profileDir, ID).exists()); + do_check_false(file.exists()); + clearCache(file); }); add_task(function*() { - manuallyInstall(do_get_file(DATA + ADDONS.bootstrap.badid), profileDir, ID); + let file = manuallyInstall(do_get_file(DATA + ADDONS.bootstrap.badid), profileDir, ID); startupManager(); // Currently we leave the sideloaded add-on there but just don't run it let addon = yield promiseAddonByID(ID); do_check_neq(addon, null); do_check_true(addon.appDisabled); do_check_false(addon.isActive); do_check_eq(addon.signedState, AddonManager.SIGNEDSTATE_BROKEN); do_check_eq(getActiveVersion(), -1); addon.uninstall(); yield promiseShutdownManager(); resetPrefs(); - do_check_false(getFileForAddon(profileDir, ID).exists()); + do_check_false(file.exists()); + clearCache(file); }); // Installs a signed add-on then modifies it in place breaking its signing add_task(function*() { - manuallyInstall(do_get_file(DATA + ADDONS.bootstrap.signed), profileDir, ID); + let file = manuallyInstall(do_get_file(DATA + ADDONS.bootstrap.signed), profileDir, ID); // Make it appear to come from the past so when we modify it later it is // detected during startup. Obviously malware can bypass this method of // detection but the periodic scan will catch that - yield promiseSetExtensionModifiedTime(getFileForAddon(profileDir, ID).path, Date.now() - 600000); + yield promiseSetExtensionModifiedTime(file.path, Date.now() - 600000); startupManager(); let addon = yield promiseAddonByID(ID); do_check_neq(addon, null); do_check_false(addon.appDisabled); do_check_true(addon.isActive); do_check_eq(addon.signedState, AddonManager.SIGNEDSTATE_SIGNED); do_check_eq(getActiveVersion(), 2); yield promiseShutdownManager(); do_check_eq(getActiveVersion(), 0); - breakAddon(getFileForAddon(profileDir, ID)); + clearCache(file); + breakAddon(file); resetPrefs(); startupManager(); addon = yield promiseAddonByID(ID); do_check_neq(addon, null); do_check_true(addon.appDisabled); do_check_false(addon.isActive); @@ -162,101 +173,106 @@ add_task(function*() { let ids = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_DISABLED); do_check_eq(ids.length, 1); do_check_eq(ids[0], ID); addon.uninstall(); yield promiseShutdownManager(); resetPrefs(); - do_check_false(getFileForAddon(profileDir, ID).exists()); + do_check_false(file.exists()); + clearCache(file); }); // Injecting into profile (non-bootstrap) add_task(function*() { - manuallyInstall(do_get_file(DATA + ADDONS.nonbootstrap.unsigned), profileDir, ID); + let file = manuallyInstall(do_get_file(DATA + ADDONS.nonbootstrap.unsigned), profileDir, ID); startupManager(); // Currently we leave the sideloaded add-on there but just don't run it let addon = yield promiseAddonByID(ID); do_check_neq(addon, null); do_check_true(addon.appDisabled); do_check_false(addon.isActive); do_check_eq(addon.signedState, AddonManager.SIGNEDSTATE_MISSING); do_check_false(isExtensionInAddonsList(profileDir, ID)); addon.uninstall(); yield promiseRestartManager(); yield promiseShutdownManager(); - do_check_false(getFileForAddon(profileDir, ID).exists()); + do_check_false(file.exists()); + clearCache(file); }); add_task(function*() { - manuallyInstall(do_get_file(DATA + ADDONS.nonbootstrap.signed), profileDir, ID); - breakAddon(getFileForAddon(profileDir, ID)); + let file = manuallyInstall(do_get_file(DATA + ADDONS.nonbootstrap.signed), profileDir, ID); + breakAddon(file); startupManager(); // Currently we leave the sideloaded add-on there but just don't run it let addon = yield promiseAddonByID(ID); do_check_neq(addon, null); do_check_true(addon.appDisabled); do_check_false(addon.isActive); do_check_eq(addon.signedState, AddonManager.SIGNEDSTATE_BROKEN); do_check_false(isExtensionInAddonsList(profileDir, ID)); addon.uninstall(); yield promiseRestartManager(); yield promiseShutdownManager(); - do_check_false(getFileForAddon(profileDir, ID).exists()); + do_check_false(file.exists()); + clearCache(file); }); add_task(function*() { - manuallyInstall(do_get_file(DATA + ADDONS.nonbootstrap.badid), profileDir, ID); + let file = manuallyInstall(do_get_file(DATA + ADDONS.nonbootstrap.badid), profileDir, ID); startupManager(); // Currently we leave the sideloaded add-on there but just don't run it let addon = yield promiseAddonByID(ID); do_check_neq(addon, null); do_check_true(addon.appDisabled); do_check_false(addon.isActive); do_check_eq(addon.signedState, AddonManager.SIGNEDSTATE_BROKEN); do_check_false(isExtensionInAddonsList(profileDir, ID)); addon.uninstall(); yield promiseRestartManager(); yield promiseShutdownManager(); - do_check_false(getFileForAddon(profileDir, ID).exists()); + do_check_false(file.exists()); + clearCache(file); }); // Installs a signed add-on then modifies it in place breaking its signing add_task(function*() { - manuallyInstall(do_get_file(DATA + ADDONS.nonbootstrap.signed), profileDir, ID); + let file = manuallyInstall(do_get_file(DATA + ADDONS.nonbootstrap.signed), profileDir, ID); // Make it appear to come from the past so when we modify it later it is // detected during startup. Obviously malware can bypass this method of // detection but the periodic scan will catch that - yield promiseSetExtensionModifiedTime(getFileForAddon(profileDir, ID).path, Date.now() - 60000); + yield promiseSetExtensionModifiedTime(file.path, Date.now() - 60000); startupManager(); let addon = yield promiseAddonByID(ID); do_check_neq(addon, null); do_check_false(addon.appDisabled); do_check_true(addon.isActive); do_check_eq(addon.signedState, AddonManager.SIGNEDSTATE_SIGNED); do_check_true(isExtensionInAddonsList(profileDir, ID)); yield promiseShutdownManager(); - breakAddon(getFileForAddon(profileDir, ID)); + clearCache(file); + breakAddon(file); startupManager(); addon = yield promiseAddonByID(ID); do_check_neq(addon, null); do_check_true(addon.appDisabled); do_check_false(addon.isActive); do_check_eq(addon.signedState, AddonManager.SIGNEDSTATE_BROKEN); @@ -265,17 +281,18 @@ add_task(function*() { let ids = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_DISABLED); do_check_eq(ids.length, 1); do_check_eq(ids[0], ID); addon.uninstall(); yield promiseRestartManager(); yield promiseShutdownManager(); - do_check_false(getFileForAddon(profileDir, ID).exists()); + do_check_false(file.exists()); + clearCache(file); }); // Stage install then modify before startup (non-bootstrap) add_task(function*() { startupManager(); yield promiseInstallAllFiles([do_get_file(DATA + ADDONS.nonbootstrap.signed)]); yield promiseShutdownManager(); @@ -286,18 +303,17 @@ add_task(function*() { breakAddon(staged); startupManager(); // Should have refused to install the broken staged version let addon = yield promiseAddonByID(ID); do_check_eq(addon, null); - let install = getFileForAddon(profileDir, ID); - do_check_false(install.exists()); + clearCache(staged); yield promiseShutdownManager(); }); // Manufacture staged install (bootstrap) add_task(function*() { let stage = profileDir.clone(); stage.append("staged"); @@ -307,14 +323,14 @@ add_task(function*() { startupManager(); // Should have refused to install the broken staged version let addon = yield promiseAddonByID(ID); do_check_eq(addon, null); do_check_eq(getActiveVersion(), -1); - let install = getFileForAddon(profileDir, ID); - do_check_false(install.exists()); + do_check_false(file.exists()); + clearCache(file); yield promiseShutdownManager(); resetPrefs(); });
--- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini @@ -233,17 +233,16 @@ skip-if = os == "android" [test_pluginBlocklistCtp.js] # Bug 676992: test consistently fails on Android fail-if = buildapp == "mulet" || os == "android" [test_pref_properties.js] [test_registry.js] [test_safemode.js] [test_signed_verify.js] [test_signed_inject.js] -skip-if = true [test_signed_install.js] run-sequentially = Uses hardcoded ports in xpi files. [test_signed_migrate.js] [test_startup.js] # Bug 676992: test consistently fails on Android fail-if = os == "android" [test_syncGUID.js] [test_strictcompatibility.js]