forked from mirrors/gecko-dev
Bug 1328653 - Merging all the various *OriginAttributes to just one, r=huseby
This commit is contained in:
parent
265b3a3710
commit
359ae91eac
152 changed files with 605 additions and 756 deletions
|
|
@ -881,8 +881,8 @@ FeedWriter.prototype = {
|
|||
.QueryInterface(Ci.nsIDocShell);
|
||||
let chan = docShell.currentDocumentChannel;
|
||||
|
||||
// We probably need to call InheritFromDocShellToDoc for this, but right now
|
||||
// we can't call it from JS.
|
||||
// We probably need to call Inherit() for this, but right now we can't call
|
||||
// it from JS.
|
||||
let attrs = docShell.getOriginAttributes();
|
||||
let ssm = Services.scriptSecurityManager;
|
||||
let nullPrincipal = ssm.createNullPrincipal(attrs);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
#include "nsIEffectiveTLDService.h"
|
||||
#include "nsIObjectInputStream.h"
|
||||
#include "nsIObjectOutputStream.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
|
||||
#include "nsPrincipal.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
|
@ -35,13 +34,13 @@ namespace mozilla {
|
|||
using dom::URLParams;
|
||||
|
||||
void
|
||||
PrincipalOriginAttributes::InheritFromDocShellToDoc(const DocShellOriginAttributes& aAttrs,
|
||||
const nsIURI* aURI)
|
||||
OriginAttributes::Inherit(const OriginAttributes& aAttrs)
|
||||
{
|
||||
mAppId = aAttrs.mAppId;
|
||||
mInIsolatedMozBrowser = aAttrs.mInIsolatedMozBrowser;
|
||||
|
||||
// addonId is computed from the principal URI and never propagated
|
||||
StripAttributes(STRIP_ADDON_ID);
|
||||
|
||||
mUserContextId = aAttrs.mUserContextId;
|
||||
|
||||
mPrivateBrowsingId = aAttrs.mPrivateBrowsingId;
|
||||
|
|
@ -49,70 +48,16 @@ PrincipalOriginAttributes::InheritFromDocShellToDoc(const DocShellOriginAttribut
|
|||
}
|
||||
|
||||
void
|
||||
PrincipalOriginAttributes::InheritFromNecko(const NeckoOriginAttributes& aAttrs)
|
||||
OriginAttributes::SetFirstPartyDomain(const bool aIsTopLevelDocument,
|
||||
nsIURI* aURI)
|
||||
{
|
||||
mAppId = aAttrs.mAppId;
|
||||
mInIsolatedMozBrowser = aAttrs.mInIsolatedMozBrowser;
|
||||
|
||||
// addonId is computed from the principal URI and never propagated
|
||||
mUserContextId = aAttrs.mUserContextId;
|
||||
|
||||
mPrivateBrowsingId = aAttrs.mPrivateBrowsingId;
|
||||
mFirstPartyDomain = aAttrs.mFirstPartyDomain;
|
||||
}
|
||||
|
||||
void
|
||||
PrincipalOriginAttributes::StripUserContextIdAndFirstPartyDomain()
|
||||
{
|
||||
mUserContextId = nsIScriptSecurityManager::DEFAULT_USER_CONTEXT_ID;
|
||||
mFirstPartyDomain.Truncate();
|
||||
}
|
||||
|
||||
void
|
||||
DocShellOriginAttributes::InheritFromDocToChildDocShell(const PrincipalOriginAttributes& aAttrs)
|
||||
{
|
||||
mAppId = aAttrs.mAppId;
|
||||
mInIsolatedMozBrowser = aAttrs.mInIsolatedMozBrowser;
|
||||
|
||||
// addonId is computed from the principal URI and never propagated
|
||||
mUserContextId = aAttrs.mUserContextId;
|
||||
|
||||
mPrivateBrowsingId = aAttrs.mPrivateBrowsingId;
|
||||
mFirstPartyDomain = aAttrs.mFirstPartyDomain;
|
||||
}
|
||||
|
||||
void
|
||||
NeckoOriginAttributes::InheritFromDocToNecko(const PrincipalOriginAttributes& aAttrs)
|
||||
{
|
||||
mAppId = aAttrs.mAppId;
|
||||
mInIsolatedMozBrowser = aAttrs.mInIsolatedMozBrowser;
|
||||
|
||||
// addonId is computed from the principal URI and never propagated
|
||||
mUserContextId = aAttrs.mUserContextId;
|
||||
|
||||
mPrivateBrowsingId = aAttrs.mPrivateBrowsingId;
|
||||
mFirstPartyDomain = aAttrs.mFirstPartyDomain;
|
||||
}
|
||||
|
||||
void
|
||||
NeckoOriginAttributes::InheritFromDocShellToNecko(const DocShellOriginAttributes& aAttrs,
|
||||
const bool aIsTopLevelDocument,
|
||||
nsIURI* aURI)
|
||||
{
|
||||
mAppId = aAttrs.mAppId;
|
||||
mInIsolatedMozBrowser = aAttrs.mInIsolatedMozBrowser;
|
||||
|
||||
// addonId is computed from the principal URI and never propagated
|
||||
mUserContextId = aAttrs.mUserContextId;
|
||||
|
||||
mPrivateBrowsingId = aAttrs.mPrivateBrowsingId;
|
||||
|
||||
bool isFirstPartyEnabled = IsFirstPartyEnabled();
|
||||
|
||||
// When the pref is on, we also compute the firstPartyDomain attribute
|
||||
// if this is for top-level document.
|
||||
if (isFirstPartyEnabled && aIsTopLevelDocument) {
|
||||
nsCOMPtr<nsIEffectiveTLDService> tldService = do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID);
|
||||
nsCOMPtr<nsIEffectiveTLDService> tldService =
|
||||
do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID);
|
||||
MOZ_ASSERT(tldService);
|
||||
if (!tldService) {
|
||||
return;
|
||||
|
|
@ -121,8 +66,6 @@ NeckoOriginAttributes::InheritFromDocShellToNecko(const DocShellOriginAttributes
|
|||
nsAutoCString baseDomain;
|
||||
tldService->GetBaseDomain(aURI, 0, baseDomain);
|
||||
mFirstPartyDomain = NS_ConvertUTF8toUTF16(baseDomain);
|
||||
} else {
|
||||
mFirstPartyDomain = aAttrs.mFirstPartyDomain;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -326,17 +269,6 @@ OriginAttributes::SyncAttributesWithPrivateBrowsing(bool aInPrivateBrowsing)
|
|||
mPrivateBrowsingId = aInPrivateBrowsing ? 1 : 0;
|
||||
}
|
||||
|
||||
void
|
||||
OriginAttributes::SetFromGenericAttributes(const GenericOriginAttributes& aAttrs)
|
||||
{
|
||||
mAppId = aAttrs.mAppId;
|
||||
mInIsolatedMozBrowser = aAttrs.mInIsolatedMozBrowser;
|
||||
mAddonId = aAttrs.mAddonId;
|
||||
mUserContextId = aAttrs.mUserContextId;
|
||||
mPrivateBrowsingId = aAttrs.mPrivateBrowsingId;
|
||||
mFirstPartyDomain = aAttrs.mFirstPartyDomain;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
OriginAttributes::IsFirstPartyEnabled()
|
||||
|
|
@ -357,7 +289,7 @@ bool
|
|||
OriginAttributes::IsPrivateBrowsing(const nsACString& aOrigin)
|
||||
{
|
||||
nsAutoCString dummy;
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (NS_WARN_IF(!attrs.PopulateFromOrigin(aOrigin, dummy))) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -684,7 +616,7 @@ BasePrincipal::AddonHasPermission(const nsAString& aPerm)
|
|||
}
|
||||
|
||||
already_AddRefed<BasePrincipal>
|
||||
BasePrincipal::CreateCodebasePrincipal(nsIURI* aURI, const PrincipalOriginAttributes& aAttrs)
|
||||
BasePrincipal::CreateCodebasePrincipal(nsIURI* aURI, const OriginAttributes& aAttrs)
|
||||
{
|
||||
// If the URI is supposed to inherit the security context of whoever loads it,
|
||||
// we shouldn't make a codebase principal for it.
|
||||
|
|
@ -724,7 +656,7 @@ BasePrincipal::CreateCodebasePrincipal(const nsACString& aOrigin)
|
|||
"CreateCodebasePrincipal does not support nsNullPrincipal");
|
||||
|
||||
nsAutoCString originNoSuffix;
|
||||
mozilla::PrincipalOriginAttributes attrs;
|
||||
mozilla::OriginAttributes attrs;
|
||||
if (!attrs.PopulateFromOrigin(aOrigin, originNoSuffix)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -739,8 +671,9 @@ BasePrincipal::CreateCodebasePrincipal(const nsACString& aOrigin)
|
|||
already_AddRefed<BasePrincipal>
|
||||
BasePrincipal::CloneStrippingUserContextIdAndFirstPartyDomain()
|
||||
{
|
||||
PrincipalOriginAttributes attrs = OriginAttributesRef();
|
||||
attrs.StripUserContextIdAndFirstPartyDomain();
|
||||
OriginAttributes attrs = OriginAttributesRef();
|
||||
attrs.StripAttributes(OriginAttributes::STRIP_USER_CONTEXT_ID |
|
||||
OriginAttributes::STRIP_FIRST_PARTY_DOMAIN);
|
||||
|
||||
nsAutoCString originNoSuffix;
|
||||
nsresult rv = GetOriginNoSuffix(originNoSuffix);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/ChromeUtilsBinding.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
|
||||
class nsIContentSecurityPolicy;
|
||||
class nsIObjectOutputStream;
|
||||
|
|
@ -21,13 +22,50 @@ class nsExpandedPrincipal;
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
class GenericOriginAttributes;
|
||||
|
||||
// Base OriginAttributes class. This has several subclass flavors, and is not
|
||||
// directly constructable itself.
|
||||
class OriginAttributes : public dom::OriginAttributesDictionary
|
||||
{
|
||||
public:
|
||||
OriginAttributes() {}
|
||||
|
||||
OriginAttributes(uint32_t aAppId, bool aInIsolatedMozBrowser)
|
||||
{
|
||||
mAppId = aAppId;
|
||||
mInIsolatedMozBrowser = aInIsolatedMozBrowser;
|
||||
}
|
||||
|
||||
explicit OriginAttributes(const OriginAttributesDictionary& aOther)
|
||||
: OriginAttributesDictionary(aOther)
|
||||
{}
|
||||
|
||||
// This method 'clones' the OriginAttributes ignoring the addonId value becaue
|
||||
// this is computed from the principal URI and never propagated.
|
||||
void Inherit(const OriginAttributes& aAttrs);
|
||||
|
||||
void SetFirstPartyDomain(const bool aIsTopLevelDocument, nsIURI* aURI);
|
||||
|
||||
enum {
|
||||
STRIP_FIRST_PARTY_DOMAIN = 0x01,
|
||||
STRIP_ADDON_ID = 0x02,
|
||||
STRIP_USER_CONTEXT_ID = 0x04,
|
||||
};
|
||||
|
||||
inline void StripAttributes(uint32_t aFlags)
|
||||
{
|
||||
if (aFlags & STRIP_FIRST_PARTY_DOMAIN) {
|
||||
mFirstPartyDomain.Truncate();
|
||||
}
|
||||
|
||||
if (aFlags & STRIP_ADDON_ID) {
|
||||
mAddonId.Truncate();
|
||||
}
|
||||
|
||||
if (aFlags & STRIP_USER_CONTEXT_ID) {
|
||||
mUserContextId = nsIScriptSecurityManager::DEFAULT_USER_CONTEXT_ID;
|
||||
}
|
||||
}
|
||||
|
||||
bool operator==(const OriginAttributes& aOther) const
|
||||
{
|
||||
return mAppId == aOther.mAppId &&
|
||||
|
|
@ -37,6 +75,7 @@ public:
|
|||
mPrivateBrowsingId == aOther.mPrivateBrowsingId &&
|
||||
mFirstPartyDomain == aOther.mFirstPartyDomain;
|
||||
}
|
||||
|
||||
bool operator!=(const OriginAttributes& aOther) const
|
||||
{
|
||||
return !(*this == aOther);
|
||||
|
|
@ -61,105 +100,12 @@ public:
|
|||
// flags. Once all other flags are removed, this can be removed too.
|
||||
void SyncAttributesWithPrivateBrowsing(bool aInPrivateBrowsing);
|
||||
|
||||
void SetFromGenericAttributes(const GenericOriginAttributes& aAttrs);
|
||||
|
||||
// check if "privacy.firstparty.isolate" is enabled.
|
||||
static bool IsFirstPartyEnabled();
|
||||
|
||||
// returns true if the originAttributes suffix has mPrivateBrowsingId value
|
||||
// different than 0.
|
||||
static bool IsPrivateBrowsing(const nsACString& aOrigin);
|
||||
|
||||
protected:
|
||||
OriginAttributes() {}
|
||||
explicit OriginAttributes(const OriginAttributesDictionary& aOther)
|
||||
: OriginAttributesDictionary(aOther) {}
|
||||
};
|
||||
|
||||
class PrincipalOriginAttributes;
|
||||
class DocShellOriginAttributes;
|
||||
class NeckoOriginAttributes;
|
||||
|
||||
// Various classes in Gecko contain OriginAttributes members, and those
|
||||
// OriginAttributes get propagated to other classes according to certain rules.
|
||||
// For example, the OriginAttributes on the docshell affect the OriginAttributes
|
||||
// for the principal of a document loaded inside it, whose OriginAttributes in
|
||||
// turn affect those of network loads and child docshells. To codify and
|
||||
// centralize these rules, we introduce separate subclasses for the different
|
||||
// flavors, and a variety of InheritFrom* methods to implement the transfer
|
||||
// behavior.
|
||||
|
||||
// For OriginAttributes stored on principals.
|
||||
class PrincipalOriginAttributes : public OriginAttributes
|
||||
{
|
||||
public:
|
||||
PrincipalOriginAttributes() {}
|
||||
PrincipalOriginAttributes(uint32_t aAppId, bool aInIsolatedMozBrowser)
|
||||
{
|
||||
mAppId = aAppId;
|
||||
mInIsolatedMozBrowser = aInIsolatedMozBrowser;
|
||||
}
|
||||
|
||||
// Inheriting OriginAttributes from docshell to document when user navigates.
|
||||
//
|
||||
// @param aAttrs Origin Attributes of the docshell.
|
||||
// @param aURI The URI of the document.
|
||||
void InheritFromDocShellToDoc(const DocShellOriginAttributes& aAttrs,
|
||||
const nsIURI* aURI);
|
||||
|
||||
// Inherit OriginAttributes from Necko.
|
||||
void InheritFromNecko(const NeckoOriginAttributes& aAttrs);
|
||||
|
||||
void StripUserContextIdAndFirstPartyDomain();
|
||||
};
|
||||
|
||||
// For OriginAttributes stored on docshells / loadcontexts / browsing contexts.
|
||||
class DocShellOriginAttributes : public OriginAttributes
|
||||
{
|
||||
public:
|
||||
DocShellOriginAttributes() {}
|
||||
DocShellOriginAttributes(uint32_t aAppId, bool aInIsolatedMozBrowser)
|
||||
{
|
||||
mAppId = aAppId;
|
||||
mInIsolatedMozBrowser = aInIsolatedMozBrowser;
|
||||
}
|
||||
|
||||
// Inheriting OriginAttributes from document to child docshell when an
|
||||
// <iframe> is created.
|
||||
//
|
||||
// @param aAttrs Origin Attributes of the document.
|
||||
void
|
||||
InheritFromDocToChildDocShell(const PrincipalOriginAttributes& aAttrs);
|
||||
};
|
||||
|
||||
// For OriginAttributes stored on Necko.
|
||||
class NeckoOriginAttributes : public OriginAttributes
|
||||
{
|
||||
public:
|
||||
NeckoOriginAttributes() {}
|
||||
explicit NeckoOriginAttributes(bool aInIsolatedMozBrowser)
|
||||
{
|
||||
mInIsolatedMozBrowser = aInIsolatedMozBrowser;
|
||||
}
|
||||
|
||||
// Inheriting OriginAttributes from document to necko when a network request
|
||||
// is made.
|
||||
void InheritFromDocToNecko(const PrincipalOriginAttributes& aAttrs);
|
||||
|
||||
// Inheriting OriginAttributes from a docshell when loading a top-level
|
||||
// document.
|
||||
void InheritFromDocShellToNecko(const DocShellOriginAttributes& aAttrs,
|
||||
const bool aIsTopLevelDocument = false,
|
||||
nsIURI* aURI = nullptr);
|
||||
};
|
||||
|
||||
// For operating on OriginAttributes not associated with any data structure.
|
||||
class GenericOriginAttributes : public OriginAttributes
|
||||
{
|
||||
public:
|
||||
GenericOriginAttributes() {}
|
||||
explicit GenericOriginAttributes(const OriginAttributesDictionary& aOther)
|
||||
: OriginAttributes(aOther) {}
|
||||
};
|
||||
|
||||
class OriginAttributesPattern : public dom::OriginAttributesPatternDictionary
|
||||
|
|
@ -294,10 +240,10 @@ public:
|
|||
|
||||
static BasePrincipal* Cast(nsIPrincipal* aPrin) { return static_cast<BasePrincipal*>(aPrin); }
|
||||
static already_AddRefed<BasePrincipal>
|
||||
CreateCodebasePrincipal(nsIURI* aURI, const PrincipalOriginAttributes& aAttrs);
|
||||
CreateCodebasePrincipal(nsIURI* aURI, const OriginAttributes& aAttrs);
|
||||
static already_AddRefed<BasePrincipal> CreateCodebasePrincipal(const nsACString& aOrigin);
|
||||
|
||||
const PrincipalOriginAttributes& OriginAttributesRef() override { return mOriginAttributes; }
|
||||
const OriginAttributes& OriginAttributesRef() override { return mOriginAttributes; }
|
||||
uint32_t AppId() const { return mOriginAttributes.mAppId; }
|
||||
uint32_t UserContextId() const { return mOriginAttributes.mUserContextId; }
|
||||
uint32_t PrivateBrowsingId() const { return mOriginAttributes.mPrivateBrowsingId; }
|
||||
|
|
@ -334,7 +280,7 @@ protected:
|
|||
|
||||
nsCOMPtr<nsIContentSecurityPolicy> mCSP;
|
||||
nsCOMPtr<nsIContentSecurityPolicy> mPreloadCSP;
|
||||
PrincipalOriginAttributes mOriginAttributes;
|
||||
OriginAttributes mOriginAttributes;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ struct JSPrincipals;
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsTArray.h"
|
||||
namespace mozilla {
|
||||
class PrincipalOriginAttributes;
|
||||
class OriginAttributes;
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ interface nsIDOMDocument;
|
|||
[ptr] native JSContext(JSContext);
|
||||
[ptr] native JSPrincipals(JSPrincipals);
|
||||
[ptr] native PrincipalArray(nsTArray<nsCOMPtr<nsIPrincipal> >);
|
||||
[ref] native const_PrincipalOriginAttributes(const mozilla::PrincipalOriginAttributes);
|
||||
[ref] native const_OriginAttributes(const mozilla::OriginAttributes);
|
||||
|
||||
[scriptable, builtinclass, uuid(3da7b133-f1a0-4de9-a2bc-5c49014c1077)]
|
||||
interface nsIPrincipal : nsISerializable
|
||||
|
|
@ -198,7 +198,7 @@ interface nsIPrincipal : nsISerializable
|
|||
readonly attribute jsval originAttributes;
|
||||
|
||||
[noscript, notxpcom, nostdcall, binaryname(OriginAttributesRef)]
|
||||
const_PrincipalOriginAttributes OriginAttributesRef();
|
||||
const_OriginAttributes OriginAttributesRef();
|
||||
|
||||
/**
|
||||
* A canonical representation of the origin for this principal. This
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ nsJSPrincipals::ReadPrincipals(JSContext* aCx, JSStructuredCloneReader* aReader,
|
|||
|
||||
static bool
|
||||
ReadSuffixAndSpec(JSStructuredCloneReader* aReader,
|
||||
PrincipalOriginAttributes& aAttrs,
|
||||
OriginAttributes& aAttrs,
|
||||
nsACString& aSpec)
|
||||
{
|
||||
uint32_t suffixLength, specLength;
|
||||
|
|
@ -160,7 +160,7 @@ ReadPrincipalInfo(JSStructuredCloneReader* aReader,
|
|||
if (aTag == SCTAG_DOM_SYSTEM_PRINCIPAL) {
|
||||
aInfo = SystemPrincipalInfo();
|
||||
} else if (aTag == SCTAG_DOM_NULL_PRINCIPAL) {
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
nsAutoCString spec;
|
||||
if (!ReadSuffixAndSpec(aReader, attrs, spec)) {
|
||||
return false;
|
||||
|
|
@ -189,7 +189,7 @@ ReadPrincipalInfo(JSStructuredCloneReader* aReader,
|
|||
|
||||
aInfo = expanded;
|
||||
} else if (aTag == SCTAG_DOM_CONTENT_PRINCIPAL) {
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
nsAutoCString spec;
|
||||
if (!ReadSuffixAndSpec(aReader, attrs, spec)) {
|
||||
return false;
|
||||
|
|
@ -237,7 +237,7 @@ nsJSPrincipals::ReadKnownPrincipalType(JSContext* aCx,
|
|||
|
||||
static bool
|
||||
WriteSuffixAndSpec(JSStructuredCloneWriter* aWriter,
|
||||
const PrincipalOriginAttributes& aAttrs,
|
||||
const OriginAttributes& aAttrs,
|
||||
const nsCString& aSpec)
|
||||
{
|
||||
nsAutoCString suffix;
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ nsNullPrincipal::CreateWithInheritedAttributes(nsIPrincipal* aInheritFrom)
|
|||
/* static */ already_AddRefed<nsNullPrincipal>
|
||||
nsNullPrincipal::CreateWithInheritedAttributes(nsIDocShell* aDocShell)
|
||||
{
|
||||
PrincipalOriginAttributes attrs;
|
||||
attrs.InheritFromDocShellToDoc(nsDocShell::Cast(aDocShell)->GetOriginAttributes(), nullptr);
|
||||
OriginAttributes attrs;
|
||||
attrs.Inherit(nsDocShell::Cast(aDocShell)->GetOriginAttributes());
|
||||
|
||||
RefPtr<nsNullPrincipal> nullPrin = new nsNullPrincipal();
|
||||
nsresult rv = nullPrin->Init(attrs);
|
||||
|
|
@ -58,8 +58,7 @@ nsNullPrincipal::CreateWithInheritedAttributes(nsIDocShell* aDocShell)
|
|||
}
|
||||
|
||||
/* static */ already_AddRefed<nsNullPrincipal>
|
||||
nsNullPrincipal::Create(const PrincipalOriginAttributes& aOriginAttributes,
|
||||
nsIURI* aURI)
|
||||
nsNullPrincipal::Create(const OriginAttributes& aOriginAttributes, nsIURI* aURI)
|
||||
{
|
||||
RefPtr<nsNullPrincipal> nullPrin = new nsNullPrincipal();
|
||||
nsresult rv = nullPrin->Init(aOriginAttributes, aURI);
|
||||
|
|
@ -69,8 +68,7 @@ nsNullPrincipal::Create(const PrincipalOriginAttributes& aOriginAttributes,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsNullPrincipal::Init(const PrincipalOriginAttributes& aOriginAttributes,
|
||||
nsIURI* aURI)
|
||||
nsNullPrincipal::Init(const OriginAttributes& aOriginAttributes, nsIURI* aURI)
|
||||
{
|
||||
mOriginAttributes = aOriginAttributes;
|
||||
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@ public:
|
|||
static already_AddRefed<nsNullPrincipal> CreateWithInheritedAttributes(nsIDocShell* aDocShell);
|
||||
|
||||
static already_AddRefed<nsNullPrincipal>
|
||||
Create(const mozilla::PrincipalOriginAttributes& aOriginAttributes = mozilla::PrincipalOriginAttributes(),
|
||||
Create(const mozilla::OriginAttributes& aOriginAttributes = mozilla::OriginAttributes(),
|
||||
nsIURI* aURI = nullptr);
|
||||
|
||||
nsresult Init(const mozilla::PrincipalOriginAttributes& aOriginAttributes = mozilla::PrincipalOriginAttributes(),
|
||||
nsresult Init(const mozilla::OriginAttributes& aOriginAttributes = mozilla::OriginAttributes(),
|
||||
nsIURI* aURI = nullptr);
|
||||
|
||||
virtual nsresult GetScriptLocation(nsACString &aStr) override;
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ nsPrincipal::~nsPrincipal()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsPrincipal::Init(nsIURI *aCodebase, const PrincipalOriginAttributes& aOriginAttributes)
|
||||
nsPrincipal::Init(nsIURI *aCodebase, const OriginAttributes& aOriginAttributes)
|
||||
{
|
||||
NS_ENSURE_STATE(!mInitialized);
|
||||
NS_ENSURE_ARG(aCodebase);
|
||||
|
|
@ -404,7 +404,7 @@ nsPrincipal::Read(nsIObjectInputStream* aStream)
|
|||
rv = aStream->ReadCString(suffix);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
bool ok = attrs.PopulateFromSuffix(suffix);
|
||||
NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
|
||||
|
||||
|
|
@ -688,7 +688,7 @@ struct OriginComparator
|
|||
};
|
||||
|
||||
nsExpandedPrincipal::nsExpandedPrincipal(nsTArray<nsCOMPtr<nsIPrincipal>> &aWhiteList,
|
||||
const PrincipalOriginAttributes& aAttrs)
|
||||
const OriginAttributes& aAttrs)
|
||||
{
|
||||
// We force the principals to be sorted by origin so that nsExpandedPrincipal
|
||||
// origins can have a canonical form.
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ public:
|
|||
nsPrincipal();
|
||||
|
||||
// Init() must be called before the principal is in a usable state.
|
||||
nsresult Init(nsIURI* aCodebase, const mozilla::PrincipalOriginAttributes& aOriginAttributes);
|
||||
nsresult Init(nsIURI* aCodebase,
|
||||
const mozilla::OriginAttributes& aOriginAttributes);
|
||||
|
||||
virtual nsresult GetScriptLocation(nsACString& aStr) override;
|
||||
void SetURI(nsIURI* aURI);
|
||||
|
|
@ -63,7 +64,7 @@ class nsExpandedPrincipal : public nsIExpandedPrincipal, public mozilla::BasePri
|
|||
{
|
||||
public:
|
||||
nsExpandedPrincipal(nsTArray<nsCOMPtr<nsIPrincipal>> &aWhiteList,
|
||||
const mozilla::PrincipalOriginAttributes& aAttrs);
|
||||
const mozilla::OriginAttributes& aAttrs);
|
||||
|
||||
NS_DECL_NSIEXPANDEDPRINCIPAL
|
||||
NS_DECL_NSISERIALIZABLE
|
||||
|
|
|
|||
|
|
@ -298,11 +298,10 @@ nsScriptSecurityManager::GetChannelResultPrincipal(nsIChannel* aChannel,
|
|||
prin =
|
||||
nsNullPrincipal::CreateWithInheritedAttributes(loadInfo->LoadingPrincipal());
|
||||
} else {
|
||||
NeckoOriginAttributes nAttrs;
|
||||
loadInfo->GetOriginAttributes(&nAttrs);
|
||||
PrincipalOriginAttributes pAttrs;
|
||||
pAttrs.InheritFromNecko(nAttrs);
|
||||
prin = nsNullPrincipal::Create(pAttrs);
|
||||
OriginAttributes attrs;
|
||||
loadInfo->GetOriginAttributes(&attrs);
|
||||
attrs.StripAttributes(OriginAttributes::STRIP_ADDON_ID);
|
||||
prin = nsNullPrincipal::Create(attrs);
|
||||
}
|
||||
prin.forget(aPrincipal);
|
||||
return NS_OK;
|
||||
|
|
@ -356,7 +355,7 @@ nsScriptSecurityManager::GetChannelResultPrincipal(nsIChannel* aChannel,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsScriptSecurityManager::MaybeSetAddonIdFromURI(PrincipalOriginAttributes& aAttrs, nsIURI* aURI)
|
||||
nsScriptSecurityManager::MaybeSetAddonIdFromURI(OriginAttributes& aAttrs, nsIURI* aURI)
|
||||
{
|
||||
nsAutoCString scheme;
|
||||
nsresult rv = aURI->GetScheme(scheme);
|
||||
|
|
@ -400,11 +399,11 @@ nsScriptSecurityManager::GetChannelURIPrincipal(nsIChannel* aChannel,
|
|||
// loadInfo will be set from nsDocShell::DoURILoad.
|
||||
// For subresource loading, the origin attributes of the loadInfo is from
|
||||
// its loadingPrincipal.
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
|
||||
// For addons loadInfo might be null.
|
||||
if (loadInfo) {
|
||||
attrs.InheritFromNecko(loadInfo->GetOriginAttributes());
|
||||
attrs.Inherit(loadInfo->GetOriginAttributes());
|
||||
}
|
||||
rv = MaybeSetAddonIdFromURI(attrs, uri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
@ -1070,7 +1069,7 @@ NS_IMETHODIMP
|
|||
nsScriptSecurityManager::GetNoAppCodebasePrincipal(nsIURI* aURI,
|
||||
nsIPrincipal** aPrincipal)
|
||||
{
|
||||
PrincipalOriginAttributes attrs(NO_APP_ID, false);
|
||||
OriginAttributes attrs;
|
||||
nsCOMPtr<nsIPrincipal> prin = BasePrincipal::CreateCodebasePrincipal(aURI, attrs);
|
||||
prin.forget(aPrincipal);
|
||||
return *aPrincipal ? NS_OK : NS_ERROR_FAILURE;
|
||||
|
|
@ -1087,7 +1086,7 @@ NS_IMETHODIMP
|
|||
nsScriptSecurityManager::CreateCodebasePrincipal(nsIURI* aURI, JS::Handle<JS::Value> aOriginAttributes,
|
||||
JSContext* aCx, nsIPrincipal** aPrincipal)
|
||||
{
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (!aOriginAttributes.isObject() || !attrs.Init(aCx, aOriginAttributes)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
|
@ -1117,7 +1116,7 @@ NS_IMETHODIMP
|
|||
nsScriptSecurityManager::CreateNullPrincipal(JS::Handle<JS::Value> aOriginAttributes,
|
||||
JSContext* aCx, nsIPrincipal** aPrincipal)
|
||||
{
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (!aOriginAttributes.isObject() || !attrs.Init(aCx, aOriginAttributes)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
|
@ -1135,7 +1134,7 @@ nsScriptSecurityManager::GetAppCodebasePrincipal(nsIURI* aURI,
|
|||
NS_ENSURE_TRUE(aAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID,
|
||||
NS_ERROR_INVALID_ARG);
|
||||
|
||||
PrincipalOriginAttributes attrs(aAppId, aInIsolatedMozBrowser);
|
||||
OriginAttributes attrs(aAppId, aInIsolatedMozBrowser);
|
||||
nsCOMPtr<nsIPrincipal> prin = BasePrincipal::CreateCodebasePrincipal(aURI, attrs);
|
||||
prin.forget(aPrincipal);
|
||||
return *aPrincipal ? NS_OK : NS_ERROR_FAILURE;
|
||||
|
|
@ -1148,12 +1147,12 @@ nsScriptSecurityManager::
|
|||
nsIPrincipal** aPrincipal)
|
||||
{
|
||||
NS_ENSURE_STATE(aLoadContext);
|
||||
DocShellOriginAttributes docShellAttrs;
|
||||
OriginAttributes docShellAttrs;
|
||||
bool result = aLoadContext->GetOriginAttributes(docShellAttrs);;
|
||||
NS_ENSURE_TRUE(result, NS_ERROR_FAILURE);
|
||||
|
||||
PrincipalOriginAttributes attrs;
|
||||
attrs.InheritFromDocShellToDoc(docShellAttrs, aURI);
|
||||
OriginAttributes attrs;
|
||||
attrs.Inherit(docShellAttrs);
|
||||
|
||||
nsresult rv = MaybeSetAddonIdFromURI(attrs, aURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
@ -1167,8 +1166,8 @@ nsScriptSecurityManager::GetDocShellCodebasePrincipal(nsIURI* aURI,
|
|||
nsIDocShell* aDocShell,
|
||||
nsIPrincipal** aPrincipal)
|
||||
{
|
||||
PrincipalOriginAttributes attrs;
|
||||
attrs.InheritFromDocShellToDoc(nsDocShell::Cast(aDocShell)->GetOriginAttributes(), aURI);
|
||||
OriginAttributes attrs;
|
||||
attrs.Inherit(nsDocShell::Cast(aDocShell)->GetOriginAttributes());
|
||||
|
||||
nsresult rv = MaybeSetAddonIdFromURI(attrs, aURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class nsIStringBundle;
|
|||
class nsSystemPrincipal;
|
||||
|
||||
namespace mozilla {
|
||||
class PrincipalOriginAttributes;
|
||||
class OriginAttributes;
|
||||
} // namespace mozilla
|
||||
|
||||
/////////////////////////////
|
||||
|
|
@ -112,7 +112,7 @@ private:
|
|||
AddSitesToFileURIWhitelist(const nsCString& aSiteList);
|
||||
|
||||
// If aURI is a moz-extension:// URI, set mAddonId to the associated addon.
|
||||
nsresult MaybeSetAddonIdFromURI(mozilla::PrincipalOriginAttributes& aAttrs, nsIURI* aURI);
|
||||
nsresult MaybeSetAddonIdFromURI(mozilla::OriginAttributes& aAttrs, nsIURI* aURI);
|
||||
|
||||
nsresult GetChannelResultPrincipal(nsIChannel* aChannel,
|
||||
nsIPrincipal** aPrincipal,
|
||||
|
|
|
|||
|
|
@ -4,35 +4,35 @@
|
|||
#include "gtest/gtest.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
|
||||
using mozilla::PrincipalOriginAttributes;
|
||||
using mozilla::OriginAttributes;
|
||||
|
||||
static void
|
||||
TestSuffix(const PrincipalOriginAttributes& attrs)
|
||||
TestSuffix(const OriginAttributes& attrs)
|
||||
{
|
||||
nsAutoCString suffix;
|
||||
attrs.CreateSuffix(suffix);
|
||||
|
||||
PrincipalOriginAttributes attrsFromSuffix;
|
||||
OriginAttributes attrsFromSuffix;
|
||||
bool success = attrsFromSuffix.PopulateFromSuffix(suffix);
|
||||
EXPECT_TRUE(success);
|
||||
|
||||
EXPECT_EQ(attrs, attrsFromSuffix);
|
||||
}
|
||||
|
||||
TEST(PrincipalOriginAttributes, Suffix_default)
|
||||
TEST(OriginAttributes, Suffix_default)
|
||||
{
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
TestSuffix(attrs);
|
||||
}
|
||||
|
||||
TEST(PrincipalOriginAttributes, Suffix_appId_inIsolatedMozBrowser)
|
||||
TEST(OriginAttributes, Suffix_appId_inIsolatedMozBrowser)
|
||||
{
|
||||
PrincipalOriginAttributes attrs(1, true);
|
||||
OriginAttributes attrs(1, true);
|
||||
TestSuffix(attrs);
|
||||
}
|
||||
|
||||
TEST(PrincipalOriginAttributes, Suffix_maxAppId_inIsolatedMozBrowser)
|
||||
TEST(OriginAttributes, Suffix_maxAppId_inIsolatedMozBrowser)
|
||||
{
|
||||
PrincipalOriginAttributes attrs(4294967295, true);
|
||||
OriginAttributes attrs(4294967295, true);
|
||||
TestSuffix(attrs);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#include "xpcpublic.h"
|
||||
|
||||
bool
|
||||
nsILoadContext::GetOriginAttributes(mozilla::DocShellOriginAttributes& aAttrs)
|
||||
nsILoadContext::GetOriginAttributes(mozilla::OriginAttributes& aAttrs)
|
||||
{
|
||||
mozilla::dom::AutoJSAPI jsapi;
|
||||
bool ok = jsapi.Init(xpc::PrivilegedJunkScope());
|
||||
|
|
@ -29,7 +29,7 @@ nsILoadContext::GetOriginAttributes(mozilla::DocShellOriginAttributes& aAttrs)
|
|||
MOZ_ASSERT(nsContentUtils::IsSystemPrincipal(nsContentUtils::ObjectPrincipal(obj)));
|
||||
JSAutoCompartment ac(jsapi.cx(), obj);
|
||||
|
||||
mozilla::DocShellOriginAttributes attrs;
|
||||
mozilla::OriginAttributes attrs;
|
||||
ok = attrs.Init(jsapi.cx(), v);
|
||||
NS_ENSURE_TRUE(ok, false);
|
||||
aAttrs = attrs;
|
||||
|
|
@ -50,8 +50,7 @@ LoadContext::LoadContext(nsIPrincipal* aPrincipal,
|
|||
, mIsNotNull(true)
|
||||
#endif
|
||||
{
|
||||
PrincipalOriginAttributes poa = aPrincipal->OriginAttributesRef();
|
||||
mOriginAttributes.InheritFromDocToChildDocShell(poa);
|
||||
mOriginAttributes.Inherit(aPrincipal->OriginAttributesRef());
|
||||
if (!aOptionalBase) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public:
|
|||
// provided by child process.
|
||||
LoadContext(const IPC::SerializedLoadContext& aToCopy,
|
||||
dom::Element* aTopFrameElement,
|
||||
DocShellOriginAttributes& aAttrs)
|
||||
OriginAttributes& aAttrs)
|
||||
: mTopFrameElement(do_GetWeakReference(aTopFrameElement))
|
||||
, mNestedFrameId(0)
|
||||
, mIsContent(aToCopy.mIsContent)
|
||||
|
|
@ -56,7 +56,7 @@ public:
|
|||
// provided by child process.
|
||||
LoadContext(const IPC::SerializedLoadContext& aToCopy,
|
||||
uint64_t aNestedFrameId,
|
||||
DocShellOriginAttributes& aAttrs)
|
||||
OriginAttributes& aAttrs)
|
||||
: mTopFrameElement(nullptr)
|
||||
, mNestedFrameId(aNestedFrameId)
|
||||
, mIsContent(aToCopy.mIsContent)
|
||||
|
|
@ -72,7 +72,7 @@ public:
|
|||
bool aIsContent,
|
||||
bool aUsePrivateBrowsing,
|
||||
bool aUseRemoteTabs,
|
||||
const DocShellOriginAttributes& aAttrs)
|
||||
const OriginAttributes& aAttrs)
|
||||
: mTopFrameElement(do_GetWeakReference(aTopFrameElement))
|
||||
, mNestedFrameId(0)
|
||||
, mIsContent(aIsContent)
|
||||
|
|
@ -86,7 +86,7 @@ public:
|
|||
}
|
||||
|
||||
// Constructor taking reserved origin attributes.
|
||||
explicit LoadContext(DocShellOriginAttributes& aAttrs)
|
||||
explicit LoadContext(OriginAttributes& aAttrs)
|
||||
: mTopFrameElement(nullptr)
|
||||
, mNestedFrameId(0)
|
||||
, mIsContent(false)
|
||||
|
|
@ -110,7 +110,7 @@ private:
|
|||
uint64_t mNestedFrameId;
|
||||
bool mIsContent;
|
||||
bool mUseRemoteTabs;
|
||||
DocShellOriginAttributes mOriginAttributes;
|
||||
OriginAttributes mOriginAttributes;
|
||||
#ifdef DEBUG
|
||||
bool mIsNotNull;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public:
|
|||
bool mIsPrivateBitValid;
|
||||
bool mIsContent;
|
||||
bool mUseRemoteTabs;
|
||||
mozilla::DocShellOriginAttributes mOriginAttributes;
|
||||
mozilla::OriginAttributes mOriginAttributes;
|
||||
};
|
||||
|
||||
// Function to serialize over IPDL
|
||||
|
|
|
|||
|
|
@ -3556,9 +3556,9 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
|
|||
aTargetItem->GetSameTypeRootTreeItem(getter_AddRefs(targetRoot));
|
||||
nsCOMPtr<nsIDocShell> targetRootDS = do_QueryInterface(targetRoot);
|
||||
|
||||
DocShellOriginAttributes targetOA =
|
||||
OriginAttributes targetOA =
|
||||
static_cast<nsDocShell*>(targetDS.get())->GetOriginAttributes();
|
||||
DocShellOriginAttributes accessingOA =
|
||||
OriginAttributes accessingOA =
|
||||
static_cast<nsDocShell*>(accessingDS.get())->GetOriginAttributes();
|
||||
|
||||
// When the first party isolation is on, the top-level docShell may not have
|
||||
|
|
@ -9673,8 +9673,8 @@ nsresult
|
|||
nsDocShell::CreatePrincipalFromReferrer(nsIURI* aReferrer,
|
||||
nsIPrincipal** aResult)
|
||||
{
|
||||
PrincipalOriginAttributes attrs;
|
||||
attrs.InheritFromDocShellToDoc(mOriginAttributes, aReferrer);
|
||||
OriginAttributes attrs;
|
||||
attrs.Inherit(mOriginAttributes);
|
||||
nsCOMPtr<nsIPrincipal> prin =
|
||||
BasePrincipal::CreateCodebasePrincipal(aReferrer, attrs);
|
||||
prin.forget(aResult);
|
||||
|
|
@ -10898,12 +10898,14 @@ nsDocShell::DoURILoad(nsIURI* aURI,
|
|||
// We have to do this in case our OriginAttributes are different from the
|
||||
// OriginAttributes of the parent document. Or in case there isn't a
|
||||
// parent document.
|
||||
NeckoOriginAttributes neckoAttrs;
|
||||
bool isTopLevelDoc = aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT &&
|
||||
mItemType == typeContent &&
|
||||
!GetIsMozBrowser();
|
||||
neckoAttrs.InheritFromDocShellToNecko(GetOriginAttributes(), isTopLevelDoc, aURI);
|
||||
rv = loadInfo->SetOriginAttributes(neckoAttrs);
|
||||
|
||||
OriginAttributes attrs;
|
||||
attrs.Inherit(GetOriginAttributes());
|
||||
attrs.SetFirstPartyDomain(isTopLevelDoc, aURI);
|
||||
rv = loadInfo->SetOriginAttributes(attrs);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
|
@ -12286,11 +12288,10 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
|
|||
loadInfo->LoadingPrincipal());
|
||||
} else {
|
||||
// get the OriginAttributes
|
||||
NeckoOriginAttributes nAttrs;
|
||||
loadInfo->GetOriginAttributes(&nAttrs);
|
||||
PrincipalOriginAttributes pAttrs;
|
||||
pAttrs.InheritFromNecko(nAttrs);
|
||||
principalToInherit = nsNullPrincipal::Create(pAttrs);
|
||||
OriginAttributes attrs;
|
||||
loadInfo->GetOriginAttributes(&attrs);
|
||||
attrs.StripAttributes(OriginAttributes::STRIP_ADDON_ID);
|
||||
principalToInherit = nsNullPrincipal::Create(attrs);
|
||||
}
|
||||
} else {
|
||||
principalToInherit = loadInfo->PrincipalToInherit();
|
||||
|
|
@ -14375,7 +14376,7 @@ nsDocShell::CanSetOriginAttributes()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsDocShell::SetOriginAttributes(const DocShellOriginAttributes& aAttrs)
|
||||
nsDocShell::SetOriginAttributes(const OriginAttributes& aAttrs)
|
||||
{
|
||||
if (!CanSetOriginAttributes()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
@ -14413,7 +14414,7 @@ nsDocShell::SetOriginAttributesBeforeLoading(JS::Handle<JS::Value> aOriginAttrib
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
DocShellOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (!aOriginAttributes.isObject() || !attrs.Init(cx, aOriginAttributes)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
|
@ -14425,7 +14426,7 @@ NS_IMETHODIMP
|
|||
nsDocShell::SetOriginAttributes(JS::Handle<JS::Value> aOriginAttributes,
|
||||
JSContext* aCx)
|
||||
{
|
||||
DocShellOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (!aOriginAttributes.isObject() || !attrs.Init(aCx, aOriginAttributes)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
|
@ -14605,8 +14606,8 @@ nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNonSubresourceReques
|
|||
}
|
||||
|
||||
if (aIsNonSubresourceRequest) {
|
||||
PrincipalOriginAttributes attrs;
|
||||
attrs.InheritFromDocShellToDoc(mOriginAttributes, aURI);
|
||||
OriginAttributes attrs;
|
||||
attrs.Inherit(mOriginAttributes);
|
||||
nsCOMPtr<nsIPrincipal> principal =
|
||||
BasePrincipal::CreateCodebasePrincipal(aURI, attrs);
|
||||
*aShouldIntercept = swm->IsAvailable(principal, aURI);
|
||||
|
|
@ -14657,12 +14658,8 @@ nsDocShell::ChannelIntercepted(nsIInterceptedChannel* aChannel)
|
|||
|
||||
bool isReload = mLoadType & LOAD_CMD_RELOAD;
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = channel->GetURI(getter_AddRefs(uri));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PrincipalOriginAttributes attrs;
|
||||
attrs.InheritFromDocShellToDoc(mOriginAttributes, uri);
|
||||
OriginAttributes attrs;
|
||||
attrs.Inherit(mOriginAttributes);
|
||||
|
||||
ErrorResult error;
|
||||
swm->DispatchFetchEvent(attrs, doc, mInterceptedDocumentId, aChannel,
|
||||
|
|
|
|||
|
|
@ -277,13 +277,13 @@ private:
|
|||
bool CanSetOriginAttributes();
|
||||
|
||||
public:
|
||||
const mozilla::DocShellOriginAttributes&
|
||||
const mozilla::OriginAttributes&
|
||||
GetOriginAttributes()
|
||||
{
|
||||
return mOriginAttributes;
|
||||
}
|
||||
|
||||
nsresult SetOriginAttributes(const mozilla::DocShellOriginAttributes& aAttrs);
|
||||
nsresult SetOriginAttributes(const mozilla::OriginAttributes& aAttrs);
|
||||
|
||||
void GetInterceptedDocumentId(nsAString& aId)
|
||||
{
|
||||
|
|
@ -1041,7 +1041,7 @@ private:
|
|||
nsTObserverArray<nsWeakPtr> mScrollObservers;
|
||||
nsCString mOriginalUriString;
|
||||
nsWeakPtr mOpener;
|
||||
mozilla::DocShellOriginAttributes mOriginAttributes;
|
||||
mozilla::OriginAttributes mOriginAttributes;
|
||||
|
||||
// A depth count of how many times NotifyRunToCompletionStart
|
||||
// has been called without a matching NotifyRunToCompletionStop.
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ interface nsIDOMElement;
|
|||
|
||||
%{C++
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
#include "mozilla/BasePrincipal.h" // for DocShellOriginAttributes
|
||||
#include "mozilla/BasePrincipal.h" // for OriginAttributes
|
||||
#endif
|
||||
%}
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ interface nsILoadContext : nsISupports
|
|||
*
|
||||
* Defined in LoadContext.cpp
|
||||
*/
|
||||
bool GetOriginAttributes(mozilla::DocShellOriginAttributes& aAttrs);
|
||||
bool GetOriginAttributes(mozilla::OriginAttributes& aAttrs);
|
||||
#endif
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ ChromeUtils::OriginAttributesToSuffix(dom::GlobalObject& aGlobal,
|
|||
nsCString& aSuffix)
|
||||
|
||||
{
|
||||
GenericOriginAttributes attrs(aAttrs);
|
||||
OriginAttributes attrs(aAttrs);
|
||||
attrs.CreateSuffix(aSuffix);
|
||||
}
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ ChromeUtils::OriginAttributesMatchPattern(dom::GlobalObject& aGlobal,
|
|||
const dom::OriginAttributesDictionary& aAttrs,
|
||||
const dom::OriginAttributesPatternDictionary& aPattern)
|
||||
{
|
||||
GenericOriginAttributes attrs(aAttrs);
|
||||
OriginAttributes attrs(aAttrs);
|
||||
OriginAttributesPattern pattern(aPattern);
|
||||
return pattern.Matches(attrs);
|
||||
}
|
||||
|
|
@ -152,7 +152,7 @@ ChromeUtils::CreateOriginAttributesFromOrigin(dom::GlobalObject& aGlobal,
|
|||
dom::OriginAttributesDictionary& aAttrs,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
GenericOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
nsAutoCString suffix;
|
||||
if (!attrs.PopulateFromOrigin(NS_ConvertUTF16toUTF8(aOrigin), suffix)) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ DOMParser::Init(nsIPrincipal* principal, nsIURI* documentURI,
|
|||
0,
|
||||
documentURI);
|
||||
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
mPrincipal = BasePrincipal::CreateCodebasePrincipal(mDocumentURI, attrs);
|
||||
NS_ENSURE_TRUE(mPrincipal, NS_ERROR_FAILURE);
|
||||
mOriginalPrincipal = mPrincipal;
|
||||
|
|
|
|||
|
|
@ -3145,11 +3145,11 @@ nsContentUtils::CanLoadImage(nsIURI* aURI, nsISupports* aContext,
|
|||
}
|
||||
|
||||
// static
|
||||
mozilla::PrincipalOriginAttributes
|
||||
mozilla::OriginAttributes
|
||||
nsContentUtils::GetOriginAttributes(nsIDocument* aDocument)
|
||||
{
|
||||
if (!aDocument) {
|
||||
return mozilla::PrincipalOriginAttributes();
|
||||
return mozilla::OriginAttributes();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup = aDocument->GetDocumentLoadGroup();
|
||||
|
|
@ -3157,30 +3157,28 @@ nsContentUtils::GetOriginAttributes(nsIDocument* aDocument)
|
|||
return GetOriginAttributes(loadGroup);
|
||||
}
|
||||
|
||||
mozilla::PrincipalOriginAttributes attrs;
|
||||
mozilla::NeckoOriginAttributes nattrs;
|
||||
mozilla::OriginAttributes attrs;
|
||||
nsCOMPtr<nsIChannel> channel = aDocument->GetChannel();
|
||||
if (channel && NS_GetOriginAttributes(channel, nattrs)) {
|
||||
attrs.InheritFromNecko(nattrs);
|
||||
if (channel && NS_GetOriginAttributes(channel, attrs)) {
|
||||
attrs.StripAttributes(OriginAttributes::STRIP_ADDON_ID);
|
||||
}
|
||||
return attrs;
|
||||
}
|
||||
|
||||
// static
|
||||
mozilla::PrincipalOriginAttributes
|
||||
mozilla::OriginAttributes
|
||||
nsContentUtils::GetOriginAttributes(nsILoadGroup* aLoadGroup)
|
||||
{
|
||||
if (!aLoadGroup) {
|
||||
return mozilla::PrincipalOriginAttributes();
|
||||
return mozilla::OriginAttributes();
|
||||
}
|
||||
mozilla::PrincipalOriginAttributes attrs;
|
||||
mozilla::DocShellOriginAttributes dsattrs;
|
||||
mozilla::OriginAttributes attrs;
|
||||
nsCOMPtr<nsIInterfaceRequestor> callbacks;
|
||||
aLoadGroup->GetNotificationCallbacks(getter_AddRefs(callbacks));
|
||||
if (callbacks) {
|
||||
nsCOMPtr<nsILoadContext> loadContext = do_GetInterface(callbacks);
|
||||
if (loadContext && loadContext->GetOriginAttributes(dsattrs)) {
|
||||
attrs.InheritFromDocShellToDoc(dsattrs, nullptr);
|
||||
if (loadContext && loadContext->GetOriginAttributes(attrs)) {
|
||||
attrs.StripAttributes(OriginAttributes::STRIP_ADDON_ID);
|
||||
}
|
||||
}
|
||||
return attrs;
|
||||
|
|
|
|||
|
|
@ -805,13 +805,13 @@ public:
|
|||
/**
|
||||
* Returns origin attributes of the document.
|
||||
**/
|
||||
static mozilla::PrincipalOriginAttributes
|
||||
static mozilla::OriginAttributes
|
||||
GetOriginAttributes(nsIDocument* aDoc);
|
||||
|
||||
/**
|
||||
* Returns origin attributes of the load group.
|
||||
**/
|
||||
static mozilla::PrincipalOriginAttributes
|
||||
static mozilla::OriginAttributes
|
||||
GetOriginAttributes(nsILoadGroup* aLoadGroup);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1361,12 +1361,12 @@ nsFrameLoader::SwapWithOtherRemoteLoader(nsFrameLoader* aOther,
|
|||
// This is the reason why now we must retrieve the correct value from the
|
||||
// usercontextid attribute before comparing our originAttributes with the
|
||||
// other one.
|
||||
DocShellOriginAttributes ourOriginAttributes =
|
||||
OriginAttributes ourOriginAttributes =
|
||||
mRemoteBrowser->OriginAttributesRef();
|
||||
rv = PopulateUserContextIdFromAttribute(ourOriginAttributes);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
DocShellOriginAttributes otherOriginAttributes =
|
||||
OriginAttributes otherOriginAttributes =
|
||||
aOther->mRemoteBrowser->OriginAttributesRef();
|
||||
rv = aOther->PopulateUserContextIdFromAttribute(otherOriginAttributes);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
|
@ -1759,12 +1759,12 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
|||
// This is the reason why now we must retrieve the correct value from the
|
||||
// usercontextid attribute before comparing our originAttributes with the
|
||||
// other one.
|
||||
DocShellOriginAttributes ourOriginAttributes =
|
||||
OriginAttributes ourOriginAttributes =
|
||||
ourDocshell->GetOriginAttributes();
|
||||
rv = PopulateUserContextIdFromAttribute(ourOriginAttributes);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
DocShellOriginAttributes otherOriginAttributes =
|
||||
OriginAttributes otherOriginAttributes =
|
||||
otherDocshell->GetOriginAttributes();
|
||||
rv = aOther->PopulateUserContextIdFromAttribute(otherOriginAttributes);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
|
@ -2406,7 +2406,7 @@ nsFrameLoader::MaybeCreateDocShell()
|
|||
}
|
||||
}
|
||||
|
||||
DocShellOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (docShell->ItemType() == mDocShell->ItemType()) {
|
||||
attrs = nsDocShell::Cast(docShell)->GetOriginAttributes();
|
||||
}
|
||||
|
|
@ -2421,7 +2421,7 @@ nsFrameLoader::MaybeCreateDocShell()
|
|||
if (parentType == nsIDocShellTreeItem::typeContent &&
|
||||
!nsContentUtils::IsSystemPrincipal(doc->NodePrincipal()) &&
|
||||
!OwnerIsMozBrowserFrame()) {
|
||||
PrincipalOriginAttributes poa = doc->NodePrincipal()->OriginAttributesRef();
|
||||
OriginAttributes oa = doc->NodePrincipal()->OriginAttributesRef();
|
||||
|
||||
// Assert on the firstPartyDomain from top-level docshell should be empty
|
||||
if (mIsTopLevelContent) {
|
||||
|
|
@ -2429,18 +2429,18 @@ nsFrameLoader::MaybeCreateDocShell()
|
|||
"top-level docshell shouldn't have firstPartyDomain attribute.");
|
||||
}
|
||||
|
||||
// So far we want to make sure InheritFromDocToChildDocShell doesn't override
|
||||
// any other origin attribute than firstPartyDomain.
|
||||
MOZ_ASSERT(attrs.mAppId == poa.mAppId,
|
||||
// So far we want to make sure Inherit doesn't override any other origin
|
||||
// attribute than firstPartyDomain.
|
||||
MOZ_ASSERT(attrs.mAppId == oa.mAppId,
|
||||
"docshell and document should have the same appId attribute.");
|
||||
MOZ_ASSERT(attrs.mUserContextId == poa.mUserContextId,
|
||||
MOZ_ASSERT(attrs.mUserContextId == oa.mUserContextId,
|
||||
"docshell and document should have the same userContextId attribute.");
|
||||
MOZ_ASSERT(attrs.mInIsolatedMozBrowser == poa.mInIsolatedMozBrowser,
|
||||
MOZ_ASSERT(attrs.mInIsolatedMozBrowser == oa.mInIsolatedMozBrowser,
|
||||
"docshell and document should have the same inIsolatedMozBrowser attribute.");
|
||||
MOZ_ASSERT(attrs.mPrivateBrowsingId == poa.mPrivateBrowsingId,
|
||||
MOZ_ASSERT(attrs.mPrivateBrowsingId == oa.mPrivateBrowsingId,
|
||||
"docshell and document should have the same privateBrowsingId attribute.");
|
||||
|
||||
attrs.InheritFromDocToChildDocShell(poa);
|
||||
attrs.Inherit(oa);
|
||||
}
|
||||
|
||||
if (OwnerIsMozBrowserFrame()) {
|
||||
|
|
@ -3592,7 +3592,7 @@ nsresult
|
|||
nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
|
||||
nsIURI* aURI)
|
||||
{
|
||||
DocShellOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
attrs.mInIsolatedMozBrowser = OwnerIsIsolatedMozBrowserFrame();
|
||||
nsresult rv;
|
||||
|
||||
|
|
@ -3641,7 +3641,7 @@ nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsFrameLoader::PopulateUserContextIdFromAttribute(DocShellOriginAttributes& aAttr)
|
||||
nsFrameLoader::PopulateUserContextIdFromAttribute(OriginAttributes& aAttr)
|
||||
{
|
||||
if (aAttr.mUserContextId ==
|
||||
nsIScriptSecurityManager::DEFAULT_USER_CONTEXT_ID) {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class nsIDocShellTreeOwner;
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
class DocShellOriginAttributes;
|
||||
class OriginAttributes;
|
||||
|
||||
namespace dom {
|
||||
class ContentParent;
|
||||
|
|
@ -308,7 +308,7 @@ private:
|
|||
void MaybeUpdatePrimaryTabParent(TabParentChange aChange);
|
||||
|
||||
nsresult
|
||||
PopulateUserContextIdFromAttribute(mozilla::DocShellOriginAttributes& aAttr);
|
||||
PopulateUserContextIdFromAttribute(mozilla::OriginAttributes& aAttr);
|
||||
|
||||
// Swap ourselves with the frameloader aOther, and notify chrome code with
|
||||
// a BrowserChangedProcess event.
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ using namespace mozilla;
|
|||
using namespace mozilla::dom;
|
||||
using namespace mozilla::dom::ipc;
|
||||
using mozilla::BasePrincipal;
|
||||
using mozilla::PrincipalOriginAttributes;
|
||||
using mozilla::OriginAttributes;
|
||||
using mozilla::TimeStamp;
|
||||
using mozilla::TimeDuration;
|
||||
using mozilla::dom::cache::CacheStorage;
|
||||
|
|
@ -2436,7 +2436,7 @@ nsGlobalWindow::ComputeIsSecureContext(nsIDocument* aDocument)
|
|||
// IsOriginPotentiallyTrustworthy doesn't care about origin attributes so
|
||||
// it doesn't actually matter what we use here, but reusing the document
|
||||
// principal's attributes is convenient.
|
||||
const PrincipalOriginAttributes& attrs = principal->OriginAttributesRef();
|
||||
const OriginAttributes& attrs = principal->OriginAttributesRef();
|
||||
// CreateCodebasePrincipal correctly gets a useful principal for blob: and
|
||||
// other URI_INHERITS_SECURITY_CONTEXT URIs.
|
||||
principal = BasePrincipal::CreateCodebasePrincipal(uri, attrs);
|
||||
|
|
@ -8486,7 +8486,7 @@ nsGlobalWindow::PostMessageMozOuter(JSContext* aCx, JS::Handle<JS::Value> aMessa
|
|||
return;
|
||||
}
|
||||
|
||||
PrincipalOriginAttributes attrs = aSubjectPrincipal.OriginAttributesRef();
|
||||
OriginAttributes attrs = aSubjectPrincipal.OriginAttributesRef();
|
||||
if (aSubjectPrincipal.GetIsSystemPrincipal()) {
|
||||
auto principal = BasePrincipal::Cast(GetPrincipal());
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
NS_IMPL_ISUPPORTS(nsOpenURIInFrameParams, nsIOpenURIInFrameParams)
|
||||
|
||||
nsOpenURIInFrameParams::nsOpenURIInFrameParams(const mozilla::DocShellOriginAttributes& aOriginAttributes)
|
||||
nsOpenURIInFrameParams::nsOpenURIInFrameParams(const mozilla::OriginAttributes& aOriginAttributes)
|
||||
: mOpenerOriginAttributes(aOriginAttributes)
|
||||
, mIsPrivate(false)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include "nsString.h"
|
||||
|
||||
namespace mozilla {
|
||||
class DocShellOriginAttributes;
|
||||
class OriginAttributes;
|
||||
}
|
||||
|
||||
class nsOpenURIInFrameParams final : public nsIOpenURIInFrameParams
|
||||
|
|
@ -18,12 +18,12 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOPENURIINFRAMEPARAMS
|
||||
|
||||
explicit nsOpenURIInFrameParams(const mozilla::DocShellOriginAttributes& aOriginAttributes);
|
||||
explicit nsOpenURIInFrameParams(const mozilla::OriginAttributes& aOriginAttributes);
|
||||
|
||||
private:
|
||||
~nsOpenURIInFrameParams();
|
||||
|
||||
mozilla::DocShellOriginAttributes mOpenerOriginAttributes;
|
||||
mozilla::OriginAttributes mOpenerOriginAttributes;
|
||||
nsString mReferrer;
|
||||
bool mIsPrivate;
|
||||
};
|
||||
|
|
|
|||
2
dom/cache/DBSchema.cpp
vendored
2
dom/cache/DBSchema.cpp
vendored
|
|
@ -1975,7 +1975,7 @@ ReadResponse(mozIStorageConnection* aConn, EntryId aEntryId,
|
|||
aSavedResponseOut->mValue.principalInfo() = void_t();
|
||||
if (!serializedInfo.IsEmpty()) {
|
||||
nsAutoCString originNoSuffix;
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (!attrs.PopulateFromOrigin(serializedInfo, originNoSuffix)) {
|
||||
NS_WARNING("Something went wrong parsing a serialized principal!");
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ public:
|
|||
}
|
||||
|
||||
void
|
||||
SetOriginAttributes(const PrincipalOriginAttributes& aOriginAttributes)
|
||||
SetOriginAttributes(const OriginAttributes& aOriginAttributes)
|
||||
{
|
||||
mOriginAttributes = aOriginAttributes;
|
||||
}
|
||||
|
|
@ -248,7 +248,7 @@ public:
|
|||
uint64_t mInnerIDNumber;
|
||||
nsString mInnerIDString;
|
||||
|
||||
PrincipalOriginAttributes mOriginAttributes;
|
||||
OriginAttributes mOriginAttributes;
|
||||
|
||||
nsString mMethodString;
|
||||
|
||||
|
|
@ -1201,7 +1201,7 @@ Console::MethodInternal(JSContext* aCx, MethodName aMethodName,
|
|||
return;
|
||||
}
|
||||
|
||||
PrincipalOriginAttributes oa;
|
||||
OriginAttributes oa;
|
||||
|
||||
if (mWindow) {
|
||||
// Save the principal's OriginAttributes in the console event data
|
||||
|
|
|
|||
|
|
@ -667,7 +667,7 @@ ContentChild::ProvideWindow(mozIDOMWindowProxy* aParent,
|
|||
static nsresult
|
||||
GetWindowParamsFromParent(mozIDOMWindowProxy* aParent,
|
||||
nsACString& aBaseURIString, float* aFullZoom,
|
||||
DocShellOriginAttributes& aOriginAttributes)
|
||||
OriginAttributes& aOriginAttributes)
|
||||
{
|
||||
*aFullZoom = 1.0f;
|
||||
auto* opener = nsPIDOMWindowOuter::From(aParent);
|
||||
|
|
@ -734,7 +734,7 @@ ContentChild::ProvideWindowCommon(TabChild* aTabOpener,
|
|||
if (NS_SUCCEEDED(rv) && !shouldLoad) {
|
||||
nsAutoCString baseURIString;
|
||||
float fullZoom;
|
||||
DocShellOriginAttributes originAttributes;
|
||||
OriginAttributes originAttributes;
|
||||
rv = GetWindowParamsFromParent(aParent, baseURIString, &fullZoom,
|
||||
originAttributes);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
|
|
@ -834,7 +834,7 @@ ContentChild::ProvideWindowCommon(TabChild* aTabOpener,
|
|||
} else {
|
||||
nsAutoCString baseURIString;
|
||||
float fullZoom;
|
||||
DocShellOriginAttributes originAttributes;
|
||||
OriginAttributes originAttributes;
|
||||
rv = GetWindowParamsFromParent(aParent, baseURIString, &fullZoom,
|
||||
originAttributes);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
|
|
@ -2324,7 +2324,7 @@ ContentChild::RecvAddPermission(const IPC::Permission& permission)
|
|||
// note we do not need to force mUserContextId to the default here because
|
||||
// the permission manager does that internally.
|
||||
nsAutoCString originNoSuffix;
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
bool success = attrs.PopulateFromOrigin(permission.origin, originNoSuffix);
|
||||
NS_ENSURE_TRUE(success, IPC_FAIL_NO_REASON(this));
|
||||
|
||||
|
|
|
|||
|
|
@ -4177,7 +4177,7 @@ ContentParent::CommonCreateWindow(PBrowserParent* aThisTab,
|
|||
nsIURI* aURIToLoad,
|
||||
const nsCString& aFeatures,
|
||||
const nsCString& aBaseURI,
|
||||
const DocShellOriginAttributes& aOpenerOriginAttributes,
|
||||
const OriginAttributes& aOpenerOriginAttributes,
|
||||
const float& aFullZoom,
|
||||
nsresult& aResult,
|
||||
nsCOMPtr<nsITabParent>& aNewTabParent,
|
||||
|
|
@ -4301,7 +4301,7 @@ ContentParent::RecvCreateWindow(PBrowserParent* aThisTab,
|
|||
const bool& aSizeSpecified,
|
||||
const nsCString& aFeatures,
|
||||
const nsCString& aBaseURI,
|
||||
const DocShellOriginAttributes& aOpenerOriginAttributes,
|
||||
const OriginAttributes& aOpenerOriginAttributes,
|
||||
const float& aFullZoom,
|
||||
nsresult* aResult,
|
||||
bool* aWindowIsNew,
|
||||
|
|
@ -4368,7 +4368,7 @@ ContentParent::RecvCreateWindowInDifferentProcess(
|
|||
const URIParams& aURIToLoad,
|
||||
const nsCString& aFeatures,
|
||||
const nsCString& aBaseURI,
|
||||
const DocShellOriginAttributes& aOpenerOriginAttributes,
|
||||
const OriginAttributes& aOpenerOriginAttributes,
|
||||
const float& aFullZoom)
|
||||
{
|
||||
nsCOMPtr<nsITabParent> newRemoteTab;
|
||||
|
|
|
|||
|
|
@ -500,7 +500,7 @@ public:
|
|||
const bool& aSizeSpecified,
|
||||
const nsCString& aFeatures,
|
||||
const nsCString& aBaseURI,
|
||||
const DocShellOriginAttributes& aOpenerOriginAttributes,
|
||||
const OriginAttributes& aOpenerOriginAttributes,
|
||||
const float& aFullZoom,
|
||||
nsresult* aResult,
|
||||
bool* aWindowIsNew,
|
||||
|
|
@ -518,7 +518,7 @@ public:
|
|||
const URIParams& aURIToLoad,
|
||||
const nsCString& aFeatures,
|
||||
const nsCString& aBaseURI,
|
||||
const DocShellOriginAttributes& aOpenerOriginAttributes,
|
||||
const OriginAttributes& aOpenerOriginAttributes,
|
||||
const float& aFullZoom) override;
|
||||
|
||||
static bool AllocateLayerTreeId(TabParent* aTabParent, uint64_t* aId);
|
||||
|
|
@ -613,7 +613,7 @@ private:
|
|||
nsIURI* aURIToLoad,
|
||||
const nsCString& aFeatures,
|
||||
const nsCString& aBaseURI,
|
||||
const DocShellOriginAttributes& aOpenerOriginAttributes,
|
||||
const OriginAttributes& aOpenerOriginAttributes,
|
||||
const float& aFullZoom,
|
||||
nsresult& aResult,
|
||||
nsCOMPtr<nsITabParent>& aNewTabParent,
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ using struct LookAndFeelInt from "mozilla/widget/WidgetMessageUtils.h";
|
|||
using class mozilla::dom::MessagePort from "mozilla/dom/MessagePort.h";
|
||||
using class mozilla::dom::ipc::StructuredCloneData from "mozilla/dom/ipc/StructuredCloneData.h";
|
||||
using mozilla::DataStorageType from "ipc/DataStorageIPCUtils.h";
|
||||
using mozilla::DocShellOriginAttributes from "mozilla/ipc/BackgroundUtils.h";
|
||||
using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
|
||||
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
|
||||
using struct mozilla::dom::FlyWebPublishOptions from "mozilla/dom/FlyWebPublishOptionsIPCSerializer.h";
|
||||
using mozilla::Telemetry::Accumulation from "mozilla/TelemetryComms.h";
|
||||
|
|
@ -1066,7 +1066,7 @@ parent:
|
|||
bool aSizeSpecified,
|
||||
nsCString aFeatures,
|
||||
nsCString aBaseURI,
|
||||
DocShellOriginAttributes aOpenerOriginAttributes,
|
||||
OriginAttributes aOpenerOriginAttributes,
|
||||
float aFullZoom)
|
||||
returns (nsresult rv,
|
||||
bool windowOpened,
|
||||
|
|
@ -1084,7 +1084,7 @@ parent:
|
|||
URIParams aURIToLoad,
|
||||
nsCString aFeatures,
|
||||
nsCString aBaseURI,
|
||||
DocShellOriginAttributes aOpenerOriginAttributes,
|
||||
OriginAttributes aOpenerOriginAttributes,
|
||||
float aFullZoom);
|
||||
|
||||
sync GetDeviceStorageLocation(nsString type)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ include protocol PBrowser;
|
|||
include PBrowserOrId;
|
||||
|
||||
using UIStateChangeType from "nsPIDOMWindow.h";
|
||||
using mozilla::DocShellOriginAttributes from "mozilla/ipc/BackgroundUtils.h";
|
||||
using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
@ -37,7 +37,7 @@ struct PopupIPCTabContext
|
|||
struct FrameIPCTabContext
|
||||
{
|
||||
// The originAttributes dictionary.
|
||||
DocShellOriginAttributes originAttributes;
|
||||
OriginAttributes originAttributes;
|
||||
|
||||
// Whether this is a mozbrowser frame. <iframe mozbrowser mozapp> and
|
||||
// <xul:browser> are not considered to be mozbrowser frames.
|
||||
|
|
|
|||
|
|
@ -1200,7 +1200,7 @@ TabChild::ApplyShowInfo(const ShowInfo& aInfo)
|
|||
NS_LITERAL_CSTRING("mozprivatebrowsing"),
|
||||
nullptr);
|
||||
} else {
|
||||
DocShellOriginAttributes attrs(nsDocShell::Cast(docShell)->GetOriginAttributes());
|
||||
OriginAttributes attrs(nsDocShell::Cast(docShell)->GetOriginAttributes());
|
||||
attrs.SyncAttributesWithPrivateBrowsing(true);
|
||||
nsDocShell::Cast(docShell)->SetOriginAttributes(attrs);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ TabContext::UpdateTabContextAfterSwap(const TabContext& aContext)
|
|||
return true;
|
||||
}
|
||||
|
||||
const DocShellOriginAttributes&
|
||||
const OriginAttributes&
|
||||
TabContext::OriginAttributesRef() const
|
||||
{
|
||||
return mOriginAttributes;
|
||||
|
|
@ -109,7 +109,7 @@ TabContext::SetTabContext(bool aIsMozBrowserElement,
|
|||
bool aIsPrerendered,
|
||||
UIStateChangeType aShowAccelerators,
|
||||
UIStateChangeType aShowFocusRings,
|
||||
const DocShellOriginAttributes& aOriginAttributes,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsAString& aPresentationURL)
|
||||
{
|
||||
NS_ENSURE_FALSE(mInitialized, false);
|
||||
|
|
@ -143,7 +143,7 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
|
|||
{
|
||||
bool isMozBrowserElement = false;
|
||||
bool isPrerendered = false;
|
||||
DocShellOriginAttributes originAttributes;
|
||||
OriginAttributes originAttributes;
|
||||
nsAutoString presentationURL;
|
||||
UIStateChangeType showAccelerators = UIStateChangeType_NoChange;
|
||||
UIStateChangeType showFocusRings = UIStateChangeType_NoChange;
|
||||
|
|
|
|||
|
|
@ -64,11 +64,11 @@ public:
|
|||
bool IsMozBrowser() const;
|
||||
|
||||
/**
|
||||
* OriginAttributesRef() returns the DocShellOriginAttributes of this frame to
|
||||
* OriginAttributesRef() returns the OriginAttributes of this frame to
|
||||
* the caller. This is used to store any attribute associated with the frame's
|
||||
* docshell.
|
||||
*/
|
||||
const DocShellOriginAttributes& OriginAttributesRef() const;
|
||||
const OriginAttributes& OriginAttributesRef() const;
|
||||
|
||||
/**
|
||||
* Returns the presentation URL associated with the tab if this tab is
|
||||
|
|
@ -105,7 +105,7 @@ protected:
|
|||
bool aIsPrerendered,
|
||||
UIStateChangeType aShowAccelerators,
|
||||
UIStateChangeType aShowFocusRings,
|
||||
const DocShellOriginAttributes& aOriginAttributes,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsAString& aPresentationURL);
|
||||
|
||||
/**
|
||||
|
|
@ -139,9 +139,9 @@ private:
|
|||
bool mIsMozBrowserElement;
|
||||
|
||||
/**
|
||||
* DocShellOriginAttributes of the top level tab docShell
|
||||
* OriginAttributes of the top level tab docShell
|
||||
*/
|
||||
DocShellOriginAttributes mOriginAttributes;
|
||||
OriginAttributes mOriginAttributes;
|
||||
|
||||
/**
|
||||
* The requested presentation URL.
|
||||
|
|
@ -173,7 +173,7 @@ public:
|
|||
bool aIsPrerendered,
|
||||
UIStateChangeType aShowAccelerators,
|
||||
UIStateChangeType aShowFocusRings,
|
||||
const DocShellOriginAttributes& aOriginAttributes,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsAString& aPresentationURL = EmptyString())
|
||||
{
|
||||
return TabContext::SetTabContext(aIsMozBrowserElement,
|
||||
|
|
|
|||
|
|
@ -1590,7 +1590,7 @@ MatchOrigin(nsIFile* aPath,
|
|||
nsresult rv;
|
||||
nsCString str;
|
||||
nsCString originNoSuffix;
|
||||
mozilla::PrincipalOriginAttributes originAttributes;
|
||||
mozilla::OriginAttributes originAttributes;
|
||||
|
||||
rv = ReadFromFile(aPath, NS_LITERAL_CSTRING("origin"), str, MaxDomainLength);
|
||||
if (!originAttributes.PopulateFromOrigin(str, originNoSuffix)) {
|
||||
|
|
@ -1603,7 +1603,7 @@ MatchOrigin(nsIFile* aPath,
|
|||
return true;
|
||||
}
|
||||
|
||||
mozilla::PrincipalOriginAttributes topLevelOriginAttributes;
|
||||
mozilla::OriginAttributes topLevelOriginAttributes;
|
||||
rv = ReadFromFile(aPath, NS_LITERAL_CSTRING("topLevelOrigin"), str, MaxDomainLength);
|
||||
if (!topLevelOriginAttributes.PopulateFromOrigin(str, originNoSuffix)) {
|
||||
// Fails on paring the originAttributes, treat this as a non-match.
|
||||
|
|
|
|||
|
|
@ -470,7 +470,7 @@ GetNodeId(const nsAString& aOrigin,
|
|||
UniquePtr<GetNodeIdCallback> callback(new TestGetNodeIdCallback(nodeId,
|
||||
result));
|
||||
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
attrs.mPrivateBrowsingId = aInPBMode ? 1 : 0;
|
||||
|
||||
nsAutoCString suffix;
|
||||
|
|
|
|||
|
|
@ -640,7 +640,7 @@ static nsresult
|
|||
GetPrincipalFromOrigin(const nsACString& aOrigin, nsIPrincipal** aPrincipal)
|
||||
{
|
||||
nsAutoCString originNoSuffix;
|
||||
mozilla::PrincipalOriginAttributes attrs;
|
||||
mozilla::OriginAttributes attrs;
|
||||
if (!attrs.PopulateFromOrigin(aOrigin, originNoSuffix)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -814,7 +814,7 @@ nsDOMOfflineResourceList::CacheKeys()
|
|||
|
||||
nsAutoCString originSuffix;
|
||||
if (loadContext) {
|
||||
mozilla::DocShellOriginAttributes oa;
|
||||
mozilla::OriginAttributes oa;
|
||||
bool ok = loadContext->GetOriginAttributes(oa);
|
||||
NS_ENSURE_TRUE(ok, NS_ERROR_UNEXPECTED);
|
||||
|
||||
|
|
|
|||
|
|
@ -561,7 +561,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL,
|
|||
// bypass ContentPolicy checks which should still be enforced.
|
||||
nsCOMPtr<nsIPrincipal> triggeringPrincipal;
|
||||
if (!aDoCheckLoadURIChecks) {
|
||||
mozilla::PrincipalOriginAttributes attrs =
|
||||
mozilla::OriginAttributes attrs =
|
||||
BasePrincipal::Cast(content->NodePrincipal())->OriginAttributesRef();
|
||||
triggeringPrincipal = BasePrincipal::CreateCodebasePrincipal(uri, attrs);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -532,7 +532,7 @@ PresentationRequest::IsPrioriAuthenticatedURL(const nsAString& aUrl)
|
|||
return true;
|
||||
}
|
||||
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
nsCOMPtr<nsIPrincipal> principal =
|
||||
BasePrincipal::CreateCodebasePrincipal(uri, attrs);
|
||||
if (NS_WARN_IF(!principal)) {
|
||||
|
|
|
|||
|
|
@ -1362,7 +1362,7 @@ struct StorageDirectoryHelper::OriginProps
|
|||
|
||||
nsCOMPtr<nsIFile> mDirectory;
|
||||
nsCString mSpec;
|
||||
PrincipalOriginAttributes mAttrs;
|
||||
OriginAttributes mAttrs;
|
||||
int64_t mTimestamp;
|
||||
nsCString mSuffix;
|
||||
nsCString mGroup;
|
||||
|
|
@ -1415,7 +1415,7 @@ class MOZ_STACK_CLASS OriginParser final
|
|||
};
|
||||
|
||||
const nsCString mOrigin;
|
||||
const PrincipalOriginAttributes mOriginAttributes;
|
||||
const OriginAttributes mOriginAttributes;
|
||||
Tokenizer mTokenizer;
|
||||
|
||||
uint32_t mAppId;
|
||||
|
|
@ -1433,7 +1433,7 @@ class MOZ_STACK_CLASS OriginParser final
|
|||
|
||||
public:
|
||||
OriginParser(const nsACString& aOrigin,
|
||||
const PrincipalOriginAttributes& aOriginAttributes)
|
||||
const OriginAttributes& aOriginAttributes)
|
||||
: mOrigin(aOrigin)
|
||||
, mOriginAttributes(aOriginAttributes)
|
||||
, mTokenizer(aOrigin, '+')
|
||||
|
|
@ -1449,10 +1449,10 @@ public:
|
|||
static bool
|
||||
ParseOrigin(const nsACString& aOrigin,
|
||||
nsCString& aSpec,
|
||||
PrincipalOriginAttributes* aAttrs);
|
||||
OriginAttributes* aAttrs);
|
||||
|
||||
bool
|
||||
Parse(nsACString& aSpec, PrincipalOriginAttributes* aAttrs);
|
||||
Parse(nsACString& aSpec, OriginAttributes* aAttrs);
|
||||
|
||||
private:
|
||||
void
|
||||
|
|
@ -1875,7 +1875,7 @@ CreateDirectoryMetadata(nsIFile* aDirectory, int64_t aTimestamp,
|
|||
{
|
||||
AssertIsOnIOThread();
|
||||
|
||||
PrincipalOriginAttributes groupAttributes;
|
||||
OriginAttributes groupAttributes;
|
||||
|
||||
nsCString groupNoSuffix;
|
||||
bool ok = groupAttributes.PopulateFromOrigin(aGroup, groupNoSuffix);
|
||||
|
|
@ -1890,7 +1890,7 @@ CreateDirectoryMetadata(nsIFile* aDirectory, int64_t aTimestamp,
|
|||
|
||||
nsCString group = groupPrefix + groupNoSuffix;
|
||||
|
||||
PrincipalOriginAttributes originAttributes;
|
||||
OriginAttributes originAttributes;
|
||||
|
||||
nsCString originNoSuffix;
|
||||
ok = originAttributes.PopulateFromOrigin(aOrigin, originNoSuffix);
|
||||
|
|
@ -4567,7 +4567,7 @@ QuotaManager::EnsureOriginIsInitialized(PersistenceType aPersistenceType,
|
|||
|
||||
if (!leafName.EqualsLiteral(kChromeOrigin)) {
|
||||
nsCString spec;
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
bool result = OriginParser::ParseOrigin(NS_ConvertUTF16toUTF8(leafName),
|
||||
spec, &attrs);
|
||||
if (NS_WARN_IF(!result)) {
|
||||
|
|
@ -6547,7 +6547,7 @@ StorageDirectoryHelper::AddOriginDirectory(nsIFile* aDirectory,
|
|||
originProps->mType = OriginProps::eChrome;
|
||||
} else {
|
||||
nsCString spec;
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
bool result = OriginParser::ParseOrigin(NS_ConvertUTF16toUTF8(leafName),
|
||||
spec, &attrs);
|
||||
if (NS_WARN_IF(!result)) {
|
||||
|
|
@ -6685,12 +6685,12 @@ StorageDirectoryHelper::Run()
|
|||
bool
|
||||
OriginParser::ParseOrigin(const nsACString& aOrigin,
|
||||
nsCString& aSpec,
|
||||
PrincipalOriginAttributes* aAttrs)
|
||||
OriginAttributes* aAttrs)
|
||||
{
|
||||
MOZ_ASSERT(!aOrigin.IsEmpty());
|
||||
MOZ_ASSERT(aAttrs);
|
||||
|
||||
PrincipalOriginAttributes originAttributes;
|
||||
OriginAttributes originAttributes;
|
||||
|
||||
nsCString originNoSuffix;
|
||||
bool ok = originAttributes.PopulateFromOrigin(aOrigin, originNoSuffix);
|
||||
|
|
@ -6703,7 +6703,7 @@ OriginParser::ParseOrigin(const nsACString& aOrigin,
|
|||
}
|
||||
|
||||
bool
|
||||
OriginParser::Parse(nsACString& aSpec, PrincipalOriginAttributes* aAttrs)
|
||||
OriginParser::Parse(nsACString& aSpec, OriginAttributes* aAttrs)
|
||||
{
|
||||
MOZ_ASSERT(aAttrs);
|
||||
|
||||
|
|
@ -6742,7 +6742,7 @@ OriginParser::Parse(nsACString& aSpec, PrincipalOriginAttributes* aAttrs)
|
|||
} else {
|
||||
MOZ_ASSERT(mOriginAttributes.mAppId == kNoAppId);
|
||||
|
||||
*aAttrs = PrincipalOriginAttributes(mAppId, mInIsolatedMozBrowser);
|
||||
*aAttrs = OriginAttributes(mAppId, mInIsolatedMozBrowser);
|
||||
}
|
||||
|
||||
nsAutoCString spec(mSchema);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ private:
|
|||
struct OriginAndAttributes
|
||||
{
|
||||
nsCString mOrigin;
|
||||
PrincipalOriginAttributes mAttributes;
|
||||
OriginAttributes mAttributes;
|
||||
|
||||
OriginAndAttributes(const OriginAndAttributes& aOther)
|
||||
: mOrigin(aOther.mOrigin)
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ Scheme0Scope(StorageCacheBridge* aCache)
|
|||
|
||||
nsCString suffix = aCache->OriginSuffix();
|
||||
|
||||
PrincipalOriginAttributes oa;
|
||||
OriginAttributes oa;
|
||||
if (!suffix.IsEmpty()) {
|
||||
DebugOnly<bool> success = oa.PopulateFromSuffix(suffix);
|
||||
MOZ_ASSERT(success);
|
||||
|
|
@ -768,7 +768,7 @@ OriginAttrsPatternMatchSQLFunction::OnFunctionCall(
|
|||
rv = aFunctionArguments->GetUTF8String(0, suffix);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PrincipalOriginAttributes oa;
|
||||
OriginAttributes oa;
|
||||
bool success = oa.PopulateFromSuffix(suffix);
|
||||
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
|
||||
bool result = mPattern.Matches(oa);
|
||||
|
|
@ -1208,7 +1208,7 @@ namespace {
|
|||
bool OriginPatternMatches(const nsACString& aOriginSuffix,
|
||||
const OriginAttributesPattern& aPattern)
|
||||
{
|
||||
PrincipalOriginAttributes oa;
|
||||
OriginAttributes oa;
|
||||
DebugOnly<bool> rv = oa.PopulateFromSuffix(aOriginSuffix);
|
||||
MOZ_ASSERT(rv);
|
||||
return aPattern.Matches(oa);
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ public:
|
|||
}
|
||||
}
|
||||
} else {
|
||||
PrincipalOriginAttributes attrs(appId, inIsolatedMozBrowser);
|
||||
OriginAttributes attrs(appId, inIsolatedMozBrowser);
|
||||
attrs.CreateSuffix(suffix);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ StorageManagerBase::ClearCaches(uint32_t aUnloadFlags,
|
|||
const nsACString& aOriginScope)
|
||||
{
|
||||
for (auto iter1 = mCaches.Iter(); !iter1.Done(); iter1.Next()) {
|
||||
PrincipalOriginAttributes oa;
|
||||
OriginAttributes oa;
|
||||
DebugOnly<bool> rv = oa.PopulateFromSuffix(iter1.Key());
|
||||
MOZ_ASSERT(rv);
|
||||
if (!aPattern.Matches(oa)) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ include protocol PBackground;
|
|||
include PBackgroundSharedTypes;
|
||||
include ServiceWorkerRegistrarTypes;
|
||||
|
||||
using mozilla::PrincipalOriginAttributes from "mozilla/ipc/BackgroundUtils.h";
|
||||
using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
@ -21,7 +21,7 @@ parent:
|
|||
|
||||
async Unregister(PrincipalInfo principalInfo, nsString scope);
|
||||
|
||||
async PropagateSoftUpdate(PrincipalOriginAttributes originAttributes,
|
||||
async PropagateSoftUpdate(OriginAttributes originAttributes,
|
||||
nsString scope);
|
||||
async PropagateUnregister(PrincipalInfo principalInfo, nsString scope);
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ parent:
|
|||
|
||||
child:
|
||||
async NotifyRegister(ServiceWorkerRegistrationData data);
|
||||
async NotifySoftUpdate(PrincipalOriginAttributes originAttributes, nsString scope);
|
||||
async NotifySoftUpdate(OriginAttributes originAttributes, nsString scope);
|
||||
async NotifyUnregister(PrincipalInfo principalInfo, nsString scope);
|
||||
async NotifyRemove(nsCString host);
|
||||
async NotifyRemoveAll();
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ GetWorkerPref(const nsACString& aPref,
|
|||
void
|
||||
GenerateSharedWorkerKey(const nsACString& aScriptSpec,
|
||||
const nsACString& aName,
|
||||
const PrincipalOriginAttributes& aAttrs,
|
||||
const OriginAttributes& aAttrs,
|
||||
nsCString& aKey)
|
||||
{
|
||||
nsAutoCString suffix;
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ private:
|
|||
nsTArray<RefPtr<CacheScriptLoader>> mLoaders;
|
||||
|
||||
nsString mCacheName;
|
||||
PrincipalOriginAttributes mOriginAttributes;
|
||||
OriginAttributes mOriginAttributes;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS0(CacheCreator)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ private:
|
|||
const nsString mCacheName;
|
||||
const nsLoadFlags mLoadFlags;
|
||||
ServiceWorkerState mState;
|
||||
PrincipalOriginAttributes mOriginAttributes;
|
||||
OriginAttributes mOriginAttributes;
|
||||
|
||||
// This id is shared with WorkerPrivate to match requests issued by service
|
||||
// workers to their corresponding serviceWorkerInfo.
|
||||
|
|
@ -113,7 +113,7 @@ public:
|
|||
return mState;
|
||||
}
|
||||
|
||||
const PrincipalOriginAttributes&
|
||||
const OriginAttributes&
|
||||
GetOriginAttributes() const
|
||||
{
|
||||
return mOriginAttributes;
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ namespace {
|
|||
class PropagateSoftUpdateRunnable final : public Runnable
|
||||
{
|
||||
public:
|
||||
PropagateSoftUpdateRunnable(const PrincipalOriginAttributes& aOriginAttributes,
|
||||
PropagateSoftUpdateRunnable(const OriginAttributes& aOriginAttributes,
|
||||
const nsAString& aScope)
|
||||
: mOriginAttributes(aOriginAttributes)
|
||||
, mScope(aScope)
|
||||
|
|
@ -342,7 +342,7 @@ private:
|
|||
~PropagateSoftUpdateRunnable()
|
||||
{}
|
||||
|
||||
const PrincipalOriginAttributes mOriginAttributes;
|
||||
const OriginAttributes mOriginAttributes;
|
||||
const nsString mScope;
|
||||
};
|
||||
|
||||
|
|
@ -928,7 +928,7 @@ ServiceWorkerManager::SendPushEvent(const nsACString& aOriginAttributes,
|
|||
const nsAString& aMessageId,
|
||||
const Maybe<nsTArray<uint8_t>>& aData)
|
||||
{
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (!attrs.PopulateFromSuffix(aOriginAttributes)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
|
@ -950,7 +950,7 @@ NS_IMETHODIMP
|
|||
ServiceWorkerManager::SendPushSubscriptionChangeEvent(const nsACString& aOriginAttributes,
|
||||
const nsACString& aScope)
|
||||
{
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (!attrs.PopulateFromSuffix(aOriginAttributes)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
|
@ -976,7 +976,7 @@ ServiceWorkerManager::SendNotificationEvent(const nsAString& aEventName,
|
|||
const nsAString& aData,
|
||||
const nsAString& aBehavior)
|
||||
{
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (!attrs.PopulateFromSuffix(aOriginSuffix)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
|
@ -1136,7 +1136,7 @@ ServiceWorkerManager::CheckReadyPromise(nsPIDOMWindowInner* aWindow,
|
|||
}
|
||||
|
||||
ServiceWorkerInfo*
|
||||
ServiceWorkerManager::GetActiveWorkerInfoForScope(const PrincipalOriginAttributes& aOriginAttributes,
|
||||
ServiceWorkerManager::GetActiveWorkerInfoForScope(const OriginAttributes& aOriginAttributes,
|
||||
const nsACString& aScope)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
|
@ -2339,7 +2339,7 @@ public:
|
|||
} // anonymous namespace
|
||||
|
||||
void
|
||||
ServiceWorkerManager::DispatchFetchEvent(const PrincipalOriginAttributes& aOriginAttributes,
|
||||
ServiceWorkerManager::DispatchFetchEvent(const OriginAttributes& aOriginAttributes,
|
||||
nsIDocument* aDoc,
|
||||
const nsAString& aDocumentIdForTopLevelNavigation,
|
||||
nsIInterceptedChannel* aChannel,
|
||||
|
|
@ -2613,7 +2613,7 @@ ServiceWorkerManager::NotifyServiceWorkerRegistrationRemoved(ServiceWorkerRegist
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerManager::SoftUpdate(const PrincipalOriginAttributes& aOriginAttributes,
|
||||
ServiceWorkerManager::SoftUpdate(const OriginAttributes& aOriginAttributes,
|
||||
const nsACString& aScope)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
|
@ -3594,7 +3594,7 @@ ServiceWorkerManager::PropagateSoftUpdate(JS::Handle<JS::Value> aOriginAttribute
|
|||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (!aOriginAttributes.isObject() || !attrs.Init(aCx, aOriginAttributes)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
|
@ -3604,7 +3604,7 @@ ServiceWorkerManager::PropagateSoftUpdate(JS::Handle<JS::Value> aOriginAttribute
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerManager::PropagateSoftUpdate(const PrincipalOriginAttributes& aOriginAttributes,
|
||||
ServiceWorkerManager::PropagateSoftUpdate(const OriginAttributes& aOriginAttributes,
|
||||
const nsAString& aScope)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
|
@ -3920,7 +3920,7 @@ ServiceWorkerManager::UpdateTimerFired(nsIPrincipal* aPrincipal,
|
|||
return;
|
||||
}
|
||||
|
||||
PrincipalOriginAttributes attrs = aPrincipal->OriginAttributesRef();
|
||||
OriginAttributes attrs = aPrincipal->OriginAttributesRef();
|
||||
|
||||
SoftUpdate(attrs, aScope);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class nsIConsoleReportCollector;
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
class PrincipalOriginAttributes;
|
||||
class OriginAttributes;
|
||||
|
||||
namespace dom {
|
||||
|
||||
|
|
@ -150,7 +150,7 @@ public:
|
|||
nsIPrincipal* aPrincipal);
|
||||
|
||||
void
|
||||
DispatchFetchEvent(const PrincipalOriginAttributes& aOriginAttributes,
|
||||
DispatchFetchEvent(const OriginAttributes& aOriginAttributes,
|
||||
nsIDocument* aDoc,
|
||||
const nsAString& aDocumentIdForTopLevelNavigation,
|
||||
nsIInterceptedChannel* aChannel,
|
||||
|
|
@ -164,11 +164,11 @@ public:
|
|||
ServiceWorkerUpdateFinishCallback* aCallback);
|
||||
|
||||
void
|
||||
SoftUpdate(const PrincipalOriginAttributes& aOriginAttributes,
|
||||
SoftUpdate(const OriginAttributes& aOriginAttributes,
|
||||
const nsACString& aScope);
|
||||
|
||||
void
|
||||
PropagateSoftUpdate(const PrincipalOriginAttributes& aOriginAttributes,
|
||||
PropagateSoftUpdate(const OriginAttributes& aOriginAttributes,
|
||||
const nsAString& aScope);
|
||||
|
||||
void
|
||||
|
|
@ -358,7 +358,7 @@ private:
|
|||
nsISupports** aServiceWorker);
|
||||
|
||||
ServiceWorkerInfo*
|
||||
GetActiveWorkerInfoForScope(const PrincipalOriginAttributes& aOriginAttributes,
|
||||
GetActiveWorkerInfoForScope(const OriginAttributes& aOriginAttributes,
|
||||
const nsACString& aScope);
|
||||
|
||||
ServiceWorkerInfo*
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ ServiceWorkerManagerChild::RecvNotifyRegister(
|
|||
|
||||
mozilla::ipc::IPCResult
|
||||
ServiceWorkerManagerChild::RecvNotifySoftUpdate(
|
||||
const PrincipalOriginAttributes& aOriginAttributes,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsString& aScope)
|
||||
{
|
||||
if (mShuttingDown) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
class PrincipalOriginAttributes;
|
||||
class OriginAttributes;
|
||||
|
||||
namespace ipc {
|
||||
class BackgroundChildImpl;
|
||||
|
|
@ -36,7 +36,7 @@ public:
|
|||
virtual mozilla::ipc::IPCResult RecvNotifyRegister(const ServiceWorkerRegistrationData& aData)
|
||||
override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvNotifySoftUpdate(const PrincipalOriginAttributes& aOriginAttributes,
|
||||
virtual mozilla::ipc::IPCResult RecvNotifySoftUpdate(const OriginAttributes& aOriginAttributes,
|
||||
const nsString& aScope) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvNotifyUnregister(const PrincipalInfo& aPrincipalInfo,
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ ServiceWorkerManagerParent::RecvUnregister(const PrincipalInfo& aPrincipalInfo,
|
|||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
ServiceWorkerManagerParent::RecvPropagateSoftUpdate(const PrincipalOriginAttributes& aOriginAttributes,
|
||||
ServiceWorkerManagerParent::RecvPropagateSoftUpdate(const OriginAttributes& aOriginAttributes,
|
||||
const nsString& aScope)
|
||||
{
|
||||
AssertIsOnBackgroundThread();
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
class PrincipalOriginAttributes;
|
||||
class OriginAttributes;
|
||||
|
||||
namespace ipc {
|
||||
class BackgroundParentImpl;
|
||||
|
|
@ -44,7 +44,7 @@ private:
|
|||
virtual mozilla::ipc::IPCResult RecvUnregister(const PrincipalInfo& aPrincipalInfo,
|
||||
const nsString& aScope) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvPropagateSoftUpdate(const PrincipalOriginAttributes& aOriginAttributes,
|
||||
virtual mozilla::ipc::IPCResult RecvPropagateSoftUpdate(const OriginAttributes& aOriginAttributes,
|
||||
const nsString& aScope) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvPropagateUnregister(const PrincipalInfo& aPrincipalInfo,
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ ServiceWorkerManagerService::PropagateRegistration(
|
|||
void
|
||||
ServiceWorkerManagerService::PropagateSoftUpdate(
|
||||
uint64_t aParentID,
|
||||
const PrincipalOriginAttributes& aOriginAttributes,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsAString& aScope)
|
||||
{
|
||||
AssertIsOnBackgroundThread();
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
class PrincipalOriginAttributes;
|
||||
class OriginAttributes;
|
||||
|
||||
namespace ipc {
|
||||
class PrincipalInfo;
|
||||
|
|
@ -42,7 +42,7 @@ public:
|
|||
ServiceWorkerRegistrationData& aData);
|
||||
|
||||
void PropagateSoftUpdate(uint64_t aParentID,
|
||||
const PrincipalOriginAttributes& aOriginAttributes,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsAString& aScope);
|
||||
|
||||
void PropagateUnregister(uint64_t aParentID,
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ ServiceWorkerRegistrar::ReadData()
|
|||
nsAutoCString suffix;
|
||||
GET_LINE(suffix);
|
||||
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (!attrs.PopulateFromSuffix(suffix)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
|
@ -382,7 +382,7 @@ ServiceWorkerRegistrar::ReadData()
|
|||
nsAutoCString suffix;
|
||||
GET_LINE(suffix);
|
||||
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (!attrs.PopulateFromSuffix(suffix)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
|
@ -415,7 +415,7 @@ ServiceWorkerRegistrar::ReadData()
|
|||
nsAutoCString suffix;
|
||||
GET_LINE(suffix);
|
||||
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (!attrs.PopulateFromSuffix(suffix)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
|
@ -442,7 +442,7 @@ ServiceWorkerRegistrar::ReadData()
|
|||
nsAutoCString suffix;
|
||||
GET_LINE(suffix);
|
||||
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (!attrs.PopulateFromSuffix(suffix)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
|
@ -472,7 +472,7 @@ ServiceWorkerRegistrar::ReadData()
|
|||
nsAutoCString suffix;
|
||||
GET_LINE(suffix);
|
||||
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (!attrs.PopulateFromSuffix(suffix)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4463,7 +4463,7 @@ WorkerPrivate::GetLoadInfo(JSContext* aCx, nsPIDOMWindowInner* aWindow,
|
|||
loadInfo.mFromWindow = false;
|
||||
loadInfo.mWindowID = UINT64_MAX;
|
||||
loadInfo.mStorageAllowed = true;
|
||||
loadInfo.mOriginAttributes = PrincipalOriginAttributes();
|
||||
loadInfo.mOriginAttributes = OriginAttributes();
|
||||
}
|
||||
|
||||
MOZ_ASSERT(loadInfo.mPrincipal);
|
||||
|
|
|
|||
|
|
@ -789,7 +789,7 @@ public:
|
|||
return mLoadInfo.mStorageAllowed;
|
||||
}
|
||||
|
||||
const PrincipalOriginAttributes&
|
||||
const OriginAttributes&
|
||||
GetOriginAttributes() const
|
||||
{
|
||||
return mLoadInfo.mOriginAttributes;
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ struct WorkerLoadInfo
|
|||
bool mPrincipalIsSystem;
|
||||
bool mStorageAllowed;
|
||||
bool mServiceWorkersTestingInWindow;
|
||||
PrincipalOriginAttributes mOriginAttributes;
|
||||
OriginAttributes mOriginAttributes;
|
||||
|
||||
WorkerLoadInfo();
|
||||
~WorkerLoadInfo();
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ TEST(ServiceWorkerRegistrar, TestWriteData)
|
|||
nsAutoCString spec;
|
||||
spec.AppendPrintf("spec write %d", i);
|
||||
reg.principal() =
|
||||
mozilla::ipc::ContentPrincipalInfo(mozilla::PrincipalOriginAttributes(i, i % 2), spec);
|
||||
mozilla::ipc::ContentPrincipalInfo(mozilla::OriginAttributes(i, i % 2), spec);
|
||||
|
||||
swr->TestRegisterServiceWorker(reg);
|
||||
}
|
||||
|
|
@ -262,7 +262,7 @@ TEST(ServiceWorkerRegistrar, TestWriteData)
|
|||
ASSERT_EQ(data[i].principal().type(), mozilla::ipc::PrincipalInfo::TContentPrincipalInfo);
|
||||
const mozilla::ipc::ContentPrincipalInfo& cInfo = data[i].principal();
|
||||
|
||||
mozilla::PrincipalOriginAttributes attrs(i, i % 2);
|
||||
mozilla::OriginAttributes attrs(i, i % 2);
|
||||
nsAutoCString suffix, expectSuffix;
|
||||
attrs.CreateSuffix(expectSuffix);
|
||||
cInfo.attrs().CreateSuffix(suffix);
|
||||
|
|
@ -593,7 +593,7 @@ TEST(ServiceWorkerRegistrar, TestDedupeWrite)
|
|||
nsAutoCString spec;
|
||||
spec.AppendPrintf("spec write dedupe/%d", i);
|
||||
reg.principal() =
|
||||
mozilla::ipc::ContentPrincipalInfo(mozilla::PrincipalOriginAttributes(0, false), spec);
|
||||
mozilla::ipc::ContentPrincipalInfo(mozilla::OriginAttributes(0, false), spec);
|
||||
|
||||
swr->TestRegisterServiceWorker(reg);
|
||||
}
|
||||
|
|
@ -614,7 +614,7 @@ TEST(ServiceWorkerRegistrar, TestDedupeWrite)
|
|||
ASSERT_EQ(data[0].principal().type(), mozilla::ipc::PrincipalInfo::TContentPrincipalInfo);
|
||||
const mozilla::ipc::ContentPrincipalInfo& cInfo = data[0].principal();
|
||||
|
||||
mozilla::PrincipalOriginAttributes attrs(0, false);
|
||||
mozilla::OriginAttributes attrs(0, false);
|
||||
nsAutoCString suffix, expectSuffix;
|
||||
attrs.CreateSuffix(expectSuffix);
|
||||
cInfo.attrs().CreateSuffix(suffix);
|
||||
|
|
|
|||
|
|
@ -1613,13 +1613,11 @@ XMLHttpRequestMainThread::SetOriginAttributes(const OriginAttributesDictionary&
|
|||
{
|
||||
MOZ_ASSERT((mState == State::opened) && !mFlagSend);
|
||||
|
||||
GenericOriginAttributes attrs(aAttrs);
|
||||
NeckoOriginAttributes neckoAttrs;
|
||||
neckoAttrs.SetFromGenericAttributes(attrs);
|
||||
OriginAttributes attrs(aAttrs);
|
||||
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = mChannel->GetLoadInfo();
|
||||
MOZ_ASSERT(loadInfo);
|
||||
loadInfo->SetOriginAttributes(neckoAttrs);
|
||||
loadInfo->SetOriginAttributes(attrs);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -414,7 +414,7 @@ txCompileObserver::loadURI(const nsAString& aUri,
|
|||
rv = NS_NewURI(getter_AddRefs(referrerUri), aReferrerUri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
nsCOMPtr<nsIPrincipal> referrerPrincipal =
|
||||
BasePrincipal::CreateCodebasePrincipal(referrerUri, attrs);
|
||||
NS_ENSURE_TRUE(referrerPrincipal, NS_ERROR_FAILURE);
|
||||
|
|
@ -619,7 +619,7 @@ txSyncCompileObserver::loadURI(const nsAString& aUri,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> referrerPrincipal =
|
||||
BasePrincipal::CreateCodebasePrincipal(referrerUri, PrincipalOriginAttributes());
|
||||
BasePrincipal::CreateCodebasePrincipal(referrerUri, OriginAttributes());
|
||||
NS_ENSURE_TRUE(referrerPrincipal, NS_ERROR_FAILURE);
|
||||
|
||||
// This is probably called by js, a loadGroup for the channel doesn't
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ interface nsIWeakReference;
|
|||
|
||||
%{C++
|
||||
namespace mozilla {
|
||||
class DocShellOriginAttributes;
|
||||
class OriginAttributes;
|
||||
}
|
||||
%}
|
||||
|
||||
[ref] native const_OriginAttributesRef(const mozilla::DocShellOriginAttributes);
|
||||
[ref] native const_OriginAttributesRef(const mozilla::OriginAttributes);
|
||||
|
||||
/**
|
||||
* The nsIWebBrowser interface is implemented by web browser objects.
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ nsWebBrowser::SetIsActive(bool aIsActive)
|
|||
}
|
||||
|
||||
void
|
||||
nsWebBrowser::SetOriginAttributes(const DocShellOriginAttributes& aAttrs)
|
||||
nsWebBrowser::SetOriginAttributes(const OriginAttributes& aAttrs)
|
||||
{
|
||||
mOriginAttributes = aAttrs;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ protected:
|
|||
nsCOMPtr<nsIWebNavigation> mDocShellAsNav;
|
||||
nsCOMPtr<nsIScrollable> mDocShellAsScrollable;
|
||||
nsCOMPtr<nsITextScroll> mDocShellAsTextScroll;
|
||||
mozilla::DocShellOriginAttributes mOriginAttributes;
|
||||
mozilla::OriginAttributes mOriginAttributes;
|
||||
|
||||
nsCOMPtr<nsIWidget> mInternalWidget;
|
||||
nsCOMPtr<nsIWindowWatcher> mWWatch;
|
||||
|
|
|
|||
|
|
@ -1103,8 +1103,8 @@ nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy* aParent,
|
|||
if (subjectPrincipal &&
|
||||
!nsContentUtils::IsSystemOrExpandedPrincipal(subjectPrincipal) &&
|
||||
docShell->ItemType() != nsIDocShellTreeItem::typeChrome) {
|
||||
DocShellOriginAttributes attrs;
|
||||
attrs.InheritFromDocToChildDocShell(subjectPrincipal->OriginAttributesRef());
|
||||
OriginAttributes attrs;
|
||||
attrs.Inherit(subjectPrincipal->OriginAttributesRef());
|
||||
isPrivateBrowsingWindow = !!attrs.mPrivateBrowsingId;
|
||||
docShell->SetOriginAttributes(attrs);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -110,8 +110,8 @@ nsPermission::Matches(nsIPrincipal* aPrincipal, bool aExactHost, bool* aMatches)
|
|||
}
|
||||
|
||||
// Compare their OriginAttributes
|
||||
const mozilla::PrincipalOriginAttributes& theirAttrs = principal->OriginAttributesRef();
|
||||
const mozilla::PrincipalOriginAttributes& ourAttrs = mPrincipal->OriginAttributesRef();
|
||||
const mozilla::OriginAttributes& theirAttrs = principal->OriginAttributesRef();
|
||||
const mozilla::OriginAttributes& ourAttrs = mPrincipal->OriginAttributesRef();
|
||||
|
||||
if (theirAttrs != ourAttrs) {
|
||||
return NS_OK;
|
||||
|
|
@ -193,7 +193,7 @@ nsPermission::MatchesURI(nsIURI* aURI, bool aExactHost, bool* aMatches)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
|
||||
mozilla::PrincipalOriginAttributes attrs;
|
||||
mozilla::OriginAttributes attrs;
|
||||
nsCOMPtr<nsIPrincipal> principal = mozilla::BasePrincipal::CreateCodebasePrincipal(aURI, attrs);
|
||||
NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE);
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ GetOriginFromPrincipal(nsIPrincipal* aPrincipal, nsACString& aOrigin)
|
|||
rv = aPrincipal->GetOriginSuffix(suffix);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mozilla::PrincipalOriginAttributes attrs;
|
||||
mozilla::OriginAttributes attrs;
|
||||
if (!attrs.PopulateFromSuffix(suffix)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
@ -121,7 +121,8 @@ GetOriginFromPrincipal(nsIPrincipal* aPrincipal, nsACString& aOrigin)
|
|||
attrs.mPrivateBrowsingId = 0;
|
||||
|
||||
// Disable userContext and firstParty isolation for permissions.
|
||||
attrs.StripUserContextIdAndFirstPartyDomain();
|
||||
attrs.StripAttributes(mozilla::OriginAttributes::STRIP_USER_CONTEXT_ID |
|
||||
mozilla::OriginAttributes::STRIP_FIRST_PARTY_DOMAIN);
|
||||
|
||||
attrs.CreateSuffix(suffix);
|
||||
aOrigin.Append(suffix);
|
||||
|
|
@ -132,13 +133,14 @@ nsresult
|
|||
GetPrincipalFromOrigin(const nsACString& aOrigin, nsIPrincipal** aPrincipal)
|
||||
{
|
||||
nsAutoCString originNoSuffix;
|
||||
mozilla::PrincipalOriginAttributes attrs;
|
||||
mozilla::OriginAttributes attrs;
|
||||
if (!attrs.PopulateFromOrigin(aOrigin, originNoSuffix)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Disable userContext and firstParty isolation for permissions.
|
||||
attrs.StripUserContextIdAndFirstPartyDomain();
|
||||
attrs.StripAttributes(mozilla::OriginAttributes::STRIP_USER_CONTEXT_ID |
|
||||
mozilla::OriginAttributes::STRIP_FIRST_PARTY_DOMAIN);
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), originNoSuffix);
|
||||
|
|
@ -152,7 +154,7 @@ GetPrincipalFromOrigin(const nsACString& aOrigin, nsIPrincipal** aPrincipal)
|
|||
nsresult
|
||||
GetPrincipal(nsIURI* aURI, uint32_t aAppId, bool aIsInIsolatedMozBrowserElement, nsIPrincipal** aPrincipal)
|
||||
{
|
||||
mozilla::PrincipalOriginAttributes attrs(aAppId, aIsInIsolatedMozBrowserElement);
|
||||
mozilla::OriginAttributes attrs(aAppId, aIsInIsolatedMozBrowserElement);
|
||||
nsCOMPtr<nsIPrincipal> principal = mozilla::BasePrincipal::CreateCodebasePrincipal(aURI, attrs);
|
||||
NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE);
|
||||
|
||||
|
|
@ -163,7 +165,7 @@ GetPrincipal(nsIURI* aURI, uint32_t aAppId, bool aIsInIsolatedMozBrowserElement,
|
|||
nsresult
|
||||
GetPrincipal(nsIURI* aURI, nsIPrincipal** aPrincipal)
|
||||
{
|
||||
mozilla::PrincipalOriginAttributes attrs;
|
||||
mozilla::OriginAttributes attrs;
|
||||
nsCOMPtr<nsIPrincipal> principal = mozilla::BasePrincipal::CreateCodebasePrincipal(aURI, attrs);
|
||||
NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE);
|
||||
|
||||
|
|
@ -2208,10 +2210,11 @@ nsPermissionManager::GetPermissionHashKey(nsIPrincipal* aPrincipal,
|
|||
}
|
||||
|
||||
// Copy the attributes over
|
||||
mozilla::PrincipalOriginAttributes attrs = aPrincipal->OriginAttributesRef();
|
||||
mozilla::OriginAttributes attrs = aPrincipal->OriginAttributesRef();
|
||||
|
||||
// Disable userContext and firstParty isolation for permissions.
|
||||
attrs.StripUserContextIdAndFirstPartyDomain();
|
||||
attrs.StripAttributes(mozilla::OriginAttributes::STRIP_USER_CONTEXT_ID |
|
||||
mozilla::OriginAttributes::STRIP_FIRST_PARTY_DOMAIN);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal =
|
||||
mozilla::BasePrincipal::CreateCodebasePrincipal(newURI, attrs);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ BlobSerial(ImageURL* aURI)
|
|||
}
|
||||
|
||||
ImageCacheKey::ImageCacheKey(nsIURI* aURI,
|
||||
const PrincipalOriginAttributes& aAttrs,
|
||||
const OriginAttributes& aAttrs,
|
||||
nsIDocument* aDocument,
|
||||
nsresult& aRv)
|
||||
: mURI(new ImageURL(aURI, aRv))
|
||||
|
|
@ -66,7 +66,7 @@ ImageCacheKey::ImageCacheKey(nsIURI* aURI,
|
|||
}
|
||||
|
||||
ImageCacheKey::ImageCacheKey(ImageURL* aURI,
|
||||
const PrincipalOriginAttributes& aAttrs,
|
||||
const OriginAttributes& aAttrs,
|
||||
nsIDocument* aDocument)
|
||||
: mURI(aURI)
|
||||
, mOriginAttributes(aAttrs)
|
||||
|
|
@ -131,7 +131,7 @@ ImageCacheKey::Spec() const
|
|||
/* static */ uint32_t
|
||||
ImageCacheKey::ComputeHash(ImageURL* aURI,
|
||||
const Maybe<uint64_t>& aBlobSerial,
|
||||
const PrincipalOriginAttributes& aAttrs,
|
||||
const OriginAttributes& aAttrs,
|
||||
void* aControlledDocument)
|
||||
{
|
||||
// Since we frequently call Hash() several times in a row on the same
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ class ImageURL;
|
|||
class ImageCacheKey final
|
||||
{
|
||||
public:
|
||||
ImageCacheKey(nsIURI* aURI, const PrincipalOriginAttributes& aAttrs,
|
||||
ImageCacheKey(nsIURI* aURI, const OriginAttributes& aAttrs,
|
||||
nsIDocument* aDocument, nsresult& aRv);
|
||||
ImageCacheKey(ImageURL* aURI, const PrincipalOriginAttributes& aAttrs,
|
||||
ImageCacheKey(ImageURL* aURI, const OriginAttributes& aAttrs,
|
||||
nsIDocument* aDocument);
|
||||
|
||||
ImageCacheKey(const ImageCacheKey& aOther);
|
||||
|
|
@ -57,13 +57,13 @@ public:
|
|||
private:
|
||||
static uint32_t ComputeHash(ImageURL* aURI,
|
||||
const Maybe<uint64_t>& aBlobSerial,
|
||||
const PrincipalOriginAttributes& aAttrs,
|
||||
const OriginAttributes& aAttrs,
|
||||
void* aControlledDocument);
|
||||
static void* GetControlledDocumentToken(nsIDocument* aDocument);
|
||||
|
||||
RefPtr<ImageURL> mURI;
|
||||
Maybe<uint64_t> mBlobSerial;
|
||||
PrincipalOriginAttributes mOriginAttributes;
|
||||
OriginAttributes mOriginAttributes;
|
||||
void* mControlledDocument;
|
||||
uint32_t mHash;
|
||||
bool mIsChrome;
|
||||
|
|
|
|||
|
|
@ -752,11 +752,11 @@ NewImageChannel(nsIChannel** aResult,
|
|||
// If this is a favicon loading, we will use the originAttributes from the
|
||||
// loadingPrincipal as the channel's originAttributes. This allows the favicon
|
||||
// loading from XUL will use the correct originAttributes.
|
||||
NeckoOriginAttributes neckoAttrs;
|
||||
neckoAttrs.InheritFromDocToNecko(aLoadingPrincipal->OriginAttributesRef());
|
||||
OriginAttributes attrs;
|
||||
attrs.Inherit(aLoadingPrincipal->OriginAttributesRef());
|
||||
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = (*aResult)->GetLoadInfo();
|
||||
rv = loadInfo->SetOriginAttributes(neckoAttrs);
|
||||
rv = loadInfo->SetOriginAttributes(attrs);
|
||||
}
|
||||
} else {
|
||||
// either we are loading something inside a document, in which case
|
||||
|
|
@ -781,14 +781,14 @@ NewImageChannel(nsIChannel** aResult,
|
|||
// Use the OriginAttributes from the loading principal, if one is available,
|
||||
// and adjust the private browsing ID based on what kind of load the caller
|
||||
// has asked us to perform.
|
||||
NeckoOriginAttributes neckoAttrs;
|
||||
OriginAttributes attrs;
|
||||
if (aLoadingPrincipal) {
|
||||
neckoAttrs.InheritFromDocToNecko(aLoadingPrincipal->OriginAttributesRef());
|
||||
attrs.Inherit(aLoadingPrincipal->OriginAttributesRef());
|
||||
}
|
||||
neckoAttrs.mPrivateBrowsingId = aRespectPrivacy ? 1 : 0;
|
||||
attrs.mPrivateBrowsingId = aRespectPrivacy ? 1 : 0;
|
||||
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = (*aResult)->GetLoadInfo();
|
||||
rv = loadInfo->SetOriginAttributes(neckoAttrs);
|
||||
rv = loadInfo->SetOriginAttributes(attrs);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
|
|
@ -1348,7 +1348,7 @@ imgLoader::FindEntryProperties(nsIURI* uri,
|
|||
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDOMDoc);
|
||||
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIPrincipal> principal = doc->NodePrincipal();
|
||||
if (principal) {
|
||||
|
|
@ -2111,7 +2111,7 @@ imgLoader::LoadImage(nsIURI* aURI,
|
|||
// XXX For now ignore aCacheKey. We will need it in the future
|
||||
// for correctly dealing with image load requests that are a result
|
||||
// of post data.
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (aLoadingPrincipal) {
|
||||
attrs = aLoadingPrincipal->OriginAttributesRef();
|
||||
}
|
||||
|
|
@ -2323,9 +2323,9 @@ imgLoader::LoadImageWithChannel(nsIChannel* channel,
|
|||
NS_ENSURE_TRUE(channel, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = channel->GetLoadInfo();
|
||||
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (loadInfo) {
|
||||
attrs.InheritFromNecko(loadInfo->GetOriginAttributes());
|
||||
attrs.Inherit(loadInfo->GetOriginAttributes());
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ PrincipalInfoToPrincipal(const PrincipalInfo& aPrincipalInfo,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (info.attrs().mAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID) {
|
||||
attrs = info.attrs();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,20 +41,8 @@ struct OriginAttributesParamTraits
|
|||
} // namespace detail
|
||||
|
||||
template<>
|
||||
struct ParamTraits<mozilla::PrincipalOriginAttributes>
|
||||
: public detail::OriginAttributesParamTraits<mozilla::PrincipalOriginAttributes> {};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<mozilla::DocShellOriginAttributes>
|
||||
: public detail::OriginAttributesParamTraits<mozilla::DocShellOriginAttributes> {};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<mozilla::NeckoOriginAttributes>
|
||||
: public detail::OriginAttributesParamTraits<mozilla::NeckoOriginAttributes> {};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<mozilla::GenericOriginAttributes>
|
||||
: public detail::OriginAttributesParamTraits<mozilla::GenericOriginAttributes> {};
|
||||
struct ParamTraits<mozilla::OriginAttributes>
|
||||
: public detail::OriginAttributesParamTraits<mozilla::OriginAttributes> {};
|
||||
|
||||
} // namespace IPC
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
using mozilla::PrincipalOriginAttributes from "mozilla/ipc/BackgroundUtils.h";
|
||||
using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
|
||||
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
|
||||
|
||||
namespace mozilla {
|
||||
|
|
@ -10,7 +10,7 @@ namespace ipc {
|
|||
|
||||
struct ContentPrincipalInfo
|
||||
{
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
nsCString spec;
|
||||
};
|
||||
|
||||
|
|
@ -19,13 +19,13 @@ struct SystemPrincipalInfo
|
|||
|
||||
struct NullPrincipalInfo
|
||||
{
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
nsCString spec;
|
||||
};
|
||||
|
||||
struct ExpandedPrincipalInfo
|
||||
{
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
PrincipalInfo[] whitelist;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1247,7 +1247,7 @@ nsXPCComponents_utils_Sandbox::Construct(nsIXPConnectWrappedNative* wrapper, JSC
|
|||
* we use the related Codebase Principal for the sandbox.
|
||||
*/
|
||||
bool
|
||||
ParsePrincipal(JSContext* cx, HandleString codebase, const PrincipalOriginAttributes& aAttrs,
|
||||
ParsePrincipal(JSContext* cx, HandleString codebase, const OriginAttributes& aAttrs,
|
||||
nsIPrincipal** principal)
|
||||
{
|
||||
MOZ_ASSERT(principal);
|
||||
|
|
@ -1331,7 +1331,7 @@ GetExpandedPrincipal(JSContext* cx, HandleObject arrayObj,
|
|||
// strings, then we will use a default OriginAttribute.
|
||||
// Otherwise, we will use the origin attributes of the passed object(s). If
|
||||
// more than one object is specified, we ensure that the OAs match.
|
||||
Maybe<PrincipalOriginAttributes> attrs;
|
||||
Maybe<OriginAttributes> attrs;
|
||||
if (options.originAttributes) {
|
||||
attrs.emplace();
|
||||
JS::RootedValue val(cx, JS::ObjectValue(*options.originAttributes));
|
||||
|
|
@ -1376,7 +1376,7 @@ GetExpandedPrincipal(JSContext* cx, HandleObject arrayObj,
|
|||
NS_ENSURE_TRUE(principal, false);
|
||||
|
||||
if (!options.originAttributes) {
|
||||
const PrincipalOriginAttributes prinAttrs =
|
||||
const OriginAttributes prinAttrs =
|
||||
principal->OriginAttributesRef();
|
||||
if (attrs.isNothing()) {
|
||||
attrs.emplace(prinAttrs);
|
||||
|
|
@ -1751,7 +1751,7 @@ nsXPCComponents_utils_Sandbox::CallOrConstruct(nsIXPConnectWrappedNative* wrappe
|
|||
|
||||
if (args[0].isString()) {
|
||||
RootedString str(cx, args[0].toString());
|
||||
PrincipalOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (options.originAttributes) {
|
||||
JS::RootedValue val(cx, JS::ObjectValue(*options.originAttributes));
|
||||
if (!attrs.Init(cx, val)) {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ namespace net {
|
|||
|
||||
NS_IMPL_ISUPPORTS(LoadContextInfo, nsILoadContextInfo)
|
||||
|
||||
LoadContextInfo::LoadContextInfo(bool aIsAnonymous, NeckoOriginAttributes aOriginAttributes)
|
||||
LoadContextInfo::LoadContextInfo(bool aIsAnonymous,
|
||||
OriginAttributes aOriginAttributes)
|
||||
: mIsAnonymous(aIsAnonymous)
|
||||
, mOriginAttributes(aOriginAttributes)
|
||||
{
|
||||
|
|
@ -40,7 +41,7 @@ NS_IMETHODIMP LoadContextInfo::GetIsAnonymous(bool *aIsAnonymous)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NeckoOriginAttributes const* LoadContextInfo::OriginAttributesPtr()
|
||||
OriginAttributes const* LoadContextInfo::OriginAttributesPtr()
|
||||
{
|
||||
return &mOriginAttributes;
|
||||
}
|
||||
|
|
@ -60,14 +61,15 @@ NS_IMPL_ISUPPORTS(LoadContextInfoFactory, nsILoadContextInfoFactory)
|
|||
|
||||
NS_IMETHODIMP LoadContextInfoFactory::GetDefault(nsILoadContextInfo * *aDefault)
|
||||
{
|
||||
nsCOMPtr<nsILoadContextInfo> info = GetLoadContextInfo(false, NeckoOriginAttributes());
|
||||
nsCOMPtr<nsILoadContextInfo> info =
|
||||
GetLoadContextInfo(false, OriginAttributes());
|
||||
info.forget(aDefault);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP LoadContextInfoFactory::GetPrivate(nsILoadContextInfo * *aPrivate)
|
||||
{
|
||||
NeckoOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
attrs.SyncAttributesWithPrivateBrowsing(true);
|
||||
nsCOMPtr<nsILoadContextInfo> info = GetLoadContextInfo(false, attrs);
|
||||
info.forget(aPrivate);
|
||||
|
|
@ -76,7 +78,8 @@ NS_IMETHODIMP LoadContextInfoFactory::GetPrivate(nsILoadContextInfo * *aPrivate)
|
|||
|
||||
NS_IMETHODIMP LoadContextInfoFactory::GetAnonymous(nsILoadContextInfo * *aAnonymous)
|
||||
{
|
||||
nsCOMPtr<nsILoadContextInfo> info = GetLoadContextInfo(true, NeckoOriginAttributes());
|
||||
nsCOMPtr<nsILoadContextInfo> info =
|
||||
GetLoadContextInfo(true, OriginAttributes());
|
||||
info.forget(aAnonymous);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
@ -85,7 +88,7 @@ NS_IMETHODIMP LoadContextInfoFactory::Custom(bool aAnonymous,
|
|||
JS::HandleValue aOriginAttributes, JSContext *cx,
|
||||
nsILoadContextInfo * *_retval)
|
||||
{
|
||||
NeckoOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
bool status = attrs.Init(cx, aOriginAttributes);
|
||||
NS_ENSURE_TRUE(status, NS_ERROR_FAILURE);
|
||||
|
||||
|
|
@ -126,7 +129,7 @@ GetLoadContextInfo(nsIChannel * aChannel)
|
|||
anon = !!(loadFlags & nsIChannel::LOAD_ANONYMOUS);
|
||||
}
|
||||
|
||||
NeckoOriginAttributes oa;
|
||||
OriginAttributes oa;
|
||||
NS_GetOriginAttributes(aChannel, oa);
|
||||
MOZ_ASSERT(pb == (oa.mPrivateBrowsingId > 0));
|
||||
|
||||
|
|
@ -137,18 +140,16 @@ LoadContextInfo *
|
|||
GetLoadContextInfo(nsILoadContext *aLoadContext, bool aIsAnonymous)
|
||||
{
|
||||
if (!aLoadContext) {
|
||||
return new LoadContextInfo(aIsAnonymous, NeckoOriginAttributes(false));
|
||||
return new LoadContextInfo(aIsAnonymous, OriginAttributes());
|
||||
}
|
||||
|
||||
DebugOnly<bool> pb = aLoadContext->UsePrivateBrowsing();
|
||||
DocShellOriginAttributes doa;
|
||||
aLoadContext->GetOriginAttributes(doa);
|
||||
MOZ_ASSERT(pb == (doa.mPrivateBrowsingId > 0));
|
||||
OriginAttributes oa;
|
||||
aLoadContext->GetOriginAttributes(oa);
|
||||
oa.StripAttributes(OriginAttributes::STRIP_ADDON_ID);
|
||||
|
||||
NeckoOriginAttributes noa;
|
||||
noa.InheritFromDocShellToNecko(doa);
|
||||
|
||||
return new LoadContextInfo(aIsAnonymous, noa);
|
||||
MOZ_ASSERT(pb == (oa.mPrivateBrowsingId > 0));
|
||||
return new LoadContextInfo(aIsAnonymous, oa);
|
||||
}
|
||||
|
||||
LoadContextInfo*
|
||||
|
|
@ -170,10 +171,9 @@ GetLoadContextInfo(nsILoadContextInfo *aInfo)
|
|||
|
||||
LoadContextInfo *
|
||||
GetLoadContextInfo(bool const aIsAnonymous,
|
||||
NeckoOriginAttributes const &aOriginAttributes)
|
||||
OriginAttributes const &aOriginAttributes)
|
||||
{
|
||||
return new LoadContextInfo(aIsAnonymous,
|
||||
aOriginAttributes);
|
||||
return new LoadContextInfo(aIsAnonymous, aOriginAttributes);
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
|
|
|
|||
|
|
@ -19,14 +19,14 @@ public:
|
|||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSILOADCONTEXTINFO
|
||||
|
||||
LoadContextInfo(bool aIsAnonymous, NeckoOriginAttributes aOriginAttributes);
|
||||
LoadContextInfo(bool aIsAnonymous, OriginAttributes aOriginAttributes);
|
||||
|
||||
private:
|
||||
virtual ~LoadContextInfo();
|
||||
|
||||
protected:
|
||||
bool mIsAnonymous : 1;
|
||||
NeckoOriginAttributes mOriginAttributes;
|
||||
OriginAttributes mOriginAttributes;
|
||||
};
|
||||
|
||||
class LoadContextInfoFactory : public nsILoadContextInfoFactory
|
||||
|
|
@ -53,7 +53,7 @@ GetLoadContextInfo(nsILoadContextInfo *aInfo);
|
|||
|
||||
LoadContextInfo*
|
||||
GetLoadContextInfo(bool const aIsAnonymous,
|
||||
NeckoOriginAttributes const &aOriginAttributes);
|
||||
OriginAttributes const &aOriginAttributes);
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
|
|
|||
|
|
@ -29,11 +29,10 @@ namespace mozilla {
|
|||
namespace net {
|
||||
|
||||
static void
|
||||
InheritOriginAttributes(nsIPrincipal* aLoadingPrincipal, NeckoOriginAttributes& aAttrs)
|
||||
InheritOriginAttributes(nsIPrincipal* aLoadingPrincipal,
|
||||
OriginAttributes& aAttrs)
|
||||
{
|
||||
const PrincipalOriginAttributes attrs =
|
||||
aLoadingPrincipal->OriginAttributesRef();
|
||||
aAttrs.InheritFromDocToNecko(attrs);
|
||||
aAttrs.Inherit(aLoadingPrincipal->OriginAttributesRef());
|
||||
}
|
||||
|
||||
LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
||||
|
|
@ -262,7 +261,7 @@ LoadInfo::LoadInfo(nsPIDOMWindowOuter* aOuterWindow,
|
|||
// get the docshell from the outerwindow, and then get the originattributes
|
||||
nsCOMPtr<nsIDocShell> docShell = aOuterWindow->GetDocShell();
|
||||
MOZ_ASSERT(docShell);
|
||||
const DocShellOriginAttributes attrs =
|
||||
const OriginAttributes attrs =
|
||||
nsDocShell::Cast(docShell)->GetOriginAttributes();
|
||||
|
||||
if (docShell->ItemType() == nsIDocShellTreeItem::typeChrome) {
|
||||
|
|
@ -270,7 +269,7 @@ LoadInfo::LoadInfo(nsPIDOMWindowOuter* aOuterWindow,
|
|||
"chrome docshell shouldn't have mPrivateBrowsingId set.");
|
||||
}
|
||||
|
||||
mOriginAttributes.InheritFromDocShellToNecko(attrs);
|
||||
mOriginAttributes.Inherit(attrs);
|
||||
}
|
||||
|
||||
LoadInfo::LoadInfo(const LoadInfo& rhs)
|
||||
|
|
@ -321,7 +320,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
|||
bool aEnforceSecurity,
|
||||
bool aInitialSecurityCheckDone,
|
||||
bool aIsThirdPartyContext,
|
||||
const NeckoOriginAttributes& aOriginAttributes,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
nsTArray<nsCOMPtr<nsIPrincipal>>& aRedirectChainIncludingInternalRedirects,
|
||||
nsTArray<nsCOMPtr<nsIPrincipal>>& aRedirectChain,
|
||||
const nsTArray<nsCString>& aCorsUnsafeHeaders,
|
||||
|
|
@ -699,9 +698,9 @@ LoadInfo::ResetPrincipalsToNullPrincipal()
|
|||
{
|
||||
// take the originAttributes from the LoadInfo and create
|
||||
// a new NullPrincipal using those origin attributes.
|
||||
PrincipalOriginAttributes pAttrs;
|
||||
pAttrs.InheritFromNecko(mOriginAttributes);
|
||||
nsCOMPtr<nsIPrincipal> newNullPrincipal = nsNullPrincipal::Create(pAttrs);
|
||||
OriginAttributes attrs;
|
||||
attrs.Inherit(mOriginAttributes);
|
||||
nsCOMPtr<nsIPrincipal> newNullPrincipal = nsNullPrincipal::Create(attrs);
|
||||
|
||||
MOZ_ASSERT(mInternalContentPolicyType != nsIContentPolicy::TYPE_DOCUMENT ||
|
||||
!mLoadingPrincipal,
|
||||
|
|
@ -726,7 +725,7 @@ NS_IMETHODIMP
|
|||
LoadInfo::SetScriptableOriginAttributes(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aOriginAttributes)
|
||||
{
|
||||
NeckoOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (!aOriginAttributes.isObject() || !attrs.Init(aCx, aOriginAttributes)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
|
@ -736,7 +735,7 @@ LoadInfo::SetScriptableOriginAttributes(JSContext* aCx,
|
|||
}
|
||||
|
||||
nsresult
|
||||
LoadInfo::GetOriginAttributes(mozilla::NeckoOriginAttributes* aOriginAttributes)
|
||||
LoadInfo::GetOriginAttributes(mozilla::OriginAttributes* aOriginAttributes)
|
||||
{
|
||||
NS_ENSURE_ARG(aOriginAttributes);
|
||||
*aOriginAttributes = mOriginAttributes;
|
||||
|
|
@ -744,7 +743,7 @@ LoadInfo::GetOriginAttributes(mozilla::NeckoOriginAttributes* aOriginAttributes)
|
|||
}
|
||||
|
||||
nsresult
|
||||
LoadInfo::SetOriginAttributes(const mozilla::NeckoOriginAttributes& aOriginAttributes)
|
||||
LoadInfo::SetOriginAttributes(const mozilla::OriginAttributes& aOriginAttributes)
|
||||
{
|
||||
mOriginAttributes = aOriginAttributes;
|
||||
return NS_OK;
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ private:
|
|||
bool aEnforceSecurity,
|
||||
bool aInitialSecurityCheckDone,
|
||||
bool aIsThirdPartyRequest,
|
||||
const NeckoOriginAttributes& aOriginAttributes,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
nsTArray<nsCOMPtr<nsIPrincipal>>& aRedirectChainIncludingInternalRedirects,
|
||||
nsTArray<nsCOMPtr<nsIPrincipal>>& aRedirectChain,
|
||||
const nsTArray<nsCString>& aUnsafeHeaders,
|
||||
|
|
@ -145,7 +145,7 @@ private:
|
|||
bool mEnforceSecurity;
|
||||
bool mInitialSecurityCheckDone;
|
||||
bool mIsThirdPartyContext;
|
||||
NeckoOriginAttributes mOriginAttributes;
|
||||
OriginAttributes mOriginAttributes;
|
||||
nsTArray<nsCOMPtr<nsIPrincipal>> mRedirectChainIncludingInternalRedirects;
|
||||
nsTArray<nsCOMPtr<nsIPrincipal>> mRedirectChain;
|
||||
nsTArray<nsCString> mCorsUnsafeHeaders;
|
||||
|
|
|
|||
|
|
@ -593,7 +593,7 @@ Predictor::Init()
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
RefPtr<LoadContextInfo> lci =
|
||||
new LoadContextInfo(false, NeckoOriginAttributes());
|
||||
new LoadContextInfo(false, OriginAttributes());
|
||||
|
||||
rv = cacheStorageService->DiskCacheStorage(lci, false,
|
||||
getter_AddRefs(mCacheDiskStorage));
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public:
|
|||
nsCOMPtr<nsILoadInfo> loadInfo;
|
||||
Unused << channel->GetLoadInfo(getter_AddRefs(loadInfo));
|
||||
if (loadInfo) {
|
||||
NeckoOriginAttributes attrs = loadInfo->GetOriginAttributes();
|
||||
OriginAttributes attrs = loadInfo->GetOriginAttributes();
|
||||
mPrivateBrowsing = attrs.mPrivateBrowsingId > 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
%{ C++
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
%}
|
||||
native OriginAttributesNativePtr(const mozilla::NeckoOriginAttributes*);
|
||||
native OriginAttributesNativePtr(const mozilla::OriginAttributes*);
|
||||
|
||||
interface nsILoadContext;
|
||||
interface nsIDOMWindow;
|
||||
|
|
@ -37,7 +37,7 @@ interface nsILoadContextInfo : nsISupports
|
|||
readonly attribute boolean isAnonymous;
|
||||
|
||||
/**
|
||||
* NeckoOriginAttributes hiding all the security context attributes
|
||||
* OriginAttributes hiding all the security context attributes
|
||||
*/
|
||||
[implicit_jscontext]
|
||||
readonly attribute jsval originAttributes;
|
||||
|
|
@ -71,7 +71,7 @@ interface nsILoadContextInfo : nsISupports
|
|||
};
|
||||
|
||||
/**
|
||||
* Since NeckoOriginAttributes struct limits the implementation of
|
||||
* Since OriginAttributes struct limits the implementation of
|
||||
* nsILoadContextInfo (that needs to be thread safe) to C++,
|
||||
* we need a scriptable factory to create instances of that
|
||||
* interface from JS.
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ class nsCString;
|
|||
%}
|
||||
|
||||
[ref] native const_nsIPrincipalArray(const nsTArray<nsCOMPtr<nsIPrincipal>>);
|
||||
native NeckoOriginAttributes(mozilla::NeckoOriginAttributes);
|
||||
[ref] native const_OriginAttributesRef(const mozilla::NeckoOriginAttributes);
|
||||
native OriginAttributes(mozilla::OriginAttributes);
|
||||
[ref] native const_OriginAttributesRef(const mozilla::OriginAttributes);
|
||||
[ref] native StringArrayRef(const nsTArray<nsCString>);
|
||||
|
||||
typedef unsigned long nsSecurityFlags;
|
||||
|
|
@ -534,7 +534,7 @@ interface nsILoadInfo : nsISupports
|
|||
void resetPrincipalsToNullPrincipal();
|
||||
|
||||
/**
|
||||
* Customized NeckoOriginAttributes within LoadInfo to allow overwriting of the
|
||||
* Customized OriginAttributes within LoadInfo to allow overwriting of the
|
||||
* default originAttributes from the loadingPrincipal.
|
||||
*
|
||||
* In chrome side, originAttributes.privateBrowsingId will always be 0 even if
|
||||
|
|
@ -546,15 +546,15 @@ interface nsILoadInfo : nsISupports
|
|||
attribute jsval originAttributes;
|
||||
|
||||
[noscript, nostdcall, binaryname(GetOriginAttributes)]
|
||||
NeckoOriginAttributes binaryGetOriginAttributes();
|
||||
OriginAttributes binaryGetOriginAttributes();
|
||||
|
||||
[noscript, nostdcall, binaryname(SetOriginAttributes)]
|
||||
void binarySetOriginAttributes(in const_OriginAttributesRef aOriginAttrs);
|
||||
|
||||
%{ C++
|
||||
inline mozilla::NeckoOriginAttributes GetOriginAttributes()
|
||||
inline mozilla::OriginAttributes GetOriginAttributes()
|
||||
{
|
||||
mozilla::NeckoOriginAttributes result;
|
||||
mozilla::OriginAttributes result;
|
||||
mozilla::DebugOnly<nsresult> rv = GetOriginAttributes(&result);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ union NetAddr;
|
|||
%}
|
||||
native NetAddr(mozilla::net::NetAddr);
|
||||
[ptr] native NetAddrPtr(mozilla::net::NetAddr);
|
||||
native NeckoOriginAttributes(mozilla::NeckoOriginAttributes);
|
||||
[ref] native const_OriginAttributesRef(const mozilla::NeckoOriginAttributes);
|
||||
native OriginAttributes(mozilla::OriginAttributes);
|
||||
[ref] native const_OriginAttributesRef(const mozilla::OriginAttributes);
|
||||
|
||||
/**
|
||||
* nsISocketTransport
|
||||
|
|
@ -58,7 +58,7 @@ interface nsISocketTransport : nsITransport
|
|||
attribute jsval originAttributes;
|
||||
|
||||
[noscript, nostdcall, binaryname(GetOriginAttributes)]
|
||||
NeckoOriginAttributes binaryGetOriginAttributes();
|
||||
OriginAttributes binaryGetOriginAttributes();
|
||||
|
||||
[noscript, nostdcall, binaryname(SetOriginAttributes)]
|
||||
void binarySetOriginAttributes(in const_OriginAttributesRef aOriginAttrs);
|
||||
|
|
|
|||
|
|
@ -1249,7 +1249,7 @@ NS_UsePrivateBrowsing(nsIChannel *channel)
|
|||
|
||||
bool
|
||||
NS_GetOriginAttributes(nsIChannel *aChannel,
|
||||
mozilla::NeckoOriginAttributes &aAttributes)
|
||||
mozilla::OriginAttributes &aAttributes)
|
||||
{
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
|
||||
if (!loadInfo) {
|
||||
|
|
@ -2346,7 +2346,7 @@ NS_CompareLoadInfoAndLoadContext(nsIChannel *aChannel)
|
|||
}
|
||||
|
||||
OriginAttributes originAttrsLoadInfo = loadInfo->GetOriginAttributes();
|
||||
DocShellOriginAttributes originAttrsLoadContext;
|
||||
OriginAttributes originAttrsLoadContext;
|
||||
loadContext->GetOriginAttributes(originAttrsLoadContext);
|
||||
|
||||
LOG(("NS_CompareLoadInfoAndLoadContext - loadInfo: %d, %d, %d; "
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class nsIIncrementalStreamLoaderObserver;
|
|||
class nsIUnicharStreamLoader;
|
||||
class nsIUnicharStreamLoaderObserver;
|
||||
|
||||
namespace mozilla { class NeckoOriginAttributes; }
|
||||
namespace mozilla { class OriginAttributes; }
|
||||
|
||||
template <class> class nsCOMPtr;
|
||||
template <typename> struct already_AddRefed;
|
||||
|
|
@ -657,10 +657,10 @@ NS_QueryNotificationCallbacks(nsIInterfaceRequestor *callbacks,
|
|||
bool NS_UsePrivateBrowsing(nsIChannel *channel);
|
||||
|
||||
/**
|
||||
* Extract the NeckoOriginAttributes from the channel's triggering principal.
|
||||
* Extract the OriginAttributes from the channel's triggering principal.
|
||||
*/
|
||||
bool NS_GetOriginAttributes(nsIChannel *aChannel,
|
||||
mozilla::NeckoOriginAttributes &aAttributes);
|
||||
mozilla::OriginAttributes &aAttributes);
|
||||
|
||||
/**
|
||||
* Returns true if the channel has visited any cross-origin URLs on any
|
||||
|
|
|
|||
|
|
@ -2422,7 +2422,7 @@ nsSocketTransport::SetScriptableOriginAttributes(JSContext* aCx,
|
|||
MutexAutoLock lock(mLock);
|
||||
NS_ENSURE_FALSE(mFD.IsInitialized(), NS_ERROR_FAILURE);
|
||||
|
||||
NeckoOriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (!aOriginAttributes.isObject() || !attrs.Init(aCx, aOriginAttributes)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
|
@ -2432,7 +2432,7 @@ nsSocketTransport::SetScriptableOriginAttributes(JSContext* aCx,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsSocketTransport::GetOriginAttributes(NeckoOriginAttributes* aOriginAttributes)
|
||||
nsSocketTransport::GetOriginAttributes(OriginAttributes* aOriginAttributes)
|
||||
{
|
||||
NS_ENSURE_ARG(aOriginAttributes);
|
||||
*aOriginAttributes = mOriginAttributes;
|
||||
|
|
@ -2440,7 +2440,7 @@ nsSocketTransport::GetOriginAttributes(NeckoOriginAttributes* aOriginAttributes)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsSocketTransport::SetOriginAttributes(const NeckoOriginAttributes& aOriginAttributes)
|
||||
nsSocketTransport::SetOriginAttributes(const OriginAttributes& aOriginAttributes)
|
||||
{
|
||||
MutexAutoLock lock(mLock);
|
||||
NS_ENSURE_FALSE(mFD.IsInitialized(), NS_ERROR_FAILURE);
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public:
|
|||
uint64_t ByteCount() { return mByteCount; }
|
||||
|
||||
// called by the socket transport on the socket thread...
|
||||
void OnSocketReady(nsresult condition);
|
||||
void OnSocketReady(nsresult condition);
|
||||
|
||||
private:
|
||||
static nsresult WriteFromSegments(nsIInputStream *, void *,
|
||||
|
|
@ -309,8 +309,8 @@ private:
|
|||
// "privacy.firstparty.isolate" is enabled. Setting this is the only way to
|
||||
// carry origin attributes down to NSPR layers which are final consumers.
|
||||
// It must be set before the socket transport is built.
|
||||
NeckoOriginAttributes mOriginAttributes;
|
||||
|
||||
OriginAttributes mOriginAttributes;
|
||||
|
||||
uint16_t SocketPort() { return (!mProxyHost.IsEmpty() && !mProxyTransparent) ? mProxyPort : mPort; }
|
||||
const nsCString &SocketHost() { return (!mProxyHost.IsEmpty() && !mProxyTransparent) ? mProxyHost : mHost; }
|
||||
|
||||
|
|
@ -351,7 +351,7 @@ private:
|
|||
|
||||
void SendStatus(nsresult status);
|
||||
nsresult ResolveHost();
|
||||
nsresult BuildSocket(PRFileDesc *&, bool &, bool &);
|
||||
nsresult BuildSocket(PRFileDesc *&, bool &, bool &);
|
||||
nsresult InitiateSocket();
|
||||
bool RecoverFromError();
|
||||
|
||||
|
|
|
|||
4
netwerk/cache/nsDiskCacheDeviceSQL.cpp
vendored
4
netwerk/cache/nsDiskCacheDeviceSQL.cpp
vendored
|
|
@ -53,7 +53,7 @@
|
|||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::storage;
|
||||
using mozilla::NeckoOriginAttributes;
|
||||
using mozilla::OriginAttributes;
|
||||
|
||||
static const char OFFLINE_CACHE_DEVICE_ID[] = { "offline" };
|
||||
|
||||
|
|
@ -2523,7 +2523,7 @@ OriginMatch::OnFunctionCall(mozIStorageValueArray* aFunctionArguments, nsIVarian
|
|||
|
||||
nsDependentCSubstring suffix(groupId.BeginReading() + hash, groupId.Length() - hash);
|
||||
|
||||
mozilla::NeckoOriginAttributes oa;
|
||||
mozilla::OriginAttributes oa;
|
||||
bool ok = oa.PopulateFromSuffix(suffix);
|
||||
NS_ENSURE_TRUE(ok, NS_ERROR_UNEXPECTED);
|
||||
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ public:
|
|||
nsresult SyncReadMetadata(nsIFile *aFile);
|
||||
|
||||
bool IsAnonymous() const { return mAnonymous; }
|
||||
mozilla::NeckoOriginAttributes const & OriginAttributes() const { return mOriginAttributes; }
|
||||
mozilla::OriginAttributes const & OriginAttributes() const { return mOriginAttributes; }
|
||||
bool Pinned() const { return !!(mMetaHdr.mFlags & kCacheEntryIsPinned); }
|
||||
|
||||
const char * GetElement(const char *aKey);
|
||||
|
|
@ -215,7 +215,7 @@ private:
|
|||
bool mAnonymous : 1;
|
||||
bool mAllocExactSize : 1;
|
||||
bool mFirstRead : 1;
|
||||
mozilla::NeckoOriginAttributes mOriginAttributes;
|
||||
mozilla::OriginAttributes mOriginAttributes;
|
||||
mozilla::TimeStamp mReadStart;
|
||||
nsCOMPtr<CacheFileMetadataListener> mListener;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@ class KeyParser : protected Tokenizer
|
|||
public:
|
||||
explicit KeyParser(nsACString const& aInput)
|
||||
: Tokenizer(aInput)
|
||||
// Initialize attributes to their default values
|
||||
, originAttribs(false)
|
||||
, isAnonymous(false)
|
||||
// Initialize the cache key to a zero length by default
|
||||
, lastTag(0)
|
||||
|
|
@ -44,7 +42,7 @@ public:
|
|||
|
||||
private:
|
||||
// Results
|
||||
NeckoOriginAttributes originAttribs;
|
||||
OriginAttributes originAttribs;
|
||||
bool isAnonymous;
|
||||
nsCString idEnhance;
|
||||
nsDependentCSubstring cacheKey;
|
||||
|
|
@ -212,7 +210,7 @@ AppendKeyPrefix(nsILoadContextInfo* aInfo, nsACString &_retval)
|
|||
* Keep the attributes list sorted according their ASCII code.
|
||||
*/
|
||||
|
||||
NeckoOriginAttributes const *oa = aInfo->OriginAttributesPtr();
|
||||
OriginAttributes const *oa = aInfo->OriginAttributesPtr();
|
||||
nsAutoCString suffix;
|
||||
oa->CreateSuffix(suffix);
|
||||
if (!suffix.IsEmpty()) {
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ namespace CacheStorageEvictHelper {
|
|||
|
||||
nsresult ClearStorage(bool const aPrivate,
|
||||
bool const aAnonymous,
|
||||
NeckoOriginAttributes &aOa)
|
||||
OriginAttributes &aOa)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
|
@ -436,7 +436,7 @@ nsresult ClearStorage(bool const aPrivate,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult Run(NeckoOriginAttributes &aOa)
|
||||
nsresult Run(OriginAttributes &aOa)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
|
@ -553,9 +553,9 @@ CacheObserver::Observe(nsISupports* aSubject,
|
|||
}
|
||||
|
||||
if (!strcmp(aTopic, "clear-origin-attributes-data")) {
|
||||
NeckoOriginAttributes oa;
|
||||
OriginAttributes oa;
|
||||
if (!oa.Init(nsDependentString(aData))) {
|
||||
NS_ERROR("Could not parse NeckoOriginAttributes JSON in clear-origin-attributes-data notification");
|
||||
NS_ERROR("Could not parse OriginAttributes JSON in clear-origin-attributes-data notification");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -524,7 +524,7 @@ GetCacheSessionNameForStoragePolicy(
|
|||
nsCSubstring const &scheme,
|
||||
nsCacheStoragePolicy storagePolicy,
|
||||
bool isPrivate,
|
||||
NeckoOriginAttributes const *originAttribs,
|
||||
OriginAttributes const *originAttribs,
|
||||
nsACString& sessionName)
|
||||
{
|
||||
MOZ_ASSERT(!isPrivate || storagePolicy == nsICache::STORE_IN_MEMORY);
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ CookieServiceChild::GetCookieStringInternal(nsIURI *aHostURI,
|
|||
URIParams uriParams;
|
||||
SerializeURI(aHostURI, uriParams);
|
||||
|
||||
mozilla::NeckoOriginAttributes attrs;
|
||||
mozilla::OriginAttributes attrs;
|
||||
if (aChannel) {
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
|
||||
if (loadInfo) {
|
||||
|
|
@ -171,7 +171,7 @@ CookieServiceChild::SetCookieStringInternal(nsIURI *aHostURI,
|
|||
URIParams uriParams;
|
||||
SerializeURI(aHostURI, uriParams);
|
||||
|
||||
mozilla::NeckoOriginAttributes attrs;
|
||||
mozilla::OriginAttributes attrs;
|
||||
if (aChannel) {
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
|
||||
if (loadInfo) {
|
||||
|
|
|
|||
|
|
@ -18,8 +18,7 @@
|
|||
|
||||
using namespace mozilla::ipc;
|
||||
using mozilla::BasePrincipal;
|
||||
using mozilla::NeckoOriginAttributes;
|
||||
using mozilla::PrincipalOriginAttributes;
|
||||
using mozilla::OriginAttributes;
|
||||
using mozilla::dom::PContentParent;
|
||||
using mozilla::net::NeckoParent;
|
||||
|
||||
|
|
@ -28,11 +27,11 @@ namespace {
|
|||
// Ignore failures from this function, as they only affect whether we do or
|
||||
// don't show a dialog box in private browsing mode if the user sets a pref.
|
||||
void
|
||||
CreateDummyChannel(nsIURI* aHostURI, NeckoOriginAttributes& aAttrs, bool aIsPrivate,
|
||||
CreateDummyChannel(nsIURI* aHostURI, OriginAttributes& aAttrs, bool aIsPrivate,
|
||||
nsIChannel** aChannel)
|
||||
{
|
||||
PrincipalOriginAttributes attrs;
|
||||
attrs.InheritFromNecko(aAttrs);
|
||||
OriginAttributes attrs;
|
||||
attrs.Inherit(aAttrs);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal =
|
||||
BasePrincipal::CreateCodebasePrincipal(aHostURI, attrs);
|
||||
|
|
@ -94,7 +93,7 @@ mozilla::ipc::IPCResult
|
|||
CookieServiceParent::RecvGetCookieString(const URIParams& aHost,
|
||||
const bool& aIsForeign,
|
||||
const bool& aFromHttp,
|
||||
const NeckoOriginAttributes& aAttrs,
|
||||
const OriginAttributes& aAttrs,
|
||||
nsCString* aResult)
|
||||
{
|
||||
if (!mCookieService)
|
||||
|
|
@ -118,7 +117,7 @@ CookieServiceParent::RecvSetCookieString(const URIParams& aHost,
|
|||
const nsCString& aCookieString,
|
||||
const nsCString& aServerTime,
|
||||
const bool& aFromHttp,
|
||||
const NeckoOriginAttributes& aAttrs)
|
||||
const OriginAttributes& aAttrs)
|
||||
{
|
||||
if (!mCookieService)
|
||||
return IPC_OK();
|
||||
|
|
@ -139,7 +138,7 @@ CookieServiceParent::RecvSetCookieString(const URIParams& aHost,
|
|||
// with aIsForeign before we have to worry about nsCookiePermission trying
|
||||
// to use the channel to inspect it.
|
||||
nsCOMPtr<nsIChannel> dummyChannel;
|
||||
CreateDummyChannel(hostURI, const_cast<NeckoOriginAttributes&>(aAttrs),
|
||||
CreateDummyChannel(hostURI, const_cast<OriginAttributes&>(aAttrs),
|
||||
isPrivate, getter_AddRefs(dummyChannel));
|
||||
|
||||
// NB: dummyChannel could be null if something failed in CreateDummyChannel.
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue