Bug 693901 - Add preference to globally (re)enable strict compatibility checks. r=dtownsend

This commit is contained in:
Blair McBride 2011-11-01 18:48:45 +13:00
parent 520c5b4f0d
commit c8f32d996d
25 changed files with 4194 additions and 93 deletions

View File

@ -54,6 +54,10 @@ pref("browser.hiddenWindowChromeURL", "chrome://browser/content/hiddenWindow.xul
// Enables some extra Extension System Logging (can reduce performance)
pref("extensions.logging.enabled", false);
// Enables strict compatibility. To be toggled in bug 698653, to make addons
// compatibile by default.
pref("extensions.strictCompatibility", true);
// Preferences for AMO integration
pref("extensions.getAddons.cache.enabled", true);
pref("extensions.getAddons.maxResults", 15);

View File

@ -866,6 +866,7 @@ function test() {
waitForExplicitFinish();
Services.prefs.setBoolPref("extensions.logging.enabled", true);
Services.prefs.setBoolPref("extensions.strictCompatibility", true);
Services.obs.addObserver(XPInstallObserver, "addon-install-started", false);
Services.obs.addObserver(XPInstallObserver, "addon-install-blocked", false);
@ -884,6 +885,7 @@ function test() {
});
Services.prefs.clearUserPref("extensions.logging.enabled");
Services.prefs.clearUserPref("extensions.strictCompatibility");
Services.obs.removeObserver(XPInstallObserver, "addon-install-started");
Services.obs.removeObserver(XPInstallObserver, "addon-install-blocked");

View File

@ -48,6 +48,9 @@ const PREF_EM_UPDATE_ENABLED = "extensions.update.enabled";
const PREF_EM_LAST_APP_VERSION = "extensions.lastAppVersion";
const PREF_EM_LAST_PLATFORM_VERSION = "extensions.lastPlatformVersion";
const PREF_EM_AUTOUPDATE_DEFAULT = "extensions.update.autoUpdateDefault";
const PREF_EM_STRICT_COMPATIBILITY = "extensions.strictCompatibility";
const STRICT_COMPATIBILITY_DEFAULT = true;
const VALID_TYPES_REGEXP = /^[\w\-]+$/;
@ -281,6 +284,7 @@ function AddonType(aId, aLocaleURI, aLocaleKey, aViewType, aUIPriority, aFlags)
}
var gStarted = false;
var gStrictCompatibility = STRICT_COMPATIBILITY_DEFAULT;
/**
* This is the real manager, kept here rather than in AddonManager to keep its
@ -374,6 +378,11 @@ var AddonManagerInternal = {
(appChanged === undefined ? 0 : -1));
}
try {
gStrictCompatibility = Services.prefs.getBoolPref(PREF_EM_STRICT_COMPATIBILITY);
} catch (e) {}
Services.prefs.addObserver(PREF_EM_STRICT_COMPATIBILITY, this, false);
// Ensure all default providers have had a chance to register themselves
DEFAULT_PROVIDERS.forEach(function(url) {
try {
@ -495,6 +504,8 @@ var AddonManagerInternal = {
* up everything in order for automated tests to fake restarts.
*/
shutdown: function AMI_shutdown() {
Services.prefs.removeObserver(PREF_EM_STRICT_COMPATIBILITY, this);
this.providers.forEach(function(provider) {
callProvider(provider, "shutdown");
});
@ -507,6 +518,31 @@ var AddonManagerInternal = {
gStarted = false;
},
/**
* Notified when a preference we're interested in has changed.
*
* @see nsIObserver
*/
observe: function AMI_observe(aSubject, aTopic, aData) {
switch (aData) {
case PREF_EM_STRICT_COMPATIBILITY:
let oldValue = gStrictCompatibility;
try {
gStrictCompatibility = Services.prefs.getBoolPref(PREF_EM_STRICT_COMPATIBILITY);
} catch(e) {
gStrictCompatibility = STRICT_COMPATIBILITY_DEFAULT;
}
// XXXunf Currently, this won't notify listeners that an addon's
// compatibility status has changed if the addon's appDisabled state
// doesn't change.
if (gStrictCompatibility != oldValue)
this.updateAddonAppDisabledStates();
break;
}
},
/**
* Performs a background update check by starting an update for all add-ons
* that can be updated.
@ -1095,6 +1131,10 @@ var AddonManagerInternal = {
return Services.prefs.getBoolPref(PREF_EM_AUTOUPDATE_DEFAULT);
} catch(e) { }
return true;
},
get strictCompatibility() {
return gStrictCompatibility;
}
};
@ -1415,6 +1455,10 @@ var AddonManager = {
if (aAddon.applyBackgroundUpdates == AddonManager.AUTOUPDATE_DISABLE)
return false;
return this.autoUpdateDefault;
},
get strictCompatibility() {
return AddonManagerInternal.strictCompatibility;
}
};

View File

@ -6908,6 +6908,11 @@ AddonInternal.prototype = {
if (!app)
return false;
// Only extensions can be compatible by default; themes always use strict
// compatibility checking.
if (this.type == "extension" && !AddonManager.strictCompatibility)
return true;
if (!aAppVersion)
aAppVersion = Services.appinfo.version;
if (!aPlatformVersion)

View File

@ -7,6 +7,8 @@
const URI_EXTENSION_UPDATE_DIALOG = "chrome://mozapps/content/extensions/update.xul";
Services.prefs.setBoolPref(PREF_STRICT_COMPAT, true);
/**
* Test add-ons:
*

View File

@ -26,6 +26,7 @@ const MANAGER_URI = "about:addons";
const INSTALL_URI = "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul";
const PREF_LOGGING_ENABLED = "extensions.logging.enabled";
const PREF_SEARCH_MAXRESULTS = "extensions.getAddons.maxResults";
const PREF_STRICT_COMPAT = "extensions.strictCompatibility";
var gPendingTests = [];
var gTestsRun = 0;
@ -44,9 +45,10 @@ registerCleanupFunction(function() {
Services.prefs.clearUserPref(PREF_LOGGING_ENABLED);
try {
Services.prefs.clearUserPref(PREF_SEARCH_MAXRESULTS);
}
catch (e) {
}
} catch (e) {}
try {
Services.prefs.clearUserPref(PREF_STRICT_COMPAT);
} catch (e) {}
Services.prefs.setCharPref(PREF_DISCOVERURL, gDiscoveryURL);
Services.prefs.setCharPref(PREF_UPDATEURL, gUpdateURL);

View File

@ -8,6 +8,9 @@ const AM_Ci = Components.interfaces;
const XULAPPINFO_CONTRACTID = "@mozilla.org/xre/app-info;1";
const XULAPPINFO_CID = Components.ID("{c763b610-9d49-455a-bbd2-ede71682a1ac}");
const PREF_EM_CHECK_UPDATE_SECURITY = "extensions.checkUpdateSecurity";
const PREF_EM_STRICT_COMPATIBILITY = "extensions.strictCompatibility";
Components.utils.import("resource://gre/modules/AddonManager.jsm");
Components.utils.import("resource://gre/modules/AddonRepository.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
@ -1103,6 +1106,10 @@ Services.prefs.setCharPref("extensions.blocklist.url", "http://127.0.0.1/blockli
// By default ignore bundled add-ons
Services.prefs.setBoolPref("extensions.installDistroAddons", false);
// By default use strict compatibility
Services.prefs.setBoolPref("extensions.strictCompatibility", true);
// Register a temporary directory for the tests.
const gTmpD = gProfD.clone();
gTmpD.append("temp");
@ -1146,4 +1153,12 @@ do_register_cleanup(function() {
do_check_false(testDir.exists());
shutdownManager();
// Clear commonly set prefs.
try {
Services.prefs.clearUserPref(PREF_EM_CHECK_UPDATE_SECURITY);
} catch (e) {}
try {
Services.prefs.clearUserPref(PREF_EM_STRICT_COMPATIBILITY);
} catch (e) {}
});

View File

@ -37,7 +37,8 @@
*/
// Disables security checking our updates which haven't been signed
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false);
var ADDONS = [
"test_bug470377_1",
@ -70,8 +71,8 @@ function run_test() {
"bug470377_5@tests.mozilla.org"],
function([a1, a2, a3, a4, a5]) {
do_check_eq(a1, null);
do_check_eq(a2, null);
do_check_eq(a3, null);
do_check_neq(a2, null);
do_check_neq(a3, null);
do_check_neq(a4, null);
do_check_neq(a5, null);

View File

@ -0,0 +1,82 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Dave Townsend <dtownsend@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL
*
* ***** END LICENSE BLOCK *****
*/
// Disables security checking our updates which haven't been signed
Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, true);
var ADDONS = [
"test_bug470377_1",
"test_bug470377_2",
"test_bug470377_3",
"test_bug470377_4",
"test_bug470377_5",
];
do_load_httpd_js();
var server;
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2");
server = new nsHttpServer();
server.registerDirectory("/", do_get_file("data/test_bug470377"));
server.start(4444);
startupManager();
installAllFiles([do_get_addon(a) for each (a in ADDONS)], function() {
restartManager();
AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org",
"bug470377_2@tests.mozilla.org",
"bug470377_3@tests.mozilla.org",
"bug470377_4@tests.mozilla.org",
"bug470377_5@tests.mozilla.org"],
function([a1, a2, a3, a4, a5]) {
do_check_eq(a1, null);
do_check_eq(a2, null);
do_check_eq(a3, null);
do_check_neq(a4, null);
do_check_neq(a5, null);
server.stop(do_test_finished);
});
}, true);
}

