Bug 1191468 - always load app dir add-ons irrespective of enabledScopes, r=Mossop,froydnj

--HG--
extra : commitid : 4O0JNbchonb
extra : rebase_source : f218722dd70f74a45e4dbb461a7faaa3ef1d1d81
extra : amend_source : 538b86815da89ccf5b3e7e42412019064123ccfe
This commit is contained in:
Gijs Kruitbosch 2015-11-17 13:55:31 +00:00
Родитель b11276e3a6
Коммит 161662dac8
6 изменённых файлов: 29 добавлений и 8 удалений

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

@ -134,7 +134,7 @@ const FILE_WEB_MANIFEST = "manifest.json";
const FILE_XPI_ADDONS_LIST = "extensions.ini";
const KEY_PROFILEDIR = "ProfD";
const KEY_APPDIR = "XCurProcD";
const KEY_ADDON_APP_DIR = "XREAddonAppDir";
const KEY_TEMPDIR = "TmpD";
const KEY_APP_DISTRIBUTION = "XREAppDist";
const KEY_APP_FEATURES = "XREAppFeat";
@ -2567,11 +2567,9 @@ this.XPIProvider = {
}
}
if (enabledScopes & AddonManager.SCOPE_APPLICATION) {
addDirectoryInstallLocation(KEY_APP_GLOBAL, KEY_APPDIR,
[DIR_EXTENSIONS],
AddonManager.SCOPE_APPLICATION, true);
}
addDirectoryInstallLocation(KEY_APP_GLOBAL, KEY_ADDON_APP_DIR,
[DIR_EXTENSIONS],
AddonManager.SCOPE_APPLICATION, true);
if (enabledScopes & AddonManager.SCOPE_SYSTEM) {
addDirectoryInstallLocation(KEY_APP_SYSTEM_SHARE, "XRESysSExtPD",

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

@ -1658,6 +1658,12 @@ gTmpD.append("temp");
gTmpD.create(AM_Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
registerDirectory("TmpD", gTmpD);
// Create a replacement app directory for the tests.
const gAppDirForAddons = gProfD.clone();
gAppDirForAddons.append("appdir-addons");
gAppDirForAddons.create(AM_Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
registerDirectory("XREAddonAppDir", gAppDirForAddons);
// Write out an empty blocklist.xml file to the profile to ensure nothing
// is blocklisted by default
var blockFile = gProfD.clone();
@ -1721,6 +1727,10 @@ do_register_cleanup(function addon_cleanup() {
}
dirEntries.close();
try {
gAppDirForAddons.remove(true);
} catch (ex) { do_print("Got exception removing addon app dir, " + ex); }
var testDir = gProfD.clone();
testDir.append("extensions");
testDir.append("trash");

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

@ -15,7 +15,7 @@ Services.prefs.setIntPref("extensions.enabledScopes",
const profileDir = gProfD.clone();
profileDir.append("extensions");
const globalDir = Services.dirsvc.get("XCurProcD", AM_Ci.nsIFile);
const globalDir = Services.dirsvc.get("XREAddonAppDir", AM_Ci.nsIFile);
globalDir.append("extensions");
var gGlobalExisted = globalDir.exists();

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

@ -13,7 +13,7 @@ Services.prefs.setIntPref("extensions.enabledScopes",
const profileDir = gProfD.clone();
profileDir.append("extensions");
const globalDir = Services.dirsvc.get("XCurProcD", AM_Ci.nsIFile);
const globalDir = Services.dirsvc.get("XREAddonAppDir", AM_Ci.nsIFile);
globalDir.append("extensions");
var gGlobalExisted = globalDir.exists();

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

@ -394,6 +394,13 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent,
if (NS_SUCCEEDED(rv))
rv = file->AppendNative(NS_LITERAL_CSTRING("features"));
}
else if (!strcmp(aProperty, XRE_ADDON_APP_DIR)) {
nsCOMPtr<nsIDirectoryServiceProvider> dirsvc(do_GetService("@mozilla.org/file/directory_service;1", &rv));
if (NS_FAILED(rv))
return rv;
bool unused;
rv = dirsvc->GetFile("XCurProcD", &unused, getter_AddRefs(file));
}
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.

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

@ -123,6 +123,12 @@
*/
#define XRE_APP_FEATURES_DIR "XREAppFeat"
/**
* A directory service key which specifies the location for app dir add-ons.
* Should be a synonym for XCurProcD everywhere except in tests.
*/
#define XRE_ADDON_APP_DIR "XREAddonAppDir"
/**
* A directory service key which provides the update directory.
* At present this is supported only on Windows.