Bug 1376235 - Change PermissionAvaliable to PermissionAvailable. r?johannh
MozReview-Commit-ID: JDrybb3WDlP
--- a/dom/tests/mochitest/localstorage/test_firstPartyOnlyPermission.html
+++ b/dom/tests/mochitest/localstorage/test_firstPartyOnlyPermission.html
@@ -12,35 +12,35 @@
add_task(async function() {
await SpecialPowers.pushPrefEnv({
set: [['network.cookie.cookieBehavior', SpecialPowers.Ci.nsICookieService.BEHAVIOR_REJECT]],
});
try {
sessionStorage.setItem("blocked", "blocked");
- ok(false, "Shouldn't be avaliable yet");
+ ok(false, "Shouldn't be available yet");
} catch (ex) {
- ok(true, "Shouldn't be avaliable yet");
+ ok(true, "Shouldn't be available yet");
}
await new Promise(resolve => SpecialPowers.pushPermissions([{
type: 'cookie',
allow: SpecialPowers.Ci.nsICookiePermission.ACCESS_ALLOW_FIRST_PARTY_ONLY,
context: document,
}], resolve));
// With the permission set to ACCESS_ALLOW_FIRST_PARTY_ONLY, we should be
// able to run it from this iframe (as we are first party with the test
// runner parent document).
try {
sessionStorage.setItem("blocked", "blocked");
- ok(true, "Should be avaliable");
+ ok(true, "Should be available");
} catch (ex) {
- ok(false, "Should be avaliable");
+ ok(false, "Should be available");
}
// A third party iframe should not have access however.
await new Promise(resolve => {
window.onmessage = evt => {
window.onmessage = null;
is(evt.data, "sessionStorage=false");
resolve();
--- a/extensions/cookie/nsPermissionManager.cpp
+++ b/extensions/cookie/nsPermissionManager.cpp
@@ -1328,17 +1328,17 @@ nsPermissionManager::InitDB(bool aRemove
&upHelper);
if (NS_FAILED(rv)) {
NS_WARNING("Unexpected failure when upgrading migrating permission "
"from host to origin");
migrationError = true;
}
}
- // We don't drop the moz_hosts table such that it is avaliable for
+ // We don't drop the moz_hosts table such that it is available for
// backwards-compatability and for future migrations in case of
// migration errors in the current code.
// Create a marker empty table which will indicate that the moz_hosts
// table is intended to act as a backup. If this table is not present,
// then the moz_hosts table was created as a random empty table.
rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
"CREATE TABLE moz_hosts_is_backup (dummy INTEGER PRIMARY KEY)"));
NS_ENSURE_SUCCESS(rv, rv);
@@ -1750,17 +1750,17 @@ nsPermissionManager::AddInternal(nsIPrin
ContentParent::GetAll(cplist);
for (uint32_t i = 0; i < cplist.Length(); ++i) {
ContentParent* cp = cplist[i];
if (cp->NeedsPermissionsUpdate(permissionKey))
Unused << cp->SendAddPermission(permission);
}
}
- MOZ_ASSERT(PermissionAvaliable(aPrincipal, aType.get()));
+ MOZ_ASSERT(PermissionAvailable(aPrincipal, aType.get()));
// look up the type index
int32_t typeIndex = GetTypeIndex(aType.get(), true);
NS_ENSURE_TRUE(typeIndex != -1, NS_ERROR_OUT_OF_MEMORY);
// When an entry already exists, PutEntry will return that, instead
// of adding a new one
RefPtr<PermissionKey> key =
@@ -2210,17 +2210,17 @@ nsPermissionManager::GetPermissionObject
return NS_OK;
}
// Querying the permission object of an nsEP is non-sensical.
if (IsExpandedPrincipal(aPrincipal)) {
return NS_ERROR_INVALID_ARG;
}
- MOZ_ASSERT(PermissionAvaliable(aPrincipal, aType));
+ MOZ_ASSERT(PermissionAvailable(aPrincipal, aType));
int32_t typeIndex = GetTypeIndex(aType, false);
// If type == -1, the type isn't known,
// so just return NS_OK
if (typeIndex == -1) return NS_OK;
PermissionHashKey* entry = GetPermissionHashKey(aPrincipal, typeIndex, aExactHostMatch);
if (!entry) {
@@ -2306,17 +2306,17 @@ nsPermissionManager::CommonTestPermissio
}
#ifdef DEBUG
{
nsCOMPtr<nsIPrincipal> prin = aPrincipal;
if (!prin) {
prin = mozilla::BasePrincipal::CreateCodebasePrincipal(aURI, OriginAttributes());
}
- MOZ_ASSERT(PermissionAvaliable(prin, aType));
+ MOZ_ASSERT(PermissionAvailable(prin, aType));
}
#endif
int32_t typeIndex = GetTypeIndex(aType, false);
// If type == -1, the type isn't known,
// so just return NS_OK
if (typeIndex == -1) return NS_OK;
@@ -2343,17 +2343,17 @@ nsPermissionManager::CommonTestPermissio
// Returns null if nothing found.
// Also accepts host on the format "<foo>". This will perform an exact match
// lookup as the string doesn't contain any dots.
nsPermissionManager::PermissionHashKey*
nsPermissionManager::GetPermissionHashKey(nsIPrincipal* aPrincipal,
uint32_t aType,
bool aExactHostMatch)
{
- MOZ_ASSERT(PermissionAvaliable(aPrincipal, mTypeArray[aType].get()));
+ MOZ_ASSERT(PermissionAvailable(aPrincipal, mTypeArray[aType].get()));
nsresult rv;
RefPtr<PermissionKey> key =
PermissionKey::CreateFromPrincipal(aPrincipal, rv);
if (!key) {
return nullptr;
}
@@ -2403,17 +2403,17 @@ nsPermissionManager::GetPermissionHashKe
uint32_t aType,
bool aExactHostMatch)
{
#ifdef DEBUG
{
nsCOMPtr<nsIPrincipal> principal;
nsresult rv = GetPrincipal(aURI, getter_AddRefs(principal));
MOZ_ASSERT_IF(NS_SUCCEEDED(rv),
- PermissionAvaliable(principal, mTypeArray[aType].get()));
+ PermissionAvailable(principal, mTypeArray[aType].get()));
}
#endif
nsresult rv;
RefPtr<PermissionKey> key =
PermissionKey::CreateFromURI(aURI, rv);
if (!key) {
return nullptr;
@@ -2458,18 +2458,18 @@ nsPermissionManager::GetPermissionHashKe
// No entry, really...
return nullptr;
}
NS_IMETHODIMP nsPermissionManager::GetEnumerator(nsISimpleEnumerator **aEnum)
{
if (XRE_IsContentProcess()) {
- NS_WARNING("nsPermissionManager's enumerator is not avaliable in the "
- "content process, as not all permissions may be avaliable.");
+ NS_WARNING("nsPermissionManager's enumerator is not available in the "
+ "content process, as not all permissions may be available.");
*aEnum = nullptr;
return NS_ERROR_NOT_AVAILABLE;
}
// roll an nsCOMArray of all our permissions, then hand out an enumerator
nsCOMArray<nsIPermission> array;
for (auto iter = mPermissionTable.Iter(); !iter.Done(); iter.Next()) {
@@ -2508,17 +2508,17 @@ NS_IMETHODIMP nsPermissionManager::GetEn
NS_IMETHODIMP nsPermissionManager::GetAllForURI(nsIURI* aURI, nsISimpleEnumerator **aEnum)
{
nsCOMArray<nsIPermission> array;
nsCOMPtr<nsIPrincipal> principal;
nsresult rv = GetPrincipal(aURI, getter_AddRefs(principal));
NS_ENSURE_SUCCESS(rv, rv);
- MOZ_ASSERT(PermissionAvaliable(principal, nullptr));
+ MOZ_ASSERT(PermissionAvailable(principal, nullptr));
RefPtr<PermissionKey> key = PermissionKey::CreateFromPrincipal(principal, rv);
if (!key) {
MOZ_ASSERT(NS_FAILED(rv));
return rv;
}
PermissionHashKey* entry = mPermissionTable.GetEntry(key);
@@ -3124,17 +3124,17 @@ nsPermissionManager::UpdateExpireTime(ns
return NS_OK;
}
// Setting the expire time of an nsEP is non-sensical.
if (IsExpandedPrincipal(aPrincipal)) {
return NS_ERROR_INVALID_ARG;
}
- MOZ_ASSERT(PermissionAvaliable(aPrincipal, aType));
+ MOZ_ASSERT(PermissionAvailable(aPrincipal, aType));
int32_t typeIndex = GetTypeIndex(aType, false);
// If type == -1, the type isn't known,
// so just return NS_OK
if (typeIndex == -1) return NS_OK;
PermissionHashKey* entry = GetPermissionHashKey(aPrincipal, typeIndex, aExactHostMatch);
if (!entry) {
@@ -3356,25 +3356,25 @@ nsPermissionManager::BroadcastPermission
nsresult rv = cp->TransmitPermissionsForPrincipal(aPrincipal);
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
}
bool
-nsPermissionManager::PermissionAvaliable(nsIPrincipal* aPrincipal, const char* aType)
+nsPermissionManager::PermissionAvailable(nsIPrincipal* aPrincipal, const char* aType)
{
if (XRE_IsContentProcess()) {
nsAutoCString permissionKey;
// NOTE: GetKeyForPermission accepts a null aType.
GetKeyForPermission(aPrincipal, aType, permissionKey);
// If we have a pending promise for the permission key in question, we don't
- // have the permission avaliable, so report a warning and return false.
+ // have the permission available, so report a warning and return false.
RefPtr<GenericPromise::Private> promise;
if (!mPermissionKeyPromiseMap.Get(permissionKey, getter_AddRefs(promise)) || promise) {
// Emit a useful diagnostic warning with the permissionKey for the process
// which hasn't received permissions yet.
NS_WARNING(nsPrintfCString("This content process hasn't received the "
"permissions for %s yet", permissionKey.get()).get());
return false;
}
@@ -3392,30 +3392,30 @@ nsPermissionManager::WhenPermissionsAvai
aRunnable->Run();
return NS_OK;
}
nsTArray<RefPtr<GenericPromise>> promises;
for (auto& key : GetAllKeysForPrincipal(aPrincipal)) {
RefPtr<GenericPromise::Private> promise;
if (!mPermissionKeyPromiseMap.Get(key, getter_AddRefs(promise))) {
- // In this case we have found a permission which isn't avaliable in the
+ // In this case we have found a permission which isn't available in the
// content process and hasn't been requested yet. We need to create a new
// promise, and send the request to the parent (if we have not already
// done so).
promise = new GenericPromise::Private(__func__);
mPermissionKeyPromiseMap.Put(key, RefPtr<GenericPromise::Private>(promise).forget());
}
if (promise) {
promises.AppendElement(Move(promise));
}
}
- // If all of our permissions are avaliable, immediately run the runnable. This
+ // If all of our permissions are available, immediately run the runnable. This
// avoids any extra overhead during fetch interception which is performance
// sensitive.
if (promises.IsEmpty()) {
aRunnable->Run();
return NS_OK;
}
auto* thread = SystemGroup::AbstractMainThreadFor(TaskCategory::Other);
--- a/extensions/cookie/nsPermissionManager.h
+++ b/extensions/cookie/nsPermissionManager.h
@@ -271,17 +271,17 @@ public:
* See `nsIPermissionManager::GetPermissionsWithKey` for more info on
* permission keys.
*
* Get all permissions keys which could correspond to the given principal.
* This method, like GetKeyForPrincipal, is infallible and should always
* produce at least one key.
*
* Unlike GetKeyForPrincipal, this method also gets the keys for base domains
- * of the given principal. All keys returned by this method must be avaliable
+ * of the given principal. All keys returned by this method must be available
* in the content process for a given URL to successfully have its permissions
* checked in the `aExactHostMatch = false` situation.
*
* @param aPrincipal The Principal which the key is to be extracted from.
*/
static nsTArray<nsCString> GetAllKeysForPrincipal(nsIPrincipal* aPrincipal);
private:
@@ -358,22 +358,22 @@ private:
/**
* This method removes all permissions modified after the specified time.
*/
nsresult
RemoveAllModifiedSince(int64_t aModificationTime);
/**
* Returns false if this permission manager wouldn't have the permission
- * requested avaliable.
+ * requested available.
*
* If aType is nullptr, checks that the permission manager would have all
- * permissions avaliable for the given principal.
+ * permissions available for the given principal.
*/
- bool PermissionAvaliable(nsIPrincipal* aPrincipal, const char* aType);
+ bool PermissionAvailable(nsIPrincipal* aPrincipal, const char* aType);
nsRefPtrHashtable<nsCStringHashKey, mozilla::GenericPromise::Private> mPermissionKeyPromiseMap;
nsCOMPtr<mozIStorageConnection> mDBConn;
nsCOMPtr<mozIStorageAsyncStatement> mStmtInsert;
nsCOMPtr<mozIStorageAsyncStatement> mStmtDelete;
nsCOMPtr<mozIStorageAsyncStatement> mStmtUpdate;
--- a/netwerk/base/nsIPermissionManager.idl
+++ b/netwerk/base/nsIPermissionManager.idl
@@ -317,17 +317,17 @@ interface nsIPermissionManager : nsISupp
void getPermissionsWithKey(in ACString permissionKey, out IPCPermissionArrayRef perms);
/**
* See `nsIPermissionManager::GetPermissionsWithKey` for more info on
* Permission keys.
*
* `SetPermissionsWithKey` may only be called in the Child process, and
* initializes the permission manager with the permissions for a given
- * Permission key. marking permissions with that key as avaliable.
+ * Permission key. marking permissions with that key as available.
*
* @param permissionKey The key for the permissions which have been sent over.
* @param perms An array with the permissions which match the given key.
*/
void setPermissionsWithKey(in ACString permissionKey, in IPCPermissionArrayRef perms);
/**
* Broadcasts permissions for the given principal to all content processes.