View File

@ -36,6 +36,8 @@
* ***** END LICENSE BLOCK *****
*/
Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false);
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2.2.3", "2");
@ -87,9 +89,9 @@ function run_test_1() {
do_check_neq(a1, null);
do_check_false(a1.isActive);
do_check_neq(a2, null);
do_check_false(a2.isActive);
do_check_true(a2.isActive);
do_check_neq(a3, null);
do_check_false(a3.isActive);
do_check_true(a3.isActive);
do_check_neq(a4, null);
do_check_true(a4.isActive);
do_check_neq(a5, null);

View File

@ -0,0 +1,140 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Dave Townsend <dtownsend@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL
*
* ***** END LICENSE BLOCK *****
*/
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2.2.3", "2");
Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, true);
// inject the add-ons into the profile
var dest = gProfD.clone();
dest.append("extensions");
dest.append("bug470377_1@tests.mozilla.org");
dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
var source = do_get_file("data/test_bug470377/install_1.rdf");
source.copyTo(dest, "install.rdf");
dest = gProfD.clone();
dest.append("extensions");
dest.append("bug470377_2@tests.mozilla.org");
dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
source = do_get_file("data/test_bug470377/install_2.rdf");
source.copyTo(dest, "install.rdf");
dest = gProfD.clone();
dest.append("extensions");
dest.append("bug470377_3@tests.mozilla.org");
dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
source = do_get_file("data/test_bug470377/install_3.rdf");
source.copyTo(dest, "install.rdf");
dest = gProfD.clone();
dest.append("extensions");
dest.append("bug470377_4@tests.mozilla.org");
dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
source = do_get_file("data/test_bug470377/install_4.rdf");
source.copyTo(dest, "install.rdf");
dest = gProfD.clone();
dest.append("extensions");
dest.append("bug470377_5@tests.mozilla.org");
dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
source = do_get_file("data/test_bug470377/install_5.rdf");
source.copyTo(dest, "install.rdf");
startupManager();
run_test_1();
}
function run_test_1() {
AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org",
"bug470377_2@tests.mozilla.org",
"bug470377_3@tests.mozilla.org",
"bug470377_4@tests.mozilla.org",
"bug470377_5@tests.mozilla.org"],
function([a1, a2, a3, a4, a5]) {
do_check_neq(a1, null);
do_check_false(a1.isActive);
do_check_neq(a2, null);
do_check_false(a2.isActive);
do_check_neq(a3, null);
do_check_false(a3.isActive);
do_check_neq(a4, null);
do_check_true(a4.isActive);
do_check_neq(a5, null);
do_check_true(a5.isActive);
run_test_2();
});
}
function run_test_2() {
// Disable compatibility checks
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
}
catch (e) { }
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
Services.prefs.setBoolPref("extensions.checkCompatibility.nightly", false);
}
else {
Services.prefs.setBoolPref("extensions.checkCompatibility.2.2", false);
}
restartManager();
AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org",
"bug470377_2@tests.mozilla.org",
"bug470377_3@tests.mozilla.org",
"bug470377_4@tests.mozilla.org",
"bug470377_5@tests.mozilla.org"],
function([a1, a2, a3, a4, a5]) {
do_check_neq(a1, null);
do_check_false(a1.isActive);
do_check_neq(a2, null);
do_check_true(a2.isActive);
do_check_neq(a3, null);
do_check_true(a3.isActive);
do_check_neq(a4, null);
do_check_true(a4.isActive);
do_check_neq(a5, null);
do_check_true(a5.isActive);
do_test_finished();
});
}

View File

@ -9,7 +9,8 @@ do_load_httpd_js();
var testserver;
// The test extension uses an insecure update url.
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false);
// Will be enabled
var addon1 = {
@ -35,7 +36,7 @@ var addon2 = {
}]
};
// Will get a compatibility update and be enabled
// Will get a compatibility update and stay enabled
var addon3 = {
id: "addon3@tests.mozilla.org",
version: "1.0",
@ -48,7 +49,7 @@ var addon3 = {
}]
};
// Will get a compatibility update and be disabled
// Will get a compatibility update and be enabled
var addon4 = {
id: "addon4@tests.mozilla.org",
version: "1.0",
@ -61,7 +62,7 @@ var addon4 = {
}]
};
// Stays incompatible
// Would stay incompatible with strict compat
var addon5 = {
id: "addon5@tests.mozilla.org",
version: "1.0",
@ -217,9 +218,9 @@ function run_test_1() {
do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5, null);
do_check_false(a5.isActive);
do_check_true(a5.isActive);
do_check_false(a5.userDisabled);
do_check_true(a5.appDisabled);
do_check_false(a5.appDisabled);
do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6, null);
@ -285,21 +286,23 @@ function run_test_1() {
do_check_neq(a3, null);
do_check_true(a3.isActive);
do_check_false(a3.userDisabled);
do_check_true(a3.appDisabled);
do_check_eq(a3.pendingOperations, AddonManager.PENDING_DISABLE);
do_check_false(a3.appDisabled);
do_check_eq(a3.pendingOperations, AddonManager.PENDING_NONE);
// The compatibility update won't be recovered and it will not have been
// able to tell that it was previously userDisabled
// The compatibility update won't be recovered and with strict
// compatibility it would not have been able to tell that it was
// previously userDisabled. However, without strict compat, it wasn't
// appDisabled, so it knows it must have been userDisabled.
do_check_neq(a4, null);
do_check_false(a4.isActive);
do_check_false(a4.userDisabled);
do_check_true(a4.appDisabled);
do_check_true(a4.userDisabled);
do_check_false(a4.appDisabled);
do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5, null);
do_check_false(a5.isActive);
do_check_true(a5.isActive);
do_check_false(a5.userDisabled);
do_check_true(a5.appDisabled);
do_check_false(a5.appDisabled);
do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6, null);
@ -354,21 +357,21 @@ function run_test_1() {
do_check_eq(a2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a3, null);
do_check_false(a3.isActive);
do_check_true(a3.isActive);
do_check_false(a3.userDisabled);
do_check_true(a3.appDisabled);
do_check_false(a3.appDisabled);
do_check_eq(a3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a4, null);
do_check_false(a4.isActive);
do_check_false(a4.userDisabled);
do_check_true(a4.appDisabled);
do_check_true(a4.userDisabled);
do_check_false(a4.appDisabled);
do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5, null);
do_check_false(a5.isActive);
do_check_true(a5.isActive);
do_check_false(a5.userDisabled);
do_check_true(a5.appDisabled);
do_check_false(a5.appDisabled);
do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6, null);

