зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1592701 - Remove usage of GetURI in nsGlobalWindowInner r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D51258 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
6b4dc767f9
Коммит
b4ebe9b54a
|
@ -458,6 +458,18 @@ BasePrincipal::SchemeIs(const char* aScheme, bool* aResult) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BasePrincipal::IsURIInPrefList(const char* aPref, bool* aResult) {
|
||||
*aResult = false;
|
||||
nsCOMPtr<nsIURI> prinURI;
|
||||
nsresult rv = GetURI(getter_AddRefs(prinURI));
|
||||
if (NS_FAILED(rv) || !prinURI) {
|
||||
return NS_OK;
|
||||
}
|
||||
*aResult = nsContentUtils::IsURIInPrefList(prinURI, aPref);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BasePrincipal::GetAboutModuleFlags(uint32_t* flags) {
|
||||
*flags = 0;
|
||||
|
|
|
@ -117,6 +117,7 @@ class BasePrincipal : public nsJSPrincipals {
|
|||
NS_IMETHOD GetIsExpandedPrincipal(bool* aResult) override;
|
||||
NS_IMETHOD GetIsSystemPrincipal(bool* aResult) override;
|
||||
NS_IMETHOD SchemeIs(const char* aScheme, bool* aResult) override;
|
||||
NS_IMETHOD IsURIInPrefList(const char* aPref, bool* aResult) override;
|
||||
NS_IMETHOD GetAboutModuleFlags(uint32_t* flags) override;
|
||||
NS_IMETHOD GetIsAddonOrExpandedAddonPrincipal(bool* aResult) override;
|
||||
NS_IMETHOD GetOriginAttributes(JSContext* aCx,
|
||||
|
|
|
@ -225,6 +225,12 @@ interface nsIPrincipal : nsISerializable
|
|||
}
|
||||
%}
|
||||
|
||||
/*
|
||||
* Checks if the Principal's URI is contained in the given Pref
|
||||
* @param pref The pref to be checked
|
||||
*/
|
||||
bool IsURIInPrefList(in string pref);
|
||||
|
||||
/**
|
||||
* Returns the Flags of the Principals
|
||||
* associated AboutModule, in case there is one.
|
||||
|
|
|
@ -4545,11 +4545,12 @@ Storage* nsGlobalWindowInner::GetLocalStorage(ErrorResult& aError) {
|
|||
if (!mDoc) {
|
||||
access = StorageAccess::eDeny;
|
||||
} else if (!StoragePartitioningEnabled(access, mDoc->CookieSettings())) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
Unused << mDoc->NodePrincipal()->GetURI(getter_AddRefs(uri));
|
||||
static const char* kPrefName =
|
||||
"privacy.restrict3rdpartystorage.partitionedHosts";
|
||||
if (!uri || !nsContentUtils::IsURIInPrefList(uri, kPrefName)) {
|
||||
|
||||
bool isInList = false;
|
||||
mDoc->NodePrincipal()->IsURIInPrefList(kPrefName, &isInList);
|
||||
if (!isInList) {
|
||||
access = StorageAccess::eDeny;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче