/* Any copyright is dedicated to the Public Domain. *http://creativecommons.org/publicdomain/zero/1.0/
*/
const ID = "addon@tests.mozilla.org";
let profileDir = gProfD.clone();
profileDir.append("extensions");
// By default disable add-ons from the profile and the system-wide scope const SCOPES = AddonManager.SCOPE_PROFILE | AddonManager.SCOPE_SYSTEM;
Services.prefs.setIntPref("extensions.enabledScopes", SCOPES);
Services.prefs.setIntPref("extensions.autoDisableScopes", SCOPES);
// Sideloading an add-on in the systemwide location should mark it as unseen
add_task(async function () {
let savedStartupScanScopes = Services.prefs.getIntPref( "extensions.startupScanScopes"
);
Services.prefs.setIntPref("extensions.startupScanScopes", 0);
Services.prefs.setIntPref( "extensions.sideloadScopes",
AddonManager.SCOPE_ALL
);
// Sideloading an add-on in the profile should mark it as unseen and it should // remain unseen after an update is sideloaded.
add_task(async function () {
let path = await manuallyInstall(XPIS[1], profileDir, ID); // Make sure the startup code will detect sideloaded updates
setExtensionModifiedTime(path, Date.now() - 10000);
await promiseStartupManager();
let addon = await promiseAddonByID(ID); Assert.equal(addon.version, "1.0"); Assert.ok(addon.foreignInstall); Assert.ok(!addon.seen);
// Sideloading an add-on in the profile should mark it as unseen and it should // remain unseen after a regular update.
add_task(async function () {
let path = await manuallyInstall(XPIS[1], profileDir, ID); // Make sure the startup code will detect sideloaded updates
setExtensionModifiedTime(path, Date.now() - 10000);
await promiseStartupManager();
let addon = await promiseAddonByID(ID); Assert.equal(addon.version, "1.0"); Assert.ok(addon.foreignInstall); Assert.ok(!addon.seen);
// Updating through the API shouldn't change the state
let install = await promiseInstallFile(XPIS[2]); Assert.equal(install.state, AddonManager.STATE_INSTALLED); Assert.ok(
!hasFlag(install.addon.pendingOperations, AddonManager.PENDING_INSTALL)
);
// After a sideloaded addon has been seen, sideloading an update should // not reset it to unseen.
add_task(async function () {
let path = await manuallyInstall(XPIS[1], profileDir, ID); // Make sure the startup code will detect sideloaded updates
setExtensionModifiedTime(path, Date.now() - 10000);
// After a sideloaded addon has been seen, manually applying an update should // not reset it to unseen.
add_task(async function () {
let path = await manuallyInstall(XPIS[1], profileDir, ID); // Make sure the startup code will detect sideloaded updates
setExtensionModifiedTime(path, Date.now() - 10000);
// Updating through the API shouldn't change the state
let install = await promiseInstallFile(XPIS[2]); Assert.equal(install.state, AddonManager.STATE_INSTALLED); Assert.ok(
!hasFlag(install.addon.pendingOperations, AddonManager.PENDING_INSTALL)
);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.