View File

@ -0,0 +1,403 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Checks that we rebuild something sensible from a corrupt database
do_load_httpd_js();
var testserver;
// The test extension uses an insecure update url.
Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, true);
// Will be enabled
var addon1 = {
id: "addon1@tests.mozilla.org",
version: "1.0",
name: "Test 1",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "2",
maxVersion: "2"
}]
};
// Will be disabled
var addon2 = {
id: "addon2@tests.mozilla.org",
version: "1.0",
name: "Test 2",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "2",
maxVersion: "2"
}]
};
// Will get a compatibility update and be enabled
var addon3 = {
id: "addon3@tests.mozilla.org",
version: "1.0",
name: "Test 3",
updateURL: "http://localhost:4444/data/test_corrupt.rdf",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1"
}]
};
// Will get a compatibility update and be disabled
var addon4 = {
id: "addon4@tests.mozilla.org",
version: "1.0",
name: "Test 4",
updateURL: "http://localhost:4444/data/test_corrupt.rdf",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1"
}]
};
// Stays incompatible
var addon5 = {
id: "addon5@tests.mozilla.org",
version: "1.0",
name: "Test 5",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1"
}]
};
// Enabled bootstrapped
var addon6 = {
id: "addon6@tests.mozilla.org",
version: "1.0",
name: "Test 6",
bootstrap: "true",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "2",
maxVersion: "2"
}]
};
// Disabled bootstrapped
var addon7 = {
id: "addon7@tests.mozilla.org",
version: "1.0",
name: "Test 7",
bootstrap: "true",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "2",
maxVersion: "2"
}]
};
// The default theme
var theme1 = {
id: "theme1@tests.mozilla.org",
version: "1.0",
name: "Theme 1",
internalName: "classic/1.0",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "2",
maxVersion: "2"
}]
};
// The selected theme
var theme2 = {
id: "theme2@tests.mozilla.org",
version: "1.0",
name: "Theme 2",
internalName: "test/1.0",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "2",
maxVersion: "2"
}]
};
const profileDir = gProfD.clone();
profileDir.append("extensions");
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2");
writeInstallRDFForExtension(addon1, profileDir);
writeInstallRDFForExtension(addon2, profileDir);
writeInstallRDFForExtension(addon3, profileDir);
writeInstallRDFForExtension(addon4, profileDir);
writeInstallRDFForExtension(addon5, profileDir);
writeInstallRDFForExtension(addon6, profileDir);
writeInstallRDFForExtension(addon7, profileDir);
writeInstallRDFForExtension(theme1, profileDir);
writeInstallRDFForExtension(theme2, profileDir);
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.start(4444);
// Startup the profile and setup the initial state
startupManager();
AddonManager.getAddonsByIDs(["addon2@tests.mozilla.org",
"addon3@tests.mozilla.org",
"addon4@tests.mozilla.org",
"addon7@tests.mozilla.org",
"theme2@tests.mozilla.org"], function([a2, a3, a4,
a7, t2]) {
// Set up the initial state
a2.userDisabled = true;
a4.userDisabled = true;
a7.userDisabled = true;
t2.userDisabled = false;
a3.findUpdates({
onUpdateFinished: function() {
a4.findUpdates({
onUpdateFinished: function() {
restartManager();
run_test_1();
}
}, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
}
}, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
});
}
function end_test() {
testserver.stop(do_test_finished);
}
function run_test_1() {
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org",
"addon3@tests.mozilla.org",
"addon4@tests.mozilla.org",
"addon5@tests.mozilla.org",
"addon6@tests.mozilla.org",
"addon7@tests.mozilla.org",
"theme1@tests.mozilla.org",
"theme2@tests.mozilla.org"], function([a1, a2, a3,
a4, a5, a6,
a7, t1, t2]) {
do_check_neq(a1, null);
do_check_true(a1.isActive);
do_check_false(a1.userDisabled);
do_check_false(a1.appDisabled);
do_check_eq(a1.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a2, null);
do_check_false(a2.isActive);
do_check_true(a2.userDisabled);
do_check_false(a2.appDisabled);
do_check_eq(a2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a3, null);
do_check_true(a3.isActive);
do_check_false(a3.userDisabled);
do_check_false(a3.appDisabled);
do_check_eq(a3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a4, null);
do_check_false(a4.isActive);
do_check_true(a4.userDisabled);
do_check_false(a4.appDisabled);
do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5, null);
do_check_false(a5.isActive);
do_check_false(a5.userDisabled);
do_check_true(a5.appDisabled);
do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6, null);
do_check_true(a6.isActive);
do_check_false(a6.userDisabled);
do_check_false(a6.appDisabled);
do_check_eq(a6.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a7, null);
do_check_false(a7.isActive);
do_check_true(a7.userDisabled);
do_check_false(a7.appDisabled);
do_check_eq(a7.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t1, null);
do_check_false(t1.isActive);
do_check_true(t1.userDisabled);
do_check_false(t1.appDisabled);
do_check_eq(t1.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t2, null);
do_check_true(t2.isActive);
do_check_false(t2.userDisabled);
do_check_false(t2.appDisabled);
do_check_eq(t2.pendingOperations, AddonManager.PENDING_NONE);
// After restarting the database won't be open and so can be replaced with
// a bad file
restartManager();
var dbfile = gProfD.clone();
dbfile.append("extensions.sqlite");
dbfile.remove(true);
dbfile.create(AM_Ci.nsIFile.DIRECTORY_TYPE, 0755);
// Accessing the add-ons should open and recover the database
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org",
"addon3@tests.mozilla.org",
"addon4@tests.mozilla.org",
"addon5@tests.mozilla.org",
"addon6@tests.mozilla.org",
"addon7@tests.mozilla.org",
"theme1@tests.mozilla.org",
"theme2@tests.mozilla.org"], function([a1, a2, a3,
a4, a5, a6,
a7, t1, t2]) {
// Should be correctly recovered
do_check_neq(a1, null);
do_check_true(a1.isActive);
do_check_false(a1.userDisabled);
do_check_false(a1.appDisabled);
do_check_eq(a1.pendingOperations, AddonManager.PENDING_NONE);
// Should be correctly recovered
do_check_neq(a2, null);
do_check_false(a2.isActive);
do_check_true(a2.userDisabled);
do_check_false(a2.appDisabled);
do_check_eq(a2.pendingOperations, AddonManager.PENDING_NONE);
// The compatibility update won't be recovered but it should still be
// active for this session
do_check_neq(a3, null);
do_check_true(a3.isActive);
do_check_false(a3.userDisabled);
do_check_true(a3.appDisabled);
do_check_eq(a3.pendingOperations, AddonManager.PENDING_DISABLE);
// The compatibility update won't be recovered and it will not have been
// able to tell that it was previously userDisabled
do_check_neq(a4, null);
do_check_false(a4.isActive);
do_check_false(a4.userDisabled);
do_check_true(a4.appDisabled);
do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5, null);
do_check_false(a5.isActive);
do_check_false(a5.userDisabled);
do_check_true(a5.appDisabled);
do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6, null);
do_check_true(a6.isActive);
do_check_false(a6.userDisabled);
do_check_false(a6.appDisabled);
do_check_eq(a6.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a7, null);
do_check_false(a7.isActive);
do_check_true(a7.userDisabled);
do_check_false(a7.appDisabled);
do_check_eq(a7.pendingOperations, AddonManager.PENDING_NONE);
// Should be correctly recovered
do_check_neq(t1, null);
do_check_false(t1.isActive);
do_check_true(t1.userDisabled);
do_check_false(t1.appDisabled);
do_check_eq(t1.pendingOperations, AddonManager.PENDING_NONE);
// Should be correctly recovered
do_check_neq(t2, null);
do_check_true(t2.isActive);
do_check_false(t2.userDisabled);
do_check_false(t2.appDisabled);
do_check_eq(t2.pendingOperations, AddonManager.PENDING_NONE);
restartManager();
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org",
"addon3@tests.mozilla.org",
"addon4@tests.mozilla.org",
"addon5@tests.mozilla.org",
"addon6@tests.mozilla.org",
"addon7@tests.mozilla.org",
"theme1@tests.mozilla.org",
"theme2@tests.mozilla.org"], function([a1, a2, a3,
a4, a5, a6,
a7, t1, t2]) {
do_check_neq(a1, null);
do_check_true(a1.isActive);
do_check_false(a1.userDisabled);
do_check_false(a1.appDisabled);
do_check_eq(a1.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a2, null);
do_check_false(a2.isActive);
do_check_true(a2.userDisabled);
do_check_false(a2.appDisabled);
do_check_eq(a2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a3, null);
do_check_false(a3.isActive);
do_check_false(a3.userDisabled);
do_check_true(a3.appDisabled);
do_check_eq(a3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a4, null);
do_check_false(a4.isActive);
do_check_false(a4.userDisabled);
do_check_true(a4.appDisabled);
do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5, null);
do_check_false(a5.isActive);
do_check_false(a5.userDisabled);
do_check_true(a5.appDisabled);
do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6, null);
do_check_true(a6.isActive);
do_check_false(a6.userDisabled);
do_check_false(a6.appDisabled);
do_check_eq(a6.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a7, null);
do_check_false(a7.isActive);
do_check_true(a7.userDisabled);
do_check_false(a7.appDisabled);
do_check_eq(a7.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t1, null);
do_check_false(t1.isActive);
do_check_true(t1.userDisabled);
do_check_false(t1.appDisabled);
do_check_eq(t1.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t2, null);
do_check_true(t2.isActive);
do_check_false(t2.userDisabled);
do_check_false(t2.appDisabled);
do_check_eq(t2.pendingOperations, AddonManager.PENDING_NONE);
end_test();
});
});
});
}

