mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Backed out changeset cf796da336c8 (bug 1678310) due to causing memory crashes. CLOSED TREE
This commit is contained in:
parent
fc9a18178f
commit
a810f4e72c
@ -106,21 +106,7 @@ BasePrincipal::GetOriginNoSuffix(nsACString& aOrigin) {
|
||||
NS_IMETHODIMP
|
||||
BasePrincipal::GetSiteOrigin(nsACString& aSiteOrigin) {
|
||||
MOZ_ASSERT(mInitialized);
|
||||
|
||||
nsresult rv = GetSiteOriginNoSuffix(aSiteOrigin);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoCString suffix;
|
||||
rv = GetOriginSuffix(suffix);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
aSiteOrigin.Append(suffix);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BasePrincipal::GetSiteOriginNoSuffix(nsACString& aSiteOrigin) {
|
||||
MOZ_ASSERT(mInitialized);
|
||||
return GetOriginNoSuffix(aSiteOrigin);
|
||||
return GetOrigin(aSiteOrigin);
|
||||
}
|
||||
|
||||
// Returns the inner Json::value of the serialized principal
|
||||
|
@ -156,8 +156,7 @@ class BasePrincipal : public nsJSPrincipals {
|
||||
bool* aIsInIsolatedMozBrowserElement) final;
|
||||
NS_IMETHOD GetUserContextId(uint32_t* aUserContextId) final;
|
||||
NS_IMETHOD GetPrivateBrowsingId(uint32_t* aPrivateBrowsingId) final;
|
||||
NS_IMETHOD GetSiteOrigin(nsACString& aSiteOrigin) final;
|
||||
NS_IMETHOD GetSiteOriginNoSuffix(nsACString& aSiteOrigin) override;
|
||||
NS_IMETHOD GetSiteOrigin(nsACString& aOrigin) override;
|
||||
NS_IMETHOD IsThirdPartyURI(nsIURI* uri, bool* aRes) override;
|
||||
NS_IMETHOD IsThirdPartyPrincipal(nsIPrincipal* uri, bool* aRes) override;
|
||||
NS_IMETHOD IsThirdPartyChannel(nsIChannel* aChannel, bool* aRes) override;
|
||||
|
@ -440,7 +440,7 @@ ContentPrincipal::GetBaseDomain(nsACString& aBaseDomain) {
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ContentPrincipal::GetSiteOriginNoSuffix(nsACString& aSiteOrigin) {
|
||||
ContentPrincipal::GetSiteOrigin(nsACString& aSiteOrigin) {
|
||||
// Handle some special URIs first.
|
||||
nsAutoCString baseDomain;
|
||||
bool handled;
|
||||
@ -450,7 +450,7 @@ ContentPrincipal::GetSiteOriginNoSuffix(nsACString& aSiteOrigin) {
|
||||
if (handled) {
|
||||
// This is a special URI ("file:", "about:", "view-source:", etc). Just
|
||||
// return the origin.
|
||||
return GetSiteOriginNoSuffix(aSiteOrigin);
|
||||
return GetOrigin(aSiteOrigin);
|
||||
}
|
||||
|
||||
// For everything else, we ask the TLD service. Note that, unlike in
|
||||
@ -491,7 +491,15 @@ ContentPrincipal::GetSiteOriginNoSuffix(nsACString& aSiteOrigin) {
|
||||
|
||||
rv = GenerateOriginNoSuffixFromURI(siteUri, aSiteOrigin);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv), "failed to create siteOriginNoSuffix");
|
||||
return rv;
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoCString suffix;
|
||||
rv = GetOriginSuffix(suffix);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv), "failed to create suffix");
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
aSiteOrigin.Append(suffix);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult ContentPrincipal::GetSiteIdentifier(SiteIdentifier& aSite) {
|
||||
|
@ -30,7 +30,7 @@ class ContentPrincipal final : public BasePrincipal {
|
||||
NS_IMETHOD SetDomain(nsIURI* aDomain) override;
|
||||
NS_IMETHOD GetBaseDomain(nsACString& aBaseDomain) override;
|
||||
NS_IMETHOD GetAddonId(nsAString& aAddonId) override;
|
||||
NS_IMETHOD GetSiteOriginNoSuffix(nsACString& aSiteOrigin) override;
|
||||
NS_IMETHOD GetSiteOrigin(nsACString& aSiteOrigin) override;
|
||||
bool IsContentPrincipal() const override { return true; }
|
||||
|
||||
ContentPrincipal();
|
||||
|
@ -419,15 +419,10 @@ interface nsIPrincipal : nsISerializable
|
||||
* principals which allow mutating |domain|, such as ContentPrincipal,
|
||||
* override the default implementation in BasePrincipal.
|
||||
*
|
||||
* TODO(nika): Use this in DocGroup.
|
||||
*/
|
||||
readonly attribute ACString siteOrigin;
|
||||
|
||||
/**
|
||||
* The base part of |siteOrigin| without the concatenation with
|
||||
* |originSuffix|.
|
||||
*/
|
||||
readonly attribute ACString siteOriginNoSuffix;
|
||||
|
||||
/**
|
||||
* The base domain of the principal URI to which this principal pertains
|
||||
* (generally the document URI), handling null principals and
|
||||
|
Loading…
Reference in New Issue
Block a user