Bug 1207287: Move the app-shipped system add-ons somewhere where they will be included in up date MARs. r=froydnj r=rhelmer

This moves the app-shipped system add-ons into <appdir>/features. I've created
a new directory provider location for this since it allows us to override the
location without allowing external apps to do so as would be the case with
prefs.

--HG--
extra : commitid : 9lzIzbjvCpK
extra : rebase_source : 1f1f319eac2142ffbe6714289e6fb4e40cfd6088
This commit is contained in:
Dave Townsend 2015-09-24 16:03:01 -07:00
Родитель 2ffb1e7856
Коммит fd7f1eb306
5 изменённых файлов: 36 добавлений и 31 удалений

Просмотреть файл

@ -135,6 +135,7 @@ const KEY_PROFILEDIR = "ProfD";
const KEY_APPDIR = "XCurProcD";
const KEY_TEMPDIR = "TmpD";
const KEY_APP_DISTRIBUTION = "XREAppDist";
const KEY_APP_FEATURES = "XREAppFeat";
const KEY_APP_PROFILE = "app-profile";
const KEY_APP_SYSTEM_ADDONS = "app-system-addons";
@ -2445,9 +2446,8 @@ this.XPIProvider = {
[DIR_SYSTEM_ADDONS],
AddonManager.SCOPE_PROFILE);
addDirectoryInstallLocation(KEY_APP_SYSTEM_DEFAULTS, KEY_APP_DISTRIBUTION,
[DIR_SYSTEM_ADDONS],
AddonManager.SCOPE_PROFILE, true);
addDirectoryInstallLocation(KEY_APP_SYSTEM_DEFAULTS, KEY_APP_FEATURES,
[], AddonManager.SCOPE_PROFILE, true);
if (enabledScopes & AddonManager.SCOPE_USER) {
addDirectoryInstallLocation(KEY_APP_SYSTEM_USER, "XREUSysExt",

Просмотреть файл

@ -8,20 +8,20 @@ Services.prefs.setBoolPref(PREF_XPI_SIGNATURES_REQUIRED, true);
const featureDir = FileUtils.getDir("ProfD", ["features"]);
// Build the test sets
let dir = FileUtils.getDir("ProfD", ["sysfeatures", "app1", "features"], true);
let dir = FileUtils.getDir("ProfD", ["sysfeatures", "app1"], true);
do_get_file("data/system_addons/system1_1.xpi").copyTo(dir, "system1@tests.mozilla.org.xpi");
do_get_file("data/system_addons/system2_1.xpi").copyTo(dir, "system2@tests.mozilla.org.xpi");
dir = FileUtils.getDir("ProfD", ["sysfeatures", "app2", "features"], true);
dir = FileUtils.getDir("ProfD", ["sysfeatures", "app2"], true);
do_get_file("data/system_addons/system1_2.xpi").copyTo(dir, "system1@tests.mozilla.org.xpi");
do_get_file("data/system_addons/system3_1.xpi").copyTo(dir, "system3@tests.mozilla.org.xpi");
dir = FileUtils.getDir("ProfD", ["sysfeatures", "app3", "features"], true);
dir = FileUtils.getDir("ProfD", ["sysfeatures", "app3"], true);
do_get_file("data/system_addons/system1_1_badcert.xpi").copyTo(dir, "system1@tests.mozilla.org.xpi");
do_get_file("data/system_addons/system3_1.xpi").copyTo(dir, "system3@tests.mozilla.org.xpi");
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "app0"], true);
registerDirectory("XREAppDist", distroDir);
registerDirectory("XREAppFeat", distroDir);
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "0");
@ -32,14 +32,7 @@ function makeUUID() {
}
function* check_installed(inProfile, ...versions) {
let expectedDir;
if (inProfile) {
expectedDir = featureDir;
}
else {
expectedDir = distroDir.clone();
expectedDir.append("features");
}
let expectedDir = inProfile ? featureDir : distroDir;
for (let i = 0; i < versions.length; i++) {
let id = "system" + (i + 1) + "@tests.mozilla.org";

Просмотреть файл

@ -13,6 +13,13 @@ const { computeHash } = Components.utils.import("resource://gre/modules/addons/P
const featureDir = FileUtils.getDir("ProfD", ["features"]);
function getCurrentFeatureDir() {
let dir = featureDir.clone();
let set = JSON.parse(Services.prefs.getCharPref(PREF_SYSTEM_ADDON_SET));
dir.append(set.directory);
return dir;
}
// Build the test sets
let dir = FileUtils.getDir("ProfD", ["features", "prefilled"], true);
do_get_file("data/system_addons/system2_2.xpi").copyTo(dir, "system2@tests.mozilla.org.xpi");
@ -35,16 +42,16 @@ const prefilledSet = {
}
};
dir = FileUtils.getDir("ProfD", ["sysfeatures", "hidden", "features"], true);
dir = FileUtils.getDir("ProfD", ["sysfeatures", "hidden"], true);
do_get_file("data/system_addons/system1_1.xpi").copyTo(dir, "system1@tests.mozilla.org.xpi");
do_get_file("data/system_addons/system2_1.xpi").copyTo(dir, "system2@tests.mozilla.org.xpi");
dir = FileUtils.getDir("ProfD", ["sysfeatures", "prefilled", "features"], true);
dir = FileUtils.getDir("ProfD", ["sysfeatures", "prefilled"], true);
do_get_file("data/system_addons/system2_2.xpi").copyTo(dir, "system2@tests.mozilla.org.xpi");
do_get_file("data/system_addons/system3_2.xpi").copyTo(dir, "system3@tests.mozilla.org.xpi");
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"], true);
registerDirectory("XREAppDist", distroDir);
registerDirectory("XREAppFeat", distroDir);
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2");
@ -128,6 +135,8 @@ function* build_xml(addons) {
}
function* check_installed(inProfile, ...versions) {
let expectedDir = inProfile ? getCurrentFeatureDir() : distroDir;
for (let i = 0; i < versions.length; i++) {
let id = "system" + (i + 1) + "@tests.mozilla.org";
let addon = yield promiseAddonByID(id);
@ -141,21 +150,14 @@ function* check_installed(inProfile, ...versions) {
go_check_true(addon.hidden);
// Verify the add-ons file is in the right place
let file = expectedDir.clone();
file.append(id + ".xpi");
do_check_true(file.exists());
do_check_true(file.isFile());
let uri = addon.getResourceURI(null);
do_check_true(uri instanceof AM_Ci.nsIFileURL);
let file = uri.file.parent;
if (inProfile) {
file = file.parent;
do_check_eq(file.leafName, "features");
file = file.parent;
do_check_eq(file.path, gProfD.path);
}
else {
do_check_eq(file.leafName, "features");
file = file.parent;
do_check_eq(file.path, distroDir.path);
}
do_check_eq(uri.file.path, file.path);
//do_check_eq(addon.signedState, AddonManager.SIGNEDSTATE_SYSTEM);

Просмотреть файл

@ -389,6 +389,11 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent,
if (NS_SUCCEEDED(rv))
rv = file->AppendNative(NS_LITERAL_CSTRING("distribution"));
}
else if (!strcmp(aProperty, XRE_APP_FEATURES_DIR)) {
rv = GetAppDir()->Clone(getter_AddRefs(file));
if (NS_SUCCEEDED(rv))
rv = file->AppendNative(NS_LITERAL_CSTRING("features"));
}
else if (NS_SUCCEEDED(GetProfileStartupDir(getter_AddRefs(file)))) {
// We need to allow component, xpt, and chrome registration to
// occur prior to the profile-after-change notification.

Просмотреть файл

@ -118,6 +118,11 @@
*/
#define XRE_APP_DISTRIBUTION_DIR "XREAppDist"
/**
* A directory service key which specifies the location for system add-ons.
*/
#define XRE_APP_FEATURES_DIR "XREAppFeat"
/**
* A directory service key which provides the update directory.
* At present this is supported only on Windows.