View File

@ -21,7 +21,8 @@ var gInstallDate;
var gInstall = null;
// The test extension uses an insecure update url.
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false);
const profileDir = gProfD.clone();
profileDir.append("extensions");
@ -671,14 +672,14 @@ function run_test_11() {
do_check_true(hasFlag(installs[1].addon.operationsRequiringRestart,
AddonManager.OP_NEEDS_RESTART_INSTALL));
// Comes from addon6.xpi and is incompatible
// Comes from addon6.xpi and would be incompatible with strict compat enabled
do_check_eq(installs[2].sourceURI, install.sourceURI);
do_check_eq(installs[2].addon.id, "addon6@tests.mozilla.org");
do_check_true(installs[2].addon.appDisabled);
do_check_false(installs[2].addon.appDisabled);
do_check_eq(installs[2].version, "2.0");
do_check_eq(installs[2].name, "Multi Test 3");
do_check_eq(installs[2].state, AddonManager.STATE_DOWNLOADED);
do_check_false(hasFlag(installs[2].addon.operationsRequiringRestart,
do_check_true(hasFlag(installs[2].addon.operationsRequiringRestart,
AddonManager.OP_NEEDS_RESTART_INSTALL));
// Comes from addon7.jar and is made compatible by an update check
@ -702,8 +703,7 @@ function run_test_11() {
"onInstalling"
],
"addon6@tests.mozilla.org": [
["onInstalling", false],
"onInstalled"
"onInstalling"
],
"addon7@tests.mozilla.org": [
"onInstalling"
@ -787,8 +787,7 @@ function run_test_12() {
"onInstalling"
],
"addon6@tests.mozilla.org": [
["onInstalling", false],
"onInstalled"
"onInstalling"
],
"addon7@tests.mozilla.org": [
"onInstalling"
@ -851,10 +850,10 @@ function check_test_12() {
do_check_eq(installs[1].name, "Multi Test 2");
do_check_eq(installs[1].state, AddonManager.STATE_INSTALLED);
// Comes from addon6.xpi and is incompatible
// Comes from addon6.xpi and would be incompatible with strict compat enabled
do_check_eq(installs[2].sourceURI, gInstall.sourceURI);
do_check_eq(installs[2].addon.id, "addon6@tests.mozilla.org");
do_check_true(installs[2].addon.appDisabled);
do_check_false(installs[2].addon.appDisabled);
do_check_eq(installs[2].version, "2.0");
do_check_eq(installs[2].name, "Multi Test 3");
do_check_eq(installs[2].state, AddonManager.STATE_INSTALLED);

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,8 @@ do_load_httpd_js();
var testserver;
// The test extension uses an insecure update url.
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false);
// Will be enabled
var addon1 = {
@ -35,7 +36,7 @@ var addon2 = {
}]
};
// Will get a compatibility update and be enabled
// Will get a compatibility update and stay enabled
var addon3 = {
id: "addon3@tests.mozilla.org",
version: "1.0",
@ -48,7 +49,7 @@ var addon3 = {
}]
};
// Will get a compatibility update and be disabled
// Will get a compatibility update and be enabled
var addon4 = {
id: "addon4@tests.mozilla.org",
version: "1.0",
@ -61,7 +62,7 @@ var addon4 = {
}]
};
// Stays incompatible
// Would stay incompatible with strict compat
var addon5 = {
id: "addon5@tests.mozilla.org",
version: "1.0",
@ -217,9 +218,9 @@ function run_test_1() {
do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5, null);
do_check_false(a5.isActive);
do_check_true(a5.isActive);
do_check_false(a5.userDisabled);
do_check_true(a5.appDisabled);
do_check_false(a5.appDisabled);
do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6, null);
@ -285,21 +286,23 @@ function run_test_1() {
do_check_neq(a3, null);
do_check_true(a3.isActive);
do_check_false(a3.userDisabled);
do_check_true(a3.appDisabled);
do_check_eq(a3.pendingOperations, AddonManager.PENDING_DISABLE);
do_check_false(a3.appDisabled);
do_check_eq(a3.pendingOperations, AddonManager.PENDING_NONE);
// The compatibility update won't be recovered and it will not have been
// able to tell that it was previously userDisabled
// The compatibility update won't be recovered and with strict
// compatibility it would not have been able to tell that it was
// previously userDisabled. However, without strict compat, it wasn't
// appDisabled, so it knows it must have been userDisabled.
do_check_neq(a4, null);
do_check_false(a4.isActive);
do_check_false(a4.userDisabled);
do_check_true(a4.appDisabled);
do_check_true(a4.userDisabled);
do_check_false(a4.appDisabled);
do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5, null);
do_check_false(a5.isActive);
do_check_true(a5.isActive);
do_check_false(a5.userDisabled);
do_check_true(a5.appDisabled);
do_check_false(a5.appDisabled);
do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6, null);
@ -357,21 +360,21 @@ function run_test_1() {
do_check_eq(a2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a3, null);
do_check_false(a3.isActive);
do_check_true(a3.isActive);
do_check_false(a3.userDisabled);
do_check_true(a3.appDisabled);
do_check_false(a3.appDisabled);
do_check_eq(a3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a4, null);
do_check_false(a4.isActive);
do_check_false(a4.userDisabled);
do_check_true(a4.appDisabled);
do_check_true(a4.userDisabled);
do_check_false(a4.appDisabled);
do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5, null);
do_check_false(a5.isActive);
do_check_true(a5.isActive);
do_check_false(a5.userDisabled);
do_check_true(a5.appDisabled);
do_check_false(a5.appDisabled);
do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6, null);

View File

@ -0,0 +1,407 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Checks that we rebuild something sensible from a corrupt database
do_load_httpd_js();
var testserver;
// The test extension uses an insecure update url.
Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, true);
// Will be enabled
var addon1 = {
id: "addon1@tests.mozilla.org",
version: "1.0",
name: "Test 1",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "2",
maxVersion: "2"
}]
};
// Will be disabled
var addon2 = {
id: "addon2@tests.mozilla.org",
version: "1.0",
name: "Test 2",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "2",
maxVersion: "2"
}]
};
// Will get a compatibility update and be enabled
var addon3 = {
id: "addon3@tests.mozilla.org",
version: "1.0",
name: "Test 3",
updateURL: "http://localhost:4444/data/test_corrupt.rdf",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1"
}]
};
// Will get a compatibility update and be disabled
var addon4 = {
id: "addon4@tests.mozilla.org",
version: "1.0",
name: "Test 4",
updateURL: "http://localhost:4444/data/test_corrupt.rdf",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1"
}]
};
// Stays incompatible
var addon5 = {
id: "addon5@tests.mozilla.org",
version: "1.0",
name: "Test 5",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1"
}]
};
// Enabled bootstrapped
var addon6 = {
id: "addon6@tests.mozilla.org",
version: "1.0",
name: "Test 6",
bootstrap: "true",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "2",
maxVersion: "2"
}]
};
// Disabled bootstrapped
var addon7 = {
id: "addon7@tests.mozilla.org",
version: "1.0",
name: "Test 7",
bootstrap: "true",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "2",
maxVersion: "2"
}]
};
// The default theme
var theme1 = {
id: "theme1@tests.mozilla.org",
version: "1.0",
name: "Theme 1",
internalName: "classic/1.0",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "2",
maxVersion: "2"
}]
};
// The selected theme
var theme2 = {
id: "theme2@tests.mozilla.org",
version: "1.0",
name: "Theme 2",
internalName: "test/1.0",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "2",
maxVersion: "2"
}]
};
const profileDir = gProfD.clone();
profileDir.append("extensions");
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2");
writeInstallRDFForExtension(addon1, profileDir);
writeInstallRDFForExtension(addon2, profileDir);
writeInstallRDFForExtension(addon3, profileDir);
writeInstallRDFForExtension(addon4, profileDir);
writeInstallRDFForExtension(addon5, profileDir);
writeInstallRDFForExtension(addon6, profileDir);
writeInstallRDFForExtension(addon7, profileDir);
writeInstallRDFForExtension(theme1, profileDir);
writeInstallRDFForExtension(theme2, profileDir);
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.start(4444);
// Startup the profile and setup the initial state
startupManager();
AddonManager.getAddonsByIDs(["addon2@tests.mozilla.org",
"addon3@tests.mozilla.org",
"addon4@tests.mozilla.org",
"addon7@tests.mozilla.org",
"theme2@tests.mozilla.org"], function([a2, a3, a4,
a7, t2]) {
// Set up the initial state
a2.userDisabled = true;
a4.userDisabled = true;
a7.userDisabled = true;
t2.userDisabled = false;
a3.findUpdates({
onUpdateFinished: function() {
a4.findUpdates({
onUpdateFinished: function() {
restartManager();
run_test_1();
}
}, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
}
}, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
});
}
function end_test() {
testserver.stop(do_test_finished);
}
function run_test_1() {
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org",
"addon3@tests.mozilla.org",
"addon4@tests.mozilla.org",
"addon5@tests.mozilla.org",
"addon6@tests.mozilla.org",
"addon7@tests.mozilla.org",
"theme1@tests.mozilla.org",
"theme2@tests.mozilla.org"], function([a1, a2, a3,
a4, a5, a6,
a7, t1, t2]) {
do_check_neq(a1, null);
do_check_true(a1.isActive);
do_check_false(a1.userDisabled);
do_check_false(a1.appDisabled);
do_check_eq(a1.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a2, null);
do_check_false(a2.isActive);
do_check_true(a2.userDisabled);
do_check_false(a2.appDisabled);
do_check_eq(a2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a3, null);
do_check_true(a3.isActive);
do_check_false(a3.userDisabled);
do_check_false(a3.appDisabled);
do_check_eq(a3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a4, null);
do_check_false(a4.isActive);
do_check_true(a4.userDisabled);
do_check_false(a4.appDisabled);
do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5, null);
do_check_false(a5.isActive);
do_check_false(a5.userDisabled);
do_check_true(a5.appDisabled);
do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6, null);
do_check_true(a6.isActive);
do_check_false(a6.userDisabled);
do_check_false(a6.appDisabled);
do_check_eq(a6.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a7, null);
do_check_false(a7.isActive);
do_check_true(a7.userDisabled);
do_check_false(a7.appDisabled);
do_check_eq(a7.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t1, null);
do_check_false(t1.isActive);
do_check_true(t1.userDisabled);
do_check_false(t1.appDisabled);
do_check_eq(t1.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t2, null);
do_check_true(t2.isActive);
do_check_false(t2.userDisabled);
do_check_false(t2.appDisabled);
do_check_eq(t2.pendingOperations, AddonManager.PENDING_NONE);
// After restarting the database won't be open so lock the file for writing
restartManager();
var dbfile = gProfD.clone();
dbfile.append("extensions.sqlite");
var fstream = AM_Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(AM_Ci.nsIFileOutputStream);
fstream.init(dbfile, FileUtils.MODE_TRUNCATE | FileUtils.MODE_WRONLY, FileUtils.PERMS_FILE, 0);
// Accessing the add-ons should open and recover the database
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org",
"addon3@tests.mozilla.org",
"addon4@tests.mozilla.org",
"addon5@tests.mozilla.org",
"addon6@tests.mozilla.org",
"addon7@tests.mozilla.org",
"theme1@tests.mozilla.org",
"theme2@tests.mozilla.org"], function([a1, a2, a3,
a4, a5, a6,
a7, t1, t2]) {
// Should be correctly recovered
do_check_neq(a1, null);
do_check_true(a1.isActive);
do_check_false(a1.userDisabled);
do_check_false(a1.appDisabled);
do_check_eq(a1.pendingOperations, AddonManager.PENDING_NONE);
// Should be correctly recovered
do_check_neq(a2, null);
do_check_false(a2.isActive);
do_check_true(a2.userDisabled);
do_check_false(a2.appDisabled);
do_check_eq(a2.pendingOperations, AddonManager.PENDING_NONE);
// The compatibility update won't be recovered but it should still be
// active for this session
do_check_neq(a3, null);
do_check_true(a3.isActive);
do_check_false(a3.userDisabled);
do_check_true(a3.appDisabled);
do_check_eq(a3.pendingOperations, AddonManager.PENDING_DISABLE);
// The compatibility update won't be recovered and it will not have been
// able to tell that it was previously userDisabled
do_check_neq(a4, null);
do_check_false(a4.isActive);
do_check_false(a4.userDisabled);
do_check_true(a4.appDisabled);
do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5, null);
do_check_false(a5.isActive);
do_check_false(a5.userDisabled);
do_check_true(a5.appDisabled);
do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6, null);
do_check_true(a6.isActive);
do_check_false(a6.userDisabled);
do_check_false(a6.appDisabled);
do_check_eq(a6.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a7, null);
do_check_false(a7.isActive);
do_check_true(a7.userDisabled);
do_check_false(a7.appDisabled);
do_check_eq(a7.pendingOperations, AddonManager.PENDING_NONE);
// Should be correctly recovered
do_check_neq(t1, null);
do_check_false(t1.isActive);
do_check_true(t1.userDisabled);
do_check_false(t1.appDisabled);
do_check_eq(t1.pendingOperations, AddonManager.PENDING_NONE);
// Should be correctly recovered
do_check_neq(t2, null);
do_check_true(t2.isActive);
do_check_false(t2.userDisabled);
do_check_false(t2.appDisabled);
do_check_eq(t2.pendingOperations, AddonManager.PENDING_NONE);
// Restarting will actually apply changes to extensions.ini which will
// then be put into the in-memory database when we next fail to load the
// real thing
restartManager();
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org",
"addon3@tests.mozilla.org",
"addon4@tests.mozilla.org",
"addon5@tests.mozilla.org",
"addon6@tests.mozilla.org",
"addon7@tests.mozilla.org",
"theme1@tests.mozilla.org",
"theme2@tests.mozilla.org"], function([a1, a2, a3,
a4, a5, a6,
a7, t1, t2]) {
do_check_neq(a1, null);
do_check_true(a1.isActive);
do_check_false(a1.userDisabled);
do_check_false(a1.appDisabled);
do_check_eq(a1.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a2, null);
do_check_false(a2.isActive);
do_check_true(a2.userDisabled);
do_check_false(a2.appDisabled);
do_check_eq(a2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a3, null);
do_check_false(a3.isActive);
do_check_false(a3.userDisabled);
do_check_true(a3.appDisabled);
do_check_eq(a3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a4, null);
do_check_false(a4.isActive);
do_check_false(a4.userDisabled);
do_check_true(a4.appDisabled);
do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5, null);
do_check_false(a5.isActive);
do_check_false(a5.userDisabled);
do_check_true(a5.appDisabled);
do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6, null);
do_check_true(a6.isActive);
do_check_false(a6.userDisabled);
do_check_false(a6.appDisabled);
do_check_eq(a6.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a7, null);
do_check_false(a7.isActive);
do_check_true(a7.userDisabled);
do_check_false(a7.appDisabled);
do_check_eq(a7.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t1, null);
do_check_false(t1.isActive);
do_check_true(t1.userDisabled);
do_check_false(t1.appDisabled);
do_check_eq(t1.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t2, null);
do_check_true(t2.isActive);
do_check_false(t2.userDisabled);
do_check_false(t2.appDisabled);
do_check_eq(t2.pendingOperations, AddonManager.PENDING_NONE);
fstream.close();
end_test();
});
});
});
}

View File

@ -0,0 +1,105 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests AddonManager.strictCompatibility and it's related preference,
// extensions.strictCompatibility
// Always compatible
var addon1 = {
id: "addon1@tests.mozilla.org",
version: "1.0",
name: "Test 1",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1"
}]
};
// Incompatible in strict compatibility mode
var addon2 = {
id: "addon2@tests.mozilla.org",
version: "1.0",
name: "Test 2",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "0.1",
maxVersion: "0.2"
}]
};
// Theme - always uses strict compatibility, so is always incompatible
var addon3 = {
id: "addon3@tests.mozilla.org",
version: "1.0",
name: "Test 3",
internalName: "test-theme-3",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "0.1",
maxVersion: "0.2"
}]
};
const profileDir = gProfD.clone();
profileDir.append("extensions");
function do_check_compat_status(aStrict, aAddonCompat, aCallback) {
do_check_eq(AddonManager.strictCompatibility, aStrict);
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org",
"addon3@tests.mozilla.org"],
function([a1, a2, a3]) {
do_check_neq(a1, null);
do_check_eq(a1.isCompatible, aAddonCompat[0]);
do_check_eq(a1.appDisabled, !aAddonCompat[0]);
do_check_neq(a2, null);
do_check_eq(a2.isCompatible, aAddonCompat[1]);
do_check_eq(a2.appDisabled, !aAddonCompat[1]);
do_check_neq(a3, null);
do_check_eq(a3.isCompatible, aAddonCompat[2]);
do_check_eq(a3.appDisabled, !aAddonCompat[2]);
aCallback();
});
}
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
writeInstallRDFForExtension(addon1, profileDir);
writeInstallRDFForExtension(addon2, profileDir);
writeInstallRDFForExtension(addon3, profileDir);
startupManager();
// Should default to enabling strict compat.
do_check_compat_status(true, [true, false, false], run_test_1);
}
function run_test_1() {
Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false);
do_check_compat_status(false, [true, true, false], run_test_2);
}
function run_test_2() {
restartManager();
do_check_compat_status(false, [true, true, false], run_test_3);
}
function run_test_3() {
Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, true);
do_check_compat_status(true, [true, false, false], run_test_4);
}
function run_test_4() {
restartManager();
do_check_compat_status(true, [true, false, false], do_test_finished);
}

View File

