Bug 1524938 - nsContentUtils::StorageAllowedForPrincipal() renamed to nsContentUtils::StorageAllowedForServiceWorker(), r=asuth

Differential Revision: https://phabricator.services.mozilla.com/D18535

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrea Marchesini 2019-02-05 09:12:11 +00:00
Родитель 963bde6573
Коммит efe393e3d2
3 изменённых файлов: 25 добавлений и 27 удалений

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

@ -8103,8 +8103,8 @@ nsContentUtils::StorageAccess nsContentUtils::StorageAllowedForWindow(
// callee is able to deal with a null channel argument, and if passed null,
// will only fail to notify the UI in case storage gets blocked.
nsIChannel* channel = document->GetChannel();
return InternalStorageAllowedForPrincipal(principal, aWindow, nullptr,
channel, *aRejectedReason);
return InternalStorageAllowedCheck(principal, aWindow, nullptr, channel,
*aRejectedReason);
}
// No document? Let's return a generic rejected reason.
@ -8124,8 +8124,8 @@ nsContentUtils::StorageAccess nsContentUtils::StorageAllowedForDocument(
nsIChannel* channel = aDoc->GetChannel();
uint32_t rejectedReason = 0;
return InternalStorageAllowedForPrincipal(principal, inner, nullptr,
channel, rejectedReason);
return InternalStorageAllowedCheck(principal, inner, nullptr, channel,
rejectedReason);
}
return StorageAccess::eDeny;
@ -8139,8 +8139,8 @@ nsContentUtils::StorageAccess nsContentUtils::StorageAllowedForNewWindow(
// parent may be nullptr
uint32_t rejectedReason = 0;
return InternalStorageAllowedForPrincipal(aPrincipal, aParent, aURI, nullptr,
rejectedReason);
return InternalStorageAllowedCheck(aPrincipal, aParent, aURI, nullptr,
rejectedReason);
}
// static, public
@ -8155,18 +8155,18 @@ nsContentUtils::StorageAccess nsContentUtils::StorageAllowedForChannel(
NS_ENSURE_TRUE(principal, nsContentUtils::StorageAccess::eDeny);
uint32_t rejectedReason = 0;
nsContentUtils::StorageAccess result = InternalStorageAllowedForPrincipal(
nsContentUtils::StorageAccess result = InternalStorageAllowedCheck(
principal, nullptr, nullptr, aChannel, rejectedReason);
return result;
}
// static, public
nsContentUtils::StorageAccess nsContentUtils::StorageAllowedForPrincipal(
nsContentUtils::StorageAccess nsContentUtils::StorageAllowedForServiceWorker(
nsIPrincipal* aPrincipal) {
uint32_t rejectedReason = 0;
return InternalStorageAllowedForPrincipal(aPrincipal, nullptr, nullptr,
nullptr, rejectedReason);
return InternalStorageAllowedCheck(aPrincipal, nullptr, nullptr, nullptr,
rejectedReason);
}
// static, private
@ -8356,12 +8356,9 @@ bool nsContentUtils::StorageDisabledByAntiTracking(nsPIDOMWindowInner* aWindow,
}
// static, private
nsContentUtils::StorageAccess
nsContentUtils::InternalStorageAllowedForPrincipal(nsIPrincipal* aPrincipal,
nsPIDOMWindowInner* aWindow,
nsIURI* aURI,
nsIChannel* aChannel,
uint32_t& aRejectedReason) {
nsContentUtils::StorageAccess nsContentUtils::InternalStorageAllowedCheck(
nsIPrincipal* aPrincipal, nsPIDOMWindowInner* aWindow, nsIURI* aURI,
nsIChannel* aChannel, uint32_t& aRejectedReason) {
MOZ_ASSERT(aPrincipal);
aRejectedReason = 0;
@ -8413,7 +8410,7 @@ nsContentUtils::InternalStorageAllowedForPrincipal(nsIPrincipal* aPrincipal,
//
// This is due to backwards-compatibility and the state of storage access
// before the introducton of
// nsContentUtils::InternalStorageAllowedForPrincipal:
// nsContentUtils::InternalStorageAllowedCheck:
//
// BEFORE:
// localStorage, caches: allowed in 3rd-party iframes always

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

@ -2967,10 +2967,9 @@ class nsContentUtils {
/*
* Checks if storage for the given principal is permitted by the user's
* preferences. The caller is assumed to not be a third-party iframe.
* (if that is possible, the caller should use StorageAllowedForWindow)
* preferences. This method should be used only by ServiceWorker loading.
*/
static StorageAccess StorageAllowedForPrincipal(nsIPrincipal* aPrincipal);
static StorageAccess StorageAllowedForServiceWorker(nsIPrincipal* aPrincipal);
/*
* Returns true if this document should disable storages because of the
@ -3356,7 +3355,7 @@ class nsContentUtils {
* Gets the current cookie lifetime policy for a given principal by checking
* with preferences and the permission manager.
*
* Used in the implementation of InternalStorageAllowedForPrincipal.
* Used in the implementation of InternalStorageAllowedCheck.
*/
static void GetCookieLifetimePolicyForPrincipal(nsIPrincipal* aPrincipal,
uint32_t* aLifetimePolicy);
@ -3370,12 +3369,14 @@ class nsContentUtils {
* allow a channel instead of the window reference when determining 3rd party
* status.
*
* Used in the implementation of StorageAllowedForWindow and
* StorageAllowedForPrincipal.
* Used in the implementation of StorageAllowedForWindow,
* StorageAllowedForChannel and StorageAllowedForServiceWorker.
*/
static StorageAccess InternalStorageAllowedForPrincipal(
nsIPrincipal* aPrincipal, nsPIDOMWindowInner* aWindow, nsIURI* aURI,
nsIChannel* aChannel, uint32_t& aRejectedReason);
static StorageAccess InternalStorageAllowedCheck(nsIPrincipal* aPrincipal,
nsPIDOMWindowInner* aWindow,
nsIURI* aURI,
nsIChannel* aChannel,
uint32_t& aRejectedReason);
static nsINode* GetCommonAncestorHelper(nsINode* aNode1, nsINode* aNode2);
static nsIContent* GetCommonFlattenedTreeAncestorHelper(

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

@ -1723,7 +1723,7 @@ nsresult ServiceWorkerPrivate::SpawnWorkerIfNeeded(WakeUpReason aWhy,
info.mLoadingPrincipal = info.mPrincipal;
nsContentUtils::StorageAccess access =
nsContentUtils::StorageAllowedForPrincipal(info.mPrincipal);
nsContentUtils::StorageAllowedForServiceWorker(info.mPrincipal);
info.mStorageAllowed =
access > nsContentUtils::StorageAccess::ePrivateBrowsing;
info.mOriginAttributes = mInfo->GetOriginAttributes();