mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 13:56:29 +00:00
Bug 457296 - allow content manager to removing mail address permissions. r=josh
This commit is contained in:
parent
1b0eea1b45
commit
ae2409391b
@ -94,8 +94,14 @@ GetPrincipal(const nsACString& aHost, uint32_t aAppId, bool aIsInBrowserElement,
|
||||
if (NS_FAILED(rv)) {
|
||||
// NOTE: most callers will end up here because we don't append "http://" for
|
||||
// hosts. It's fine to arbitrary use "http://" because, for those entries,
|
||||
// we will actually just use the host.
|
||||
rv = NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("http://") + aHost);
|
||||
// we will actually just use the host. If we end up here, but the host looks
|
||||
// like an email address, we use mailto: instead.
|
||||
nsCString scheme;
|
||||
if (aHost.FindChar('@') == -1)
|
||||
scheme = NS_LITERAL_CSTRING("http://");
|
||||
else
|
||||
scheme = NS_LITERAL_CSTRING("mailto:");
|
||||
rv = NS_NewURI(getter_AddRefs(uri), scheme + aHost);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
@ -15,13 +15,16 @@ function run_test() {
|
||||
Services.perms.add(uri, kType, kCapability);
|
||||
do_check_true(permission_exists(kTestAddr, kType, kCapability));
|
||||
|
||||
Services.perms.removeAll();
|
||||
// remove the permission, and make sure it was removed
|
||||
Services.perms.remove(kTestAddr, kType);
|
||||
do_check_false(permission_exists(kTestAddr, kType, kCapability));
|
||||
|
||||
uri = Services.io.newURI("mailto:" + kTestAddr, null, null);
|
||||
Services.perms.add(uri, kType, kCapability);
|
||||
do_check_true(permission_exists(kTestAddr, kType, kCapability));
|
||||
|
||||
Services.perms.removeAll();
|
||||
Services.perms.remove(kTestAddr, kType);
|
||||
do_check_false(permission_exists(kTestAddr, kType, kCapability));
|
||||
}
|
||||
|
||||
function permission_exists(aHost, aType, aCapability) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user