@ -8,7 +8,8 @@ const PREF_MATCH_OS_LOCALE = "intl.locale.matchOS";
const PREF_SELECTED_LOCALE = "general.useragent.locale";
// The test extension uses an insecure update url.
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false);
// This test requires lightweight themes update to be enabled even if the app
// doesn't support lightweight themes.
Services.prefs.setBoolPref("lightweightThemes.update.enabled", true);
@ -235,16 +236,16 @@ function check_test_2() {
function run_test_3() {
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
do_check_neq(a2, null);
do_check_false(a2.isActive);
do_check_false(a2.isCompatible);
do_check_true(a2.appDisabled);
do_check_true(a2.isActive);
do_check_true(a2.isCompatible);
do_check_false(a2.appDisabled);
do_check_true(a2.isCompatibleWith("0"));
a2.findUpdates({
onCompatibilityUpdateAvailable: function(addon) {
do_check_true(a2.isCompatible);
do_check_false(a2.appDisabled);
do_check_false(a2.isActive);
do_check_true(a2.isActive);
},
onUpdateAvailable: function(addon, install) {
@ -276,11 +277,11 @@ function check_test_3() {
function run_test_4() {
AddonManager.getAddonByID("addon3@tests.mozilla.org", function(a3) {
do_check_neq(a3, null);
do_check_false(a3.isActive);
do_check_false(a3.isCompatible);
do_check_true(a3.appDisabled);
do_check_true(a3.isActive);
do_check_true(a3.isCompatible);
do_check_false(a3.appDisabled);
do_check_true(a3.isCompatibleWith("5"));
do_check_false(a3.isCompatibleWith("2"));
do_check_true(a3.isCompatibleWith("2"));
a3.findUpdates({
sawUpdate: false,
@ -309,18 +310,18 @@ function run_test_4() {
function run_test_5() {
AddonManager.getAddonByID("addon3@tests.mozilla.org", function(a3) {
do_check_neq(a3, null);
do_check_false(a3.isActive);
do_check_false(a3.isCompatible);
do_check_true(a3.appDisabled);
do_check_true(a3.isActive);
do_check_true(a3.isCompatible);
do_check_false(a3.appDisabled);
do_check_true(a3.isCompatibleWith("5"));
do_check_false(a3.isCompatibleWith("2"));
do_check_true(a3.isCompatibleWith("2"));
a3.findUpdates({
sawUpdate: false,
onCompatibilityUpdateAvailable: function(addon) {
do_check_false(a3.isCompatible);
do_check_true(a3.appDisabled);
do_check_false(a3.isActive);
do_check_true(a3.isCompatible);
do_check_false(a3.appDisabled);
do_check_true(a3.isActive);
this.sawUpdate = true;
},
@ -344,9 +345,9 @@ function run_test_5() {
function check_test_5() {
AddonManager.getAddonByID("addon3@tests.mozilla.org", function(a3) {
do_check_neq(a3, null);
do_check_false(a3.isActive);
do_check_false(a3.isCompatible);
do_check_true(a3.appDisabled);
do_check_true(a3.isActive);
do_check_true(a3.isCompatible);
do_check_false(a3.appDisabled);
a3.uninstall();
restartManager();
@ -609,7 +610,7 @@ function run_test_8() {
case "addon3@tests.mozilla.org":
do_check_eq(item_version, "1.3+");
do_check_eq(item_maxappversion, "0");
do_check_eq(item_status, "userEnabled,incompatible");
do_check_eq(item_status, "userEnabled");
do_check_eq(app_version, "1");
do_check_eq(update_type, "112");
break;
@ -741,7 +742,7 @@ function run_test_11() {
AddonManager.getAddonByID("addon4@tests.mozilla.org", function(a4) {
a4.findUpdates({
onUpdateFinished: function(addon) {
do_check_false(addon.isCompatible);
do_check_true(addon.isCompatible);
run_test_12();
}
@ -754,8 +755,8 @@ function run_test_12() {
restartManager();
AddonManager.getAddonByID("addon4@tests.mozilla.org", function(a4) {
do_check_false(a4.isActive);
do_check_false(a4.isCompatible);
do_check_true(a4.isActive);
do_check_true(a4.isCompatible);
a4.uninstall();
restartManager();
@ -784,9 +785,9 @@ function run_test_13() {
AddonManager.getAddonByID("addon7@tests.mozilla.org", function(a7) {
do_check_neq(a7, null);
do_check_false(a7.isActive);
do_check_false(a7.isCompatible);
do_check_true(a7.appDisabled);
do_check_true(a7.isActive);
do_check_true(a7.isCompatible);
do_check_false(a7.appDisabled);
do_check_true(a7.isCompatibleWith("0"));
a7.findUpdates({

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,10 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// This verifies that app upgrades produce the expected behaviours.
// This verifies that app upgrades produce the expected behaviours,
// with strict compatibility checking disabled.
Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false);
// Enable loading extensions from the application scope
Services.prefs.setIntPref("extensions.enabledScopes",
@ -21,7 +24,7 @@ var gInstallTime = Date.now();
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
// Will be enabled in the first version and disabled in subsequent versions
// Will be compatible in the first version and incompatible in subsequent versions
writeInstallRDFForExtension({
id: "addon1@tests.mozilla.org",
version: "1.0",
@ -52,7 +55,7 @@ function run_test() {
]
}, profileDir);
// Will be disabled in the first version and enabled in the second.
// Will be incompatible in the first version and enabled in the second.
writeInstallRDFForExtension({
id: "addon3@tests.mozilla.org",
version: "1.0",
@ -64,7 +67,7 @@ function run_test() {
name: "Test Addon 3",
}, profileDir);
// Will be enabled in both versions but will change version in between
// Will be compatible in both versions but will change version in between
var dest = writeInstallRDFForExtension({
id: "addon4@tests.mozilla.org",
version: "1.0",
@ -110,7 +113,7 @@ function run_test_1() {
do_check_true(isExtensionInAddonsList(profileDir, a2.id));
do_check_neq(a3, null);
do_check_false(isExtensionInAddonsList(profileDir, a3.id));
do_check_true(isExtensionInAddonsList(profileDir, a3.id));
do_check_neq(a4, null);
do_check_true(isExtensionInAddonsList(globalDir, a4.id));
@ -120,7 +123,7 @@ function run_test_1() {
});
}
// Test that upgrading the application disables now incompatible add-ons
// Test that upgrading the application doesn't disable now incompatible add-ons
function run_test_2() {
// Upgrade the extension
var dest = writeInstallRDFForExtension({
@ -143,7 +146,7 @@ function run_test_2() {
function([a1, a2, a3, a4]) {
do_check_neq(a1, null);
do_check_false(isExtensionInAddonsList(profileDir, a1.id));
do_check_true(isExtensionInAddonsList(profileDir, a1.id));
do_check_neq(a2, null);
do_check_true(isExtensionInAddonsList(profileDir, a2.id));
@ -188,7 +191,7 @@ function run_test_3() {
function([a1, a2, a3, a4]) {
do_check_neq(a1, null);
do_check_false(isExtensionInAddonsList(profileDir, a1.id));
do_check_true(isExtensionInAddonsList(profileDir, a1.id));
do_check_neq(a2, null);
do_check_true(isExtensionInAddonsList(profileDir, a2.id));

View File

@ -0,0 +1,211 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// This verifies that app upgrades produce the expected behaviours,
// with strict compatibility checking enabled.
// Enable loading extensions from the application scope
Services.prefs.setIntPref("extensions.enabledScopes",
AddonManager.SCOPE_PROFILE +
AddonManager.SCOPE_APPLICATION);
const profileDir = gProfD.clone();
profileDir.append("extensions");
const globalDir = Services.dirsvc.get("XCurProcD", AM_Ci.nsILocalFile);
globalDir.append("extensions");
var gGlobalExisted = globalDir.exists();
var gInstallTime = Date.now();
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
// Will be enabled in the first version and disabled in subsequent versions
writeInstallRDFForExtension({
id: "addon1@tests.mozilla.org",
version: "1.0",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1"
}],
name: "Test Addon 1",
targetPlatforms: [
"XPCShell",
"WINNT_x86",
]
}, profileDir);
// Works in all tested versions
writeInstallRDFForExtension({
id: "addon2@tests.mozilla.org",
version: "1.0",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "2"
}],
name: "Test Addon 2",
targetPlatforms: [
"XPCShell_noarch-spidermonkey"
]
}, profileDir);
// Will be disabled in the first version and enabled in the second.
writeInstallRDFForExtension({
id: "addon3@tests.mozilla.org",
version: "1.0",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "2",
maxVersion: "2"
}],
name: "Test Addon 3",
}, profileDir);
// Will be enabled in both versions but will change version in between
var dest = writeInstallRDFForExtension({
id: "addon4@tests.mozilla.org",
version: "1.0",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1"
}],
name: "Test Addon 4",
}, globalDir);
setExtensionModifiedTime(dest, gInstallTime);
do_test_pending();
Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, true);
run_test_1();
}
function end_test() {
if (!gGlobalExisted) {
globalDir.remove(true);
}
else {
globalDir.append(do_get_expected_addon_name("addon4@tests.mozilla.org"));
globalDir.remove(true);
}
Services.prefs.clearUserPref(PREF_EM_STRICT_COMPATIBILITY);
do_test_finished();
}
// Test that the test extensions are all installed
function run_test_1() {
startupManager();
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org",
"addon3@tests.mozilla.org",
"addon4@tests.mozilla.org"],
function([a1, a2, a3, a4]) {
do_check_neq(a1, null);
do_check_true(isExtensionInAddonsList(profileDir, a1.id));
do_check_neq(a2, null);
do_check_true(isExtensionInAddonsList(profileDir, a2.id));
do_check_neq(a3, null);
do_check_false(isExtensionInAddonsList(profileDir, a3.id));
do_check_neq(a4, null);
do_check_true(isExtensionInAddonsList(globalDir, a4.id));
do_check_eq(a4.version, "1.0");
run_test_2();
});
}
// Test that upgrading the application disables now incompatible add-ons
function run_test_2() {
// Upgrade the extension
var dest = writeInstallRDFForExtension({
id: "addon4@tests.mozilla.org",
version: "2.0",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "2",
maxVersion: "2"
}],
name: "Test Addon 4",
}, globalDir);
setExtensionModifiedTime(dest, gInstallTime);
restartManager("2");
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org",
"addon3@tests.mozilla.org",
"addon4@tests.mozilla.org"],
function([a1, a2, a3, a4]) {
do_check_neq(a1, null);
do_check_false(isExtensionInAddonsList(profileDir, a1.id));
do_check_neq(a2, null);
do_check_true(isExtensionInAddonsList(profileDir, a2.id));
do_check_neq(a3, null);
do_check_true(isExtensionInAddonsList(profileDir, a3.id));
do_check_neq(a4, null);
do_check_true(isExtensionInAddonsList(globalDir, a4.id));
do_check_eq(a4.version, "2.0");
run_test_3();
});
}
// Test that nothing changes when only the build ID changes.
function run_test_3() {
// Upgrade the extension
var dest = writeInstallRDFForExtension({
id: "addon4@tests.mozilla.org",
version: "3.0",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "3",
maxVersion: "3"
}],
name: "Test Addon 4",
}, globalDir);
setExtensionModifiedTime(dest, gInstallTime);
// Simulates a simple Build ID change, the platform deletes extensions.ini
// whenever the application is changed.
var file = gProfD.clone();
file.append("extensions.ini");
file.remove(true);
restartManager();
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org",
"addon3@tests.mozilla.org",
"addon4@tests.mozilla.org"],
function([a1, a2, a3, a4]) {
do_check_neq(a1, null);
do_check_false(isExtensionInAddonsList(profileDir, a1.id));
do_check_neq(a2, null);
do_check_true(isExtensionInAddonsList(profileDir, a2.id));
do_check_neq(a3, null);
do_check_true(isExtensionInAddonsList(profileDir, a3.id));
do_check_neq(a4, null);
do_check_true(isExtensionInAddonsList(globalDir, a4.id));
do_check_eq(a4.version, "2.0");
end_test();
});
}

View File

@ -70,12 +70,18 @@ skip-if = os == "android"
[test_bug470377_1.js]
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"
[test_bug470377_1_strictcompat.js]
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"
[test_bug470377_2.js]
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"
[test_bug470377_3.js]
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"
[test_bug470377_3_strictcompat.js]
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"
[test_bug470377_4.js]
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"
@ -121,6 +127,7 @@ fail-if = os == "android"
[test_cacheflush.js]
[test_checkcompatibility.js]
[test_corrupt.js]
[test_corrupt_strictcompat.js]
[test_dictionary.js]
[test_disable.js]
[test_distribution.js]
@ -153,8 +160,12 @@ skip-if = os == "android"
[test_install.js]
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"
[test_install_strictcompat.js]
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"
[test_locale.js]
[test_locked.js]
[test_locked_strictcompat.js]
[test_manifest.js]
[test_migrate1.js]
[test_migrate2.js]
@ -170,6 +181,7 @@ fail-if = os == "android"
[test_startup.js]
# Bug 676992: test consistently fails on Android
fail-if = os == "android"
[test_strictcompatibility.js]
[test_targetPlatforms.js]
[test_theme.js]
# Bug 676992: test consistently fails on Android
@ -179,6 +191,9 @@ fail-if = os == "android"
[test_update.js]
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"
[test_update_strictcompat.js]
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"
[test_updatecheck.js]
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"
@ -188,4 +203,6 @@ skip-if = os == "android"
[test_upgrade.js]
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"
[test_upgrade_strictcompat.js]
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"

View File

@ -816,6 +816,7 @@ function setupPrefs() {
Services.prefs.setIntPref(PREF_APP_UPDATE_IDLETIME, 0);
Services.prefs.setIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 0);
Services.prefs.setBoolPref(PREF_EXTENSIONS_STRICT_COMPAT, true);
}
/**
@ -913,6 +914,10 @@ function resetPrefs() {
}
catch(e) {
}
if (Services.prefs.prefHasUserValue(PREF_EXTENSIONS_STRICT_COMPAT)) {
Services.prefs.clearUserPref(PREF_EXTENSIONS_STRICT_COMPAT);
}
}
/**

View File

@ -73,6 +73,7 @@ const PREF_DISTRIBUTION_ID = "distribution.id";
const PREF_DISTRIBUTION_VERSION = "distribution.version";
const PREF_EXTENSIONS_UPDATE_URL = "extensions.update.url";
const PREF_EXTENSIONS_STRICT_COMPAT = "extensions.strictCompatibility";
const NS_APP_PROFILE_DIR_STARTUP = "ProfDS";
const NS_APP_USER_PROFILE_50_DIR = "ProfD";