Bug 1073095 - nsPermissionManager.cpp references a browser path by default in kDefaultsUrlPrefName. Make the permissions.manager.defaultsUrl pref overridable. r=benjamin

--HG--
rename : browser/app/default_permissions => browser/app/permissions
This commit is contained in:
Magnus Melin 2015-02-13 23:32:41 +02:00
Родитель b930f4e186
Коммит cb8cf22e82
4 изменённых файлов: 9 добавлений и 13 удалений

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

@ -1,4 +1,3 @@
browser.jar:
# The file that holds the default permissions (which is loaded by nsPermissionManager) for the browser.
default_permissions (default_permissions)
% resource app %
defaults/permissions (permissions)

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

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

@ -410,6 +410,9 @@ pref("browser.search.hiddenOneOffs", "");
pref("browser.sessionhistory.max_entries", 50);
// Built-in default permissions.
pref("permissions.manager.defaultsUrl", "resource://app/defaults/permissions");
// handle links targeting new windows
// 1=current window/tab, 2=new window, 3=new tab in most recent window
pref("browser.link.open_newwindow", 3);

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

@ -362,10 +362,8 @@ static const char kPermissionsFileName[] = "permissions.sqlite";
static const char kHostpermFileName[] = "hostperm.1";
// Default permissions are read from a URL - this is the preference we read
// to find that URL.
// to find that URL. If not set, don't use any default permissions.
static const char kDefaultsUrlPrefName[] = "permissions.manager.defaultsUrl";
// If the pref above doesn't exist, the URL we use by default.
static const char kDefaultsUrl[] = "resource://app/chrome/browser/default_permissions";
static const char kPermissionChangeNotification[] = PERM_CHANGE_NOTIFICATION;
@ -1892,13 +1890,9 @@ nsPermissionManager::Import()
nsresult
nsPermissionManager::ImportDefaults()
{
// We allow prefs to override the default permissions URI, mainly as a hook
// for testing.
nsCString defaultsURL;
if (mozilla::Preferences::HasUserValue(kDefaultsUrlPrefName)) {
defaultsURL = mozilla::Preferences::GetCString(kDefaultsUrlPrefName);
} else {
defaultsURL = NS_LITERAL_CSTRING(kDefaultsUrl);
nsCString defaultsURL = mozilla::Preferences::GetCString(kDefaultsUrlPrefName);
if (defaultsURL.IsEmpty()) { // == Don't use built-in permissions.
return NS_OK;
}
nsresult rv;