--- a/browser/components/feeds/FeedWriter.js
+++ b/browser/components/feeds/FeedWriter.js
@@ -876,18 +876,18 @@ FeedWriter.prototype = {
* The window of the document invoking the BrowserFeedWriter
*/
_getOriginalURI(aWindow) {
let docShell = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.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);
// this channel is not going to be openend, use a nullPrincipal
// and the most restrctive securityFlag.
let resolvedURI = NetUtil.newChannel({
uri: "about:feeds",
--- a/caps/BasePrincipal.cpp
+++ b/caps/BasePrincipal.cpp
@@ -10,17 +10,16 @@
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsIAddonPolicyService.h"
#include "nsIContentSecurityPolicy.h"
#include "nsIEffectiveTLDService.h"
#include "nsIObjectInputStream.h"
#include "nsIObjectOutputStream.h"
-#include "nsIScriptSecurityManager.h"
#include "nsPrincipal.h"
#include "nsNetUtil.h"
#include "nsIURIWithPrincipal.h"
#include "nsNullPrincipal.h"
#include "nsScriptSecurityManager.h"
#include "nsServiceManagerUtils.h"
@@ -30,104 +29,48 @@
#include "mozilla/dom/ToJSValue.h"
#include "mozilla/dom/URLSearchParams.h"
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
- mUserContextId = aAttrs.mUserContextId;
-
- mPrivateBrowsingId = aAttrs.mPrivateBrowsingId;
- mFirstPartyDomain = aAttrs.mFirstPartyDomain;
-}
+ StripAttributes(STRIP_ADDON_ID);
-void
-PrincipalOriginAttributes::InheritFromNecko(const NeckoOriginAttributes& 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
-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)
+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
-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;
}
nsAutoCString baseDomain;
tldService->GetBaseDomain(aURI, 0, baseDomain);
mFirstPartyDomain = NS_ConvertUTF8toUTF16(baseDomain);
- } else {
- mFirstPartyDomain = aAttrs.mFirstPartyDomain;
}
}
void
OriginAttributes::CreateSuffix(nsACString& aStr) const
{
UniquePtr<URLParams> params(new URLParams());
nsAutoString value;
@@ -321,27 +264,16 @@ OriginAttributes::PopulateFromOrigin(con
}
void
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()
{
// Cache the privacy.firstparty.isolate pref.
static bool sFirstPartyIsolation = false;
static bool sCachedFirstPartyPref = false;
if (!sCachedFirstPartyPref) {
@@ -352,17 +284,17 @@ OriginAttributes::IsFirstPartyEnabled()
return sFirstPartyIsolation;
}
/* static */
bool
OriginAttributes::IsPrivateBrowsing(const nsACString& aOrigin)
{
nsAutoCString dummy;
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
if (NS_WARN_IF(!attrs.PopulateFromOrigin(aOrigin, dummy))) {
return false;
}
return !!attrs.mPrivateBrowsingId;
}
BasePrincipal::BasePrincipal()
@@ -679,17 +611,17 @@ BasePrincipal::AddonHasPermission(const
bool retval = false;
nsresult rv = aps->AddonHasPermission(mOriginAttributes.mAddonId, aPerm, &retval);
NS_ENSURE_SUCCESS(rv, false);
return retval;
}
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.
bool inheritsPrincipal;
nsresult rv = NS_URIChainHasFlags(aURI, nsIProtocolHandler::URI_INHERITS_SECURITY_CONTEXT,
&inheritsPrincipal);
if (NS_FAILED(rv) || inheritsPrincipal) {
return nsNullPrincipal::Create(aAttrs);
@@ -719,33 +651,34 @@ BasePrincipal::CreateCodebasePrincipal(c
{
MOZ_ASSERT(!StringBeginsWith(aOrigin, NS_LITERAL_CSTRING("[")),
"CreateCodebasePrincipal does not support System and Expanded principals");
MOZ_ASSERT(!StringBeginsWith(aOrigin, NS_LITERAL_CSTRING(NS_NULLPRINCIPAL_SCHEME ":")),
"CreateCodebasePrincipal does not support nsNullPrincipal");
nsAutoCString originNoSuffix;
- mozilla::PrincipalOriginAttributes attrs;
+ mozilla::OriginAttributes attrs;
if (!attrs.PopulateFromOrigin(aOrigin, originNoSuffix)) {
return nullptr;
}
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), originNoSuffix);
NS_ENSURE_SUCCESS(rv, nullptr);
return BasePrincipal::CreateCodebasePrincipal(uri, attrs);
}
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);
NS_ENSURE_SUCCESS(rv, nullptr);
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), originNoSuffix);
NS_ENSURE_SUCCESS(rv, nullptr);
--- a/caps/BasePrincipal.h
+++ b/caps/BasePrincipal.h
@@ -6,42 +6,81 @@
#ifndef mozilla_BasePrincipal_h
#define mozilla_BasePrincipal_h
#include "nsJSPrincipals.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/ChromeUtilsBinding.h"
+#include "nsIScriptSecurityManager.h"
class nsIContentSecurityPolicy;
class nsIObjectOutputStream;
class nsIObjectInputStream;
class nsIURI;
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 &&
mInIsolatedMozBrowser == aOther.mInIsolatedMozBrowser &&
mAddonId == aOther.mAddonId &&
mUserContextId == aOther.mUserContextId &&
mPrivateBrowsingId == aOther.mPrivateBrowsingId &&
mFirstPartyDomain == aOther.mFirstPartyDomain;
}
+
bool operator!=(const OriginAttributes& aOther) const
{
return !(*this == aOther);
}
// Serializes/Deserializes non-default values into the suffix format, i.e.
// |!key1=value1&key2=value2|. If there are no non-default attributes, this
// returns an empty string.
@@ -56,115 +95,22 @@ public:
// |uri!key1=value1&key2=value2| and returns the uri without the suffix.
MOZ_MUST_USE bool PopulateFromOrigin(const nsACString& aOrigin,
nsACString& aOriginNoSuffix);
// Helper function to match mIsPrivateBrowsing to existing private browsing
// 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
{
public:
// To convert a JSON string to an OriginAttributesPattern, do the following:
//
// OriginAttributesPattern pattern;
@@ -289,20 +235,20 @@ public:
virtual bool AddonHasPermission(const nsAString& aPerm);
virtual bool IsOnCSSUnprefixingWhitelist() override { return false; }
virtual bool IsCodebasePrincipal() const { return false; };
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; }
bool IsInIsolatedMozBrowserElement() const { return mOriginAttributes.mInIsolatedMozBrowser; }
enum PrincipalKind {
eNullPrincipal,
eCodebasePrincipal,
@@ -329,14 +275,14 @@ protected:
friend class ::nsExpandedPrincipal;
// Helper to check whether this principal is associated with an addon that
// allows unprivileged code to load aURI.
bool AddonAllowsLoad(nsIURI* aURI);
nsCOMPtr<nsIContentSecurityPolicy> mCSP;
nsCOMPtr<nsIContentSecurityPolicy> mPreloadCSP;
- PrincipalOriginAttributes mOriginAttributes;
+ OriginAttributes mOriginAttributes;
};
} // namespace mozilla
#endif /* mozilla_BasePrincipal_h */
--- a/caps/nsIPrincipal.idl
+++ b/caps/nsIPrincipal.idl
@@ -7,28 +7,28 @@
#include "nsISerializable.idl"
%{C++
struct JSPrincipals;
#include "nsCOMPtr.h"
#include "nsTArray.h"
namespace mozilla {
-class PrincipalOriginAttributes;
+class OriginAttributes;
}
%}
interface nsIURI;
interface nsIContentSecurityPolicy;
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
{
/**
* Returns whether the other principal is equivalent to this principal.
* Principals are considered equal if they are the same principal, or
* they have the same origin.
@@ -193,17 +193,17 @@ interface nsIPrincipal : nsISerializable
*
* If you're looking for an easy-to-use canonical stringification of the origin
* attributes, see |originSuffix| below.
*/
[implicit_jscontext]
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
* consists of a base string (which, for codebase principals, is of the
* format scheme://host:port), concatenated with |originAttributes| (see
* below).
*
* We maintain the invariant that principalA.equals(principalB) if and only
--- a/caps/nsJSPrincipals.cpp
+++ b/caps/nsJSPrincipals.cpp
@@ -121,17 +121,17 @@ nsJSPrincipals::ReadPrincipals(JSContext
return false;
}
return ReadKnownPrincipalType(aCx, aReader, tag, aOutPrincipals);
}
static bool
ReadSuffixAndSpec(JSStructuredCloneReader* aReader,
- PrincipalOriginAttributes& aAttrs,
+ OriginAttributes& aAttrs,
nsACString& aSpec)
{
uint32_t suffixLength, specLength;
if (!JS_ReadUint32Pair(aReader, &suffixLength, &specLength)) {
return false;
}
nsAutoCString suffix;
@@ -155,17 +155,17 @@ ReadSuffixAndSpec(JSStructuredCloneReade
static bool
ReadPrincipalInfo(JSStructuredCloneReader* aReader,
uint32_t aTag,
PrincipalInfo& aInfo)
{
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;
}
aInfo = NullPrincipalInfo(attrs, spec);
} else if (aTag == SCTAG_DOM_EXPANDED_PRINCIPAL) {
uint32_t length, unused;
if (!JS_ReadUint32Pair(aReader, &length, &unused)) {
@@ -184,17 +184,17 @@ ReadPrincipalInfo(JSStructuredCloneReade
if (!ReadPrincipalInfo(aReader, tag, sub)) {
return false;
}
expanded.whitelist().AppendElement(sub);
}
aInfo = expanded;
} else if (aTag == SCTAG_DOM_CONTENT_PRINCIPAL) {
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
nsAutoCString spec;
if (!ReadSuffixAndSpec(aReader, attrs, spec)) {
return false;
}
aInfo = ContentPrincipalInfo(attrs, spec);
} else {
MOZ_CRASH("unexpected principal structured clone tag");
@@ -232,17 +232,17 @@ nsJSPrincipals::ReadKnownPrincipalType(J
}
*aOutPrincipals = get(prin.forget().take());
return true;
}
static bool
WriteSuffixAndSpec(JSStructuredCloneWriter* aWriter,
- const PrincipalOriginAttributes& aAttrs,
+ const OriginAttributes& aAttrs,
const nsCString& aSpec)
{
nsAutoCString suffix;
aAttrs.CreateSuffix(suffix);
return JS_WriteUint32Pair(aWriter, suffix.Length(), aSpec.Length()) &&
JS_WriteBytes(aWriter, suffix.get(), suffix.Length()) &&
JS_WriteBytes(aWriter, aSpec.get(), aSpec.Length());
--- a/caps/nsNullPrincipal.cpp
+++ b/caps/nsNullPrincipal.cpp
@@ -43,39 +43,37 @@ nsNullPrincipal::CreateWithInheritedAttr
nsresult rv = nullPrin->Init(Cast(aInheritFrom)->OriginAttributesRef());
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
return nullPrin.forget();
}
/* 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);
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
return nullPrin.forget();
}
/* 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);
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
return nullPrin.forget();
}
nsresult
-nsNullPrincipal::Init(const PrincipalOriginAttributes& aOriginAttributes,
- nsIURI* aURI)
+nsNullPrincipal::Init(const OriginAttributes& aOriginAttributes, nsIURI* aURI)
{
mOriginAttributes = aOriginAttributes;
if (aURI) {
nsAutoCString scheme;
nsresult rv = aURI->GetScheme(scheme);
NS_ENSURE_SUCCESS(rv, rv);
--- a/caps/nsNullPrincipal.h
+++ b/caps/nsNullPrincipal.h
@@ -48,20 +48,20 @@ public:
NS_IMETHOD GetBaseDomain(nsACString& aBaseDomain) override;
nsresult GetOriginInternal(nsACString& aOrigin) override;
static already_AddRefed<nsNullPrincipal> CreateWithInheritedAttributes(nsIPrincipal* aInheritFrom);
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;
PrincipalKind Kind() override { return eNullPrincipal; }
protected:
virtual ~nsNullPrincipal() {}
--- a/caps/nsPrincipal.cpp
+++ b/caps/nsPrincipal.cpp
@@ -77,17 +77,17 @@ nsPrincipal::~nsPrincipal()
{
// let's clear the principal within the csp to avoid a tangling pointer
if (mCSP) {
static_cast<nsCSPContext*>(mCSP.get())->clearLoadingPrincipal();
}
}
nsresult
-nsPrincipal::Init(nsIURI *aCodebase, const PrincipalOriginAttributes& aOriginAttributes)
+nsPrincipal::Init(nsIURI *aCodebase, const OriginAttributes& aOriginAttributes)
{
NS_ENSURE_STATE(!mInitialized);
NS_ENSURE_ARG(aCodebase);
mInitialized = true;
mCodebase = NS_TryToMakeImmutable(aCodebase);
mCodebaseImmutable = URIIsImmutable(mCodebase);
@@ -399,17 +399,17 @@ nsPrincipal::Read(nsIObjectInputStream*
}
domain = do_QueryInterface(supports);
nsAutoCString suffix;
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);
rv = NS_ReadOptionalObject(aStream, true, getter_AddRefs(supports));
NS_ENSURE_SUCCESS(rv, rv);
rv = Init(codebase, attrs);
NS_ENSURE_SUCCESS(rv, rv);
@@ -683,17 +683,17 @@ struct OriginComparator
nsAutoCString originB;
rv = b->GetOrigin(originB);
NS_ENSURE_SUCCESS(rv, false);
return a == b;
}
};
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.
OriginComparator c;
for (size_t i = 0; i < aWhiteList.Length(); ++i) {
mPrincipals.InsertElementSorted(aWhiteList[i], c);
}
mOriginAttributes = aAttrs;
--- a/caps/nsPrincipal.h
+++ b/caps/nsPrincipal.h
@@ -27,17 +27,18 @@ public:
NS_IMETHOD GetBaseDomain(nsACString& aBaseDomain) override;
virtual bool IsOnCSSUnprefixingWhitelist() override;
bool IsCodebasePrincipal() const override { return true; }
nsresult GetOriginInternal(nsACString& aOrigin) override;
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);
/**
* Called at startup to setup static data, e.g. about:config pref-observers.
*/
static void InitializeStatics();
@@ -58,17 +59,17 @@ protected:
bool SubsumesInternal(nsIPrincipal* aOther, DocumentDomainConsideration aConsideration) override;
bool MayLoadInternal(nsIURI* aURI) override;
};
class nsExpandedPrincipal : public nsIExpandedPrincipal, public mozilla::BasePrincipal
{
public:
nsExpandedPrincipal(nsTArray<nsCOMPtr<nsIPrincipal>> &aWhiteList,
- const mozilla::PrincipalOriginAttributes& aAttrs);
+ const mozilla::OriginAttributes& aAttrs);
NS_DECL_NSIEXPANDEDPRINCIPAL
NS_DECL_NSISERIALIZABLE
NS_IMETHOD_(MozExternalRefCountType) AddRef() override { return nsJSPrincipals::AddRef(); };
NS_IMETHOD_(MozExternalRefCountType) Release() override { return nsJSPrincipals::Release(); };
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
NS_IMETHOD GetHashValue(uint32_t* aHashValue) override;
NS_IMETHOD GetURI(nsIURI** aURI) override;
--- a/caps/nsScriptSecurityManager.cpp
+++ b/caps/nsScriptSecurityManager.cpp
@@ -293,21 +293,20 @@ nsScriptSecurityManager::GetChannelResul
if (loadInfo) {
if (!aIgnoreSandboxing && loadInfo->GetLoadingSandboxed()) {
RefPtr<nsNullPrincipal> prin;
if (loadInfo->LoadingPrincipal()) {
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;
}
bool forceInherit = loadInfo->GetForceInheritPrincipal();
if (aIgnoreSandboxing && !forceInherit) {
// Check if SEC_FORCE_INHERIT_PRINCIPAL was dropped because of
@@ -351,17 +350,17 @@ nsScriptSecurityManager::GetChannelResul
return NS_OK;
}
}
}
return GetChannelURIPrincipal(aChannel, aPrincipal);
}
nsresult
-nsScriptSecurityManager::MaybeSetAddonIdFromURI(PrincipalOriginAttributes& aAttrs, nsIURI* aURI)
+nsScriptSecurityManager::MaybeSetAddonIdFromURI(OriginAttributes& aAttrs, nsIURI* aURI)
{
nsAutoCString scheme;
nsresult rv = aURI->GetScheme(scheme);
NS_ENSURE_SUCCESS(rv, rv);
if (scheme.EqualsLiteral("moz-extension") && GetAddonPolicyService()) {
rv = GetAddonPolicyService()->ExtensionURIToAddonId(aURI, aAttrs.mAddonId);
NS_ENSURE_SUCCESS(rv, rv);
}
@@ -395,21 +394,21 @@ nsScriptSecurityManager::GetChannelURIPr
nsCOMPtr<nsILoadInfo> loadInfo;
aChannel->GetLoadInfo(getter_AddRefs(loadInfo));
// Inherit the origin attributes from loadInfo.
// If this is a top-level document load, the origin attributes of the
// 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);
nsCOMPtr<nsIPrincipal> prin = BasePrincipal::CreateCodebasePrincipal(uri, attrs);
prin.forget(aPrincipal);
return *aPrincipal ? NS_OK : NS_ERROR_FAILURE;
}
@@ -1065,34 +1064,34 @@ nsScriptSecurityManager::GetSystemPrinci
return NS_OK;
}
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;
}
NS_IMETHODIMP
nsScriptSecurityManager::GetCodebasePrincipal(nsIURI* aURI,
nsIPrincipal** aPrincipal)
{
return GetNoAppCodebasePrincipal(aURI, aPrincipal);
}
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;
}
nsCOMPtr<nsIPrincipal> prin = BasePrincipal::CreateCodebasePrincipal(aURI, attrs);
prin.forget(aPrincipal);
return *aPrincipal ? NS_OK : NS_ERROR_FAILURE;
}
@@ -1112,17 +1111,17 @@ nsScriptSecurityManager::CreateCodebaseP
prin.forget(aPrincipal);
return *aPrincipal ? NS_OK : NS_ERROR_FAILURE;
}
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;
}
nsCOMPtr<nsIPrincipal> prin = nsNullPrincipal::Create(attrs);
prin.forget(aPrincipal);
return NS_OK;
}
@@ -1130,50 +1129,50 @@ NS_IMETHODIMP
nsScriptSecurityManager::GetAppCodebasePrincipal(nsIURI* aURI,
uint32_t aAppId,
bool aInIsolatedMozBrowser,
nsIPrincipal** aPrincipal)
{
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;
}
NS_IMETHODIMP
nsScriptSecurityManager::
GetLoadContextCodebasePrincipal(nsIURI* aURI,
nsILoadContext* aLoadContext,
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);
nsCOMPtr<nsIPrincipal> prin = BasePrincipal::CreateCodebasePrincipal(aURI, attrs);
prin.forget(aPrincipal);
return *aPrincipal ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHODIMP
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);
nsCOMPtr<nsIPrincipal> prin = BasePrincipal::CreateCodebasePrincipal(aURI, attrs);
prin.forget(aPrincipal);
return *aPrincipal ? NS_OK : NS_ERROR_FAILURE;
}
--- a/caps/nsScriptSecurityManager.h
+++ b/caps/nsScriptSecurityManager.h
@@ -22,17 +22,17 @@
#include <stdint.h>
class nsCString;
class nsIIOService;
class nsIStringBundle;
class nsSystemPrincipal;
namespace mozilla {
-class PrincipalOriginAttributes;
+class OriginAttributes;
} // namespace mozilla
/////////////////////////////
// nsScriptSecurityManager //
/////////////////////////////
#define NS_SCRIPTSECURITYMANAGER_CID \
{ 0x7ee2a4c0, 0x4b93, 0x17d3, \
{ 0xba, 0x18, 0x00, 0x60, 0xb0, 0xf1, 0x99, 0xa2 }}
@@ -107,17 +107,17 @@ private:
inline void
ScriptSecurityPrefChanged();
inline void
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,
bool aIgnoreSandboxing);
nsresult
CheckLoadURIFlags(nsIURI* aSourceURI, nsIURI* aTargetURI, nsIURI* aSourceBaseURI,
nsIURI* aTargetBaseURI, uint32_t aFlags);
--- a/caps/tests/gtest/TestOriginAttributes.cpp
+++ b/caps/tests/gtest/TestOriginAttributes.cpp
@@ -1,38 +1,38 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#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);
}
--- a/docshell/base/LoadContext.cpp
+++ b/docshell/base/LoadContext.cpp
@@ -8,33 +8,33 @@
#include "mozilla/BasePrincipal.h"
#include "mozilla/LoadContext.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/ScriptSettings.h" // for AutoJSAPI
#include "nsContentUtils.h"
#include "xpcpublic.h"
bool
-nsILoadContext::GetOriginAttributes(mozilla::DocShellOriginAttributes& aAttrs)
+nsILoadContext::GetOriginAttributes(mozilla::OriginAttributes& aAttrs)
{
mozilla::dom::AutoJSAPI jsapi;
bool ok = jsapi.Init(xpc::PrivilegedJunkScope());
NS_ENSURE_TRUE(ok, false);
JS::Rooted<JS::Value> v(jsapi.cx());
nsresult rv = GetOriginAttributes(&v);
NS_ENSURE_SUCCESS(rv, false);
NS_ENSURE_TRUE(v.isObject(), false);
JS::Rooted<JSObject*> obj(jsapi.cx(), &v.toObject());
// If we're JS-implemented, the object will be left in a different (System-Principaled)
// scope, so we may need to enter its compartment.
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;
return true;
}
namespace mozilla {
@@ -45,18 +45,17 @@ LoadContext::LoadContext(nsIPrincipal* a
: mTopFrameElement(nullptr)
, mNestedFrameId(0)
, mIsContent(true)
, mUseRemoteTabs(false)
#ifdef DEBUG
, mIsNotNull(true)
#endif
{
- PrincipalOriginAttributes poa = aPrincipal->OriginAttributesRef();
- mOriginAttributes.InheritFromDocToChildDocShell(poa);
+ mOriginAttributes.Inherit(aPrincipal->OriginAttributesRef());
if (!aOptionalBase) {
return;
}
MOZ_ALWAYS_SUCCEEDS(aOptionalBase->GetIsContent(&mIsContent));
MOZ_ALWAYS_SUCCEEDS(aOptionalBase->GetUseRemoteTabs(&mUseRemoteTabs));
}
--- a/docshell/base/LoadContext.h
+++ b/docshell/base/LoadContext.h
@@ -35,63 +35,63 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSILOADCONTEXT
NS_DECL_NSIINTERFACEREQUESTOR
// appId/inIsolatedMozBrowser arguments override those in SerializedLoadContext
// 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)
, mUseRemoteTabs(aToCopy.mUseRemoteTabs)
, mOriginAttributes(aAttrs)
#ifdef DEBUG
, mIsNotNull(aToCopy.mIsNotNull)
#endif
{
}
// appId/inIsolatedMozBrowser arguments override those in SerializedLoadContext
// provided by child process.
LoadContext(const IPC::SerializedLoadContext& aToCopy,
uint64_t aNestedFrameId,
- DocShellOriginAttributes& aAttrs)
+ OriginAttributes& aAttrs)
: mTopFrameElement(nullptr)
, mNestedFrameId(aNestedFrameId)
, mIsContent(aToCopy.mIsContent)
, mUseRemoteTabs(aToCopy.mUseRemoteTabs)
, mOriginAttributes(aAttrs)
#ifdef DEBUG
, mIsNotNull(aToCopy.mIsNotNull)
#endif
{
}
LoadContext(dom::Element* aTopFrameElement,
bool aIsContent,
bool aUsePrivateBrowsing,
bool aUseRemoteTabs,
- const DocShellOriginAttributes& aAttrs)
+ const OriginAttributes& aAttrs)
: mTopFrameElement(do_GetWeakReference(aTopFrameElement))
, mNestedFrameId(0)
, mIsContent(aIsContent)
, mUseRemoteTabs(aUseRemoteTabs)
, mOriginAttributes(aAttrs)
#ifdef DEBUG
, mIsNotNull(true)
#endif
{
MOZ_DIAGNOSTIC_ASSERT(aUsePrivateBrowsing == (aAttrs.mPrivateBrowsingId > 0));
}
// Constructor taking reserved origin attributes.
- explicit LoadContext(DocShellOriginAttributes& aAttrs)
+ explicit LoadContext(OriginAttributes& aAttrs)
: mTopFrameElement(nullptr)
, mNestedFrameId(0)
, mIsContent(false)
, mUseRemoteTabs(false)
, mOriginAttributes(aAttrs)
#ifdef DEBUG
, mIsNotNull(true)
#endif
@@ -105,17 +105,17 @@ public:
private:
~LoadContext() {}
nsWeakPtr mTopFrameElement;
uint64_t mNestedFrameId;
bool mIsContent;
bool mUseRemoteTabs;
- DocShellOriginAttributes mOriginAttributes;
+ OriginAttributes mOriginAttributes;
#ifdef DEBUG
bool mIsNotNull;
#endif
};
} // namespace mozilla
#endif // LoadContext_h
--- a/docshell/base/SerializedLoadContext.h
+++ b/docshell/base/SerializedLoadContext.h
@@ -47,17 +47,17 @@ public:
// used to indicate if child-side LoadContext * was null.
bool mIsNotNull;
// used to indicate if child-side mUsePrivateBrowsing flag is valid, even if
// mIsNotNull is false, i.e., child LoadContext was null.
bool mIsPrivateBitValid;
bool mIsContent;
bool mUseRemoteTabs;
- mozilla::DocShellOriginAttributes mOriginAttributes;
+ mozilla::OriginAttributes mOriginAttributes;
};
// Function to serialize over IPDL
template<>
struct ParamTraits<SerializedLoadContext>
{
typedef SerializedLoadContext paramType;
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -3551,19 +3551,19 @@ nsDocShell::CanAccessItem(nsIDocShellTre
nsCOMPtr<nsIDocShellTreeItem> accessingRoot;
aAccessingItem->GetSameTypeRootTreeItem(getter_AddRefs(accessingRoot));
nsCOMPtr<nsIDocShell> accessingRootDS = do_QueryInterface(accessingRoot);
nsCOMPtr<nsIDocShellTreeItem> targetRoot;
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
// the firstPartyDomain in its originAttributes, but its document will have
// it. So we get the firstPartyDomain from the nodePrincipal of the document
// before we compare the originAttributes.
if (OriginAttributes::IsFirstPartyEnabled()) {
if (accessingDS == accessingRootDS &&
@@ -9668,18 +9668,18 @@ nsDocShell::JustStartedNetworkLoad()
{
return mDocumentRequest && mDocumentRequest != GetCurrentDocChannel();
}
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);
return *aResult ? NS_OK : NS_ERROR_FAILURE;
}
bool
@@ -10893,22 +10893,24 @@ nsDocShell::DoURILoad(nsIURI* aURI,
if (aPrincipalToInherit) {
loadInfo->SetPrincipalToInherit(aPrincipalToInherit);
}
// 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;
}
if (!isSrcdoc) {
rv = NS_NewChannelInternal(getter_AddRefs(channel),
aURI,
loadInfo,
@@ -12281,21 +12283,20 @@ nsDocShell::AddToSessionHistory(nsIURI*
// For now keep storing just the principal in the SHEntry.
if (!principalToInherit) {
if (loadInfo->GetLoadingSandboxed()) {
if (loadInfo->LoadingPrincipal()) {
principalToInherit = nsNullPrincipal::CreateWithInheritedAttributes(
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();
}
}
}
}
@@ -14370,17 +14371,17 @@ nsDocShell::CanSetOriginAttributes()
}
}
}
return true;
}
nsresult
-nsDocShell::SetOriginAttributes(const DocShellOriginAttributes& aAttrs)
+nsDocShell::SetOriginAttributes(const OriginAttributes& aAttrs)
{
if (!CanSetOriginAttributes()) {
return NS_ERROR_FAILURE;
}
AssertOriginAttributesMatchPrivateBrowsing();
mOriginAttributes = aAttrs;
@@ -14408,29 +14409,29 @@ nsDocShell::SetOriginAttributesBeforeLoa
return NS_ERROR_UNEXPECTED;
}
JSContext* cx = jsapi.cx();
if (NS_WARN_IF(!cx)) {
return NS_ERROR_FAILURE;
}
- DocShellOriginAttributes attrs;
+ OriginAttributes attrs;
if (!aOriginAttributes.isObject() || !attrs.Init(cx, aOriginAttributes)) {
return NS_ERROR_INVALID_ARG;
}
return SetOriginAttributes(attrs);
}
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;
}
return SetOriginAttributes(attrs);
}
NS_IMETHODIMP
@@ -14600,18 +14601,18 @@ nsDocShell::ShouldPrepareForIntercept(ns
if (isThirdPartyURI) {
return NS_OK;
}
}
}
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);
return NS_OK;
}
nsCOMPtr<nsIDocument> doc = GetDocument();
if (!doc) {
@@ -14652,22 +14653,18 @@ nsDocShell::ChannelIntercepted(nsIInterc
// For top-level navigations, save a document ID which will be passed to
// the FetchEvent as the clientId later on.
rv = nsIDocument::GenerateDocumentId(mInterceptedDocumentId);
NS_ENSURE_SUCCESS(rv, rv);
}
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,
isReload, isSubresourceLoad, error);
if (NS_WARN_IF(error.Failed())) {
return error.StealNSResult();
}
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -272,23 +272,23 @@ public:
mInFrameSwap = aInSwap;
}
bool InFrameSwap();
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)
{
aId = mInterceptedDocumentId;
}
private:
// An observed docshell wrapper is created when recording markers is enabled.
@@ -1036,17 +1036,17 @@ private:
nsCString mParentCharset;
int32_t mParentCharsetSource;
nsCOMPtr<nsIPrincipal> mParentCharsetPrincipal;
nsTObserverArray<nsWeakPtr> mPrivacyObservers;
nsTObserverArray<nsWeakPtr> mReflowObservers;
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.
uint32_t mJSRunToCompletionDepth;
// Whether or not touch events are overridden. Possible values are defined
// as constants in the nsIDocShell.idl file.
uint32_t mTouchEventsOverride;
--- a/docshell/base/nsILoadContext.idl
+++ b/docshell/base/nsILoadContext.idl
@@ -6,17 +6,17 @@
#include "nsISupports.idl"
interface mozIDOMWindowProxy;
interface nsIDOMElement;
%{C++
#ifdef MOZILLA_INTERNAL_API
-#include "mozilla/BasePrincipal.h" // for DocShellOriginAttributes
+#include "mozilla/BasePrincipal.h" // for OriginAttributes
#endif
%}
/**
* An nsILoadContext represents the context of a load. This interface
* can be queried for various information about where the load is
* happening.
*/
@@ -122,17 +122,17 @@ interface nsILoadContext : nsISupports
%{C++
#ifdef MOZILLA_INTERNAL_API
/**
* The C++ getter for origin attributes.
*
* Defined in LoadContext.cpp
*/
- bool GetOriginAttributes(mozilla::DocShellOriginAttributes& aAttrs);
+ bool GetOriginAttributes(mozilla::OriginAttributes& aAttrs);
#endif
%}
/**
* Returns true if tracking protection is enabled for the load context.
*/
boolean IsTrackingProtectionOn();
--- a/dom/base/ChromeUtils.cpp
+++ b/dom/base/ChromeUtils.cpp
@@ -127,37 +127,37 @@ ThreadSafeChromeUtils::Base64URLDecode(G
}
/* static */ void
ChromeUtils::OriginAttributesToSuffix(dom::GlobalObject& aGlobal,
const dom::OriginAttributesDictionary& aAttrs,
nsCString& aSuffix)
{
- GenericOriginAttributes attrs(aAttrs);
+ OriginAttributes attrs(aAttrs);
attrs.CreateSuffix(aSuffix);
}
/* static */ bool
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);
}
/* static */ void
ChromeUtils::CreateOriginAttributesFromOrigin(dom::GlobalObject& aGlobal,
const nsAString& aOrigin,
dom::OriginAttributesDictionary& aAttrs,
ErrorResult& aRv)
{
- GenericOriginAttributes attrs;
+ OriginAttributes attrs;
nsAutoCString suffix;
if (!attrs.PopulateFromOrigin(NS_ConvertUTF16toUTF8(aOrigin), suffix)) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
aAttrs = attrs;
}
--- a/dom/base/DOMParser.cpp
+++ b/dom/base/DOMParser.cpp
@@ -345,17 +345,17 @@ DOMParser::Init(nsIPrincipal* principal,
NS_LITERAL_CSTRING("DOM"),
nullptr,
nsContentUtils::eDOM_PROPERTIES,
"ChromeScriptedDOMParserWithoutPrincipal",
nullptr,
0,
documentURI);
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
mPrincipal = BasePrincipal::CreateCodebasePrincipal(mDocumentURI, attrs);
NS_ENSURE_TRUE(mPrincipal, NS_ERROR_FAILURE);
mOriginalPrincipal = mPrincipal;
} else {
mOriginalPrincipal = mPrincipal;
if (nsContentUtils::IsSystemPrincipal(mPrincipal)) {
// Don't give DOMParsers the system principal. Use a null
// principal instead.
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -3140,52 +3140,50 @@ nsContentUtils::CanLoadImage(nsIURI* aUR
if (aImageBlockingStatus) {
*aImageBlockingStatus =
NS_FAILED(rv) ? nsIContentPolicy::REJECT_REQUEST : decision;
}
return NS_FAILED(rv) ? false : NS_CP_ACCEPTED(decision);
}
// static
-mozilla::PrincipalOriginAttributes
+mozilla::OriginAttributes
nsContentUtils::GetOriginAttributes(nsIDocument* aDocument)
{
if (!aDocument) {
- return mozilla::PrincipalOriginAttributes();
+ return mozilla::OriginAttributes();
}
nsCOMPtr<nsILoadGroup> loadGroup = aDocument->GetDocumentLoadGroup();
if (loadGroup) {
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();
- }
- mozilla::PrincipalOriginAttributes attrs;
- mozilla::DocShellOriginAttributes dsattrs;
+ return mozilla::OriginAttributes();
+ }
+ 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;
}
// static
bool
nsContentUtils::IsInPrivateBrowsing(nsIDocument* aDoc)
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -800,23 +800,23 @@ public:
*/
static void GetEventArgNames(int32_t aNameSpaceID, nsIAtom *aEventName,
bool aIsForWindow,
uint32_t *aArgCount, const char*** aArgNames);
/**
* 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);
/**
* Returns true if this document is in a Private Browsing window.
*/
static bool IsInPrivateBrowsing(nsIDocument* aDoc);
/**
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -1356,22 +1356,22 @@ nsFrameLoader::SwapWithOtherRemoteLoader
// When we swap docShells, maybe we have to deal with a new page created just
// for this operation. In this case, the browser code should already have set
// the correct userContextId attribute value in the owning XULElement, but our
// docShell, that has been created way before) doesn't know that that
// happened.
// 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);
if (ourOriginAttributes != otherOriginAttributes) {
return NS_ERROR_NOT_IMPLEMENTED;
}
@@ -1754,22 +1754,22 @@ nsFrameLoader::SwapWithOtherLoader(nsFra
// When we swap docShells, maybe we have to deal with a new page created just
// for this operation. In this case, the browser code should already have set
// the correct userContextId attribute value in the owning XULElement, but our
// docShell, that has been created way before) doesn't know that that
// happened.
// 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);
if (ourOriginAttributes != otherOriginAttributes) {
return NS_ERROR_NOT_IMPLEMENTED;
}
@@ -2401,51 +2401,51 @@ nsFrameLoader::MaybeCreateDocShell()
mPartialSHistory = new PartialSHistory(this);
nsCOMPtr<nsISHistoryListener> listener(do_QueryInterface(mPartialSHistory));
nsCOMPtr<nsIPartialSHistoryListener> partialListener(do_QueryInterface(mPartialSHistory));
sessionHistory->AddSHistoryListener(listener);
sessionHistory->SetPartialSHistoryListener(partialListener);
}
}
- DocShellOriginAttributes attrs;
+ OriginAttributes attrs;
if (docShell->ItemType() == mDocShell->ItemType()) {
attrs = nsDocShell::Cast(docShell)->GetOriginAttributes();
}
// Inherit origin attributes from parent document if
// 1. It's in a content docshell.
// 2. its nodePrincipal is not a SystemPrincipal.
// 3. It's not a mozbrowser frame.
//
// For example, firstPartyDomain is computed from top-level document, it
// doesn't exist in the top-level docshell.
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) {
MOZ_ASSERT(attrs.mFirstPartyDomain.IsEmpty(),
"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()) {
attrs.mAppId = nsIScriptSecurityManager::NO_APP_ID;
attrs.mInIsolatedMozBrowser = OwnerIsIsolatedMozBrowserFrame();
mDocShell->SetFrameType(nsIDocShell::FRAME_TYPE_BROWSER);
}
@@ -3587,17 +3587,17 @@ nsFrameLoader::MaybeUpdatePrimaryTabPare
}
}
}
nsresult
nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
nsIURI* aURI)
{
- DocShellOriginAttributes attrs;
+ OriginAttributes attrs;
attrs.mInIsolatedMozBrowser = OwnerIsIsolatedMozBrowserFrame();
nsresult rv;
attrs.mAppId = nsIScriptSecurityManager::NO_APP_ID;
// set the userContextId on the attrs before we pass them into
// the tab context
rv = PopulateUserContextIdFromAttribute(attrs);
@@ -3636,17 +3636,17 @@ nsFrameLoader::GetNewTabContext(MutableT
attrs,
presentationURLStr);
NS_ENSURE_STATE(tabContextUpdated);
return NS_OK;
}
nsresult
-nsFrameLoader::PopulateUserContextIdFromAttribute(DocShellOriginAttributes& aAttr)
+nsFrameLoader::PopulateUserContextIdFromAttribute(OriginAttributes& aAttr)
{
if (aAttr.mUserContextId ==
nsIScriptSecurityManager::DEFAULT_USER_CONTEXT_ID) {
// Grab the userContextId from owner if XUL
nsAutoString userContextIdStr;
int32_t namespaceID = mOwnerContent->GetNameSpaceID();
if ((namespaceID == kNameSpaceID_XUL) &&
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::usercontextid,
--- a/dom/base/nsFrameLoader.h
+++ b/dom/base/nsFrameLoader.h
@@ -34,17 +34,17 @@ class nsIInProcessContentFrameMessageMan
class AutoResetInShow;
class AutoResetInFrameSwap;
class nsITabParent;
class nsIDocShellTreeItem;
class nsIDocShellTreeOwner;
namespace mozilla {
-class DocShellOriginAttributes;
+class OriginAttributes;
namespace dom {
class ContentParent;
class PBrowserParent;
class Promise;
class TabParent;
class MutableTabContext;
@@ -303,17 +303,17 @@ private:
enum TabParentChange {
eTabParentRemoved,
eTabParentChanged
};
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.
bool SwapBrowsersAndNotify(nsFrameLoader* aOther);
// Returns a promise which will be resolved once all of the blockers have
// resolved which were added during the BrowserWillChangeProcess event.
already_AddRefed<mozilla::dom::Promise> FireWillChangeProcessEvent();
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -270,17 +270,17 @@ class nsIScriptTimeoutHandler;
#endif
static const char kStorageEnabled[] = "dom.storage.enabled";
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;
static LazyLogModule gDOMLeakPRLog("DOMLeak");
nsGlobalWindow::WindowByIdTable *nsGlobalWindow::sWindowsById = nullptr;
bool nsGlobalWindow::sWarnedAboutWindowInternal = false;
@@ -2431,17 +2431,17 @@ nsGlobalWindow::ComputeIsSecureContext(n
return true;
}
if (principal->GetIsNullPrincipal()) {
nsCOMPtr<nsIURI> uri = aDocument->GetOriginalURI();
// 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);
if (NS_WARN_IF(!principal)) {
return false;
}
}
@@ -8481,17 +8481,17 @@ nsGlobalWindow::PostMessageMozOuter(JSCo
return;
}
if (NS_FAILED(originURI->SetUserPass(EmptyCString())) ||
NS_FAILED(originURI->SetPath(EmptyCString()))) {
return;
}
- PrincipalOriginAttributes attrs = aSubjectPrincipal.OriginAttributesRef();
+ OriginAttributes attrs = aSubjectPrincipal.OriginAttributesRef();
if (aSubjectPrincipal.GetIsSystemPrincipal()) {
auto principal = BasePrincipal::Cast(GetPrincipal());
if (attrs != principal->OriginAttributesRef()) {
nsCOMPtr<nsIURI> targetURI;
nsAutoCString targetURL;
nsAutoCString sourceOrigin;
nsAutoCString targetOrigin;
--- a/dom/base/nsOpenURIInFrameParams.cpp
+++ b/dom/base/nsOpenURIInFrameParams.cpp
@@ -5,17 +5,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsOpenURIInFrameParams.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/dom/ToJSValue.h"
NS_IMPL_ISUPPORTS(nsOpenURIInFrameParams, nsIOpenURIInFrameParams)
-nsOpenURIInFrameParams::nsOpenURIInFrameParams(const mozilla::DocShellOriginAttributes& aOriginAttributes)
+nsOpenURIInFrameParams::nsOpenURIInFrameParams(const mozilla::OriginAttributes& aOriginAttributes)
: mOpenerOriginAttributes(aOriginAttributes)
, mIsPrivate(false)
{
}
nsOpenURIInFrameParams::~nsOpenURIInFrameParams() {
}
--- a/dom/base/nsOpenURIInFrameParams.h
+++ b/dom/base/nsOpenURIInFrameParams.h
@@ -4,26 +4,26 @@
* 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/. */
#include "mozilla/BasePrincipal.h"
#include "nsIBrowserDOMWindow.h"
#include "nsString.h"
namespace mozilla {
-class DocShellOriginAttributes;
+class OriginAttributes;
}
class nsOpenURIInFrameParams final : public nsIOpenURIInFrameParams
{
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;
};
--- a/dom/cache/DBSchema.cpp
+++ b/dom/cache/DBSchema.cpp
@@ -1970,17 +1970,17 @@ ReadResponse(mozIStorageConnection* aCon
nsAutoCString serializedInfo;
rv = state->GetUTF8String(5, serializedInfo);
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
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;
}
aSavedResponseOut->mValue.principalInfo() =
mozilla::ipc::ContentPrincipalInfo(attrs, originNoSuffix);
}
--- a/dom/console/Console.cpp
+++ b/dom/console/Console.cpp
@@ -147,17 +147,17 @@ public:
MOZ_ASSERT(mIDType == eUnknown);
mOuterIDString = aOuterID;
mInnerIDString = aInnerID;
mIDType = eString;
}
void
- SetOriginAttributes(const PrincipalOriginAttributes& aOriginAttributes)
+ SetOriginAttributes(const OriginAttributes& aOriginAttributes)
{
mOriginAttributes = aOriginAttributes;
}
bool
PopulateArgumentsSequence(Sequence<JS::Value>& aSequence) const
{
AssertIsOnOwningThread();
@@ -243,17 +243,17 @@ public:
} mIDType;
uint64_t mOuterIDNumber;
nsString mOuterIDString;
uint64_t mInnerIDNumber;
nsString mInnerIDString;
- PrincipalOriginAttributes mOriginAttributes;
+ OriginAttributes mOriginAttributes;
nsString mMethodString;
// Stack management is complicated, because we want to do it as
// lazily as possible. Therefore, we have the following behavior:
// 1) mTopStackFrame is initialized whenever we have any JS on the stack
// 2) mReifiedStack is initialized if we're created in a worker.
// 3) mStack is set (possibly to null if there is no JS on the stack) if
@@ -1196,17 +1196,17 @@ Console::MethodInternal(JSContext* aCx,
ClearException ce(aCx);
if (NS_WARN_IF(!callData->Initialize(aCx, aMethodName, aMethodString,
aData, this))) {
return;
}
- PrincipalOriginAttributes oa;
+ OriginAttributes oa;
if (mWindow) {
// Save the principal's OriginAttributes in the console event data
// so that we will be able to filter messages by origin attributes.
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(mWindow);
if (NS_WARN_IF(!sop)) {
return;
}
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -662,17 +662,17 @@ ContentChild::ProvideWindow(mozIDOMWindo
aCalledFromJS, aPositionSpecified,
aSizeSpecified, aURI, aName, aFeatures,
aForceNoOpener, aWindowIsNew, aReturn);
}
static nsresult
GetWindowParamsFromParent(mozIDOMWindowProxy* aParent,
nsACString& aBaseURIString, float* aFullZoom,
- DocShellOriginAttributes& aOriginAttributes)
+ OriginAttributes& aOriginAttributes)
{
*aFullZoom = 1.0f;
auto* opener = nsPIDOMWindowOuter::From(aParent);
if (!opener) {
return NS_OK;
}
nsCOMPtr<nsIDocument> doc = opener->GetDoc();
@@ -729,17 +729,17 @@ ContentChild::ProvideWindowCommon(TabChi
nsCOMPtr<nsIWebBrowserChrome3> browserChrome3;
rv = aTabOpener->GetWebBrowserChrome(getter_AddRefs(browserChrome3));
if (NS_SUCCEEDED(rv) && browserChrome3) {
bool shouldLoad;
rv = browserChrome3->ShouldLoadURIInThisProcess(aURI, &shouldLoad);
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))) {
return rv;
}
URIParams uriToLoad;
SerializeURI(aURI, uriToLoad);
@@ -829,17 +829,17 @@ ContentChild::ProvideWindowCommon(TabChi
newChild->SendBrowserFrameOpenWindow(aTabOpener, renderFrame, NS_ConvertUTF8toUTF16(url),
name, NS_ConvertUTF8toUTF16(features),
aWindowIsNew, &textureFactoryIdentifier,
&layersId);
} else {
nsAutoCString baseURIString;
float fullZoom;
- DocShellOriginAttributes originAttributes;
+ OriginAttributes originAttributes;
rv = GetWindowParamsFromParent(aParent, baseURIString, &fullZoom,
originAttributes);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
if (!SendCreateWindow(aTabOpener, newChild, renderFrame,
aChromeFlags, aCalledFromJS, aPositionSpecified,
@@ -2319,17 +2319,17 @@ ContentChild::RecvAddPermission(const IP
nsPermissionManager* permissionManager =
static_cast<nsPermissionManager*>(permissionManagerIface.get());
MOZ_ASSERT(permissionManager,
"We have no permissionManager in the Content process !");
// 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));
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), originNoSuffix);
NS_ENSURE_SUCCESS(rv, IPC_OK());
nsCOMPtr<nsIPrincipal> principal = mozilla::BasePrincipal::CreateCodebasePrincipal(uri, attrs);
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -4172,17 +4172,17 @@ ContentParent::CommonCreateWindow(PBrows
bool aSetOpener,
const uint32_t& aChromeFlags,
const bool& aCalledFromJS,
const bool& aPositionSpecified,
const bool& aSizeSpecified,
nsIURI* aURIToLoad,
const nsCString& aFeatures,
const nsCString& aBaseURI,
- const DocShellOriginAttributes& aOpenerOriginAttributes,
+ const OriginAttributes& aOpenerOriginAttributes,
const float& aFullZoom,
nsresult& aResult,
nsCOMPtr<nsITabParent>& aNewTabParent,
bool* aWindowIsNew)
{
// The content process should never be in charge of computing whether or
// not a window should be private or remote - the parent will do that.
@@ -4296,17 +4296,17 @@ ContentParent::RecvCreateWindow(PBrowser
PBrowserParent* aNewTab,
PRenderFrameParent* aRenderFrame,
const uint32_t& aChromeFlags,
const bool& aCalledFromJS,
const bool& aPositionSpecified,
const bool& aSizeSpecified,
const nsCString& aFeatures,
const nsCString& aBaseURI,
- const DocShellOriginAttributes& aOpenerOriginAttributes,
+ const OriginAttributes& aOpenerOriginAttributes,
const float& aFullZoom,
nsresult* aResult,
bool* aWindowIsNew,
InfallibleTArray<FrameScriptInfo>* aFrameScripts,
nsCString* aURLToLoad,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId)
{
@@ -4363,17 +4363,17 @@ ContentParent::RecvCreateWindowInDiffere
PBrowserParent* aThisTab,
const uint32_t& aChromeFlags,
const bool& aCalledFromJS,
const bool& aPositionSpecified,
const bool& aSizeSpecified,
const URIParams& aURIToLoad,
const nsCString& aFeatures,
const nsCString& aBaseURI,
- const DocShellOriginAttributes& aOpenerOriginAttributes,
+ const OriginAttributes& aOpenerOriginAttributes,
const float& aFullZoom)
{
nsCOMPtr<nsITabParent> newRemoteTab;
bool windowIsNew;
nsCOMPtr<nsIURI> uriToLoad = DeserializeURI(aURIToLoad);
nsresult rv;
mozilla::ipc::IPCResult ipcResult =
CommonCreateWindow(aThisTab, /* aSetOpener = */ false, aChromeFlags,
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -495,17 +495,17 @@ public:
PBrowserParent* aNewTab,
layout::PRenderFrameParent* aRenderFrame,
const uint32_t& aChromeFlags,
const bool& aCalledFromJS,
const bool& aPositionSpecified,
const bool& aSizeSpecified,
const nsCString& aFeatures,
const nsCString& aBaseURI,
- const DocShellOriginAttributes& aOpenerOriginAttributes,
+ const OriginAttributes& aOpenerOriginAttributes,
const float& aFullZoom,
nsresult* aResult,
bool* aWindowIsNew,
InfallibleTArray<FrameScriptInfo>* aFrameScripts,
nsCString* aURLToLoad,
layers::TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId) override;
@@ -513,17 +513,17 @@ public:
PBrowserParent* aThisTab,
const uint32_t& aChromeFlags,
const bool& aCalledFromJS,
const bool& aPositionSpecified,
const bool& aSizeSpecified,
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);
static void
BroadcastBlobURLRegistration(const nsACString& aURI,
BlobImpl* aBlobImpl,
nsIPrincipal* aPrincipal,
@@ -608,17 +608,17 @@ private:
bool aSetOpener,
const uint32_t& aChromeFlags,
const bool& aCalledFromJS,
const bool& aPositionSpecified,
const bool& aSizeSpecified,
nsIURI* aURIToLoad,
const nsCString& aFeatures,
const nsCString& aBaseURI,
- const DocShellOriginAttributes& aOpenerOriginAttributes,
+ const OriginAttributes& aOpenerOriginAttributes,
const float& aFullZoom,
nsresult& aResult,
nsCOMPtr<nsITabParent>& aNewTabParent,
bool* aWindowIsNew);
FORWARD_SHMEM_ALLOCATOR_TO(PContentParent)
ContentParent(ContentParent* aOpener,
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -85,17 +85,17 @@ using mozilla::hal::ProcessPriority from
using mozilla::gfx::IntSize from "mozilla/gfx/2D.h";
using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
using mozilla::dom::ContentParentId from "mozilla/dom/ipc/IdType.h";
using mozilla::LayoutDeviceIntPoint from "Units.h";
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";
using mozilla::Telemetry::KeyedAccumulation from "mozilla/TelemetryComms.h";
union ChromeRegistryItem
{
ChromePackage;
@@ -1061,17 +1061,17 @@ parent:
PBrowser aNewTab,
PRenderFrame aRenderFrame,
uint32_t aChromeFlags,
bool aCalledFromJS,
bool aPositionSpecified,
bool aSizeSpecified,
nsCString aFeatures,
nsCString aBaseURI,
- DocShellOriginAttributes aOpenerOriginAttributes,
+ OriginAttributes aOpenerOriginAttributes,
float aFullZoom)
returns (nsresult rv,
bool windowOpened,
FrameScriptInfo[] frameScripts,
nsCString urlToLoad,
TextureFactoryIdentifier textureFactoryIdentifier,
uint64_t layersId);
@@ -1079,17 +1079,17 @@ parent:
PBrowser aThisTab,
uint32_t aChromeFlags,
bool aCalledFromJS,
bool aPositionSpecified,
bool aSizeSpecified,
URIParams aURIToLoad,
nsCString aFeatures,
nsCString aBaseURI,
- DocShellOriginAttributes aOpenerOriginAttributes,
+ OriginAttributes aOpenerOriginAttributes,
float aFullZoom);
sync GetDeviceStorageLocation(nsString type)
returns (nsString path);
sync GetDeviceStorageLocations()
returns (DeviceStorageLocationInfo info);
--- a/dom/ipc/PTabContext.ipdlh
+++ b/dom/ipc/PTabContext.ipdlh
@@ -3,17 +3,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
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 {
// An IPCTabContext which corresponds to a PBrowser opened by a child when it
// receives window.open().
//
// If isMozBrowserElement is false, this PopupIPCTabContext is either a
@@ -32,17 +32,17 @@ struct PopupIPCTabContext
PBrowserOrId opener;
bool isMozBrowserElement;
};
// An IPCTabContext which corresponds to an app, browser, or normal frame.
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.
bool isMozBrowserElement;
// Whether this TabContext should work in prerender mode.
bool isPrerendered;
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -1195,17 +1195,17 @@ TabChild::ApplyShowInfo(const ShowInfo&
if (!context->UsePrivateBrowsing()) {
if (docShell->GetHasLoadedNonBlankURI()) {
nsContentUtils::ReportToConsoleNonLocalized(
NS_LITERAL_STRING("We should not switch to Private Browsing after loading a document."),
nsIScriptError::warningFlag,
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);
}
}
}
}
mDPI = aInfo.dpi();
mRounding = aInfo.widgetRounding();
--- a/dom/ipc/TabContext.cpp
+++ b/dom/ipc/TabContext.cpp
@@ -75,17 +75,17 @@ TabContext::UpdateTabContextAfterSwap(co
if (aContext.mOriginAttributes != mOriginAttributes) {
return false;
}
mIsMozBrowserElement = aContext.mIsMozBrowserElement;
return true;
}
-const DocShellOriginAttributes&
+const OriginAttributes&
TabContext::OriginAttributesRef() const
{
return mOriginAttributes;
}
const nsAString&
TabContext::PresentationURL() const
{
@@ -104,17 +104,17 @@ TabContext::ShowFocusRings() const
return mShowFocusRings;
}
bool
TabContext::SetTabContext(bool aIsMozBrowserElement,
bool aIsPrerendered,
UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings,
- const DocShellOriginAttributes& aOriginAttributes,
+ const OriginAttributes& aOriginAttributes,
const nsAString& aPresentationURL)
{
NS_ENSURE_FALSE(mInitialized, false);
// Veryify that app id matches mAppId passed in originAttributes
MOZ_RELEASE_ASSERT(aOriginAttributes.mAppId == NO_APP_ID);
mInitialized = true;
@@ -138,17 +138,17 @@ TabContext::AsIPCTabContext() const
mShowFocusRings));
}
MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
: mInvalidReason(nullptr)
{
bool isMozBrowserElement = false;
bool isPrerendered = false;
- DocShellOriginAttributes originAttributes;
+ OriginAttributes originAttributes;
nsAutoString presentationURL;
UIStateChangeType showAccelerators = UIStateChangeType_NoChange;
UIStateChangeType showFocusRings = UIStateChangeType_NoChange;
switch(aParams.type()) {
case IPCTabContext::TPopupIPCTabContext: {
const PopupIPCTabContext &ipcContext = aParams.get_PopupIPCTabContext();
--- a/dom/ipc/TabContext.h
+++ b/dom/ipc/TabContext.h
@@ -59,21 +59,21 @@ public:
/**
* Does this TabContext correspond to a mozbrowser? This is equivalent to
* IsMozBrowserElement(). Returns false for <xul:browser>, which isn't a
* mozbrowser.
*/
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
* created for presented content
*/
const nsAString& PresentationURL() const;
UIStateChangeType ShowAccelerators() const;
@@ -100,17 +100,17 @@ protected:
* Set the tab context's origin attributes to a private browsing value.
*/
void SetPrivateBrowsingAttributes(bool aIsPrivateBrowsing);
bool SetTabContext(bool aIsMozBrowserElement,
bool aIsPrerendered,
UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings,
- const DocShellOriginAttributes& aOriginAttributes,
+ const OriginAttributes& aOriginAttributes,
const nsAString& aPresentationURL);
/**
* Modify this TabContext to match the given TabContext. This is a special
* case triggered by nsFrameLoader::SwapWithOtherRemoteLoader which may have
* caused the owner content to change.
*
* This special case only allows the field `mIsMozBrowserElement` to be
@@ -134,19 +134,19 @@ private:
* Whether this TabContext corresponds to a mozbrowser.
*
* <iframe mozbrowser> and <xul:browser> are not considered to be
* mozbrowser elements.
*/
bool mIsMozBrowserElement;
/**
- * DocShellOriginAttributes of the top level tab docShell
+ * OriginAttributes of the top level tab docShell
*/
- DocShellOriginAttributes mOriginAttributes;
+ OriginAttributes mOriginAttributes;
/**
* The requested presentation URL.
*/
nsString mPresentationURL;
/**
* Keyboard indicator state (focus rings, accelerators).
@@ -168,17 +168,17 @@ public:
return TabContext::SetTabContext(aContext);
}
bool
SetTabContext(bool aIsMozBrowserElement,
bool aIsPrerendered,
UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings,
- const DocShellOriginAttributes& aOriginAttributes,
+ const OriginAttributes& aOriginAttributes,
const nsAString& aPresentationURL = EmptyString())
{
return TabContext::SetTabContext(aIsMozBrowserElement,
aIsPrerendered,
aShowAccelerators,
aShowFocusRings,
aOriginAttributes,
aPresentationURL);
--- a/dom/media/gmp/GMPServiceParent.cpp
+++ b/dom/media/gmp/GMPServiceParent.cpp
@@ -1585,30 +1585,30 @@ MatchOrigin(nsIFile* aPath,
const mozilla::OriginAttributesPattern& aPattern)
{
// http://en.wikipedia.org/wiki/Domain_Name_System#Domain_name_syntax
static const uint32_t MaxDomainLength = 253;
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)) {
// Fails on parsing the originAttributes, treat this as a non-match.
return false;
}
if (NS_SUCCEEDED(rv) && ExtractHostName(originNoSuffix, str) && str.Equals(aSite) &&
aPattern.Matches(originAttributes)) {
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.
return false;
}
if (NS_SUCCEEDED(rv) && ExtractHostName(originNoSuffix, str) && str.Equals(aSite) &&
aPattern.Matches(topLevelOriginAttributes)) {
--- a/dom/media/gtest/TestGMPCrossOrigin.cpp
+++ b/dom/media/gtest/TestGMPCrossOrigin.cpp
@@ -465,17 +465,17 @@ GetNodeId(const nsAString& aOrigin,
RefPtr<GeckoMediaPluginServiceParent> service =
GeckoMediaPluginServiceParent::GetSingleton();
EXPECT_TRUE(service);
nsCString nodeId;
nsresult result;
UniquePtr<GetNodeIdCallback> callback(new TestGetNodeIdCallback(nodeId,
result));
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
attrs.mPrivateBrowsingId = aInPBMode ? 1 : 0;
nsAutoCString suffix;
attrs.CreateSuffix(suffix);
nsAutoString origin;
origin.Assign(aOrigin);
origin.Append(NS_ConvertUTF8toUTF16(suffix));
--- a/dom/media/systemservices/CamerasParent.cpp
+++ b/dom/media/systemservices/CamerasParent.cpp
@@ -635,17 +635,17 @@ CamerasParent::RecvGetCaptureDevice(cons
DispatchToVideoCaptureThread(webrtc_runnable);
return IPC_OK();
}
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;
}
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), originNoSuffix);
NS_ENSURE_SUCCESS(rv, rv);
--- a/dom/offline/nsDOMOfflineResourceList.cpp
+++ b/dom/offline/nsDOMOfflineResourceList.cpp
@@ -809,17 +809,17 @@ nsDOMOfflineResourceList::CacheKeys()
return NS_OK;
nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(GetOwner());
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(window);
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(webNav);
nsAutoCString originSuffix;
if (loadContext) {
- mozilla::DocShellOriginAttributes oa;
+ mozilla::OriginAttributes oa;
bool ok = loadContext->GetOriginAttributes(oa);
NS_ENSURE_TRUE(ok, NS_ERROR_UNEXPECTED);
oa.CreateSuffix(originSuffix);
}
nsAutoCString groupID;
mApplicationCacheService->BuildGroupIDForSuffix(
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -556,17 +556,17 @@ NS_IMETHODIMP nsPluginInstanceOwner::Get
// if security checks (in particular CheckLoadURIWithPrincipal) needs
// to be skipped we are creating a codebasePrincipal to make sure
// that security check succeeds. Please note that we do not want to
// fall back to using the systemPrincipal, because that would also
// 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);
}
rv = lh->OnLinkClick(content, uri, unitarget.get(), NullString(),
aPostStream, headersDataStream, true, triggeringPrincipal);
return rv;
--- a/dom/presentation/PresentationRequest.cpp
+++ b/dom/presentation/PresentationRequest.cpp
@@ -527,17 +527,17 @@ PresentationRequest::IsPrioriAuthenticat
return false;
}
if (uriSpec.EqualsLiteral("about:blank") ||
uriSpec.EqualsLiteral("about:srcdoc")) {
return true;
}
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
nsCOMPtr<nsIPrincipal> principal =
BasePrincipal::CreateCodebasePrincipal(uri, attrs);
if (NS_WARN_IF(!principal)) {
return false;
}
nsCOMPtr<nsIContentSecurityManager> csm =
do_GetService(NS_CONTENTSECURITYMANAGER_CONTRACTID);
--- a/dom/quota/ActorsParent.cpp
+++ b/dom/quota/ActorsParent.cpp
@@ -1357,17 +1357,17 @@ struct StorageDirectoryHelper::OriginPro
enum Type
{
eChrome,
eContent
};
nsCOMPtr<nsIFile> mDirectory;
nsCString mSpec;
- PrincipalOriginAttributes mAttrs;
+ OriginAttributes mAttrs;
int64_t mTimestamp;
nsCString mSuffix;
nsCString mGroup;
nsCString mOrigin;
Type mType;
bool mIsApp;
bool mNeedsRestore;
@@ -1410,17 +1410,17 @@ class MOZ_STACK_CLASS OriginParser final
eExpectingPort,
eExpectingEmptyTokenOrDriveLetterOrPathnameComponent,
eExpectingEmptyTokenOrPathnameComponent,
eComplete,
eHandledTrailingSeparator
};
const nsCString mOrigin;
- const PrincipalOriginAttributes mOriginAttributes;
+ const OriginAttributes mOriginAttributes;
Tokenizer mTokenizer;
uint32_t mAppId;
nsCString mSchema;
nsCString mHost;
Nullable<uint32_t> mPort;
nsTArray<nsCString> mPathnameComponents;
nsCString mHandledTokens;
@@ -1428,36 +1428,36 @@ class MOZ_STACK_CLASS OriginParser final
SchemaType mSchemaType;
State mState;
bool mInIsolatedMozBrowser;
bool mMaybeDriveLetter;
bool mError;
public:
OriginParser(const nsACString& aOrigin,
- const PrincipalOriginAttributes& aOriginAttributes)
+ const OriginAttributes& aOriginAttributes)
: mOrigin(aOrigin)
, mOriginAttributes(aOriginAttributes)
, mTokenizer(aOrigin, '+')
, mAppId(kNoAppId)
, mPort()
, mSchemaType(eNone)
, mState(eExpectingAppIdOrSchema)
, mInIsolatedMozBrowser(false)
, mMaybeDriveLetter(false)
, mError(false)
{ }
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
HandleSchema(const nsDependentCSubstring& aSchema);
void
HandlePathnameComponent(const nsDependentCSubstring& aSchema);
@@ -1870,32 +1870,32 @@ GetJarPrefix(uint32_t aAppId,
nsresult
CreateDirectoryMetadata(nsIFile* aDirectory, int64_t aTimestamp,
const nsACString& aSuffix, const nsACString& aGroup,
const nsACString& aOrigin, bool aIsApp)
{
AssertIsOnIOThread();
- PrincipalOriginAttributes groupAttributes;
+ OriginAttributes groupAttributes;
nsCString groupNoSuffix;
bool ok = groupAttributes.PopulateFromOrigin(aGroup, groupNoSuffix);
if (!ok) {
return NS_ERROR_FAILURE;
}
nsCString groupPrefix;
GetJarPrefix(groupAttributes.mAppId,
groupAttributes.mInIsolatedMozBrowser,
groupPrefix);
nsCString group = groupPrefix + groupNoSuffix;
- PrincipalOriginAttributes originAttributes;
+ OriginAttributes originAttributes;
nsCString originNoSuffix;
ok = originAttributes.PopulateFromOrigin(aOrigin, originNoSuffix);
if (!ok) {
return NS_ERROR_FAILURE;
}
nsCString originPrefix;
@@ -4562,17 +4562,17 @@ QuotaManager::EnsureOriginIsInitialized(
nsString leafName;
nsresult rv = directory->GetLeafName(leafName);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
if (!leafName.EqualsLiteral(kChromeOrigin)) {
nsCString spec;
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
bool result = OriginParser::ParseOrigin(NS_ConvertUTF16toUTF8(leafName),
spec, &attrs);
if (NS_WARN_IF(!result)) {
QM_WARNING("Preventing creation of a new origin directory which is not "
"supported by our origin parser!");
return NS_ERROR_FAILURE;
}
@@ -6542,17 +6542,17 @@ StorageDirectoryHelper::AddOriginDirecto
if (leafName.EqualsLiteral(kChromeOrigin)) {
originProps = mOriginProps.AppendElement();
originProps->mDirectory = aDirectory;
originProps->mSpec = kChromeOrigin;
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)) {
return NS_ERROR_FAILURE;
}
originProps = mOriginProps.AppendElement();
originProps->mDirectory = aDirectory;
@@ -6680,35 +6680,35 @@ StorageDirectoryHelper::Run()
return NS_OK;
}
// static
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);
if (!ok) {
return false;
}
OriginParser parser(originNoSuffix, originAttributes);
return parser.Parse(aSpec, aAttrs);
}
bool
-OriginParser::Parse(nsACString& aSpec, PrincipalOriginAttributes* aAttrs)
+OriginParser::Parse(nsACString& aSpec, OriginAttributes* aAttrs)
{
MOZ_ASSERT(aAttrs);
while (mTokenizer.hasMoreTokens()) {
const nsDependentCSubstring& token = mTokenizer.nextToken();
HandleToken(token);
@@ -6737,17 +6737,17 @@ OriginParser::Parse(nsACString& aSpec, P
MOZ_ASSERT(mState == eComplete || mState == eHandledTrailingSeparator);
if (mAppId == kNoAppId) {
*aAttrs = mOriginAttributes;
} else {
MOZ_ASSERT(mOriginAttributes.mAppId == kNoAppId);
- *aAttrs = PrincipalOriginAttributes(mAppId, mInIsolatedMozBrowser);
+ *aAttrs = OriginAttributes(mAppId, mInIsolatedMozBrowser);
}
nsAutoCString spec(mSchema);
if (mSchemaType == eFile) {
spec.AppendLiteral("://");
for (uint32_t count = mPathnameComponents.Length(), index = 0;
--- a/dom/quota/OriginScope.h
+++ b/dom/quota/OriginScope.h
@@ -23,17 +23,17 @@ public:
ePrefix,
eNull
};
private:
struct OriginAndAttributes
{
nsCString mOrigin;
- PrincipalOriginAttributes mAttributes;
+ OriginAttributes mAttributes;
OriginAndAttributes(const OriginAndAttributes& aOther)
: mOrigin(aOther.mOrigin)
, mAttributes(aOther.mAttributes)
{
MOZ_COUNT_CTOR(OriginAndAttributes);
}
--- a/dom/storage/StorageDBThread.cpp
+++ b/dom/storage/StorageDBThread.cpp
@@ -49,17 +49,17 @@ namespace { // anon
// key in the schema version 0 format for the scope column.
nsCString
Scheme0Scope(StorageCacheBridge* aCache)
{
nsCString result;
nsCString suffix = aCache->OriginSuffix();
- PrincipalOriginAttributes oa;
+ OriginAttributes oa;
if (!suffix.IsEmpty()) {
DebugOnly<bool> success = oa.PopulateFromSuffix(suffix);
MOZ_ASSERT(success);
}
if (oa.mAppId != nsIScriptSecurityManager::NO_APP_ID ||
oa.mInIsolatedMozBrowser) {
result.AppendInt(oa.mAppId);
@@ -763,17 +763,17 @@ OriginAttrsPatternMatchSQLFunction::OnFu
mozIStorageValueArray* aFunctionArguments, nsIVariant** aResult)
{
nsresult rv;
nsAutoCString suffix;
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);
RefPtr<nsVariant> outVar(new nsVariant());
rv = outVar->SetAsBool(result);
NS_ENSURE_SUCCESS(rv, rv);
@@ -1203,17 +1203,17 @@ StorageDBThread::PendingOperations::HasT
return !!mUpdates.Count() || !!mClears.Count();
}
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);
}
} // namespace
bool
--- a/dom/storage/StorageDBUpdater.cpp
+++ b/dom/storage/StorageDBUpdater.cpp
@@ -130,17 +130,17 @@ public:
Token t;
while (Next(t)) {
if (t.Equals(Token::Char(':'))) {
Claim(suffix);
break;
}
}
} else {
- PrincipalOriginAttributes attrs(appId, inIsolatedMozBrowser);
+ OriginAttributes attrs(appId, inIsolatedMozBrowser);
attrs.CreateSuffix(suffix);
}
// Consume the rest of the input as "origin".
origin.Assign(Substring(mCursor, mEnd));
}
};
--- a/dom/storage/StorageManager.cpp
+++ b/dom/storage/StorageManager.cpp
@@ -480,17 +480,17 @@ StorageManagerBase::GetLocalStorageForPr
}
void
StorageManagerBase::ClearCaches(uint32_t aUnloadFlags,
const OriginAttributesPattern& aPattern,
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)) {
// This table doesn't match the given origin attributes pattern
continue;
}
CacheOriginHashtable* table = iter1.Data();
--- a/dom/workers/PServiceWorkerManager.ipdl
+++ b/dom/workers/PServiceWorkerManager.ipdl
@@ -2,43 +2,43 @@
* 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/. */
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 {
protocol PServiceWorkerManager
{
manager PBackground;
parent:
async Register(ServiceWorkerRegistrationData data);
async Unregister(PrincipalInfo principalInfo, nsString scope);
- async PropagateSoftUpdate(PrincipalOriginAttributes originAttributes,
+ async PropagateSoftUpdate(OriginAttributes originAttributes,
nsString scope);
async PropagateUnregister(PrincipalInfo principalInfo, nsString scope);
async PropagateRemove(nsCString host);
async PropagateRemoveAll();
async Shutdown();
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();
async __delete__();
};
} // namespace dom
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -247,17 +247,17 @@ GetWorkerPref(const nsACString& aPref,
}
// This fn creates a key for a SharedWorker that contains the name, script
// spec, and the serialized origin attributes:
// "name|scriptSpec^key1=val1&key2=val2&key3=val3"
void
GenerateSharedWorkerKey(const nsACString& aScriptSpec,
const nsACString& aName,
- const PrincipalOriginAttributes& aAttrs,
+ const OriginAttributes& aAttrs,
nsCString& aKey)
{
nsAutoCString suffix;
aAttrs.CreateSuffix(suffix);
aKey.Truncate();
aKey.SetCapacity(aName.Length() + aScriptSpec.Length() + suffix.Length() + 2);
aKey.Append(aName);
--- a/dom/workers/ScriptLoader.cpp
+++ b/dom/workers/ScriptLoader.cpp
@@ -412,17 +412,17 @@ private:
FailLoaders(nsresult aRv);
RefPtr<Cache> mCache;
RefPtr<CacheStorage> mCacheStorage;
nsCOMPtr<nsIGlobalObject> mSandboxGlobalObject;
nsTArray<RefPtr<CacheScriptLoader>> mLoaders;
nsString mCacheName;
- PrincipalOriginAttributes mOriginAttributes;
+ OriginAttributes mOriginAttributes;
};
NS_IMPL_ISUPPORTS0(CacheCreator)
class CacheScriptLoader final : public PromiseNativeHandler
, public nsIStreamLoaderObserver
{
public:
--- a/dom/workers/ServiceWorkerInfo.h
+++ b/dom/workers/ServiceWorkerInfo.h
@@ -27,17 +27,17 @@ class ServiceWorkerInfo final : public n
{
private:
nsCOMPtr<nsIPrincipal> mPrincipal;
const nsCString mScope;
const nsCString mScriptSpec;
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.
uint64_t mServiceWorkerID;
// We hold rawptrs since the ServiceWorker constructor and destructor ensure
// addition and removal.
// There is a high chance of there being at least one ServiceWorker
@@ -108,17 +108,17 @@ public:
nsLoadFlags aLoadFlags);
ServiceWorkerState
State() const
{
return mState;
}
- const PrincipalOriginAttributes&
+ const OriginAttributes&
GetOriginAttributes() const
{
return mOriginAttributes;
}
const nsString&
CacheName() const
{
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -316,17 +316,17 @@ public:
NS_INLINE_DECL_REFCOUNTING(ServiceWorkerResolveWindowPromiseOnRegisterCallback, override)
};
namespace {
class PropagateSoftUpdateRunnable final : public Runnable
{
public:
- PropagateSoftUpdateRunnable(const PrincipalOriginAttributes& aOriginAttributes,
+ PropagateSoftUpdateRunnable(const OriginAttributes& aOriginAttributes,
const nsAString& aScope)
: mOriginAttributes(aOriginAttributes)
, mScope(aScope)
{}
NS_IMETHOD Run() override
{
AssertIsOnMainThread();
@@ -337,17 +337,17 @@ public:
swm->PropagateSoftUpdate(mOriginAttributes, mScope);
return NS_OK;
}
private:
~PropagateSoftUpdateRunnable()
{}
- const PrincipalOriginAttributes mOriginAttributes;
+ const OriginAttributes mOriginAttributes;
const nsString mScope;
};
class PropagateUnregisterRunnable final : public Runnable
{
public:
PropagateUnregisterRunnable(nsIPrincipal* aPrincipal,
nsIServiceWorkerUnregisterCallback* aCallback,
@@ -923,17 +923,17 @@ ServiceWorkerManager::SendPushEvent(cons
}
nsresult
ServiceWorkerManager::SendPushEvent(const nsACString& aOriginAttributes,
const nsACString& aScope,
const nsAString& aMessageId,
const Maybe<nsTArray<uint8_t>>& aData)
{
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
if (!attrs.PopulateFromSuffix(aOriginAttributes)) {
return NS_ERROR_INVALID_ARG;
}
ServiceWorkerInfo* serviceWorker = GetActiveWorkerInfoForScope(attrs, aScope);
if (NS_WARN_IF(!serviceWorker)) {
return NS_ERROR_FAILURE;
}
@@ -945,17 +945,17 @@ ServiceWorkerManager::SendPushEvent(cons
return serviceWorker->WorkerPrivate()->SendPushEvent(aMessageId, aData,
registration);
}
NS_IMETHODIMP
ServiceWorkerManager::SendPushSubscriptionChangeEvent(const nsACString& aOriginAttributes,
const nsACString& aScope)
{
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
if (!attrs.PopulateFromSuffix(aOriginAttributes)) {
return NS_ERROR_INVALID_ARG;
}
ServiceWorkerInfo* info = GetActiveWorkerInfoForScope(attrs, aScope);
if (!info) {
return NS_ERROR_FAILURE;
}
@@ -971,17 +971,17 @@ ServiceWorkerManager::SendNotificationEv
const nsAString& aDir,
const nsAString& aLang,
const nsAString& aBody,
const nsAString& aTag,
const nsAString& aIcon,
const nsAString& aData,
const nsAString& aBehavior)
{
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
if (!attrs.PopulateFromSuffix(aOriginSuffix)) {
return NS_ERROR_INVALID_ARG;
}
ServiceWorkerInfo* info = GetActiveWorkerInfoForScope(attrs, aScope);
if (!info) {
return NS_ERROR_FAILURE;
}
@@ -1131,17 +1131,17 @@ ServiceWorkerManager::CheckReadyPromise(
aPromise->MaybeResolve(swr);
return true;
}
return false;
}
ServiceWorkerInfo*
-ServiceWorkerManager::GetActiveWorkerInfoForScope(const PrincipalOriginAttributes& aOriginAttributes,
+ServiceWorkerManager::GetActiveWorkerInfoForScope(const OriginAttributes& aOriginAttributes,
const nsACString& aScope)
{
AssertIsOnMainThread();
nsCOMPtr<nsIURI> scopeURI;
nsresult rv = NS_NewURI(getter_AddRefs(scopeURI), aScope, nullptr, nullptr);
if (NS_FAILED(rv)) {
return nullptr;
@@ -2334,17 +2334,17 @@ public:
return NS_OK;
}
};
} // anonymous namespace
void
-ServiceWorkerManager::DispatchFetchEvent(const PrincipalOriginAttributes& aOriginAttributes,
+ServiceWorkerManager::DispatchFetchEvent(const OriginAttributes& aOriginAttributes,
nsIDocument* aDoc,
const nsAString& aDocumentIdForTopLevelNavigation,
nsIInterceptedChannel* aChannel,
bool aIsReload,
bool aIsSubresourceLoad,
ErrorResult& aRv)
{
MOZ_ASSERT(aChannel);
@@ -2608,17 +2608,17 @@ ServiceWorkerManager::NotifyServiceWorke
if (utf8Scope.Equals(aRegistration->mScope)) {
target->RegistrationRemoved();
}
}
}
void
-ServiceWorkerManager::SoftUpdate(const PrincipalOriginAttributes& aOriginAttributes,
+ServiceWorkerManager::SoftUpdate(const OriginAttributes& aOriginAttributes,
const nsACString& aScope)
{
AssertIsOnMainThread();
if (mShuttingDown) {
return;
}
@@ -3589,27 +3589,27 @@ ServiceWorkerManager::Observe(nsISupport
NS_IMETHODIMP
ServiceWorkerManager::PropagateSoftUpdate(JS::Handle<JS::Value> aOriginAttributes,
const nsAString& aScope,
JSContext* aCx)
{
AssertIsOnMainThread();
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
if (!aOriginAttributes.isObject() || !attrs.Init(aCx, aOriginAttributes)) {
return NS_ERROR_INVALID_ARG;
}
PropagateSoftUpdate(attrs, aScope);
return NS_OK;
}
void
-ServiceWorkerManager::PropagateSoftUpdate(const PrincipalOriginAttributes& aOriginAttributes,
+ServiceWorkerManager::PropagateSoftUpdate(const OriginAttributes& aOriginAttributes,
const nsAString& aScope)
{
AssertIsOnMainThread();
if (!mActor) {
RefPtr<nsIRunnable> runnable =
new PropagateSoftUpdateRunnable(aOriginAttributes, aScope);
AppendPendingOperation(runnable);
@@ -3915,17 +3915,17 @@ ServiceWorkerManager::UpdateTimerFired(n
if (!registration) {
return;
}
if (!registration->CheckAndClearIfUpdateNeeded()) {
return;
}
- PrincipalOriginAttributes attrs = aPrincipal->OriginAttributesRef();
+ OriginAttributes attrs = aPrincipal->OriginAttributesRef();
SoftUpdate(attrs, aScope);
}
void
ServiceWorkerManager::MaybeSendUnregister(nsIPrincipal* aPrincipal,
const nsACString& aScope)
{
--- a/dom/workers/ServiceWorkerManager.h
+++ b/dom/workers/ServiceWorkerManager.h
@@ -32,17 +32,17 @@
#include "nsRefPtrHashtable.h"
#include "nsTArrayForwardDeclare.h"
#include "nsTObserverArray.h"
class nsIConsoleReportCollector;
namespace mozilla {
-class PrincipalOriginAttributes;
+class OriginAttributes;
namespace dom {
class ServiceWorkerRegistrationListener;
namespace workers {
class ServiceWorkerClientInfo;
@@ -145,35 +145,35 @@ public:
// semantics that ensure this method returns true until the worker is known to
// have shut down in order to allow the caller to induce a crash for security
// reasons without having to worry about shutdown races with the worker.
bool
MayHaveActiveServiceWorkerInstance(ContentParent* aContent,
nsIPrincipal* aPrincipal);
void
- DispatchFetchEvent(const PrincipalOriginAttributes& aOriginAttributes,
+ DispatchFetchEvent(const OriginAttributes& aOriginAttributes,
nsIDocument* aDoc,
const nsAString& aDocumentIdForTopLevelNavigation,
nsIInterceptedChannel* aChannel,
bool aIsReload,
bool aIsSubresourceLoad,
ErrorResult& aRv);
void
Update(nsIPrincipal* aPrincipal,
const nsACString& aScope,
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
PropagateRemove(const nsACString& aHost);
void
Remove(const nsACString& aHost);
@@ -353,17 +353,17 @@ private:
nsresult
GetServiceWorkerForScope(nsPIDOMWindowInner* aWindow,
const nsAString& aScope,
WhichServiceWorker aWhichWorker,
nsISupports** aServiceWorker);
ServiceWorkerInfo*
- GetActiveWorkerInfoForScope(const PrincipalOriginAttributes& aOriginAttributes,
+ GetActiveWorkerInfoForScope(const OriginAttributes& aOriginAttributes,
const nsACString& aScope);
ServiceWorkerInfo*
GetActiveWorkerInfoForDocument(nsIDocument* aDocument);
void
TransitionServiceWorkerRegistrationWorker(ServiceWorkerRegistrationInfo* aRegistration,
WhichServiceWorker aWhichOne);
--- a/dom/workers/ServiceWorkerManagerChild.cpp
+++ b/dom/workers/ServiceWorkerManagerChild.cpp
@@ -27,17 +27,17 @@ ServiceWorkerManagerChild::RecvNotifyReg
MOZ_ASSERT(swm);
swm->LoadRegistration(aData);
return IPC_OK();
}
mozilla::ipc::IPCResult
ServiceWorkerManagerChild::RecvNotifySoftUpdate(
- const PrincipalOriginAttributes& aOriginAttributes,
+ const OriginAttributes& aOriginAttributes,
const nsString& aScope)
{
if (mShuttingDown) {
return IPC_OK();
}
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
MOZ_ASSERT(swm);
--- a/dom/workers/ServiceWorkerManagerChild.h
+++ b/dom/workers/ServiceWorkerManagerChild.h
@@ -7,17 +7,17 @@
#ifndef mozilla_dom_ServiceWorkerManagerChild_h
#define mozilla_dom_ServiceWorkerManagerChild_h
#include "mozilla/dom/PServiceWorkerManagerChild.h"
#include "mozilla/ipc/BackgroundUtils.h"
namespace mozilla {
-class PrincipalOriginAttributes;
+class OriginAttributes;
namespace ipc {
class BackgroundChildImpl;
} // namespace ipc
namespace dom {
namespace workers {
@@ -31,17 +31,17 @@ public:
void ManagerShuttingDown()
{
mShuttingDown = true;
}
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,
const nsString& aScope) override;
virtual mozilla::ipc::IPCResult RecvNotifyRemove(const nsCString& aHost) override;
virtual mozilla::ipc::IPCResult RecvNotifyRemoveAll() override;
--- a/dom/workers/ServiceWorkerManagerParent.cpp
+++ b/dom/workers/ServiceWorkerManagerParent.cpp
@@ -226,17 +226,17 @@ ServiceWorkerManagerParent::RecvUnregist
new CheckPrincipalWithCallbackRunnable(parent.forget(), aPrincipalInfo,
callback);
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
return IPC_OK();
}
mozilla::ipc::IPCResult
-ServiceWorkerManagerParent::RecvPropagateSoftUpdate(const PrincipalOriginAttributes& aOriginAttributes,
+ServiceWorkerManagerParent::RecvPropagateSoftUpdate(const OriginAttributes& aOriginAttributes,
const nsString& aScope)
{
AssertIsOnBackgroundThread();
if (NS_WARN_IF(!mService)) {
return IPC_FAIL_NO_REASON(this);
}
--- a/dom/workers/ServiceWorkerManagerParent.h
+++ b/dom/workers/ServiceWorkerManagerParent.h
@@ -6,17 +6,17 @@
#ifndef mozilla_dom_ServiceWorkerManagerParent_h
#define mozilla_dom_ServiceWorkerManagerParent_h
#include "mozilla/dom/PServiceWorkerManagerParent.h"
namespace mozilla {
-class PrincipalOriginAttributes;
+class OriginAttributes;
namespace ipc {
class BackgroundParentImpl;
} // namespace ipc
namespace dom {
namespace workers {
@@ -39,17 +39,17 @@ private:
~ServiceWorkerManagerParent();
virtual mozilla::ipc::IPCResult RecvRegister(
const ServiceWorkerRegistrationData& aData) override;
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,
const nsString& aScope) override;
virtual mozilla::ipc::IPCResult RecvPropagateRemove(const nsCString& aHost) override;
virtual mozilla::ipc::IPCResult RecvPropagateRemoveAll() override;
--- a/dom/workers/ServiceWorkerManagerService.cpp
+++ b/dom/workers/ServiceWorkerManagerService.cpp
@@ -108,17 +108,17 @@ ServiceWorkerManagerService::PropagateRe
#ifdef DEBUG
MOZ_ASSERT(parentFound);
#endif
}
void
ServiceWorkerManagerService::PropagateSoftUpdate(
uint64_t aParentID,
- const PrincipalOriginAttributes& aOriginAttributes,
+ const OriginAttributes& aOriginAttributes,
const nsAString& aScope)
{
AssertIsOnBackgroundThread();
DebugOnly<bool> parentFound = false;
for (auto iter = mAgents.Iter(); !iter.Done(); iter.Next()) {
RefPtr<ServiceWorkerManagerParent> parent = iter.Get()->GetKey();
MOZ_ASSERT(parent);
--- a/dom/workers/ServiceWorkerManagerService.h
+++ b/dom/workers/ServiceWorkerManagerService.h
@@ -8,17 +8,17 @@
#define mozilla_dom_ServiceWorkerManagerService_h
#include "nsISupportsImpl.h"
#include "nsHashKeys.h"
#include "nsTHashtable.h"
namespace mozilla {
-class PrincipalOriginAttributes;
+class OriginAttributes;
namespace ipc {
class PrincipalInfo;
} // namespace ipc
namespace dom {
class ServiceWorkerRegistrationData;
@@ -37,17 +37,17 @@ public:
void RegisterActor(ServiceWorkerManagerParent* aParent);
void UnregisterActor(ServiceWorkerManagerParent* aParent);
void PropagateRegistration(uint64_t aParentID,
ServiceWorkerRegistrationData& aData);
void PropagateSoftUpdate(uint64_t aParentID,
- const PrincipalOriginAttributes& aOriginAttributes,
+ const OriginAttributes& aOriginAttributes,
const nsAString& aScope);
void PropagateUnregister(uint64_t aParentID,
const mozilla::ipc::PrincipalInfo& aPrincipalInfo,
const nsAString& aScope);
void PropagateRemove(uint64_t aParentID, const nsACString& aHost);
--- a/dom/workers/ServiceWorkerRegistrar.cpp
+++ b/dom/workers/ServiceWorkerRegistrar.cpp
@@ -336,17 +336,17 @@ ServiceWorkerRegistrar::ReadData()
}
nsAutoCString line;
nsAutoCString unused;
if (version.EqualsLiteral(SERVICEWORKERREGISTRAR_VERSION)) {
nsAutoCString suffix;
GET_LINE(suffix);
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
if (!attrs.PopulateFromSuffix(suffix)) {
return NS_ERROR_INVALID_ARG;
}
GET_LINE(entry->scope());
entry->principal() =
mozilla::ipc::ContentPrincipalInfo(attrs, entry->scope());
@@ -377,17 +377,17 @@ ServiceWorkerRegistrar::ReadData()
}
} else if (version.EqualsLiteral("5")) {
overwrite = true;
dedupe = true;
nsAutoCString suffix;
GET_LINE(suffix);
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
if (!attrs.PopulateFromSuffix(suffix)) {
return NS_ERROR_INVALID_ARG;
}
GET_LINE(entry->scope());
entry->principal() =
mozilla::ipc::ContentPrincipalInfo(attrs, entry->scope());
@@ -410,17 +410,17 @@ ServiceWorkerRegistrar::ReadData()
entry->loadFlags() = nsIRequest::VALIDATE_ALWAYS;
} else if (version.EqualsLiteral("4")) {
overwrite = true;
dedupe = true;
nsAutoCString suffix;
GET_LINE(suffix);
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
if (!attrs.PopulateFromSuffix(suffix)) {
return NS_ERROR_INVALID_ARG;
}
GET_LINE(entry->scope());
entry->principal() =
mozilla::ipc::ContentPrincipalInfo(attrs, entry->scope());
@@ -437,17 +437,17 @@ ServiceWorkerRegistrar::ReadData()
entry->loadFlags() = nsIRequest::VALIDATE_ALWAYS;
} else if (version.EqualsLiteral("3")) {
overwrite = true;
dedupe = true;
nsAutoCString suffix;
GET_LINE(suffix);
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
if (!attrs.PopulateFromSuffix(suffix)) {
return NS_ERROR_INVALID_ARG;
}
// principal spec is no longer used; we use scope directly instead
GET_LINE(unused);
GET_LINE(entry->scope());
@@ -467,17 +467,17 @@ ServiceWorkerRegistrar::ReadData()
entry->loadFlags() = nsIRequest::VALIDATE_ALWAYS;
} else if (version.EqualsLiteral("2")) {
overwrite = true;
dedupe = true;
nsAutoCString suffix;
GET_LINE(suffix);
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
if (!attrs.PopulateFromSuffix(suffix)) {
return NS_ERROR_INVALID_ARG;
}
// principal spec is no longer used; we use scope directly instead
GET_LINE(unused);
GET_LINE(entry->scope());
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -4458,17 +4458,17 @@ WorkerPrivate::GetLoadInfo(JSContext* aC
if (NS_FAILED(rv)) {
return rv;
}
}
loadInfo.mXHRParamsAllowed = true;
loadInfo.mFromWindow = false;
loadInfo.mWindowID = UINT64_MAX;
loadInfo.mStorageAllowed = true;
- loadInfo.mOriginAttributes = PrincipalOriginAttributes();
+ loadInfo.mOriginAttributes = OriginAttributes();
}
MOZ_ASSERT(loadInfo.mPrincipal);
MOZ_ASSERT(isChrome || !loadInfo.mDomain.IsEmpty());
if (!loadInfo.mLoadGroup || aLoadGroupBehavior == OverrideLoadGroup) {
OverrideLoadInfoLoadGroup(loadInfo);
}
--- a/dom/workers/WorkerPrivate.h
+++ b/dom/workers/WorkerPrivate.h
@@ -784,17 +784,17 @@ public:
}
bool
IsStorageAllowed() const
{
return mLoadInfo.mStorageAllowed;
}
- const PrincipalOriginAttributes&
+ const OriginAttributes&
GetOriginAttributes() const
{
return mLoadInfo.mOriginAttributes;
}
// Determine if the SW testing per-window flag is set by devtools
bool
ServiceWorkersTestingInWindow() const
--- a/dom/workers/Workers.h
+++ b/dom/workers/Workers.h
@@ -266,17 +266,17 @@ struct WorkerLoadInfo
net::ReferrerPolicy mReferrerPolicy;
bool mFromWindow;
bool mEvalAllowed;
bool mReportCSPViolations;
bool mXHRParamsAllowed;
bool mPrincipalIsSystem;
bool mStorageAllowed;
bool mServiceWorkersTestingInWindow;
- PrincipalOriginAttributes mOriginAttributes;
+ OriginAttributes mOriginAttributes;
WorkerLoadInfo();
~WorkerLoadInfo();
void StealFrom(WorkerLoadInfo& aOther);
};
// All of these are implemented in RuntimeService.cpp
--- a/dom/workers/test/gtest/TestReadWrite.cpp
+++ b/dom/workers/test/gtest/TestReadWrite.cpp
@@ -234,17 +234,17 @@ TEST(ServiceWorkerRegistrar, TestWriteDa
reg.currentWorkerHandlesFetch() = true;
reg.cacheName() =
NS_ConvertUTF8toUTF16(nsPrintfCString("cacheName write %d", i));
reg.loadFlags() = nsIRequest::VALIDATE_ALWAYS;
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);
}
nsresult rv = swr->TestWriteData();
ASSERT_EQ(NS_OK, rv) << "WriteData() should not fail";
}
@@ -257,17 +257,17 @@ TEST(ServiceWorkerRegistrar, TestWriteDa
ASSERT_EQ((uint32_t)10, data.Length()) << "10 entries should be found";
for (int i = 0; i < 10; ++i) {
nsAutoCString test;
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);
ASSERT_STREQ(expectSuffix.get(), suffix.get());
test.AppendPrintf("scope write %d", i);
ASSERT_STREQ(test.get(), cInfo.spec().get());
@@ -588,17 +588,17 @@ TEST(ServiceWorkerRegistrar, TestDedupeW
reg.currentWorkerHandlesFetch() = true;
reg.cacheName() =
NS_ConvertUTF8toUTF16(nsPrintfCString("cacheName write %d", i));
reg.loadFlags() = nsIRequest::VALIDATE_ALWAYS;
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);
}
nsresult rv = swr->TestWriteData();
ASSERT_EQ(NS_OK, rv) << "WriteData() should not fail";
}
@@ -609,17 +609,17 @@ TEST(ServiceWorkerRegistrar, TestDedupeW
// Duplicate entries should be removed.
const nsTArray<ServiceWorkerRegistrationData>& data = swr->TestGetData();
ASSERT_EQ((uint32_t)1, data.Length()) << "1 entry should be found";
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);
// Last entry passed to RegisterServiceWorkerInternal() should overwrite
// previous values. So expect "9" in values here.
ASSERT_STREQ(expectSuffix.get(), suffix.get());
ASSERT_STREQ("scope write dedupe", cInfo.spec().get());
--- a/dom/xhr/XMLHttpRequestMainThread.cpp
+++ b/dom/xhr/XMLHttpRequestMainThread.cpp
@@ -1608,23 +1608,21 @@ XMLHttpRequestMainThread::Open(const nsA
return NS_OK;
}
void
XMLHttpRequestMainThread::SetOriginAttributes(const OriginAttributesDictionary& aAttrs)
{
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
XMLHttpRequestMainThread::PopulateNetworkInterfaceId()
{
if (mNetworkInterfaceId.IsEmpty()) {
return;
}
--- a/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp
+++ b/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp
@@ -409,17 +409,17 @@ txCompileObserver::loadURI(const nsAStri
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), aUri);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIURI> referrerUri;
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);
return startLoad(uri, aCompiler, referrerPrincipal, aReferrerPolicy);
}
void
@@ -614,17 +614,17 @@ txSyncCompileObserver::loadURI(const nsA
nsresult rv = NS_NewURI(getter_AddRefs(uri), aUri);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIURI> referrerUri;
rv = NS_NewURI(getter_AddRefs(referrerUri), aReferrerUri);
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
// make sense.
nsCOMPtr<nsINode> source;
if (mProcessor) {
source =
do_QueryInterface(mProcessor->GetSourceContentModel());
--- a/embedding/browser/nsIWebBrowser.idl
+++ b/embedding/browser/nsIWebBrowser.idl
@@ -10,21 +10,21 @@ interface nsIInterfaceRequestor;
interface nsIWebBrowserChrome;
interface nsIURIContentListener;
interface nsIDOMWindow;
interface mozIDOMWindowProxy;
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.
* Embedders use this interface during initialisation to associate
* the new web browser instance with the embedders chrome and
* to register any listeners. The interface may also be used at runtime
* to obtain the content DOM window and from that the rest of the DOM.
*/
--- a/embedding/browser/nsWebBrowser.cpp
+++ b/embedding/browser/nsWebBrowser.cpp
@@ -385,17 +385,17 @@ nsWebBrowser::SetIsActive(bool aIsActive
// If we have a docshell, pass on the request
if (mDocShell) {
return mDocShell->SetIsActive(aIsActive);
}
return NS_OK;
}
void
-nsWebBrowser::SetOriginAttributes(const DocShellOriginAttributes& aAttrs)
+nsWebBrowser::SetOriginAttributes(const OriginAttributes& aAttrs)
{
mOriginAttributes = aAttrs;
}
//*****************************************************************************
// nsWebBrowser::nsIDocShellTreeItem
//*****************************************************************************
--- a/embedding/browser/nsWebBrowser.h
+++ b/embedding/browser/nsWebBrowser.h
@@ -128,17 +128,17 @@ protected:
protected:
RefPtr<nsDocShellTreeOwner> mDocShellTreeOwner;
nsCOMPtr<nsIDocShell> mDocShell;
nsCOMPtr<nsIInterfaceRequestor> mDocShellAsReq;
nsCOMPtr<nsIBaseWindow> mDocShellAsWin;
nsCOMPtr<nsIWebNavigation> mDocShellAsNav;
nsCOMPtr<nsIScrollable> mDocShellAsScrollable;
nsCOMPtr<nsITextScroll> mDocShellAsTextScroll;
- mozilla::DocShellOriginAttributes mOriginAttributes;
+ mozilla::OriginAttributes mOriginAttributes;
nsCOMPtr<nsIWidget> mInternalWidget;
nsCOMPtr<nsIWindowWatcher> mWWatch;
nsAutoPtr<nsWebBrowserInitInfo> mInitInfo;
uint32_t mContentType;
bool mActivating;
bool mShouldEnableHistory;
bool mIsActive;
--- a/embedding/components/windowwatcher/nsWindowWatcher.cpp
+++ b/embedding/components/windowwatcher/nsWindowWatcher.cpp
@@ -1098,18 +1098,18 @@ nsWindowWatcher::OpenWindowInternal(mozI
if (windowIsNew) {
auto* docShell = static_cast<nsDocShell*>(newDocShell.get());
// If this is not a chrome docShell, we apply originAttributes from the
// subjectPrincipal unless if it's an expanded or system principal.
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 {
nsCOMPtr<nsIDocShellTreeItem> parentItem;
GetWindowTreeItem(aParent, getter_AddRefs(parentItem));
nsCOMPtr<nsILoadContext> parentContext = do_QueryInterface(parentItem);
if (parentContext) {
isPrivateBrowsingWindow = parentContext->UsePrivateBrowsing();
--- a/extensions/cookie/nsPermission.cpp
+++ b/extensions/cookie/nsPermission.cpp
@@ -105,18 +105,18 @@ nsPermission::Matches(nsIPrincipal* aPri
// If we are matching with an exact host, we're done now - the permissions don't match
// otherwise, we need to start comparing subdomains!
if (aExactHost) {
return NS_OK;
}
// 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;
}
nsCOMPtr<nsIURI> theirURI;
nsresult rv = principal->GetURI(getter_AddRefs(theirURI));
NS_ENSURE_SUCCESS(rv, rv);
@@ -188,14 +188,14 @@ nsPermission::Matches(nsIPrincipal* aPri
return NS_OK;
}
NS_IMETHODIMP
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);
return Matches(principal, aExactHost, aMatches);
}
--- a/extensions/cookie/nsPermissionManager.cpp
+++ b/extensions/cookie/nsPermissionManager.cpp
@@ -106,69 +106,71 @@ GetOriginFromPrincipal(nsIPrincipal* aPr
{
nsresult rv = aPrincipal->GetOriginNoSuffix(aOrigin);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString suffix;
rv = aPrincipal->GetOriginSuffix(suffix);
NS_ENSURE_SUCCESS(rv, rv);
- mozilla::PrincipalOriginAttributes attrs;
+ mozilla::OriginAttributes attrs;
if (!attrs.PopulateFromSuffix(suffix)) {
return NS_ERROR_FAILURE;
}
// mPrivateBrowsingId must be set to false because PermissionManager is not supposed to have
// any knowledge of private browsing. Allowing it to be true changes the suffix being hashed.
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);
return NS_OK;
}
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);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrincipal> principal = mozilla::BasePrincipal::CreateCodebasePrincipal(uri, attrs);
principal.forget(aPrincipal);
return NS_OK;
}
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);
principal.forget(aPrincipal);
return NS_OK;
}
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);
principal.forget(aPrincipal);
return NS_OK;
}
nsCString
@@ -2203,20 +2205,21 @@ nsPermissionManager::GetPermissionHashKe
}
rv = newURI->SetHost(domain);
if (NS_FAILED(rv)) {
return nullptr;
}
// 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);
return GetPermissionHashKey(principal, aType, aExactHostMatch);
}
// No entry, really...
--- a/image/ImageCacheKey.cpp
+++ b/image/ImageCacheKey.cpp
@@ -41,17 +41,17 @@ BlobSerial(ImageURL* aURI)
blob) {
return Some(blob->GetSerialNumber());
}
return Nothing();
}
ImageCacheKey::ImageCacheKey(nsIURI* aURI,
- const PrincipalOriginAttributes& aAttrs,
+ const OriginAttributes& aAttrs,
nsIDocument* aDocument,
nsresult& aRv)
: mURI(new ImageURL(aURI, aRv))
, mOriginAttributes(aAttrs)
, mControlledDocument(GetControlledDocumentToken(aDocument))
, mIsChrome(URISchemeIs(mURI, "chrome"))
{
NS_ENSURE_SUCCESS_VOID(aRv);
@@ -61,17 +61,17 @@ ImageCacheKey::ImageCacheKey(nsIURI* aUR
if (URISchemeIs(mURI, "blob")) {
mBlobSerial = BlobSerial(mURI);
}
mHash = ComputeHash(mURI, mBlobSerial, mOriginAttributes, mControlledDocument);
}
ImageCacheKey::ImageCacheKey(ImageURL* aURI,
- const PrincipalOriginAttributes& aAttrs,
+ const OriginAttributes& aAttrs,
nsIDocument* aDocument)
: mURI(aURI)
, mOriginAttributes(aAttrs)
, mControlledDocument(GetControlledDocumentToken(aDocument))
, mIsChrome(URISchemeIs(mURI, "chrome"))
{
MOZ_ASSERT(aURI);
@@ -126,17 +126,17 @@ const char*
ImageCacheKey::Spec() const
{
return mURI->Spec();
}
/* 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
// ImageCacheKey, as an optimization we compute our hash once and store it.
nsPrintfCString ptr("%p", aControlledDocument);
nsAutoCString suffix;
aAttrs.CreateSuffix(suffix);
--- a/image/ImageCacheKey.h
+++ b/image/ImageCacheKey.h
@@ -28,19 +28,19 @@ class ImageURL;
* We key the cache on the initial URI (before any redirects), with some
* canonicalization applied. See ComputeHash() for the details.
* Controlled documents do not share their cache entries with
* non-controlled documents, or other controlled documents.
*/
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);
ImageCacheKey(ImageCacheKey&& aOther);
bool operator==(const ImageCacheKey& aOther) const;
uint32_t Hash() const { return mHash; }
@@ -52,23 +52,23 @@ public:
/// A token indicating which service worker controlled document this entry
/// belongs to, if any.
void* ControlledDocument() const { return mControlledDocument; }
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;
};
} // namespace image
} // namespace mozilla
--- a/image/imgLoader.cpp
+++ b/image/imgLoader.cpp
@@ -747,21 +747,21 @@ NewImageChannel(nsIChannel** aResult,
if (NS_FAILED(rv)) {
return rv;
}
if (aPolicyType == nsIContentPolicy::TYPE_INTERNAL_IMAGE_FAVICON) {
// 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
// we should always have a requestingNode, or we are loading something
// outside a document, in which case the loadingPrincipal and
// triggeringPrincipal should always be the systemPrincipal.
// However, there are exceptions: one is Notifications which create a
// channel in the parent prcoess in which case we can't get a requestingNode.
@@ -776,24 +776,24 @@ NewImageChannel(nsIChannel** aResult,
if (NS_FAILED(rv)) {
return rv;
}
// 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)) {
return rv;
}
// only inherit if we have a principal
*aForcePrincipalCheckForCacheEntry =
@@ -1343,17 +1343,17 @@ NS_IMETHODIMP
imgLoader::FindEntryProperties(nsIURI* uri,
nsIDOMDocument* aDOMDoc,
nsIProperties** _retval)
{
*_retval = nullptr;
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDOMDoc);
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
if (doc) {
nsCOMPtr<nsIPrincipal> principal = doc->NodePrincipal();
if (principal) {
attrs = principal->OriginAttributesRef();
}
}
nsresult rv;
@@ -2106,17 +2106,17 @@ imgLoader::LoadImage(nsIURI* aURI,
}
RefPtr<imgCacheEntry> entry;
// Look in the cache for our URI, and then validate it.
// 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();
}
ImageCacheKey key(aURI, attrs, aLoadingDocument, rv);
NS_ENSURE_SUCCESS(rv, rv);
imgCacheTable& cache = GetCache(key);
if (cache.Get(key, getter_AddRefs(entry)) && entry) {
@@ -2318,19 +2318,19 @@ imgLoader::LoadImageWithChannel(nsIChann
nsCOMPtr<nsIURI> uri;
channel->GetURI(getter_AddRefs(uri));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aCX);
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;
ImageCacheKey key(uri, attrs, doc, rv);
NS_ENSURE_SUCCESS(rv, rv);
nsLoadFlags requestFlags = nsIRequest::LOAD_NORMAL;
channel->GetLoadFlags(&requestFlags);
--- a/ipc/glue/BackgroundUtils.cpp
+++ b/ipc/glue/BackgroundUtils.cpp
@@ -78,17 +78,17 @@ PrincipalInfoToPrincipal(const Principal
aPrincipalInfo.get_ContentPrincipalInfo();
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), info.spec());
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
if (info.attrs().mAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID) {
attrs = info.attrs();
}
principal = BasePrincipal::CreateCodebasePrincipal(uri, attrs);
rv = principal ? NS_OK : NS_ERROR_FAILURE;
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
--- a/ipc/glue/BackgroundUtils.h
+++ b/ipc/glue/BackgroundUtils.h
@@ -36,30 +36,18 @@ struct OriginAttributesParamTraits
nsAutoCString suffix;
return ReadParam(aMsg, aIter, &suffix) &&
aResult->PopulateFromSuffix(suffix);
}
};
} // 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
namespace mozilla {
namespace net {
class OptionalLoadInfoArgs;
} // namespace net
--- a/ipc/glue/PBackgroundSharedTypes.ipdlh
+++ b/ipc/glue/PBackgroundSharedTypes.ipdlh
@@ -1,36 +1,36 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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 {
namespace ipc {
struct ContentPrincipalInfo
{
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
nsCString spec;
};
struct SystemPrincipalInfo
{ };
struct NullPrincipalInfo
{
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
nsCString spec;
};
struct ExpandedPrincipalInfo
{
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
PrincipalInfo[] whitelist;
};
union PrincipalInfo
{
ContentPrincipalInfo;
SystemPrincipalInfo;
NullPrincipalInfo;
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -1242,17 +1242,17 @@ nsXPCComponents_utils_Sandbox::Construct
return CallOrConstruct(wrapper, cx, obj, args, _retval);
}
/*
* For sandbox constructor the first argument can be a URI string in which case
* 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);
MOZ_ASSERT(codebase);
nsCOMPtr<nsIURI> uri;
nsAutoJSString codebaseStr;
NS_ENSURE_TRUE(codebaseStr.init(cx, codebase), false);
nsresult rv = NS_NewURI(getter_AddRefs(uri), codebaseStr);
@@ -1326,17 +1326,17 @@ GetExpandedPrincipal(JSContext* cx, Hand
// If an originAttributes option has been specified, we will use that as the
// OriginAttribute of all of the string arguments passed to this function.
// Otherwise, we will use the OriginAttributes of a principal or SOP object
// in the array, if any. If no such object is present, and all we have are
// 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));
if (!attrs->Init(cx, val)) {
// The originAttributes option, if specified, must be valid!
JS_ReportErrorASCII(cx, "Expected a valid OriginAttributes object");
return false;
}
@@ -1371,17 +1371,17 @@ GetExpandedPrincipal(JSContext* cx, Hand
nsCOMPtr<nsIScriptObjectPrincipal> sop(do_QueryInterface(prinOrSop));
principal = do_QueryInterface(prinOrSop);
if (sop)
principal = sop->GetPrincipal();
NS_ENSURE_TRUE(principal, false);
if (!options.originAttributes) {
- const PrincipalOriginAttributes prinAttrs =
+ const OriginAttributes prinAttrs =
principal->OriginAttributesRef();
if (attrs.isNothing()) {
attrs.emplace(prinAttrs);
} else if (prinAttrs != attrs.ref()) {
// If attrs is from a previously encountered principal in the
// array, we need to ensure that it matches the OA of the
// principal we have here.
// If attrs comes from OriginAttributes, we don't need
@@ -1746,17 +1746,17 @@ nsXPCComponents_utils_Sandbox::CallOrCon
// Make sure to set up principals on the sandbox before initing classes.
nsCOMPtr<nsIPrincipal> principal;
nsCOMPtr<nsIExpandedPrincipal> expanded;
nsCOMPtr<nsISupports> prinOrSop;
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)) {
// The originAttributes option, if specified, must be valid!
JS_ReportErrorASCII(cx, "Expected a valid OriginAttributes object");
return ThrowAndFail(NS_ERROR_INVALID_ARG, cx, _retval);
}
}
--- a/netwerk/base/LoadContextInfo.cpp
+++ b/netwerk/base/LoadContextInfo.cpp
@@ -13,17 +13,18 @@
using namespace mozilla::dom;
namespace mozilla {
namespace net {
// LoadContextInfo
NS_IMPL_ISUPPORTS(LoadContextInfo, nsILoadContextInfo)
-LoadContextInfo::LoadContextInfo(bool aIsAnonymous, NeckoOriginAttributes aOriginAttributes)
+LoadContextInfo::LoadContextInfo(bool aIsAnonymous,
+ OriginAttributes aOriginAttributes)
: mIsAnonymous(aIsAnonymous)
, mOriginAttributes(aOriginAttributes)
{
}
LoadContextInfo::~LoadContextInfo()
{
}
@@ -35,17 +36,17 @@ NS_IMETHODIMP LoadContextInfo::GetIsPriv
}
NS_IMETHODIMP LoadContextInfo::GetIsAnonymous(bool *aIsAnonymous)
{
*aIsAnonymous = mIsAnonymous;
return NS_OK;
}
-NeckoOriginAttributes const* LoadContextInfo::OriginAttributesPtr()
+OriginAttributes const* LoadContextInfo::OriginAttributesPtr()
{
return &mOriginAttributes;
}
NS_IMETHODIMP LoadContextInfo::GetOriginAttributes(JSContext *aCx,
JS::MutableHandle<JS::Value> aVal)
{
if (NS_WARN_IF(!ToJSValue(aCx, mOriginAttributes, aVal))) {
@@ -55,42 +56,44 @@ NS_IMETHODIMP LoadContextInfo::GetOrigin
}
// LoadContextInfoFactory
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);
return NS_OK;
}
NS_IMETHODIMP LoadContextInfoFactory::GetAnonymous(nsILoadContextInfo * *aAnonymous)
{
- nsCOMPtr<nsILoadContextInfo> info = GetLoadContextInfo(true, NeckoOriginAttributes());
+ nsCOMPtr<nsILoadContextInfo> info =
+ GetLoadContextInfo(true, OriginAttributes());
info.forget(aAnonymous);
return NS_OK;
}
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);
nsCOMPtr<nsILoadContextInfo> info = GetLoadContextInfo(aAnonymous, attrs);
info.forget(_retval);
return NS_OK;
}
@@ -121,39 +124,37 @@ GetLoadContextInfo(nsIChannel * aChannel
bool anon = false;
nsLoadFlags loadFlags;
rv = aChannel->GetLoadFlags(&loadFlags);
if (NS_SUCCEEDED(rv)) {
anon = !!(loadFlags & nsIChannel::LOAD_ANONYMOUS);
}
- NeckoOriginAttributes oa;
+ OriginAttributes oa;
NS_GetOriginAttributes(aChannel, oa);
MOZ_ASSERT(pb == (oa.mPrivateBrowsingId > 0));
return new LoadContextInfo(anon, oa);
}
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*
GetLoadContextInfo(nsIDOMWindow *aWindow,
bool aIsAnonymous)
{
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(aWindow);
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(webNav);
@@ -165,16 +166,15 @@ LoadContextInfo *
GetLoadContextInfo(nsILoadContextInfo *aInfo)
{
return new LoadContextInfo(aInfo->IsAnonymous(),
*aInfo->OriginAttributesPtr());
}
LoadContextInfo *
GetLoadContextInfo(bool const aIsAnonymous,
- NeckoOriginAttributes const &aOriginAttributes)
+ OriginAttributes const &aOriginAttributes)
{
- return new LoadContextInfo(aIsAnonymous,
- aOriginAttributes);
+ return new LoadContextInfo(aIsAnonymous, aOriginAttributes);
}
} // namespace net
} // namespace mozilla
--- a/netwerk/base/LoadContextInfo.h
+++ b/netwerk/base/LoadContextInfo.h
@@ -14,24 +14,24 @@ namespace mozilla {
namespace net {
class LoadContextInfo : public nsILoadContextInfo
{
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
{
virtual ~LoadContextInfoFactory() {}
public:
NS_DECL_ISUPPORTS // deliberately not thread-safe
NS_DECL_NSILOADCONTEXTINFOFACTORY
@@ -48,14 +48,14 @@ LoadContextInfo*
GetLoadContextInfo(nsIDOMWindow *aLoadContext,
bool aIsAnonymous);
LoadContextInfo*
GetLoadContextInfo(nsILoadContextInfo *aInfo);
LoadContextInfo*
GetLoadContextInfo(bool const aIsAnonymous,
- NeckoOriginAttributes const &aOriginAttributes);
+ OriginAttributes const &aOriginAttributes);
} // namespace net
} // namespace mozilla
#endif
--- a/netwerk/base/LoadInfo.cpp
+++ b/netwerk/base/LoadInfo.cpp
@@ -24,21 +24,20 @@
#include "nsNullPrincipal.h"
using namespace mozilla::dom;
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,
nsIPrincipal* aTriggeringPrincipal,
nsINode* aLoadingContext,
nsSecurityFlags aSecurityFlags,
nsContentPolicyType aContentPolicyType)
: mLoadingPrincipal(aLoadingContext ?
@@ -257,25 +256,25 @@ LoadInfo::LoadInfo(nsPIDOMWindowOuter* a
// TODO We can have a parent without a frame element in some cases dealing
// with the hidden window.
nsCOMPtr<nsPIDOMWindowOuter> parent = aOuterWindow->GetScriptableParent();
mParentOuterWindowID = parent ? parent->WindowID() : 0;
// 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) {
MOZ_ASSERT(attrs.mPrivateBrowsingId == 0,
"chrome docshell shouldn't have mPrivateBrowsingId set.");
}
- mOriginAttributes.InheritFromDocShellToNecko(attrs);
+ mOriginAttributes.Inherit(attrs);
}
LoadInfo::LoadInfo(const LoadInfo& rhs)
: mLoadingPrincipal(rhs.mLoadingPrincipal)
, mTriggeringPrincipal(rhs.mTriggeringPrincipal)
, mPrincipalToInherit(rhs.mPrincipalToInherit)
, mLoadingContext(rhs.mLoadingContext)
, mSecurityFlags(rhs.mSecurityFlags)
@@ -316,17 +315,17 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadin
bool aForceInheritPrincipalDropped,
uint64_t aInnerWindowID,
uint64_t aOuterWindowID,
uint64_t aParentOuterWindowID,
uint64_t aFrameOuterWindowID,
bool aEnforceSecurity,
bool aInitialSecurityCheckDone,
bool aIsThirdPartyContext,
- const NeckoOriginAttributes& aOriginAttributes,
+ const OriginAttributes& aOriginAttributes,
nsTArray<nsCOMPtr<nsIPrincipal>>& aRedirectChainIncludingInternalRedirects,
nsTArray<nsCOMPtr<nsIPrincipal>>& aRedirectChain,
const nsTArray<nsCString>& aCorsUnsafeHeaders,
bool aForcePreflight,
bool aIsPreflight,
bool aForceHSTSPriming,
bool aMixedContentWouldBlock)
: mLoadingPrincipal(aLoadingPrincipal)
@@ -694,19 +693,19 @@ LoadInfo::GetScriptableOriginAttributes(
return NS_OK;
}
NS_IMETHODIMP
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,
"LoadingPrincipal should be null for toplevel loads");
// the loadingPrincipal for toplevel loads is always a nullptr;
if (mInternalContentPolicyType != nsIContentPolicy::TYPE_DOCUMENT) {
mLoadingPrincipal = newNullPrincipal;
@@ -721,35 +720,35 @@ LoadInfo::ResetPrincipalsToNullPrincipal
return NS_OK;
}
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;
}
mOriginAttributes = attrs;
return NS_OK;
}
nsresult
-LoadInfo::GetOriginAttributes(mozilla::NeckoOriginAttributes* aOriginAttributes)
+LoadInfo::GetOriginAttributes(mozilla::OriginAttributes* aOriginAttributes)
{
NS_ENSURE_ARG(aOriginAttributes);
*aOriginAttributes = mOriginAttributes;
return NS_OK;
}
nsresult
-LoadInfo::SetOriginAttributes(const mozilla::NeckoOriginAttributes& aOriginAttributes)
+LoadInfo::SetOriginAttributes(const mozilla::OriginAttributes& aOriginAttributes)
{
mOriginAttributes = aOriginAttributes;
return NS_OK;
}
NS_IMETHODIMP
LoadInfo::SetEnforceSecurity(bool aEnforceSecurity)
{
--- a/netwerk/base/LoadInfo.h
+++ b/netwerk/base/LoadInfo.h
@@ -96,17 +96,17 @@ private:
bool aForceInheritPrincipalDropped,
uint64_t aInnerWindowID,
uint64_t aOuterWindowID,
uint64_t aParentOuterWindowID,
uint64_t aFrameOuterWindowID,
bool aEnforceSecurity,
bool aInitialSecurityCheckDone,
bool aIsThirdPartyRequest,
- const NeckoOriginAttributes& aOriginAttributes,
+ const OriginAttributes& aOriginAttributes,
nsTArray<nsCOMPtr<nsIPrincipal>>& aRedirectChainIncludingInternalRedirects,
nsTArray<nsCOMPtr<nsIPrincipal>>& aRedirectChain,
const nsTArray<nsCString>& aUnsafeHeaders,
bool aForcePreflight,
bool aIsPreflight,
bool aForceHSTSPriming,
bool aMixedContentWouldBlock);
LoadInfo(const LoadInfo& rhs);
@@ -140,17 +140,17 @@ private:
bool mForceInheritPrincipalDropped;
uint64_t mInnerWindowID;
uint64_t mOuterWindowID;
uint64_t mParentOuterWindowID;
uint64_t mFrameOuterWindowID;
bool mEnforceSecurity;
bool mInitialSecurityCheckDone;
bool mIsThirdPartyContext;
- NeckoOriginAttributes mOriginAttributes;
+ OriginAttributes mOriginAttributes;
nsTArray<nsCOMPtr<nsIPrincipal>> mRedirectChainIncludingInternalRedirects;
nsTArray<nsCOMPtr<nsIPrincipal>> mRedirectChain;
nsTArray<nsCString> mCorsUnsafeHeaders;
bool mForcePreflight;
bool mIsPreflight;
bool mForceHSTSPriming : 1;
bool mMixedContentWouldBlock : 1;
--- a/netwerk/base/Predictor.cpp
+++ b/netwerk/base/Predictor.cpp
@@ -588,17 +588,17 @@ Predictor::Init()
mDNSListener = new DNSListener();
}
nsCOMPtr<nsICacheStorageService> cacheStorageService =
do_GetService("@mozilla.org/netwerk/cache-storage-service;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
RefPtr<LoadContextInfo> lci =
- new LoadContextInfo(false, NeckoOriginAttributes());
+ new LoadContextInfo(false, OriginAttributes());
rv = cacheStorageService->DiskCacheStorage(lci, false,
getter_AddRefs(mCacheDiskStorage));
NS_ENSURE_SUCCESS(rv, rv);
mIOService = do_GetService("@mozilla.org/network/io-service;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
--- a/netwerk/base/PrivateBrowsingChannel.h
+++ b/netwerk/base/PrivateBrowsingChannel.h
@@ -79,17 +79,17 @@ public:
if (loadContext) {
mPrivateBrowsing = loadContext->UsePrivateBrowsing();
return;
}
nsCOMPtr<nsILoadInfo> loadInfo;
Unused << channel->GetLoadInfo(getter_AddRefs(loadInfo));
if (loadInfo) {
- NeckoOriginAttributes attrs = loadInfo->GetOriginAttributes();
+ OriginAttributes attrs = loadInfo->GetOriginAttributes();
mPrivateBrowsing = attrs.mPrivateBrowsingId > 0;
}
}
bool CanSetCallbacks(nsIInterfaceRequestor* aCallbacks) const
{
// Make sure that the private bit override flag is not set.
// This is a fatal error in debug builds, and a runtime error in release
--- a/netwerk/base/nsILoadContextInfo.idl
+++ b/netwerk/base/nsILoadContextInfo.idl
@@ -3,17 +3,17 @@
* 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/. */
#include "nsISupports.idl"
%{ C++
#include "mozilla/BasePrincipal.h"
%}
-native OriginAttributesNativePtr(const mozilla::NeckoOriginAttributes*);
+native OriginAttributesNativePtr(const mozilla::OriginAttributes*);
interface nsILoadContext;
interface nsIDOMWindow;
/**
* Helper interface to carry informatin about the load context
* encapsulating origin attributes and IsAnonymous, IsPrivite properties.
* It shall be used where nsILoadContext cannot be used or is not
@@ -32,17 +32,17 @@ interface nsILoadContextInfo : nsISuppor
readonly attribute boolean isPrivate;
/**
* Whether the load is initiated as anonymous
*/
readonly attribute boolean isAnonymous;
/**
- * NeckoOriginAttributes hiding all the security context attributes
+ * OriginAttributes hiding all the security context attributes
*/
[implicit_jscontext]
readonly attribute jsval originAttributes;
[noscript, notxpcom, nostdcall, binaryname(OriginAttributesPtr)]
OriginAttributesNativePtr binaryOriginAttributesPtr();
%{C++
/**
@@ -66,17 +66,17 @@ interface nsILoadContextInfo : nsISuppor
{
return IsAnonymous() == aOther->IsAnonymous() &&
*OriginAttributesPtr() == *aOther->OriginAttributesPtr();
}
%}
};
/**
- * 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.
*/
[scriptable, uuid(c1c7023d-4318-4f99-8307-b5ccf0558793)]
interface nsILoadContextInfoFactory : nsISupports
{
readonly attribute nsILoadContextInfo default;
--- a/netwerk/base/nsILoadInfo.idl
+++ b/netwerk/base/nsILoadInfo.idl
@@ -15,18 +15,18 @@ interface nsIPrincipal;
#include "nsTArray.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/LoadTainting.h"
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;
/**
* The LoadInfo object contains information about a network load, why it
* was started, and how we plan on using the resulting response.
* If a network request is redirected, the new channel will receive a new
@@ -529,37 +529,37 @@ interface nsILoadInfo : nsISupports
* loads is always null.)
*
* WARNING: Please only use that function if you know exactly what
* you are doing!!!
*/
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
* the usePrivateBrowsing is true, because chrome docshell won't set
* privateBrowsingId on origin attributes (See bug 1278664). This is to make
* sure nsILoadInfo and nsILoadContext have the same origin attributes.
*/
[implicit_jscontext, binaryname(ScriptableOriginAttributes)]
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;
}
%}
/**
* Whenever a channel is openend by asyncOpen2() [or also open2()],
--- a/netwerk/base/nsISocketTransport.idl
+++ b/netwerk/base/nsISocketTransport.idl
@@ -13,18 +13,18 @@ interface nsINetAddr;
namespace mozilla {
namespace net {
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
*
* NOTE: Connection setup is triggered by opening an input or output stream,
* it does not start on its own. Completion of the connection setup is
* indicated by a STATUS_CONNECTED_TO notification to the event sink (if set).
*
@@ -53,17 +53,17 @@ interface nsISocketTransport : nsITransp
* "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.
*/
[implicit_jscontext, binaryname(ScriptableOriginAttributes)]
attribute jsval originAttributes;
[noscript, nostdcall, binaryname(GetOriginAttributes)]
- NeckoOriginAttributes binaryGetOriginAttributes();
+ OriginAttributes binaryGetOriginAttributes();
[noscript, nostdcall, binaryname(SetOriginAttributes)]
void binarySetOriginAttributes(in const_OriginAttributesRef aOriginAttrs);
/**
* The platform-specific network interface id that this socket
* associated with. Note that this attribute can be only accessed
* in the socket thread.
--- a/netwerk/base/nsNetUtil.cpp
+++ b/netwerk/base/nsNetUtil.cpp
@@ -1244,17 +1244,17 @@ NS_UsePrivateBrowsing(nsIChannel *channe
// Some channels may not implement nsIPrivateBrowsingChannel
nsCOMPtr<nsILoadContext> loadContext;
NS_QueryNotificationCallbacks(channel, loadContext);
return loadContext && loadContext->UsePrivateBrowsing();
}
bool
NS_GetOriginAttributes(nsIChannel *aChannel,
- mozilla::NeckoOriginAttributes &aAttributes)
+ mozilla::OriginAttributes &aAttributes)
{
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
if (!loadInfo) {
return false;
}
loadInfo->GetOriginAttributes(&aAttributes);
aAttributes.SyncAttributesWithPrivateBrowsing(NS_UsePrivateBrowsing(aChannel));
@@ -2341,17 +2341,17 @@ NS_CompareLoadInfoAndLoadContext(nsIChan
bool loadContextIsInBE = false;
nsresult rv = loadContext->GetIsInIsolatedMozBrowserElement(&loadContextIsInBE);
if (NS_FAILED(rv)) {
return NS_ERROR_UNEXPECTED;
}
OriginAttributes originAttrsLoadInfo = loadInfo->GetOriginAttributes();
- DocShellOriginAttributes originAttrsLoadContext;
+ OriginAttributes originAttrsLoadContext;
loadContext->GetOriginAttributes(originAttrsLoadContext);
LOG(("NS_CompareLoadInfoAndLoadContext - loadInfo: %d, %d, %d; "
"loadContext: %d %d, %d. [channel=%p]",
originAttrsLoadInfo.mInIsolatedMozBrowser, originAttrsLoadInfo.mUserContextId,
originAttrsLoadInfo.mPrivateBrowsingId, loadContextIsInBE,
originAttrsLoadContext.mUserContextId, originAttrsLoadContext.mPrivateBrowsingId,
aChannel));
--- a/netwerk/base/nsNetUtil.h
+++ b/netwerk/base/nsNetUtil.h
@@ -43,17 +43,17 @@ class nsIRequestObserver;
class nsIStreamListener;
class nsIStreamLoader;
class nsIStreamLoaderObserver;
class nsIIncrementalStreamLoader;
class nsIIncrementalStreamLoaderObserver;
class nsIUnicharStreamLoader;
class nsIUnicharStreamLoaderObserver;
-namespace mozilla { class NeckoOriginAttributes; }
+namespace mozilla { class OriginAttributes; }
template <class> class nsCOMPtr;
template <typename> struct already_AddRefed;
#ifdef MOZILLA_INTERNAL_API
#include "nsReadableUtils.h"
#include "nsString.h"
#else
@@ -652,20 +652,20 @@ NS_QueryNotificationCallbacks(nsIInterfa
/**
* Returns true if channel is using Private Browsing, or false if not.
* Returns false if channel's callbacks don't implement nsILoadContext.
*/
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
* URLs that it was redirected through.
*/
bool NS_HasBeenCrossOrigin(nsIChannel* aChannel, bool aReport = false);
// Constants duplicated from nsIScriptSecurityManager so we avoid having necko
--- a/netwerk/base/nsSocketTransport2.cpp
+++ b/netwerk/base/nsSocketTransport2.cpp
@@ -2417,35 +2417,35 @@ nsSocketTransport::GetScriptableOriginAt
NS_IMETHODIMP
nsSocketTransport::SetScriptableOriginAttributes(JSContext* aCx,
JS::Handle<JS::Value> aOriginAttributes)
{
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;
}
mOriginAttributes = attrs;
return NS_OK;
}
nsresult
-nsSocketTransport::GetOriginAttributes(NeckoOriginAttributes* aOriginAttributes)
+nsSocketTransport::GetOriginAttributes(OriginAttributes* aOriginAttributes)
{
NS_ENSURE_ARG(aOriginAttributes);
*aOriginAttributes = mOriginAttributes;
return NS_OK;
}
nsresult
-nsSocketTransport::SetOriginAttributes(const NeckoOriginAttributes& aOriginAttributes)
+nsSocketTransport::SetOriginAttributes(const OriginAttributes& aOriginAttributes)
{
MutexAutoLock lock(mLock);
NS_ENSURE_FALSE(mFD.IsInitialized(), NS_ERROR_FAILURE);
mOriginAttributes = aOriginAttributes;
return NS_OK;
}
--- a/netwerk/base/nsSocketTransport2.h
+++ b/netwerk/base/nsSocketTransport2.h
@@ -86,17 +86,17 @@ public:
explicit nsSocketOutputStream(nsSocketTransport *);
virtual ~nsSocketOutputStream();
bool IsReferenced() { return mWriterRefCnt > 0; }
nsresult Condition() { return mCondition; }
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 *,
const char *, uint32_t offset,
uint32_t count, uint32_t *countRead);
nsSocketTransport *mTransport;
ThreadSafeAutoRefCnt mWriterRefCnt;
@@ -304,18 +304,18 @@ private:
uint32_t mConnectionFlags;
bool mReuseAddrPort;
// The origin attributes are used to create sockets. The first party domain
// will eventually be used to isolate OCSP cache and is only non-empty when
// "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; }
//-------------------------------------------------------------------------
// members accessible only on the socket transport thread:
// (the exception being initialization/shutdown time)
//-------------------------------------------------------------------------
@@ -346,17 +346,17 @@ private:
Atomic<bool, Relaxed> mNetAddrPreResolved;
nsAutoPtr<NetAddr> mBindAddr;
// socket methods (these can only be called on the socket thread):
void SendStatus(nsresult status);
nsresult ResolveHost();
- nsresult BuildSocket(PRFileDesc *&, bool &, bool &);
+ nsresult BuildSocket(PRFileDesc *&, bool &, bool &);
nsresult InitiateSocket();
bool RecoverFromError();
void OnMsgInputPending()
{
if (mState == STATE_TRANSFERRING)
mPollFlags |= (PR_POLL_READ | PR_POLL_EXCEPT);
}
--- a/netwerk/cache/nsDiskCacheDeviceSQL.cpp
+++ b/netwerk/cache/nsDiskCacheDeviceSQL.cpp
@@ -48,17 +48,17 @@
#include "sqlite3.h"
#include "mozilla/storage.h"
#include "nsVariant.h"
#include "mozilla/BasePrincipal.h"
using namespace mozilla;
using namespace mozilla::storage;
-using mozilla::NeckoOriginAttributes;
+using mozilla::OriginAttributes;
static const char OFFLINE_CACHE_DEVICE_ID[] = { "offline" };
#define LOG(args) CACHE_LOG_DEBUG(args)
static uint32_t gNextTemporaryClientID = 0;
/*****************************************************************************
@@ -2518,17 +2518,17 @@ OriginMatch::OnFunctionCall(mozIStorageV
// Just ignore...
return NS_OK;
}
++hash;
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);
bool match = mPattern.Matches(oa);
RefPtr<nsVariant> outVar(new nsVariant());
rv = outVar->SetAsUint32(match ? 1 : 0);
NS_ENSURE_SUCCESS(rv, rv);
--- a/netwerk/cache2/CacheFileMetadata.h
+++ b/netwerk/cache2/CacheFileMetadata.h
@@ -142,17 +142,17 @@ public:
nsresult ReadMetadata(CacheFileMetadataListener *aListener);
uint32_t CalcMetadataSize(uint32_t aElementsSize, uint32_t aHashCount);
nsresult WriteMetadata(uint32_t aOffset,
CacheFileMetadataListener *aListener);
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);
nsresult SetElement(const char *aKey, const char *aValue);
nsresult Visit(nsICacheEntryMetaDataVisitor *aVisitor);
CacheHash::Hash16_t GetHash(uint32_t aIndex);
nsresult SetHash(uint32_t aIndex, CacheHash::Hash16_t aHash);
@@ -210,17 +210,17 @@ private:
uint32_t mBufSize;
char *mWriteBuf;
CacheFileMetadataHeader mMetaHdr;
uint32_t mElementsSize;
bool mIsDirty : 1;
bool mAnonymous : 1;
bool mAllocExactSize : 1;
bool mFirstRead : 1;
- mozilla::NeckoOriginAttributes mOriginAttributes;
+ mozilla::OriginAttributes mOriginAttributes;
mozilla::TimeStamp mReadStart;
nsCOMPtr<CacheFileMetadataListener> mListener;
};
} // namespace net
} // namespace mozilla
--- a/netwerk/cache2/CacheFileUtils.cpp
+++ b/netwerk/cache2/CacheFileUtils.cpp
@@ -29,27 +29,25 @@ namespace {
/**
* A simple recursive descent parser for the mapping key.
*/
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)
{
}
private:
// Results
- NeckoOriginAttributes originAttribs;
+ OriginAttributes originAttribs;
bool isAnonymous;
nsCString idEnhance;
nsDependentCSubstring cacheKey;
// Keeps the last tag name, used for alphabetical sort checking
char lastTag;
// Classifier for the 'tag' character valid range
@@ -207,17 +205,17 @@ AppendKeyPrefix(nsILoadContextInfo* aInf
/**
* This key is used to salt file hashes. When form of the key is changed
* cache entries will fail to find on disk.
*
* IMPORTANT NOTE:
* 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()) {
AppendTagWithValue(_retval, 'O', suffix);
}
if (aInfo->IsAnonymous()) {
_retval.AppendLiteral("a,");
--- a/netwerk/cache2/CacheObserver.cpp
+++ b/netwerk/cache2/CacheObserver.cpp
@@ -405,17 +405,17 @@ void CacheObserver::ParentDirOverride(ns
sSelf->mCacheParentDirectoryOverride->Clone(aDir);
}
namespace {
namespace CacheStorageEvictHelper {
nsresult ClearStorage(bool const aPrivate,
bool const aAnonymous,
- NeckoOriginAttributes &aOa)
+ OriginAttributes &aOa)
{
nsresult rv;
aOa.SyncAttributesWithPrivateBrowsing(aPrivate);
RefPtr<LoadContextInfo> info = GetLoadContextInfo(aAnonymous, aOa);
nsCOMPtr<nsICacheStorage> storage;
RefPtr<CacheStorageService> service = CacheStorageService::Self();
@@ -431,17 +431,17 @@ nsresult ClearStorage(bool const aPrivat
rv = service->MemoryCacheStorage(info, getter_AddRefs(storage));
NS_ENSURE_SUCCESS(rv, rv);
rv = storage->AsyncEvictStorage(nullptr);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
-nsresult Run(NeckoOriginAttributes &aOa)
+nsresult Run(OriginAttributes &aOa)
{
nsresult rv;
// Clear all [private X anonymous] combinations
rv = ClearStorage(false, false, aOa);
NS_ENSURE_SUCCESS(rv, rv);
rv = ClearStorage(false, true, aOa);
NS_ENSURE_SUCCESS(rv, rv);
@@ -548,19 +548,19 @@ CacheObserver::Observe(nsISupports* aSub
if (service) {
service->DropPrivateBrowsingEntries();
}
return NS_OK;
}
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;
}
nsresult rv = CacheStorageEvictHelper::Run(oa);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
--- a/netwerk/cache2/OldWrappers.cpp
+++ b/netwerk/cache2/OldWrappers.cpp
@@ -519,17 +519,17 @@ NS_IMETHODIMP _OldCacheEntryWrapper::Vis
namespace {
nsresult
GetCacheSessionNameForStoragePolicy(
nsCSubstring const &scheme,
nsCacheStoragePolicy storagePolicy,
bool isPrivate,
- NeckoOriginAttributes const *originAttribs,
+ OriginAttributes const *originAttribs,
nsACString& sessionName)
{
MOZ_ASSERT(!isPrivate || storagePolicy == nsICache::STORE_IN_MEMORY);
// HTTP
if (scheme.EqualsLiteral("http") ||
scheme.EqualsLiteral("https")) {
switch (storagePolicy) {
--- a/netwerk/cookie/CookieServiceChild.cpp
+++ b/netwerk/cookie/CookieServiceChild.cpp
@@ -119,17 +119,17 @@ CookieServiceChild::GetCookieStringInter
// Determine whether the request is foreign. Failure is acceptable.
bool isForeign = true;
if (RequireThirdPartyCheck())
mThirdPartyUtil->IsThirdPartyChannel(aChannel, aHostURI, &isForeign);
URIParams uriParams;
SerializeURI(aHostURI, uriParams);
- mozilla::NeckoOriginAttributes attrs;
+ mozilla::OriginAttributes attrs;
if (aChannel) {
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
if (loadInfo) {
attrs = loadInfo->GetOriginAttributes();
}
}
// Synchronously call the parent.
@@ -166,17 +166,17 @@ CookieServiceChild::SetCookieStringInter
nsDependentCString cookieString(aCookieString);
nsDependentCString serverTime;
if (aServerTime)
serverTime.Rebind(aServerTime);
URIParams uriParams;
SerializeURI(aHostURI, uriParams);
- mozilla::NeckoOriginAttributes attrs;
+ mozilla::OriginAttributes attrs;
if (aChannel) {
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
if (loadInfo) {
attrs = loadInfo->GetOriginAttributes();
}
}
// Synchronously call the parent.
--- a/netwerk/cookie/CookieServiceParent.cpp
+++ b/netwerk/cookie/CookieServiceParent.cpp
@@ -13,31 +13,30 @@
#include "nsIChannel.h"
#include "nsIScriptSecurityManager.h"
#include "nsIPrivateBrowsingChannel.h"
#include "nsNetCID.h"
#include "nsPrintfCString.h"
using namespace mozilla::ipc;
using mozilla::BasePrincipal;
-using mozilla::NeckoOriginAttributes;
-using mozilla::PrincipalOriginAttributes;
+using mozilla::OriginAttributes;
using mozilla::dom::PContentParent;
using mozilla::net::NeckoParent;
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);
if (!principal) {
return;
}
nsCOMPtr<nsIURI> dummyURI;
@@ -89,17 +88,17 @@ CookieServiceParent::ActorDestroy(ActorD
// Nothing needed here. Called right before destructor since this is a
// non-refcounted class.
}
mozilla::ipc::IPCResult
CookieServiceParent::RecvGetCookieString(const URIParams& aHost,
const bool& aIsForeign,
const bool& aFromHttp,
- const NeckoOriginAttributes& aAttrs,
+ const OriginAttributes& aAttrs,
nsCString* aResult)
{
if (!mCookieService)
return IPC_OK();
// Deserialize URI. Having a host URI is mandatory and should always be
// provided by the child; thus we consider failure fatal.
nsCOMPtr<nsIURI> hostURI = DeserializeURI(aHost);
@@ -113,17 +112,17 @@ CookieServiceParent::RecvGetCookieString
}
mozilla::ipc::IPCResult
CookieServiceParent::RecvSetCookieString(const URIParams& aHost,
const bool& aIsForeign,
const nsCString& aCookieString,
const nsCString& aServerTime,
const bool& aFromHttp,
- const NeckoOriginAttributes& aAttrs)
+ const OriginAttributes& aAttrs)
{
if (!mCookieService)
return IPC_OK();
// Deserialize URI. Having a host URI is mandatory and should always be
// provided by the child; thus we consider failure fatal.
nsCOMPtr<nsIURI> hostURI = DeserializeURI(aHost);
if (!hostURI)
@@ -134,17 +133,17 @@ CookieServiceParent::RecvSetCookieString
// This is a gross hack. We've already computed everything we need to know
// for whether to set this cookie or not, but we need to communicate all of
// this information through to nsICookiePermission, which indirectly
// computes the information from the channel. We only care about the
// aIsPrivate argument as nsCookieService::SetCookieStringInternal deals
// 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.
nsDependentCString cookieString(aCookieString, 0);
mCookieService->SetCookieStringInternal(hostURI, aIsForeign, cookieString,
aServerTime, aFromHttp, aAttrs,
isPrivate, dummyChannel);
return IPC_OK();
--- a/netwerk/cookie/CookieServiceParent.h
+++ b/netwerk/cookie/CookieServiceParent.h
@@ -4,42 +4,42 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_net_CookieServiceParent_h
#define mozilla_net_CookieServiceParent_h
#include "mozilla/net/PCookieServiceParent.h"
class nsCookieService;
-namespace mozilla { class NeckoOriginAttributes; }
+namespace mozilla { class OriginAttributes; }
namespace mozilla {
namespace net {
class CookieServiceParent : public PCookieServiceParent
{
public:
CookieServiceParent();
virtual ~CookieServiceParent();
protected:
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
virtual mozilla::ipc::IPCResult RecvGetCookieString(const URIParams& aHost,
const bool& aIsForeign,
const bool& aFromHttp,
- const NeckoOriginAttributes& aAttrs,
+ const OriginAttributes& aAttrs,
nsCString* aResult) override;
virtual mozilla::ipc::IPCResult RecvSetCookieString(const URIParams& aHost,
const bool& aIsForeign,
const nsCString& aCookieString,
const nsCString& aServerTime,
const bool& aFromHttp,
- const NeckoOriginAttributes& aAttrs) override;
+ const OriginAttributes& aAttrs) override;
RefPtr<nsCookieService> mCookieService;
};
} // namespace net
} // namespace mozilla
#endif // mozilla_net_CookieServiceParent_h
--- a/netwerk/cookie/PCookieService.ipdl
+++ b/netwerk/cookie/PCookieService.ipdl
@@ -3,17 +3,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
include protocol PNecko;
include URIParams;
-using mozilla::NeckoOriginAttributes from "mozilla/ipc/BackgroundUtils.h";
+using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
namespace mozilla {
namespace net {
/**
* PCookieService
*
* Provides IPDL methods for setting and getting cookies. These are stored on
@@ -57,17 +57,17 @@ parent:
* @see nsICookieService.getCookieStringFromHttp
* @see mozIThirdPartyUtil.isThirdPartyChannel
*
* @return the resulting cookie string.
*/
nested(inside_cpow) sync GetCookieString(URIParams host,
bool isForeign,
bool fromHttp,
- NeckoOriginAttributes attrs)
+ OriginAttributes attrs)
returns (nsCString result);
/*
* Set a cookie string.
*
* @param host
* Same as the 'aURI' argument to nsICookieService.setCookieString.
* @param isForeign
@@ -94,16 +94,16 @@ parent:
* @see nsICookieService.setCookieStringFromHttp
* @see mozIThirdPartyUtil.isThirdPartyChannel
*/
nested(inside_cpow) async SetCookieString(URIParams host,
bool isForeign,
nsCString cookieString,
nsCString serverTime,
bool fromHttp,
- NeckoOriginAttributes attrs);
+ OriginAttributes attrs);
async __delete__();
};
}
}
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -10,16 +10,17 @@
#include "mozilla/Unused.h"
#include "mozilla/net/CookieServiceChild.h"
#include "mozilla/net/NeckoCommon.h"
#include "nsCookieService.h"
#include "nsContentUtils.h"
#include "nsIServiceManager.h"
+#include "nsIScriptSecurityManager.h"
#include "nsIIOService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIScriptError.h"
#include "nsICookiePermission.h"
#include "nsIURI.h"
#include "nsIURL.h"
@@ -56,17 +57,17 @@
using namespace mozilla;
using namespace mozilla::net;
// Create key from baseDomain that will access the default cookie namespace.
// TODO: When we figure out what the API will look like for nsICookieManager{2}
// on content processes (see bug 777620), change to use the appropriate app
// namespace. For now those IDLs aren't supported on child processes.
#define DEFAULT_APP_KEY(baseDomain) \
- nsCookieKey(baseDomain, NeckoOriginAttributes())
+ nsCookieKey(baseDomain, OriginAttributes())
/******************************************************************************
* nsCookieService impl:
* useful types & constants
******************************************************************************/
static nsCookieService *gCookieService;
@@ -836,17 +837,18 @@ ConvertAppIdToOriginAttrsSQLFunction::On
nsresult rv;
int32_t inIsolatedMozBrowser;
rv = aFunctionArguments->GetInt32(1, &inIsolatedMozBrowser);
NS_ENSURE_SUCCESS(rv, rv);
// Create an originAttributes object by inIsolatedMozBrowser.
// Then create the originSuffix string from this object.
- NeckoOriginAttributes attrs((inIsolatedMozBrowser ? 1 : 0));
+ OriginAttributes attrs(nsIScriptSecurityManager::NO_APP_ID,
+ (inIsolatedMozBrowser ? true : false));
nsAutoCString suffix;
attrs.CreateSuffix(suffix);
RefPtr<nsVariant> outVar(new nsVariant());
rv = outVar->SetAsAUTF8String(suffix);
NS_ENSURE_SUCCESS(rv, rv);
outVar.forget(aResult);
@@ -864,17 +866,17 @@ class SetAppIdFromOriginAttributesSQLFun
NS_IMPL_ISUPPORTS(SetAppIdFromOriginAttributesSQLFunction, mozIStorageFunction);
NS_IMETHODIMP
SetAppIdFromOriginAttributesSQLFunction::OnFunctionCall(
mozIStorageValueArray* aFunctionArguments, nsIVariant** aResult)
{
nsresult rv;
nsAutoCString suffix;
- NeckoOriginAttributes attrs;
+ OriginAttributes attrs;
rv = aFunctionArguments->GetUTF8String(0, suffix);
NS_ENSURE_SUCCESS(rv, rv);
bool success = attrs.PopulateFromSuffix(suffix);
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
RefPtr<nsVariant> outVar(new nsVariant());
rv = outVar->SetAsInt32(attrs.mAppId);
@@ -897,17 +899,17 @@ NS_IMPL_ISUPPORTS(SetInBrowserFromOrigin
mozIStorageFunction);
NS_IMETHODIMP
SetInBrowserFromOriginAttributesSQLFunction::OnFunctionCall(
mozIStorageValueArray* aFunctionArguments, nsIVariant** aResult)
{
nsresult rv;
nsAutoCString suffix;
- NeckoOriginAttributes attrs;
+ OriginAttributes attrs;
rv = aFunctionArguments->GetUTF8String(0, suffix);
NS_ENSURE_SUCCESS(rv, rv);
bool success = attrs.PopulateFromSuffix(suffix);
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
RefPtr<nsVariant> outVar(new nsVariant());
rv = outVar->SetAsInt32(attrs.mInIsolatedMozBrowser);
@@ -1990,17 +1992,17 @@ nsCookieService::GetCookieStringCommon(n
NS_ENSURE_ARG(aHostURI);
NS_ENSURE_ARG(aCookie);
// Determine whether the request is foreign. Failure is acceptable.
bool isForeign = true;
mThirdPartyUtil->IsThirdPartyChannel(aChannel, aHostURI, &isForeign);
// Get originAttributes.
- NeckoOriginAttributes attrs;
+ OriginAttributes attrs;
if (aChannel) {
NS_GetOriginAttributes(aChannel, attrs);
}
bool isPrivate = aChannel && NS_UsePrivateBrowsing(aChannel);
nsAutoCString result;
GetCookieStringInternal(aHostURI, isForeign, aHttpBound, attrs,
@@ -2063,17 +2065,17 @@ nsCookieService::SetCookieStringCommon(n
NS_ENSURE_ARG(aHostURI);
NS_ENSURE_ARG(aCookieHeader);
// Determine whether the request is foreign. Failure is acceptable.
bool isForeign = true;
mThirdPartyUtil->IsThirdPartyChannel(aChannel, aHostURI, &isForeign);
// Get originAttributes.
- NeckoOriginAttributes attrs;
+ OriginAttributes attrs;
if (aChannel) {
NS_GetOriginAttributes(aChannel, attrs);
}
bool isPrivate = aChannel && NS_UsePrivateBrowsing(aChannel);
nsDependentCString cookieString(aCookieHeader);
nsDependentCString serverTime(aServerTime ? aServerTime : "");
@@ -2084,17 +2086,17 @@ nsCookieService::SetCookieStringCommon(n
}
void
nsCookieService::SetCookieStringInternal(nsIURI *aHostURI,
bool aIsForeign,
nsDependentCString &aCookieHeader,
const nsCString &aServerTime,
bool aFromHttp,
- const NeckoOriginAttributes &aOriginAttrs,
+ const OriginAttributes &aOriginAttrs,
bool aIsPrivate,
nsIChannel *aChannel)
{
NS_ASSERTION(aHostURI, "null host!");
if (!mDBState) {
NS_WARNING("No DBState! Profile already closed?");
return;
@@ -2353,17 +2355,17 @@ nsCookieService::GetEnumerator(nsISimple
cookieList.AppendObject(cookies[i]);
}
}
return NS_NewArrayEnumerator(aEnumerator, cookieList);
}
static nsresult
-InitializeOriginAttributes(NeckoOriginAttributes* aAttrs,
+InitializeOriginAttributes(OriginAttributes* aAttrs,
JS::HandleValue aOriginAttributes,
JSContext* aCx,
uint8_t aArgc,
const char16_t* aAPI,
const char16_t* aInterfaceSuffix)
{
MOZ_ASSERT(aAttrs);
MOZ_ASSERT(aCx);
@@ -2406,17 +2408,17 @@ nsCookieService::Add(const nsACString &a
bool aIsSession,
int64_t aExpiry,
JS::HandleValue aOriginAttributes,
JSContext* aCx,
uint8_t aArgc)
{
MOZ_ASSERT(aArgc == 0 || aArgc == 1);
- NeckoOriginAttributes attrs;
+ OriginAttributes attrs;
nsresult rv = InitializeOriginAttributes(&attrs,
aOriginAttributes,
aCx,
aArgc,
u"nsICookieManager2.add()",
u"2");
NS_ENSURE_SUCCESS(rv, rv);
@@ -2428,17 +2430,17 @@ NS_IMETHODIMP_(nsresult)
nsCookieService::AddNative(const nsACString &aHost,
const nsACString &aPath,
const nsACString &aName,
const nsACString &aValue,
bool aIsSecure,
bool aIsHttpOnly,
bool aIsSession,
int64_t aExpiry,
- NeckoOriginAttributes* aOriginAttributes)
+ OriginAttributes* aOriginAttributes)
{
if (NS_WARN_IF(!aOriginAttributes)) {
return NS_ERROR_FAILURE;
}
if (!mDBState) {
NS_WARNING("No DBState! Profile already closed?");
return NS_ERROR_NOT_AVAILABLE;
@@ -2472,17 +2474,17 @@ nsCookieService::AddNative(const nsACStr
}
AddInternal(key, cookie, currentTimeInUsec, nullptr, nullptr, true);
return NS_OK;
}
nsresult
-nsCookieService::Remove(const nsACString& aHost, const NeckoOriginAttributes& aAttrs,
+nsCookieService::Remove(const nsACString& aHost, const OriginAttributes& aAttrs,
const nsACString& aName, const nsACString& aPath,
bool aBlocked)
{
if (!mDBState) {
NS_WARNING("No DBState! Profile already closed?");
return NS_ERROR_NOT_AVAILABLE;
}
@@ -2535,34 +2537,34 @@ nsCookieService::Remove(const nsACString
const nsACString &aPath,
bool aBlocked,
JS::HandleValue aOriginAttributes,
JSContext* aCx,
uint8_t aArgc)
{
MOZ_ASSERT(aArgc == 0 || aArgc == 1);
- NeckoOriginAttributes attrs;
+ OriginAttributes attrs;
nsresult rv = InitializeOriginAttributes(&attrs,
aOriginAttributes,
aCx,
aArgc,
u"nsICookieManager.remove()",
u"");
NS_ENSURE_SUCCESS(rv, rv);
return RemoveNative(aHost, aName, aPath, aBlocked, &attrs);
}
NS_IMETHODIMP_(nsresult)
nsCookieService::RemoveNative(const nsACString &aHost,
const nsACString &aName,
const nsACString &aPath,
bool aBlocked,
- NeckoOriginAttributes* aOriginAttributes)
+ OriginAttributes* aOriginAttributes)
{
if (NS_WARN_IF(!aOriginAttributes)) {
return NS_ERROR_FAILURE;
}
nsresult rv = Remove(aHost, *aOriginAttributes, aName, aPath, aBlocked);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@@ -2907,17 +2909,17 @@ nsCookieService::EnsureReadComplete()
if (!hasResult)
break;
// Make sure we haven't already read the data.
stmt->GetUTF8String(IDX_BASE_DOMAIN, baseDomain);
nsAutoCString suffix;
- NeckoOriginAttributes attrs;
+ OriginAttributes attrs;
stmt->GetUTF8String(IDX_ORIGIN_ATTRIBUTES, suffix);
// If PopulateFromSuffix failed we just ignore the OA attributes
// that we don't support
Unused << attrs.PopulateFromSuffix(suffix);
nsCookieKey key(baseDomain, attrs);
if (mDefaultDBState->readSet.GetEntry(key))
continue;
@@ -3058,17 +3060,17 @@ nsCookieService::ImportCookies(nsIFile *
}
// compute the baseDomain from the host
rv = GetBaseDomainFromHost(host, baseDomain);
if (NS_FAILED(rv))
continue;
// pre-existing cookies have inIsolatedMozBrowser=false set by default
- // constructor of NeckoOriginAttributes().
+ // constructor of OriginAttributes().
nsCookieKey key = DEFAULT_APP_KEY(baseDomain);
// Create a new nsCookie and assign the data. We don't know the cookie
// creation time, so just use the current time to generate a unique one.
RefPtr<nsCookie> newCookie =
nsCookie::Create(Substring(buffer, nameIndex, cookieIndex - nameIndex - 1),
Substring(buffer, cookieIndex, buffer.Length() - cookieIndex),
host,
@@ -3191,17 +3193,17 @@ PathMatches(nsCookie* aCookie, const nsA
// the given path.
return true;
}
void
nsCookieService::GetCookieStringInternal(nsIURI *aHostURI,
bool aIsForeign,
bool aHttpBound,
- const NeckoOriginAttributes& aOriginAttrs,
+ const OriginAttributes& aOriginAttrs,
bool aIsPrivate,
nsCString &aCookieString)
{
NS_ASSERTION(aHostURI, "null host!");
if (!mDBState) {
NS_WARNING("No DBState! Profile already closed?");
return;
@@ -4538,31 +4540,31 @@ nsCookieService::CookieExists(nsICookie2
uint8_t aArgc,
bool* aFoundCookie)
{
NS_ENSURE_ARG_POINTER(aCookie);
NS_ENSURE_ARG_POINTER(aCx);
NS_ENSURE_ARG_POINTER(aFoundCookie);
MOZ_ASSERT(aArgc == 0 || aArgc == 1);
- NeckoOriginAttributes attrs;
+ OriginAttributes attrs;
nsresult rv = InitializeOriginAttributes(&attrs,
aOriginAttributes,
aCx,
aArgc,
u"nsICookieManager2.cookieExists()",
u"2");
NS_ENSURE_SUCCESS(rv, rv);
return CookieExistsNative(aCookie, &attrs, aFoundCookie);
}
NS_IMETHODIMP_(nsresult)
nsCookieService::CookieExistsNative(nsICookie2* aCookie,
- NeckoOriginAttributes* aOriginAttributes,
+ OriginAttributes* aOriginAttributes,
bool* aFoundCookie)
{
NS_ENSURE_ARG_POINTER(aCookie);
NS_ENSURE_ARG_POINTER(aOriginAttributes);
NS_ENSURE_ARG_POINTER(aFoundCookie);
if (!mDBState) {
NS_WARNING("No DBState! Profile already closed?");
@@ -4778,17 +4780,17 @@ nsCookieService::GetCookiesFromHost(cons
nsAutoCString host(aHost);
nsresult rv = NormalizeHost(host);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString baseDomain;
rv = GetBaseDomainFromHost(host, baseDomain);
NS_ENSURE_SUCCESS(rv, rv);
- NeckoOriginAttributes attrs;
+ OriginAttributes attrs;
rv = InitializeOriginAttributes(&attrs,
aOriginAttributes,
aCx,
aArgc,
u"nsICookieManager2.getCookiesFromHost()",
u"2");
NS_ENSURE_SUCCESS(rv, rv);
--- a/netwerk/cookie/nsCookieService.h
+++ b/netwerk/cookie/nsCookieService.h
@@ -27,17 +27,16 @@
#include "mozIStorageStatementCallback.h"
#include "mozIStorageFunction.h"
#include "nsIVariant.h"
#include "nsIFile.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Maybe.h"
-using mozilla::NeckoOriginAttributes;
using mozilla::OriginAttributes;
class nsICookiePermission;
class nsIEffectiveTLDService;
class nsIIDNService;
class nsIPrefBranch;
class nsIObserverService;
class nsIURI;
@@ -61,17 +60,17 @@ class nsCookieKey : public PLDHashEntryH
{
public:
typedef const nsCookieKey& KeyType;
typedef const nsCookieKey* KeyTypePointer;
nsCookieKey()
{}
- nsCookieKey(const nsCString &baseDomain, const NeckoOriginAttributes &attrs)
+ nsCookieKey(const nsCString &baseDomain, const OriginAttributes &attrs)
: mBaseDomain(baseDomain)
, mOriginAttributes(attrs)
{}
explicit nsCookieKey(KeyTypePointer other)
: mBaseDomain(other->mBaseDomain)
, mOriginAttributes(other->mOriginAttributes)
{}
@@ -106,17 +105,17 @@ public:
return mozilla::HashString(temp);
}
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
enum { ALLOW_MEMMOVE = true };
nsCString mBaseDomain;
- NeckoOriginAttributes mOriginAttributes;
+ OriginAttributes mOriginAttributes;
};
// Inherit from nsCookieKey so this can be stored in nsTHashTable
// TODO: why aren't we using nsClassHashTable<nsCookieKey, ArrayType>?
class nsCookieEntry : public nsCookieKey
{
public:
// Hash methods
@@ -290,19 +289,19 @@ class nsCookieService final : public nsI
void AsyncReadComplete();
void CancelAsyncRead(bool aPurgeReadSet);
void EnsureReadDomain(const nsCookieKey &aKey);
void EnsureReadComplete();
nsresult NormalizeHost(nsCString &aHost);
nsresult GetBaseDomain(nsIURI *aHostURI, nsCString &aBaseDomain, bool &aRequireHostMatch);
nsresult GetBaseDomainFromHost(const nsACString &aHost, nsCString &aBaseDomain);
nsresult GetCookieStringCommon(nsIURI *aHostURI, nsIChannel *aChannel, bool aHttpBound, char** aCookie);
- void GetCookieStringInternal(nsIURI *aHostURI, bool aIsForeign, bool aHttpBound, const NeckoOriginAttributes& aOriginAttrs, bool aIsPrivate, nsCString &aCookie);
+ void GetCookieStringInternal(nsIURI *aHostURI, bool aIsForeign, bool aHttpBound, const OriginAttributes& aOriginAttrs, bool aIsPrivate, nsCString &aCookie);
nsresult SetCookieStringCommon(nsIURI *aHostURI, const char *aCookieHeader, const char *aServerTime, nsIChannel *aChannel, bool aFromHttp);
- void SetCookieStringInternal(nsIURI *aHostURI, bool aIsForeign, nsDependentCString &aCookieHeader, const nsCString &aServerTime, bool aFromHttp, const NeckoOriginAttributes &aOriginAttrs, bool aIsPrivate, nsIChannel* aChannel);
+ void SetCookieStringInternal(nsIURI *aHostURI, bool aIsForeign, nsDependentCString &aCookieHeader, const nsCString &aServerTime, bool aFromHttp, const OriginAttributes &aOriginAttrs, bool aIsPrivate, nsIChannel* aChannel);
bool SetCookieInternal(nsIURI *aHostURI, const nsCookieKey& aKey, bool aRequireHostMatch, CookieStatus aStatus, nsDependentCString &aCookieHeader, int64_t aServerTime, bool aFromHttp, nsIChannel* aChannel);
void AddInternal(const nsCookieKey& aKey, nsCookie *aCookie, int64_t aCurrentTimeInUsec, nsIURI *aHostURI, const char *aCookieHeader, bool aFromHttp);
void RemoveCookieFromList(const nsListIter &aIter, mozIStorageBindingParamsArray *aParamsArray = nullptr);
void AddCookieToList(const nsCookieKey& aKey, nsCookie *aCookie, DBState *aDBState, mozIStorageBindingParamsArray *aParamsArray, bool aWriteToDB = true);
void UpdateCookieInList(nsCookie *aCookie, int64_t aLastAccessed, mozIStorageBindingParamsArray *aParamsArray);
static bool GetTokenValue(nsASingleFragmentCString::const_char_iterator &aIter, nsASingleFragmentCString::const_char_iterator &aEndIter, nsDependentCSubstring &aTokenString, nsDependentCSubstring &aTokenValue, bool &aEqualsFound);
static bool ParseAttributes(nsDependentCString &aCookieHeader, nsCookieAttributes &aCookie);
bool RequireThirdPartyCheck();
@@ -324,20 +323,20 @@ class nsCookieService final : public nsI
already_AddRefed<nsIArray> CreatePurgeList(nsICookie2* aCookie);
void UpdateCookieOldestTime(DBState* aDBState, nsCookie* aCookie);
nsresult GetCookiesWithOriginAttributes(const mozilla::OriginAttributesPattern& aPattern, const nsCString& aBaseDomain, nsISimpleEnumerator **aEnumerator);
nsresult RemoveCookiesWithOriginAttributes(const mozilla::OriginAttributesPattern& aPattern, const nsCString& aBaseDomain);
/**
* This method is a helper that allows calling nsICookieManager::Remove()
- * with NeckoOriginAttributes parameter.
+ * with OriginAttributes parameter.
* NOTE: this could be added to a public interface if we happen to need it.
*/
- nsresult Remove(const nsACString& aHost, const NeckoOriginAttributes& aAttrs,
+ nsresult Remove(const nsACString& aHost, const OriginAttributes& aAttrs,
const nsACString& aName, const nsACString& aPath,
bool aBlocked);
protected:
// cached members.
nsCOMPtr<nsICookiePermission> mPermissionService;
nsCOMPtr<mozIThirdPartyUtil> mThirdPartyUtil;
nsCOMPtr<nsIEffectiveTLDService> mTLDService;
--- a/netwerk/cookie/nsICookieManager.idl
+++ b/netwerk/cookie/nsICookieManager.idl
@@ -2,21 +2,21 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#include "nsISupports.idl"
%{ C++
namespace mozilla {
-class NeckoOriginAttributes;
+class OriginAttributes;
} // mozilla namespace
%}
-[ptr] native NeckoOriginAttributesPtr(mozilla::NeckoOriginAttributes);
+[ptr] native OriginAttributesPtr(mozilla::OriginAttributes);
interface nsISimpleEnumerator;
[scriptable, function, uuid(20709db8-8dad-4e45-b33e-6e7c761dfc5d)]
interface nsIPrivateModeCallback : nsISupports
{
void callback();
};
@@ -67,17 +67,17 @@ interface nsICookieManager : nsISupports
in boolean aBlocked,
[optional] in jsval aOriginAttributes);
[notxpcom]
nsresult removeNative(in AUTF8String aHost,
in ACString aName,
in AUTF8String aPath,
in boolean aBlocked,
- in NeckoOriginAttributesPtr aOriginAttributes);
+ in OriginAttributesPtr aOriginAttributes);
/**
* Set the cookie manager to work on private or non-private cookies for the
* duration of the callback.
*
* @param aIsPrivate True to work on private cookies, false to work on
* non-private cookies.
* @param aCallback Methods on the cookie manager interface will work on
--- a/netwerk/cookie/nsICookieManager2.idl
+++ b/netwerk/cookie/nsICookieManager2.idl
@@ -64,17 +64,17 @@ interface nsICookieManager2 : nsICookieM
nsresult addNative(in AUTF8String aHost,
in AUTF8String aPath,
in ACString aName,
in ACString aValue,
in boolean aIsSecure,
in boolean aIsHttpOnly,
in boolean aIsSession,
in int64_t aExpiry,
- in NeckoOriginAttributesPtr aOriginAttributes);
+ in OriginAttributesPtr aOriginAttributes);
/**
* Find whether a given cookie already exists.
*
* @param aCookie
* the cookie to look for
* @param aOriginAttributes
* nsICookie2 contains an originAttributes but if nsICookie2 is
@@ -86,17 +86,17 @@ interface nsICookieManager2 : nsICookieM
* fields of aCookie
*/
[implicit_jscontext, optional_argc]
boolean cookieExists(in nsICookie2 aCookie,
[optional] in jsval aOriginAttributes);
[notxpcom]
nsresult cookieExistsNative(in nsICookie2 aCookie,
- in NeckoOriginAttributesPtr aOriginAttributes,
+ in OriginAttributesPtr aOriginAttributes,
out boolean aExists);
/**
* Count how many cookies exist within the base domain of 'aHost'.
* Thus, for a host "weather.yahoo.com", the base domain would be "yahoo.com",
* and any host or domain cookies for "yahoo.com" and its subdomains would be
* counted.
*
--- a/netwerk/ipc/NeckoChannelParams.ipdlh
+++ b/netwerk/ipc/NeckoChannelParams.ipdlh
@@ -10,17 +10,17 @@ include protocol PFTPChannel;
include protocol PRtspChannel;
include protocol PSendStream;
include BlobTypes;
include URIParams;
include IPCStream;
include InputStreamParams;
include PBackgroundSharedTypes;
-using mozilla::NeckoOriginAttributes from "mozilla/ipc/BackgroundUtils.h";
+using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
using RequestHeaderTuples from "mozilla/net/PHttpChannelParams.h";
using struct nsHttpAtom from "nsHttp.h";
using class nsHttpResponseHead from "nsHttpResponseHead.h";
namespace mozilla {
namespace net {
@@ -42,17 +42,17 @@ struct LoadInfoArgs
bool forceInheritPrincipalDropped;
uint64_t innerWindowID;
uint64_t outerWindowID;
uint64_t parentOuterWindowID;
uint64_t frameOuterWindowID;
bool enforceSecurity;
bool initialSecurityCheckDone;
bool isInThirdPartyContext;
- NeckoOriginAttributes originAttributes;
+ OriginAttributes originAttributes;
PrincipalInfo[] redirectChainIncludingInternalRedirects;
PrincipalInfo[] redirectChain;
nsCString[] corsUnsafeHeaders;
bool forcePreflight;
bool isPreflight;
bool forceHSTSPriming;
bool mixedContentWouldBlock;
};
--- a/netwerk/ipc/NeckoParent.cpp
+++ b/netwerk/ipc/NeckoParent.cpp
@@ -40,18 +40,17 @@
#include "SerializedLoadContext.h"
#include "nsAuthInformationHolder.h"
#include "nsIAuthPromptCallback.h"
#include "nsPrincipal.h"
#include "nsINetworkPredictor.h"
#include "nsINetworkPredictorVerifier.h"
#include "nsISpeculativeConnect.h"
-using mozilla::DocShellOriginAttributes;
-using mozilla::NeckoOriginAttributes;
+using mozilla::OriginAttributes;
using mozilla::dom::ChromeUtils;
using mozilla::dom::ContentParent;
using mozilla::dom::TabContext;
using mozilla::dom::TabParent;
using mozilla::net::PTCPSocketParent;
using mozilla::dom::TCPSocketParent;
using mozilla::net::PTCPServerSocketParent;
using mozilla::dom::TCPServerSocketParent;
@@ -153,23 +152,23 @@ void CrashWithReason(const char * reason
MOZ_REALLY_CRASH();
#endif
}
const char*
NeckoParent::GetValidatedOriginAttributes(const SerializedLoadContext& aSerialized,
PContentParent* aContent,
nsIPrincipal* aRequestingPrincipal,
- DocShellOriginAttributes& aAttrs)
+ OriginAttributes& aAttrs)
{
if (!UsingNeckoIPCSecurity()) {
if (!aSerialized.IsNotNull()) {
// If serialized is null, we cannot validate anything. We have to assume
// that this requests comes from a SystemPrincipal.
- aAttrs = DocShellOriginAttributes(NECKO_NO_APP_ID, false);
+ aAttrs = OriginAttributes(NECKO_NO_APP_ID, false);
} else {
aAttrs = aSerialized.mOriginAttributes;
}
return nullptr;
}
if (!aSerialized.IsNotNull()) {
CrashWithReason("GetValidatedOriginAttributes | SerializedLoadContext from child is null");
@@ -232,17 +231,17 @@ NeckoParent::GetValidatedOriginAttribute
const char *
NeckoParent::CreateChannelLoadContext(const PBrowserOrId& aBrowser,
PContentParent* aContent,
const SerializedLoadContext& aSerialized,
nsIPrincipal* aRequestingPrincipal,
nsCOMPtr<nsILoadContext> &aResult)
{
- DocShellOriginAttributes attrs;
+ OriginAttributes attrs;
const char* error = GetValidatedOriginAttributes(aSerialized, aContent,
aRequestingPrincipal, attrs);
if (error) {
return error;
}
// if !UsingNeckoIPCSecurity(), we may not have a LoadContext to set. This is
// the common case for most xpcshell tests.
@@ -828,17 +827,17 @@ NeckoParent::RecvPredPredict(const ipc::
const bool& hasVerifier)
{
nsCOMPtr<nsIURI> targetURI = DeserializeURI(aTargetURI);
nsCOMPtr<nsIURI> sourceURI = DeserializeURI(aSourceURI);
// We only actually care about the loadContext.mPrivateBrowsing, so we'll just
// pass dummy params for nestFrameId, and originAttributes.
uint64_t nestedFrameId = 0;
- DocShellOriginAttributes attrs(NECKO_UNKNOWN_APP_ID, false);
+ OriginAttributes attrs(NECKO_UNKNOWN_APP_ID, false);
nsCOMPtr<nsILoadContext> loadContext;
if (aLoadContext.IsNotNull()) {
attrs.SyncAttributesWithPrivateBrowsing(aLoadContext.mOriginAttributes.mPrivateBrowsingId > 0);
loadContext = new LoadContext(aLoadContext, nestedFrameId, attrs);
}
// Get the current predictor
nsresult rv = NS_OK;
@@ -861,17 +860,17 @@ NeckoParent::RecvPredLearn(const ipc::UR
const SerializedLoadContext& aLoadContext)
{
nsCOMPtr<nsIURI> targetURI = DeserializeURI(aTargetURI);
nsCOMPtr<nsIURI> sourceURI = DeserializeURI(aSourceURI);
// We only actually care about the loadContext.mPrivateBrowsing, so we'll just
// pass dummy params for nestFrameId, and originAttributes;
uint64_t nestedFrameId = 0;
- DocShellOriginAttributes attrs(NECKO_UNKNOWN_APP_ID, false);
+ OriginAttributes attrs(NECKO_UNKNOWN_APP_ID, false);
nsCOMPtr<nsILoadContext> loadContext;
if (aLoadContext.IsNotNull()) {
attrs.SyncAttributesWithPrivateBrowsing(aLoadContext.mOriginAttributes.mPrivateBrowsingId > 0);
loadContext = new LoadContext(aLoadContext, nestedFrameId, attrs);
}
// Get the current predictor
nsresult rv = NS_OK;
--- a/netwerk/ipc/NeckoParent.h
+++ b/netwerk/ipc/NeckoParent.h
@@ -33,17 +33,17 @@ public:
NeckoParent();
virtual ~NeckoParent();
MOZ_MUST_USE
static const char *
GetValidatedOriginAttributes(const SerializedLoadContext& aSerialized,
PContentParent* aBrowser,
nsIPrincipal* aRequestingPrincipal,
- mozilla::DocShellOriginAttributes& aAttrs);
+ mozilla::OriginAttributes& aAttrs);
/*
* Creates LoadContext for parent-side of an e10s channel.
*
* PContentParent corresponds to the process that is requesting the load.
*
* Returns null if successful, or an error string if failed.
*/
--- a/netwerk/protocol/ftp/FTPChannelParent.cpp
+++ b/netwerk/protocol/ftp/FTPChannelParent.cpp
@@ -138,17 +138,17 @@ FTPChannelParent::DoAsyncOpen(const URIP
nsCOMPtr<nsILoadInfo> loadInfo;
rv = mozilla::ipc::LoadInfoArgsToLoadInfo(aLoadInfoArgs,
getter_AddRefs(loadInfo));
if (NS_FAILED(rv)) {
return SendFailedAsyncOpen(rv);
}
- NeckoOriginAttributes attrs;
+ OriginAttributes attrs;
rv = loadInfo->GetOriginAttributes(&attrs);
if (NS_FAILED(rv)) {
return SendFailedAsyncOpen(rv);
}
nsCOMPtr<nsIChannel> chan;
rv = NS_NewChannelInternal(getter_AddRefs(chan), uri, loadInfo,
nullptr, nullptr,
--- a/netwerk/protocol/http/AlternateServices.cpp
+++ b/netwerk/protocol/http/AlternateServices.cpp
@@ -46,17 +46,17 @@ SchemeIsHTTPS(const nsACString &originSc
return NS_OK;
}
void
AltSvcMapping::ProcessHeader(const nsCString &buf, const nsCString &originScheme,
const nsCString &originHost, int32_t originPort,
const nsACString &username, bool privateBrowsing,
nsIInterfaceRequestor *callbacks, nsProxyInfo *proxyInfo,
- uint32_t caps, const NeckoOriginAttributes &originAttributes)
+ uint32_t caps, const OriginAttributes &originAttributes)
{
MOZ_ASSERT(NS_IsMainThread());
LOG(("AltSvcMapping::ProcessHeader: %s\n", buf.get()));
if (!callbacks) {
return;
}
if (proxyInfo && !proxyInfo->IsDirect()) {
@@ -306,17 +306,17 @@ AltSvcMapping::RouteEquals(AltSvcMapping
return mAlternateHost.Equals(map->mAlternateHost) &&
(mAlternatePort == map->mAlternatePort) &&
mNPNToken.Equals(map->mNPNToken);
}
void
AltSvcMapping::GetConnectionInfo(nsHttpConnectionInfo **outCI,
nsProxyInfo *pi,
- const NeckoOriginAttributes &originAttributes)
+ const OriginAttributes &originAttributes)
{
RefPtr<nsHttpConnectionInfo> ci =
new nsHttpConnectionInfo(mOriginHost, mOriginPort, mNPNToken,
mUsername, pi, originAttributes,
mAlternateHost, mAlternatePort);
// http:// without the mixed-scheme attribute needs to be segmented in the
// connection manager connection information hash with this attribute
@@ -815,17 +815,17 @@ AltSvcCache::LookupMapping(const nsCStri
LOG(("AltSvcCache::LookupMapping %p HIT %p\n", this, rv.get()));
return rv.forget();
}
void
AltSvcCache::UpdateAltServiceMapping(AltSvcMapping *map, nsProxyInfo *pi,
nsIInterfaceRequestor *aCallbacks,
uint32_t caps,
- const NeckoOriginAttributes &originAttributes)
+ const OriginAttributes &originAttributes)
{
MOZ_ASSERT(NS_IsMainThread());
if (!mStorage) {
return;
}
RefPtr<AltSvcMapping> existing = LookupMapping(map->HashKey(), map->Private());
LOG(("AltSvcCache::UpdateAltServiceMapping %p map %p existing %p %s validated=%d",
this, map, existing.get(), map->AlternateHost().get(),
--- a/netwerk/protocol/http/AlternateServices.h
+++ b/netwerk/protocol/http/AlternateServices.h
@@ -58,30 +58,30 @@ private: // ctor from ProcessHeader
const nsACString &npnToken);
public:
AltSvcMapping(DataStorage *storage, int32_t storageEpoch, const nsCString &serialized);
static void ProcessHeader(const nsCString &buf, const nsCString &originScheme,
const nsCString &originHost, int32_t originPort,
const nsACString &username, bool privateBrowsing,
nsIInterfaceRequestor *callbacks, nsProxyInfo *proxyInfo,
- uint32_t caps, const NeckoOriginAttributes &originAttributes);
+ uint32_t caps, const OriginAttributes &originAttributes);
const nsCString &AlternateHost() const { return mAlternateHost; }
const nsCString &OriginHost() const { return mOriginHost; }
uint32_t OriginPort() const { return mOriginPort; }
const nsCString &HashKey() const { return mHashKey; }
uint32_t AlternatePort() const { return mAlternatePort; }
bool Validated() { return mValidated; }
int32_t GetExpiresAt() { return mExpiresAt; }
bool RouteEquals(AltSvcMapping *map);
bool HTTPS() { return mHttps; }
void GetConnectionInfo(nsHttpConnectionInfo **outCI, nsProxyInfo *pi,
- const NeckoOriginAttributes &originAttributes);
+ const OriginAttributes &originAttributes);
int32_t TTL();
int32_t StorageEpoch() { return mStorageEpoch; }
bool Private() { return mPrivate; }
void SetValidated(bool val);
void SetMixedScheme(bool val);
void SetExpiresAt(int32_t val);
@@ -164,17 +164,17 @@ private:
class AltSvcCache
{
public:
AltSvcCache() : mStorageEpoch(0) {}
virtual ~AltSvcCache () {};
void UpdateAltServiceMapping(AltSvcMapping *map, nsProxyInfo *pi,
nsIInterfaceRequestor *, uint32_t caps,
- const NeckoOriginAttributes &originAttributes); // main thread
+ const OriginAttributes &originAttributes); // main thread
already_AddRefed<AltSvcMapping> GetAltServiceMapping(const nsACString &scheme,
const nsACString &host,
int32_t port, bool pb);
void ClearAltServiceMappings();
void ClearHostMapping(const nsACString &host, int32_t port);
void ClearHostMapping(nsHttpConnectionInfo *ci);
DataStorage *GetStoragePtr() { return mStorage.get(); }
int32_t StorageEpoch() { return mStorageEpoch; }
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -2736,17 +2736,17 @@ void HttpBaseChannel::AssertPrivateBrows
// We skip testing of favicon loading here since it could be triggered by XUL image
// which uses SystemPrincipal. The SystemPrincpal doesn't have mPrivateBrowsingId.
if (nsContentUtils::IsSystemPrincipal(mLoadInfo->LoadingPrincipal()) &&
mLoadInfo->InternalContentPolicyType() == nsIContentPolicy::TYPE_INTERNAL_IMAGE_FAVICON) {
return;
}
- DocShellOriginAttributes docShellAttrs;
+ OriginAttributes docShellAttrs;
loadContext->GetOriginAttributes(docShellAttrs);
MOZ_ASSERT(mLoadInfo->GetOriginAttributes().mPrivateBrowsingId == docShellAttrs.mPrivateBrowsingId,
"PrivateBrowsingId values are not the same between LoadInfo and LoadContext.");
}
#endif
//-----------------------------------------------------------------------------
// nsHttpChannel::nsITraceableChannel
@@ -3010,31 +3010,32 @@ HttpBaseChannel::SetupReplacementChannel
// re-compute the origin attributes of the loadInfo if it's top-level load.
bool isTopLevelDoc =
newLoadInfo->GetExternalContentPolicyType() == nsIContentPolicy::TYPE_DOCUMENT;
if (isTopLevelDoc) {
nsCOMPtr<nsILoadContext> loadContext;
NS_QueryNotificationCallbacks(this, loadContext);
- DocShellOriginAttributes docShellAttrs;
+ OriginAttributes docShellAttrs;
if (loadContext) {
loadContext->GetOriginAttributes(docShellAttrs);
}
- NeckoOriginAttributes attrs = newLoadInfo->GetOriginAttributes();
+ OriginAttributes attrs = newLoadInfo->GetOriginAttributes();
MOZ_ASSERT(docShellAttrs.mUserContextId == attrs.mUserContextId,
"docshell and necko should have the same userContextId attribute.");
MOZ_ASSERT(docShellAttrs.mInIsolatedMozBrowser == attrs.mInIsolatedMozBrowser,
"docshell and necko should have the same inIsolatedMozBrowser attribute.");
MOZ_ASSERT(docShellAttrs.mPrivateBrowsingId == attrs.mPrivateBrowsingId,
"docshell and necko should have the same privateBrowsingId attribute.");
- attrs.InheritFromDocShellToNecko(docShellAttrs, true, newURI);
+ attrs.Inherit(docShellAttrs);
+ attrs.SetFirstPartyDomain(true, newURI);
newLoadInfo->SetOriginAttributes(attrs);
}
bool isInternalRedirect =
(redirectFlags & (nsIChannelEventSink::REDIRECT_INTERNAL |
nsIChannelEventSink::REDIRECT_STS_UPGRADE));
newLoadInfo->AppendRedirectedPrincipal(GetURIPrincipal(), isInternalRedirect);
newChannel->SetLoadInfo(newLoadInfo);
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -354,17 +354,17 @@ HttpChannelParent::DoAsyncOpen( const U
nsCOMPtr<nsILoadInfo> loadInfo;
rv = mozilla::ipc::LoadInfoArgsToLoadInfo(aLoadInfoArgs,
getter_AddRefs(loadInfo));
if (NS_FAILED(rv)) {
return SendFailedAsyncOpen(rv);
}
- NeckoOriginAttributes attrs;
+ OriginAttributes attrs;
rv = loadInfo->GetOriginAttributes(&attrs);
if (NS_FAILED(rv)) {
return SendFailedAsyncOpen(rv);
}
nsCOMPtr<nsIChannel> channel;
rv = NS_NewChannelInternal(getter_AddRefs(channel), uri, loadInfo,
nullptr, nullptr, aLoadFlags, ios);
@@ -551,21 +551,20 @@ HttpChannelParent::DoAsyncOpen( const U
getter_AddRefs(appCache));
if (NS_SUCCEEDED(rv)) {
appCacheChan->SetApplicationCache(appCache);
setChooseApplicationCache = false;
}
}
if (setChooseApplicationCache) {
- NeckoOriginAttributes neckoAttrs;
- NS_GetOriginAttributes(mChannel, neckoAttrs);
+ OriginAttributes attrs;
+ NS_GetOriginAttributes(mChannel, attrs);
+ attrs.StripAttributes(OriginAttributes::STRIP_ADDON_ID);
- PrincipalOriginAttributes attrs;
- attrs.InheritFromNecko(neckoAttrs);
nsCOMPtr<nsIPrincipal> principal =
BasePrincipal::CreateCodebasePrincipal(uri, attrs);
bool chooseAppCache = false;
// This works because we've already called SetNotificationCallbacks and
// done mPBOverride logic by this point.
chooseAppCache = NS_ShouldCheckAppCache(principal, NS_UsePrivateBrowsing(mChannel));
--- a/netwerk/protocol/http/TunnelUtils.cpp
+++ b/netwerk/protocol/http/TunnelUtils.cpp
@@ -73,17 +73,17 @@ TLSFilterTransaction::TLSFilterTransacti
sLayerMethodsPtr = &sLayerMethods;
}
mFD = PR_CreateIOLayerStub(sLayerIdentity, &sLayerMethods);
if (provider && mFD) {
mFD->secret = reinterpret_cast<PRFilePrivate *>(this);
provider->AddToSocket(PR_AF_INET, aTLSHost, aTLSPort, nullptr,
- NeckoOriginAttributes(), 0, mFD,
+ OriginAttributes(), 0, mFD,
getter_AddRefs(mSecInfo));
}
if (mTransaction) {
nsCOMPtr<nsIInterfaceRequestor> callbacks;
mTransaction->GetSecurityCallbacks(getter_AddRefs(callbacks));
nsCOMPtr<nsISSLSocketControl> secCtrl(do_QueryInterface(mSecInfo));
if (secCtrl) {
@@ -1591,23 +1591,23 @@ FWD_TS_ADDREF(GetSecurityInfo, nsISuppor
FWD_TS_ADDREF(GetSecurityCallbacks, nsIInterfaceRequestor);
FWD_TS_PTR(IsAlive, bool);
FWD_TS_PTR(GetConnectionFlags, uint32_t);
FWD_TS(SetConnectionFlags, uint32_t);
FWD_TS_PTR(GetRecvBufferSize, uint32_t);
FWD_TS(SetRecvBufferSize, uint32_t);
nsresult
-SocketTransportShim::GetOriginAttributes(mozilla::NeckoOriginAttributes* aOriginAttributes)
+SocketTransportShim::GetOriginAttributes(mozilla::OriginAttributes* aOriginAttributes)
{
return mWrapped->GetOriginAttributes(aOriginAttributes);
}
nsresult
-SocketTransportShim::SetOriginAttributes(const mozilla::NeckoOriginAttributes& aOriginAttributes)
+SocketTransportShim::SetOriginAttributes(const mozilla::OriginAttributes& aOriginAttributes)
{
return mWrapped->SetOriginAttributes(aOriginAttributes);
}
NS_IMETHODIMP
SocketTransportShim::GetScriptableOriginAttributes(JSContext* aCx,
JS::MutableHandle<JS::Value> aOriginAttributes)
{
--- a/netwerk/protocol/http/nsHttpAuthCache.cpp
+++ b/netwerk/protocol/http/nsHttpAuthCache.cpp
@@ -286,18 +286,18 @@ RemoveEntriesForPattern(PLHashEntry *ent
nsDependentCString key(static_cast<const char*>(entry->key));
// Extract the origin attributes suffix from the key.
int32_t colon = key.Find(NS_LITERAL_CSTRING(":"));
MOZ_ASSERT(colon != kNotFound);
nsDependentCSubstring oaSuffix;
oaSuffix.Rebind(key.BeginReading(), colon);
- // Build the NeckoOriginAttributes object of it...
- NeckoOriginAttributes oa;
+ // Build the OriginAttributes object of it...
+ OriginAttributes oa;
DebugOnly<bool> rv = oa.PopulateFromSuffix(oaSuffix);
MOZ_ASSERT(rv);
// ...and match it against the given pattern.
OriginAttributesPattern const *pattern = static_cast<OriginAttributesPattern const*>(arg);
if (pattern->Matches(oa)) {
return HT_ENUMERATE_NEXT | HT_ENUMERATE_REMOVE;
}
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -1885,17 +1885,17 @@ nsHttpChannel::ProcessAltService()
nsCOMPtr<nsIInterfaceRequestor> callbacks;
nsCOMPtr<nsProxyInfo> proxyInfo;
NS_NewNotificationCallbacksAggregation(mCallbacks, mLoadGroup,
getter_AddRefs(callbacks));
if (mProxyInfo) {
proxyInfo = do_QueryInterface(mProxyInfo);
}
- NeckoOriginAttributes originAttributes;
+ OriginAttributes originAttributes;
NS_GetOriginAttributes(this, originAttributes);
AltSvcMapping::ProcessHeader(altSvc, scheme, originHost, originPort,
mUsername, mPrivateBrowsing, callbacks, proxyInfo,
mCaps & NS_HTTP_DISALLOW_SPDY,
originAttributes);
}
@@ -5879,17 +5879,17 @@ nsHttpChannel::BeginConnect()
if (mProxyInfo)
proxyInfo = do_QueryInterface(mProxyInfo);
mRequestHead.SetHTTPS(isHttps);
mRequestHead.SetOrigin(scheme, host, port);
SetDoNotTrack();
- NeckoOriginAttributes originAttributes;
+ OriginAttributes originAttributes;
NS_GetOriginAttributes(this, originAttributes);
RefPtr<AltSvcMapping> mapping;
if (!mConnectionInfo && mAllowAltSvc && // per channel
!(mLoadFlags & LOAD_FRESH_CONNECTION) &&
(scheme.Equals(NS_LITERAL_CSTRING("http")) ||
scheme.Equals(NS_LITERAL_CSTRING("https"))) &&
(!proxyInfo || proxyInfo->IsDirect()) &&
--- a/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
+++ b/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
@@ -51,17 +51,17 @@ namespace net {
#define HTTP_AUTH_NTLM_INSECURE 4
#define HTTP_AUTH_NTLM_SECURE 5
#define HTTP_AUTH_NEGOTIATE_INSECURE 6
#define HTTP_AUTH_NEGOTIATE_SECURE 7
static void
GetOriginAttributesSuffix(nsIChannel* aChan, nsACString &aSuffix)
{
- NeckoOriginAttributes oa;
+ OriginAttributes oa;
// Deliberately ignoring the result and going with defaults
if (aChan) {
NS_GetOriginAttributes(aChan, oa);
}
oa.CreateSuffix(aSuffix);
}
--- a/netwerk/protocol/http/nsHttpConnectionInfo.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionInfo.cpp
@@ -46,29 +46,29 @@ SHA256(const char* aPlainText, nsAutoCSt
namespace mozilla {
namespace net {
nsHttpConnectionInfo::nsHttpConnectionInfo(const nsACString &originHost,
int32_t originPort,
const nsACString &npnToken,
const nsACString &username,
nsProxyInfo *proxyInfo,
- const NeckoOriginAttributes &originAttributes,
+ const OriginAttributes &originAttributes,
bool endToEndSSL)
: mRoutedPort(443)
{
Init(originHost, originPort, npnToken, username, proxyInfo, originAttributes, endToEndSSL);
}
nsHttpConnectionInfo::nsHttpConnectionInfo(const nsACString &originHost,
int32_t originPort,
const nsACString &npnToken,
const nsACString &username,
nsProxyInfo *proxyInfo,
- const NeckoOriginAttributes &originAttributes,
+ const OriginAttributes &originAttributes,
const nsACString &routedHost,
int32_t routedPort)
{
mEndToEndSSL = true; // so DefaultPort() works
mRoutedPort = routedPort == -1 ? DefaultPort() : routedPort;
if (!originHost.Equals(routedHost) || (originPort != routedPort)) {
mRoutedHost = routedHost;
@@ -76,17 +76,17 @@ nsHttpConnectionInfo::nsHttpConnectionIn
Init(originHost, originPort, npnToken, username, proxyInfo, originAttributes, true);
}
void
nsHttpConnectionInfo::Init(const nsACString &host, int32_t port,
const nsACString &npnToken,
const nsACString &username,
nsProxyInfo* proxyInfo,
- const NeckoOriginAttributes &originAttributes,
+ const OriginAttributes &originAttributes,
bool e2eSSL)
{
LOG(("Init nsHttpConnectionInfo @%p\n", this));
mUsername = username;
mProxyInfo = proxyInfo;
mEndToEndSSL = e2eSSL;
mUsingConnect = false;
--- a/netwerk/protocol/http/nsHttpConnectionInfo.h
+++ b/netwerk/protocol/http/nsHttpConnectionInfo.h
@@ -35,28 +35,28 @@ extern LazyLogModule gHttpLog;
class nsHttpConnectionInfo: public ARefBase
{
public:
nsHttpConnectionInfo(const nsACString &originHost,
int32_t originPort,
const nsACString &npnToken,
const nsACString &username,
nsProxyInfo *proxyInfo,
- const NeckoOriginAttributes &originAttributes,
+ const OriginAttributes &originAttributes,
bool endToEndSSL = false);
// this version must use TLS and you may supply separate
// connection (aka routing) information than the authenticated
// origin information
nsHttpConnectionInfo(const nsACString &originHost,
int32_t originPort,
const nsACString &npnToken,
const nsACString &username,
nsProxyInfo *proxyInfo,
- const NeckoOriginAttributes &originAttributes,
+ const OriginAttributes &originAttributes,
const nsACString &routedHost,
int32_t routedPort);
private:
virtual ~nsHttpConnectionInfo()
{
MOZ_LOG(gHttpLog, LogLevel::Debug, ("Destroying nsHttpConnectionInfo @%x\n", this));
}
@@ -122,17 +122,17 @@ public:
{ mHashKey.SetCharAt(aBeConservative ? 'C' : '.', 6); }
bool GetBeConservative() const { return mHashKey.CharAt(6) == 'C'; }
const nsCString &GetNetworkInterfaceId() const { return mNetworkInterfaceId; }
const nsCString &GetNPNToken() { return mNPNToken; }
const nsCString &GetUsername() { return mUsername; }
- const NeckoOriginAttributes &GetOriginAttributes() { return mOriginAttributes; }
+ const OriginAttributes &GetOriginAttributes() { return mOriginAttributes; }
// Returns true for any kind of proxy (http, socks, https, etc..)
bool UsingProxy();
// Returns true when proxying over HTTP or HTTPS
bool UsingHttpProxy() const { return mUsingHttpProxy || mUsingHttpsProxy; }
// Returns true when proxying over HTTPS
@@ -151,17 +151,17 @@ public:
bool HostIsLocalIPLiteral() const;
private:
void Init(const nsACString &host,
int32_t port,
const nsACString &npnToken,
const nsACString &username,
nsProxyInfo* proxyInfo,
- const NeckoOriginAttributes &originAttributes,
+ const OriginAttributes &originAttributes,
bool EndToEndSSL);
void SetOriginServer(const nsACString &host, int32_t port);
nsCString mOrigin;
int32_t mOriginPort;
nsCString mRoutedHost;
int32_t mRoutedPort;
@@ -169,17 +169,17 @@ private:
nsCString mNetworkInterfaceId;
nsCString mUsername;
nsCOMPtr<nsProxyInfo> mProxyInfo;
bool mUsingHttpProxy;
bool mUsingHttpsProxy;
bool mEndToEndSSL;
bool mUsingConnect; // if will use CONNECT with http proxy
nsCString mNPNToken;
- NeckoOriginAttributes mOriginAttributes;
+ OriginAttributes mOriginAttributes;
// for RefPtr
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(nsHttpConnectionInfo)
};
} // namespace net
} // namespace mozilla
--- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ -1018,17 +1018,17 @@ nsHttpConnectionMgr::ReportFailedToProce
uri->GetUsername(username);
if (NS_FAILED(rv) || !isHttp || host.IsEmpty())
return;
// report the event for all the permutations of anonymous and
// private versions of this host
RefPtr<nsHttpConnectionInfo> ci =
new nsHttpConnectionInfo(host, port, EmptyCString(), username, nullptr,
- NeckoOriginAttributes(), usingSSL);
+ OriginAttributes(), usingSSL);
ci->SetAnonymous(false);
ci->SetPrivate(false);
PipelineFeedbackInfo(ci, RedCorruptedContent, nullptr, 0);
ci = ci->Clone();
ci->SetAnonymous(false);
ci->SetPrivate(true);
PipelineFeedbackInfo(ci, RedCorruptedContent, nullptr, 0);
@@ -3081,19 +3081,18 @@ nsHalfOpenSocket::SetupStreams(nsISocket
}
if (!Allow1918()) {
tmpFlags |= nsISocketTransport::DISABLE_RFC1918;
}
socketTransport->SetConnectionFlags(tmpFlags);
- NeckoOriginAttributes originAttributes =
- mEnt->mConnInfo->GetOriginAttributes();
- if (originAttributes != NeckoOriginAttributes()) {
+ const OriginAttributes& originAttributes = mEnt->mConnInfo->GetOriginAttributes();
+ if (originAttributes != OriginAttributes()) {
socketTransport->SetOriginAttributes(originAttributes);
}
socketTransport->SetQoSBits(gHttpHandler->GetQoSBits());
if (!ci->GetNetworkInterfaceId().IsEmpty()) {
socketTransport->SetNetworkInterfaceId(ci->GetNetworkInterfaceId());
}
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -2300,32 +2300,30 @@ nsHttpHandler::SpeculativeConnectInterna
int32_t port = -1;
rv = aURI->GetPort(&port);
if (NS_FAILED(rv))
return rv;
nsAutoCString username;
aURI->GetUsername(username);
- NeckoOriginAttributes neckoOriginAttributes;
+ OriginAttributes originAttributes;
// If the principal is given, we use the originAttributes from this
// principal. Otherwise, we use the originAttributes from the
// loadContext.
if (aPrincipal) {
- neckoOriginAttributes.InheritFromDocToNecko(
- aPrincipal->OriginAttributesRef());
+ originAttributes.Inherit(aPrincipal->OriginAttributesRef());
} else if (loadContext) {
- DocShellOriginAttributes docshellOriginAttributes;
- loadContext->GetOriginAttributes(docshellOriginAttributes);
- neckoOriginAttributes.InheritFromDocShellToNecko(docshellOriginAttributes);
+ loadContext->GetOriginAttributes(originAttributes);
+ originAttributes.StripAttributes(OriginAttributes::STRIP_ADDON_ID);
}
auto *ci =
new nsHttpConnectionInfo(host, port, EmptyCString(), username, nullptr,
- neckoOriginAttributes, usingSSL);
+ originAttributes, usingSSL);
ci->SetAnonymous(anonymous);
return SpeculativeConnect(ci, aCallbacks);
}
NS_IMETHODIMP
nsHttpHandler::SpeculativeConnect(nsIURI *aURI,
nsIInterfaceRequestor *aCallbacks)
--- a/netwerk/protocol/http/nsHttpHandler.h
+++ b/netwerk/protocol/http/nsHttpHandler.h
@@ -238,17 +238,17 @@ public:
return mConnMgr->SpeculativeConnect(ci, callbacks, caps);
}
// Alternate Services Maps are main thread only
void UpdateAltServiceMapping(AltSvcMapping *map,
nsProxyInfo *proxyInfo,
nsIInterfaceRequestor *callbacks,
uint32_t caps,
- const NeckoOriginAttributes &originAttributes)
+ const OriginAttributes &originAttributes)
{
mConnMgr->UpdateAltServiceMapping(map, proxyInfo, callbacks, caps,
originAttributes);
}
already_AddRefed<AltSvcMapping> GetAltServiceMapping(const nsACString &scheme,
const nsACString &host,
int32_t port, bool pb)
--- a/netwerk/protocol/wyciwyg/nsWyciwygChannel.h
+++ b/netwerk/protocol/wyciwyg/nsWyciwygChannel.h
@@ -82,17 +82,17 @@ protected:
nsresult mStatus;
bool mIsPending;
bool mCharsetAndSourceSet;
bool mNeedToWriteCharset;
int32_t mCharsetSource;
nsCString mCharset;
int64_t mContentLength;
uint32_t mLoadFlags;
- mozilla::NeckoOriginAttributes mOriginAttributes;
+ mozilla::OriginAttributes mOriginAttributes;
nsCOMPtr<nsIURI> mURI;
nsCOMPtr<nsIURI> mOriginalURI;
nsCOMPtr<nsISupports> mOwner;
nsCOMPtr<nsILoadInfo> mLoadInfo;
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
nsCOMPtr<nsIProgressEventSink> mProgressSink;
nsCOMPtr<nsILoadGroup> mLoadGroup;
nsCOMPtr<nsIStreamListener> mListener;
--- a/netwerk/socket/nsISocketProvider.idl
+++ b/netwerk/socket/nsISocketProvider.idl
@@ -2,18 +2,18 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#include "nsISupports.idl"
interface nsIProxyInfo;
[ptr] native PRFileDescStar(struct PRFileDesc);
-native NeckoOriginAttributes(mozilla::NeckoOriginAttributes);
-[ref] native const_OriginAttributesRef(const mozilla::NeckoOriginAttributes);
+native OriginAttributes(mozilla::OriginAttributes);
+[ref] native const_OriginAttributesRef(const mozilla::OriginAttributes);
%{ C++
#include "mozilla/BasePrincipal.h"
%}
/**
* nsISocketProvider
*/
--- a/netwerk/socket/nsSOCKSSocketProvider.cpp
+++ b/netwerk/socket/nsSOCKSSocketProvider.cpp
@@ -6,17 +6,17 @@
#include "nsIServiceManager.h"
#include "nsNamedPipeIOLayer.h"
#include "nsSOCKSSocketProvider.h"
#include "nsSOCKSIOLayer.h"
#include "nsCOMPtr.h"
#include "nsError.h"
-using mozilla::NeckoOriginAttributes;
+using mozilla::OriginAttributes;
//////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS(nsSOCKSSocketProvider, nsISocketProvider)
nsresult
nsSOCKSSocketProvider::CreateV4(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
@@ -43,17 +43,17 @@ nsSOCKSSocketProvider::CreateV5(nsISuppo
return rv;
}
NS_IMETHODIMP
nsSOCKSSocketProvider::NewSocket(int32_t family,
const char *host,
int32_t port,
nsIProxyInfo *proxy,
- const NeckoOriginAttributes &originAttributes,
+ const OriginAttributes &originAttributes,
uint32_t flags,
PRFileDesc **result,
nsISupports **socksInfo)
{
PRFileDesc *sock;
#if defined(XP_WIN)
nsAutoCString proxyHost;
@@ -85,17 +85,17 @@ nsSOCKSSocketProvider::NewSocket(int32_t
return NS_ERROR_SOCKET_CREATE_FAILED;
}
NS_IMETHODIMP
nsSOCKSSocketProvider::AddToSocket(int32_t family,
const char *host,
int32_t port,
nsIProxyInfo *proxy,
- const NeckoOriginAttributes &originAttributes,
+ const OriginAttributes &originAttributes,
uint32_t flags,
PRFileDesc *sock,
nsISupports **socksInfo)
{
nsresult rv = nsSOCKSIOLayerAddToSocket(family,
host,
port,
proxy,
--- a/netwerk/socket/nsUDPSocketProvider.cpp
+++ b/netwerk/socket/nsUDPSocketProvider.cpp
@@ -1,30 +1,30 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#include "nsUDPSocketProvider.h"
#include "nspr.h"
-using mozilla::NeckoOriginAttributes;
+using mozilla::OriginAttributes;
NS_IMPL_ISUPPORTS(nsUDPSocketProvider, nsISocketProvider)
nsUDPSocketProvider::~nsUDPSocketProvider()
{
}
NS_IMETHODIMP
nsUDPSocketProvider::NewSocket(int32_t aFamily,
const char *aHost,
int32_t aPort,
nsIProxyInfo *aProxy,
- const NeckoOriginAttributes &originAttributes,
+ const OriginAttributes &originAttributes,
uint32_t aFlags,
PRFileDesc * *aFileDesc,
nsISupports **aSecurityInfo)
{
NS_ENSURE_ARG_POINTER(aFileDesc);
PRFileDesc* udpFD = PR_OpenUDPSocket(aFamily);
if (!udpFD)
@@ -34,17 +34,17 @@ nsUDPSocketProvider::NewSocket(int32_t a
return NS_OK;
}
NS_IMETHODIMP
nsUDPSocketProvider::AddToSocket(int32_t aFamily,
const char *aHost,
int32_t aPort,
nsIProxyInfo *aProxy,
- const NeckoOriginAttributes &originAttributes,
+ const OriginAttributes &originAttributes,
uint32_t aFlags,
struct PRFileDesc * aFileDesc,
nsISupports **aSecurityInfo)
{
// does not make sense to strap a UDP socket onto an existing socket
NS_NOTREACHED("Cannot layer UDP socket on an existing socket");
return NS_ERROR_UNEXPECTED;
}
--- a/netwerk/test/TestCookie.cpp
+++ b/netwerk/test/TestCookie.cpp
@@ -617,17 +617,17 @@ TEST(TestCookie,TestCookieMain)
// *** nsICookieManager{2} interface tests
nsCOMPtr<nsICookieManager> cookieMgr = do_GetService(NS_COOKIEMANAGER_CONTRACTID, &rv0);
ASSERT_TRUE(NS_SUCCEEDED(rv0));
nsCOMPtr<nsICookieManager2> cookieMgr2 = do_QueryInterface(cookieMgr);
ASSERT_TRUE(cookieMgr2);
- mozilla::NeckoOriginAttributes attrs;
+ mozilla::OriginAttributes attrs;
// first, ensure a clean slate
EXPECT_TRUE(NS_SUCCEEDED(cookieMgr->RemoveAll()));
// add some cookies
EXPECT_TRUE(NS_SUCCEEDED(cookieMgr2->AddNative(NS_LITERAL_CSTRING("cookiemgr.test"), // domain
NS_LITERAL_CSTRING("/foo"), // path
NS_LITERAL_CSTRING("test1"), // name
NS_LITERAL_CSTRING("yes"), // value
--- a/security/certverifier/CertVerifier.cpp
+++ b/security/certverifier/CertVerifier.cpp
@@ -336,17 +336,17 @@ static const unsigned int MIN_RSA_BITS_W
Result
CertVerifier::VerifyCert(CERTCertificate* cert, SECCertificateUsage usage,
Time time, void* pinArg, const char* hostname,
/*out*/ UniqueCERTCertList& builtChain,
/*optional*/ const Flags flags,
/*optional*/ const SECItem* stapledOCSPResponseSECItem,
/*optional*/ const SECItem* sctsFromTLSSECItem,
- /*optional*/ const NeckoOriginAttributes& originAttributes,
+ /*optional*/ const OriginAttributes& originAttributes,
/*optional out*/ SECOidTag* evOidPolicy,
/*optional out*/ OCSPStaplingStatus* ocspStaplingStatus,
/*optional out*/ KeySizeStatus* keySizeStatus,
/*optional out*/ SHA1ModeResult* sha1ModeResult,
/*optional out*/ PinningTelemetryInfo* pinningTelemetryInfo,
/*optional out*/ CertificateTransparencyInfo* ctInfo)
{
MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("Top of VerifyCert\n"));
@@ -819,17 +819,17 @@ CertVerifier::VerifySSLServerCert(const
/*optional*/ const SECItem* stapledOCSPResponse,
/*optional*/ const SECItem* sctsFromTLS,
Time time,
/*optional*/ void* pinarg,
const char* hostname,
/*out*/ UniqueCERTCertList& builtChain,
/*optional*/ bool saveIntermediatesInPermanentDatabase,
/*optional*/ Flags flags,
- /*optional*/ const NeckoOriginAttributes& originAttributes,
+ /*optional*/ const OriginAttributes& originAttributes,
/*optional out*/ SECOidTag* evOidPolicy,
/*optional out*/ OCSPStaplingStatus* ocspStaplingStatus,
/*optional out*/ KeySizeStatus* keySizeStatus,
/*optional out*/ SHA1ModeResult* sha1ModeResult,
/*optional out*/ PinningTelemetryInfo* pinningTelemetryInfo,
/*optional out*/ CertificateTransparencyInfo* ctInfo)
{
MOZ_ASSERT(peerCert);
--- a/security/certverifier/CertVerifier.h
+++ b/security/certverifier/CertVerifier.h
@@ -115,18 +115,18 @@ public:
SECCertificateUsage usage,
mozilla::pkix::Time time,
void* pinArg,
const char* hostname,
/*out*/ UniqueCERTCertList& builtChain,
Flags flags = 0,
/*optional in*/ const SECItem* stapledOCSPResponse = nullptr,
/*optional in*/ const SECItem* sctsFromTLS = nullptr,
- /*optional in*/ const NeckoOriginAttributes& originAttributes =
- NeckoOriginAttributes(),
+ /*optional in*/ const OriginAttributes& originAttributes =
+ OriginAttributes(),
/*optional out*/ SECOidTag* evOidPolicy = nullptr,
/*optional out*/ OCSPStaplingStatus* ocspStaplingStatus = nullptr,
/*optional out*/ KeySizeStatus* keySizeStatus = nullptr,
/*optional out*/ SHA1ModeResult* sha1ModeResult = nullptr,
/*optional out*/ PinningTelemetryInfo* pinningTelemetryInfo = nullptr,
/*optional out*/ CertificateTransparencyInfo* ctInfo = nullptr);
mozilla::pkix::Result VerifySSLServerCert(
@@ -134,18 +134,18 @@ public:
/*optional*/ const SECItem* stapledOCSPResponse,
/*optional*/ const SECItem* sctsFromTLS,
mozilla::pkix::Time time,
/*optional*/ void* pinarg,
const char* hostname,
/*out*/ UniqueCERTCertList& builtChain,
/*optional*/ bool saveIntermediatesInPermanentDatabase = false,
/*optional*/ Flags flags = 0,
- /*optional*/ const NeckoOriginAttributes& originAttributes =
- NeckoOriginAttributes(),
+ /*optional*/ const OriginAttributes& originAttributes =
+ OriginAttributes(),
/*optional out*/ SECOidTag* evOidPolicy = nullptr,
/*optional out*/ OCSPStaplingStatus* ocspStaplingStatus = nullptr,
/*optional out*/ KeySizeStatus* keySizeStatus = nullptr,
/*optional out*/ SHA1ModeResult* sha1ModeResult = nullptr,
/*optional out*/ PinningTelemetryInfo* pinningTelemetryInfo = nullptr,
/*optional out*/ CertificateTransparencyInfo* ctInfo = nullptr);
enum PinningMode {
--- a/security/certverifier/NSSCertDBTrustDomain.cpp
+++ b/security/certverifier/NSSCertDBTrustDomain.cpp
@@ -50,17 +50,17 @@ NSSCertDBTrustDomain::NSSCertDBTrustDoma
/*optional but shouldn't be*/ void* pinArg,
CertVerifier::OcspGetConfig ocspGETConfig,
uint32_t certShortLifetimeInDays,
CertVerifier::PinningMode pinningMode,
unsigned int minRSABits,
ValidityCheckingMode validityCheckingMode,
CertVerifier::SHA1Mode sha1Mode,
NetscapeStepUpPolicy netscapeStepUpPolicy,
- const NeckoOriginAttributes& originAttributes,
+ const OriginAttributes& originAttributes,
UniqueCERTCertList& builtChain,
/*optional*/ PinningTelemetryInfo* pinningTelemetryInfo,
/*optional*/ const char* hostname)
: mCertDBTrustType(certDBTrustType)
, mOCSPFetching(ocspFetching)
, mOCSPCache(ocspCache)
, mPinArg(pinArg)
, mOCSPGetConfig(ocspGETConfig)
--- a/security/certverifier/NSSCertDBTrustDomain.h
+++ b/security/certverifier/NSSCertDBTrustDomain.h
@@ -78,17 +78,17 @@ public:
OCSPCache& ocspCache, void* pinArg,
CertVerifier::OcspGetConfig ocspGETConfig,
uint32_t certShortLifetimeInDays,
CertVerifier::PinningMode pinningMode,
unsigned int minRSABits,
ValidityCheckingMode validityCheckingMode,
CertVerifier::SHA1Mode sha1Mode,
NetscapeStepUpPolicy netscapeStepUpPolicy,
- const NeckoOriginAttributes& originAttributes,
+ const OriginAttributes& originAttributes,
UniqueCERTCertList& builtChain,
/*optional*/ PinningTelemetryInfo* pinningTelemetryInfo = nullptr,
/*optional*/ const char* hostname = nullptr);
virtual Result FindIssuer(mozilla::pkix::Input encodedIssuerName,
IssuerChecker& checker,
mozilla::pkix::Time time) override;
@@ -182,17 +182,17 @@ private:
void* mPinArg; // non-owning!
const CertVerifier::OcspGetConfig mOCSPGetConfig;
const uint32_t mCertShortLifetimeInDays;
CertVerifier::PinningMode mPinningMode;
const unsigned int mMinRSABits;
ValidityCheckingMode mValidityCheckingMode;
CertVerifier::SHA1Mode mSHA1Mode;
NetscapeStepUpPolicy mNetscapeStepUpPolicy;
- const NeckoOriginAttributes& mOriginAttributes;
+ const OriginAttributes& mOriginAttributes;
UniqueCERTCertList& mBuiltChain; // non-owning
PinningTelemetryInfo* mPinningTelemetryInfo;
const char* mHostname; // non-owning - only used for pinning checks
nsCOMPtr<nsICertBlocklist> mCertBlocklist;
CertVerifier::OCSPStaplingStatus mOCSPStaplingStatus;
// Certificate Transparency data extracted during certificate verification
UniqueSECItem mSCTListFromCertificate;
UniqueSECItem mSCTListFromOCSPStapling;
--- a/security/certverifier/OCSPCache.cpp
+++ b/security/certverifier/OCSPCache.cpp
@@ -73,17 +73,17 @@ DigestLength(UniquePK11Context& context,
// serialNumberLenB, serialNumberB, originAttributesLenB, originAttributesB)
// such that the concatenation of each tuple results in the same string of
// bytes but where each part in A is not equal to its counterpart in B. This is
// important because as a result it is computationally infeasible to find
// collisions that would subvert this cache (given that SHA384 is a
// cryptographically-secure hash function).
static SECStatus
CertIDHash(SHA384Buffer& buf, const CertID& certID,
- const NeckoOriginAttributes& originAttributes)
+ const OriginAttributes& originAttributes)
{
UniquePK11Context context(PK11_CreateDigestContext(SEC_OID_SHA384));
if (!context) {
return SECFailure;
}
SECStatus rv = PK11_DigestBegin(context.get());
if (rv != SECSuccess) {
return rv;
@@ -131,17 +131,17 @@ CertIDHash(SHA384Buffer& buf, const Cert
if (outLen != SHA384_LENGTH) {
return SECFailure;
}
return rv;
}
Result
OCSPCache::Entry::Init(const CertID& aCertID,
- const NeckoOriginAttributes& aOriginAttributes)
+ const OriginAttributes& aOriginAttributes)
{
SECStatus srv = CertIDHash(mIDHash, aCertID, aOriginAttributes);
if (srv != SECSuccess) {
return MapPRErrorCodeToResult(PR_GetError());
}
return Success;
}
@@ -154,17 +154,17 @@ OCSPCache::~OCSPCache()
{
Clear();
}
// Returns false with index in an undefined state if no matching entry was
// found.
bool
OCSPCache::FindInternal(const CertID& aCertID,
- const NeckoOriginAttributes& aOriginAttributes,
+ const OriginAttributes& aOriginAttributes,
/*out*/ size_t& index,
const MutexAutoLock& /* aProofOfLock */)
{
if (mEntries.length() == 0) {
return false;
}
SHA384Buffer idHash;
@@ -182,17 +182,17 @@ OCSPCache::FindInternal(const CertID& aC
return true;
}
}
return false;
}
static inline void
LogWithCertID(const char* aMessage, const CertID& aCertID,
- const NeckoOriginAttributes& aOriginAttributes)
+ const OriginAttributes& aOriginAttributes)
{
NS_ConvertUTF16toUTF8 firstPartyDomain(aOriginAttributes.mFirstPartyDomain);
MOZ_LOG(gCertVerifierLog, LogLevel::Debug,
(aMessage, &aCertID, firstPartyDomain.get()));
}
void
OCSPCache::MakeMostRecentlyUsed(size_t aIndex,
@@ -204,17 +204,17 @@ OCSPCache::MakeMostRecentlyUsed(size_t a
mEntries.erase(mEntries.begin() + aIndex);
// erase() does not shrink or realloc memory, so the append below should
// always succeed.
MOZ_RELEASE_ASSERT(mEntries.append(entry));
}
bool
OCSPCache::Get(const CertID& aCertID,
- const NeckoOriginAttributes& aOriginAttributes,
+ const OriginAttributes& aOriginAttributes,
Result& aResult, Time& aValidThrough)
{
MutexAutoLock lock(mMutex);
size_t index;
if (!FindInternal(aCertID, aOriginAttributes, index, lock)) {
LogWithCertID("OCSPCache::Get(%p,\"%s\") not in cache", aCertID,
aOriginAttributes);
@@ -225,17 +225,17 @@ OCSPCache::Get(const CertID& aCertID,
aResult = mEntries[index]->mResult;
aValidThrough = mEntries[index]->mValidThrough;
MakeMostRecentlyUsed(index, lock);
return true;
}
Result
OCSPCache::Put(const CertID& aCertID,
- const NeckoOriginAttributes& aOriginAttributes,
+ const OriginAttributes& aOriginAttributes,
Result aResult, Time aThisUpdate, Time aValidThrough)
{
MutexAutoLock lock(mMutex);
size_t index;
if (FindInternal(aCertID, aOriginAttributes, index, lock)) {
// Never replace an entry indicating a revoked certificate.
if (mEntries[index]->mResult == Result::ERROR_REVOKED_CERTIFICATE) {
--- a/security/certverifier/OCSPCache.h
+++ b/security/certverifier/OCSPCache.h
@@ -29,17 +29,17 @@
#include "mozilla/Mutex.h"
#include "mozilla/Vector.h"
#include "pkix/Result.h"
#include "pkix/Time.h"
#include "prerror.h"
#include "seccomon.h"
namespace mozilla {
-class NeckoOriginAttributes;
+class OriginAttributes;
}
namespace mozilla { namespace pkix {
struct CertID;
} } // namespace mozilla::pkix
namespace mozilla { namespace psm {
@@ -61,34 +61,34 @@ public:
// Returns true if the status of the given certificate (issued by the given
// issuer) is in the cache, and false otherwise.
// If it is in the cache, returns by reference the error code of the cached
// status and the time through which the status is considered trustworthy.
// The passed in origin attributes are used to isolate the OCSP cache.
// We currently only use the first party domain portion of the attributes, and
// it is non-empty only when "privacy.firstParty.isolate" is enabled.
bool Get(const mozilla::pkix::CertID& aCertID,
- const NeckoOriginAttributes& aOriginAttributes,
+ const OriginAttributes& aOriginAttributes,
/*out*/ mozilla::pkix::Result& aResult,
/*out*/ mozilla::pkix::Time& aValidThrough);
// Caches the status of the given certificate (issued by the given issuer).
// The status is considered trustworthy through the given time.
// A status with an error code of SEC_ERROR_REVOKED_CERTIFICATE will not
// be replaced or evicted.
// A status with an error code of SEC_ERROR_OCSP_UNKNOWN_CERT will not
// be evicted when the cache is full.
// A status with a more recent thisUpdate will not be replaced with a
// status with a less recent thisUpdate unless the less recent status
// indicates the certificate is revoked.
// The passed in origin attributes are used to isolate the OCSP cache.
// We currently only use the first party domain portion of the attributes, and
// it is non-empty only when "privacy.firstParty.isolate" is enabled.
mozilla::pkix::Result Put(const mozilla::pkix::CertID& aCertID,
- const NeckoOriginAttributes& aOriginAttributes,
+ const OriginAttributes& aOriginAttributes,
mozilla::pkix::Result aResult,
mozilla::pkix::Time aThisUpdate,
mozilla::pkix::Time aValidThrough);
// Removes everything from the cache.
void Clear();
private:
@@ -99,31 +99,31 @@ private:
mozilla::pkix::Time aThisUpdate,
mozilla::pkix::Time aValidThrough)
: mResult(aResult)
, mThisUpdate(aThisUpdate)
, mValidThrough(aValidThrough)
{
}
mozilla::pkix::Result Init(const mozilla::pkix::CertID& aCertID,
- const NeckoOriginAttributes& aOriginAttributes);
+ const OriginAttributes& aOriginAttributes);
mozilla::pkix::Result mResult;
mozilla::pkix::Time mThisUpdate;
mozilla::pkix::Time mValidThrough;
// The SHA-384 hash of the concatenation of the DER encodings of the
// issuer name and issuer key, followed by the length of the serial number,
// the serial number, the length of the first party domain, and the first
// party domain (if "privacy.firstparty.isolate" is enabled).
// See the documentation for CertIDHash in OCSPCache.cpp.
SHA384Buffer mIDHash;
};
bool FindInternal(const mozilla::pkix::CertID& aCertID,
- const NeckoOriginAttributes& aOriginAttributes,
+ const OriginAttributes& aOriginAttributes,
/*out*/ size_t& index,
const MutexAutoLock& aProofOfLock);
void MakeMostRecentlyUsed(size_t aIndex, const MutexAutoLock& aProofOfLock);
Mutex mMutex;
static const size_t MaxEntries = 1024;
// Sorted with the most-recently-used entry at the end.
// Using 256 here reserves as much possible inline storage as the vector
--- a/security/certverifier/OCSPRequestor.cpp
+++ b/security/certverifier/OCSPRequestor.cpp
@@ -69,17 +69,17 @@ AppendEscapedBase64Item(const SECItem* e
base64Request.ReplaceSubstring("/", "%2F");
base64Request.ReplaceSubstring("=", "%3D");
path.Append(base64Request);
return NS_OK;
}
Result
DoOCSPRequest(const UniquePLArenaPool& arena, const char* url,
- const NeckoOriginAttributes& originAttributes,
+ const OriginAttributes& originAttributes,
const SECItem* encodedRequest, PRIntervalTime timeout,
bool useGET,
/*out*/ SECItem*& encodedResponse)
{
MOZ_ASSERT(arena.get());
MOZ_ASSERT(url);
MOZ_ASSERT(encodedRequest);
MOZ_ASSERT(encodedRequest->data);
--- a/security/certverifier/OCSPRequestor.h
+++ b/security/certverifier/OCSPRequestor.h
@@ -6,23 +6,23 @@
#ifndef OCSPRequestor_h
#define OCSPRequestor_h
#include "CertVerifier.h"
#include "secmodt.h"
namespace mozilla {
-class NeckoOriginAttributes;
+class OriginAttributes;
}
namespace mozilla { namespace psm {
// The memory returned via |encodedResponse| is owned by the given arena.
Result DoOCSPRequest(const UniquePLArenaPool& arena, const char* url,
- const NeckoOriginAttributes& originAttributes,
+ const OriginAttributes& originAttributes,
const SECItem* encodedRequest, PRIntervalTime timeout,
bool useGET,
/*out*/ SECItem*& encodedResponse);
} } // namespace mozilla::psm
#endif // OCSPRequestor_h
--- a/security/manager/ssl/TransportSecurityInfo.cpp
+++ b/security/manager/ssl/TransportSecurityInfo.cpp
@@ -95,17 +95,17 @@ nsresult
TransportSecurityInfo::GetPort(int32_t *aPort)
{
*aPort = mPort;
return NS_OK;
}
nsresult
TransportSecurityInfo::SetOriginAttributes(
- const NeckoOriginAttributes& aOriginAttributes)
+ const OriginAttributes& aOriginAttributes)
{
mOriginAttributes = aOriginAttributes;
return NS_OK;
}
PRErrorCode
TransportSecurityInfo::GetErrorCode() const
{
--- a/security/manager/ssl/TransportSecurityInfo.h
+++ b/security/manager/ssl/TransportSecurityInfo.h
@@ -59,20 +59,20 @@ public:
nsresult GetHostName(char **aHostName);
nsresult SetHostName(const char *aHostName);
int32_t GetPort() const { return mPort; }
nsresult GetPort(int32_t *aPort);
nsresult SetPort(int32_t aPort);
- const NeckoOriginAttributes& GetOriginAttributes() const {
+ const OriginAttributes& GetOriginAttributes() const {
return mOriginAttributes;
}
- nsresult SetOriginAttributes(const NeckoOriginAttributes& aOriginAttributes);
+ nsresult SetOriginAttributes(const OriginAttributes& aOriginAttributes);
PRErrorCode GetErrorCode() const;
void GetErrorLogMessage(PRErrorCode errorCode,
::mozilla::psm::SSLErrorMessageType errorMessageType,
nsString &result);
void SetCanceled(PRErrorCode errorCode,
@@ -102,17 +102,17 @@ private:
nsresult formatErrorMessage(::mozilla::MutexAutoLock const & proofOfLock,
PRErrorCode errorCode,
::mozilla::psm::SSLErrorMessageType errorMessageType,
bool wantsHtml, bool suppressPort443,
nsString &result);
int32_t mPort;
nsXPIDLCString mHostName;
- NeckoOriginAttributes mOriginAttributes;
+ OriginAttributes mOriginAttributes;
/* SSL Status */
RefPtr<nsSSLStatus> mSSLStatus;
/* Peer cert chain for failed connections (for error reporting) */
nsCOMPtr<nsIX509CertList> mFailedCertChain;
virtual void virtualDestroyNSSReference() override;
--- a/security/manager/ssl/nsClientAuthRemember.cpp
+++ b/security/manager/ssl/nsClientAuthRemember.cpp
@@ -94,17 +94,17 @@ void nsClientAuthRememberService::ClearA
void
nsClientAuthRememberService::RemoveAllFromMemory()
{
mSettingsTable.Clear();
}
nsresult
nsClientAuthRememberService::RememberDecision(
- const nsACString& aHostName, const NeckoOriginAttributes& aOriginAttributes,
+ const nsACString& aHostName, const OriginAttributes& aOriginAttributes,
CERTCertificate* aServerCert, CERTCertificate* aClientCert)
{
// aClientCert == nullptr means: remember that user does not want to use a cert
NS_ENSURE_ARG_POINTER(aServerCert);
if (aHostName.IsEmpty()) {
return NS_ERROR_INVALID_ARG;
}
@@ -129,17 +129,17 @@ nsClientAuthRememberService::RememberDec
}
}
return NS_OK;
}
nsresult
nsClientAuthRememberService::HasRememberedDecision(
- const nsACString& aHostName, const NeckoOriginAttributes& aOriginAttributes,
+ const nsACString& aHostName, const OriginAttributes& aOriginAttributes,
CERTCertificate* aCert, nsACString& aCertDBKey, bool* aRetVal)
{
if (aHostName.IsEmpty())
return NS_ERROR_INVALID_ARG;
NS_ENSURE_ARG_POINTER(aCert);
NS_ENSURE_ARG_POINTER(aRetVal);
*aRetVal = false;
@@ -164,17 +164,17 @@ nsClientAuthRememberService::HasRemember
aCertDBKey = settings.mDBKey;
*aRetVal = true;
return NS_OK;
}
nsresult
nsClientAuthRememberService::AddEntryToList(
- const nsACString& aHostName, const NeckoOriginAttributes& aOriginAttributes,
+ const nsACString& aHostName, const OriginAttributes& aOriginAttributes,
const nsACString& aFingerprint, const nsACString& aDBKey)
{
nsAutoCString entryKey;
GetEntryKey(aHostName, aOriginAttributes, aFingerprint, entryKey);
{
ReentrantMonitorAutoEnter lock(monitor);
nsClientAuthRememberEntry* entry = mSettingsTable.PutEntry(entryKey.get());
@@ -193,17 +193,17 @@ nsClientAuthRememberService::AddEntryToL
}
return NS_OK;
}
void
nsClientAuthRememberService::GetEntryKey(
const nsACString& aHostName,
- const NeckoOriginAttributes& aOriginAttributes,
+ const OriginAttributes& aOriginAttributes,
const nsACString& aFingerprint,
nsACString& aEntryKey)
{
nsAutoCString hostCert(aHostName);
nsAutoCString suffix;
aOriginAttributes.CreateSuffix(suffix);
hostCert.Append(suffix);
hostCert.Append(':');
--- a/security/manager/ssl/nsClientAuthRemember.h
+++ b/security/manager/ssl/nsClientAuthRemember.h
@@ -12,20 +12,20 @@
#include "nsIObserver.h"
#include "nsIX509Cert.h"
#include "nsNSSCertificate.h"
#include "nsString.h"
#include "nsWeakReference.h"
#include "mozilla/Attributes.h"
namespace mozilla {
- class NeckoOriginAttributes;
+ class OriginAttributes;
}
-using mozilla::NeckoOriginAttributes;
+using mozilla::OriginAttributes;
class nsClientAuthRemember
{
public:
nsClientAuthRemember()
{
}
@@ -117,39 +117,39 @@ public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIOBSERVER
nsClientAuthRememberService();
nsresult Init();
static void GetEntryKey(const nsACString& aHostName,
- const NeckoOriginAttributes& aOriginAttributes,
+ const OriginAttributes& aOriginAttributes,
const nsACString& aFingerprint,
/*out*/ nsACString& aEntryKey);
nsresult RememberDecision(const nsACString& aHostName,
- const NeckoOriginAttributes& aOriginAttributes,
+ const OriginAttributes& aOriginAttributes,
CERTCertificate* aServerCert,
CERTCertificate* aClientCert);
nsresult HasRememberedDecision(const nsACString& aHostName,
- const NeckoOriginAttributes& aOriginAttributes,
+ const OriginAttributes& aOriginAttributes,
CERTCertificate* aServerCert,
nsACString& aCertDBKey, bool* aRetVal);
void ClearRememberedDecisions();
static void ClearAllRememberedDecisions();
protected:
~nsClientAuthRememberService();
mozilla::ReentrantMonitor monitor;
nsTHashtable<nsClientAuthRememberEntry> mSettingsTable;
void RemoveAllFromMemory();
nsresult AddEntryToList(const nsACString& aHost,
- const NeckoOriginAttributes& aOriginAttributes,
+ const OriginAttributes& aOriginAttributes,
const nsACString& aServerFingerprint,
const nsACString& aDBKey);
};
#endif
--- a/security/manager/ssl/nsNSSCallbacks.cpp
+++ b/security/manager/ssl/nsNSSCallbacks.cpp
@@ -109,18 +109,18 @@ nsHTTPDownloadEvent::Run()
priorityChannel->AdjustPriority(nsISupportsPriority::PRIORITY_HIGHEST);
chan->SetLoadFlags(nsIRequest::LOAD_ANONYMOUS |
nsIChannel::LOAD_BYPASS_SERVICE_WORKER);
// For OCSP requests, only the first party domain aspect of origin attributes
// is used. This means that OCSP requests are shared across different
// containers.
- if (mRequestSession->mOriginAttributes != NeckoOriginAttributes()) {
- NeckoOriginAttributes attrs;
+ if (mRequestSession->mOriginAttributes != OriginAttributes()) {
+ OriginAttributes attrs;
attrs.mFirstPartyDomain =
mRequestSession->mOriginAttributes.mFirstPartyDomain;
nsCOMPtr<nsILoadInfo> loadInfo = chan->GetLoadInfo();
if (loadInfo) {
rv = loadInfo->SetOriginAttributes(attrs);
NS_ENSURE_SUCCESS(rv, rv);
}
@@ -225,17 +225,17 @@ nsNSSHttpServerSession::createSessionFcn
return Success;
}
mozilla::pkix::Result
nsNSSHttpRequestSession::createFcn(const nsNSSHttpServerSession* session,
const char* http_protocol_variant,
const char* path_and_query_string,
const char* http_request_method,
- const NeckoOriginAttributes& origin_attributes,
+ const OriginAttributes& origin_attributes,
const PRIntervalTime timeout,
/*out*/ nsNSSHttpRequestSession** pRequest)
{
if (!session || !http_protocol_variant || !path_and_query_string ||
!http_request_method || !pRequest) {
return Result::FATAL_ERROR_INVALID_ARGS;
}
--- a/security/manager/ssl/nsNSSCallbacks.h
+++ b/security/manager/ssl/nsNSSCallbacks.h
@@ -16,17 +16,17 @@
#include "nsIStreamLoader.h"
#include "nspr.h"
#include "nsString.h"
#include "pk11func.h"
#include "pkix/pkixtypes.h"
#include "ocspt.h" // Must be included after pk11func.h.
-using mozilla::NeckoOriginAttributes;
+using mozilla::OriginAttributes;
class nsILoadGroup;
char*
PK11PasswordPrompt(PK11SlotInfo *slot, PRBool retry, void* arg);
void HandshakeCallback(PRFileDesc *fd, void *client_data);
SECStatus CanFalseStartCallback(PRFileDesc* fd, void* client_data,
@@ -97,17 +97,17 @@ protected:
public:
typedef mozilla::pkix::Result Result;
static Result createFcn(const nsNSSHttpServerSession* session,
const char* httpProtocolVariant,
const char* pathAndQueryString,
const char* httpRequestMethod,
- const NeckoOriginAttributes& originAttributes,
+ const OriginAttributes& originAttributes,
const PRIntervalTime timeout,
/*out*/ nsNSSHttpRequestSession** pRequest);
Result setPostDataFcn(const char* httpData,
const uint32_t httpDataLen,
const char* httpContentType);
Result trySendAndReceiveFcn(PRPollDesc** pPollDesc,
@@ -122,17 +122,17 @@ public:
nsCString mURL;
nsCString mRequestMethod;
bool mHasPostData;
nsCString mPostData;
nsCString mPostContentType;
- NeckoOriginAttributes mOriginAttributes;
+ OriginAttributes mOriginAttributes;
PRIntervalTime mTimeoutInterval;
RefPtr<nsHTTPListener> mListener;
protected:
nsNSSHttpRequestSession();
~nsNSSHttpRequestSession();
@@ -157,17 +157,17 @@ public:
{
return nsNSSHttpServerSession::createSessionFcn(host, portnum, pSession);
}
static Result createFcn(const nsNSSHttpServerSession* session,
const char* httpProtocolVariant,
const char* pathAndQueryString,
const char* httpRequestMethod,
- const NeckoOriginAttributes& originAttributes,
+ const OriginAttributes& originAttributes,
const PRIntervalTime timeout,
/*out*/ nsNSSHttpRequestSession** pRequest)
{
return nsNSSHttpRequestSession::createFcn(session, httpProtocolVariant,
pathAndQueryString,
httpRequestMethod, originAttributes,
timeout, pRequest);
}
--- a/security/manager/ssl/nsNSSCertificateDB.cpp
+++ b/security/manager/ssl/nsNSSCertificateDB.cpp
@@ -1405,27 +1405,27 @@ VerifyCertAtTime(nsIX509Cert* aCert,
nullptr, // stapledOCSPResponse
nullptr, // sctsFromTLSExtension
aTime,
nullptr, // Assume no context
aHostname,
resultChain,
false, // don't save intermediates
aFlags,
- NeckoOriginAttributes(),
+ OriginAttributes(),
&evOidPolicy);
} else {
result = certVerifier->VerifyCert(nssCert.get(), aUsage, aTime,
nullptr, // Assume no context
aHostname,
resultChain,
aFlags,
nullptr, // stapledOCSPResponse
nullptr, // sctsFromTLSExtension
- NeckoOriginAttributes(),
+ OriginAttributes(),
&evOidPolicy);
}
nsCOMPtr<nsIX509CertList> nssCertList;
// This adopts the list
nssCertList = new nsNSSCertList(Move(resultChain), locker);
NS_ENSURE_TRUE(nssCertList, NS_ERROR_FAILURE);
--- a/security/manager/ssl/nsNSSIOLayer.cpp
+++ b/security/manager/ssl/nsNSSIOLayer.cpp
@@ -1750,17 +1750,17 @@ nsSSLIOLayerHelpers::treatUnsafeNegotiat
return mTreatUnsafeNegotiationAsBroken;
}
nsresult
nsSSLIOLayerNewSocket(int32_t family,
const char* host,
int32_t port,
nsIProxyInfo *proxy,
- const NeckoOriginAttributes& originAttributes,
+ const OriginAttributes& originAttributes,
PRFileDesc** fd,
nsISupports** info,
bool forSTARTTLS,
uint32_t flags)
{
PRFileDesc* sock = PR_OpenTCPSocket(family);
if (!sock) return NS_ERROR_OUT_OF_MEMORY;
@@ -2482,17 +2482,17 @@ nsSSLIOLayerSetOptions(PRFileDesc* fd, b
return NS_OK;
}
nsresult
nsSSLIOLayerAddToSocket(int32_t family,
const char* host,
int32_t port,
nsIProxyInfo* proxy,
- const NeckoOriginAttributes& originAttributes,
+ const OriginAttributes& originAttributes,
PRFileDesc* fd,
nsISupports** info,
bool forSTARTTLS,
uint32_t providerFlags)
{
nsNSSShutDownPreventionLock locker;
PRFileDesc* layer = nullptr;
PRFileDesc* plaintextLayer = nullptr;
--- a/security/manager/ssl/nsNSSIOLayer.h
+++ b/security/manager/ssl/nsNSSIOLayer.h
@@ -15,23 +15,23 @@
#include "nsIClientAuthDialogs.h"
#include "nsIProxyInfo.h"
#include "nsISSLSocketControl.h"
#include "nsNSSCertificate.h"
#include "nsTHashtable.h"
#include "sslt.h"
namespace mozilla {
-class NeckoOriginAttributes;
+class OriginAttributes;
namespace psm {
class SharedSSLState;
} // namespace psm
} // namespace mozilla
-using mozilla::NeckoOriginAttributes;
+using mozilla::OriginAttributes;
class nsIObserver;
class nsNSSSocketInfo final : public mozilla::psm::TransportSecurityInfo,
public nsISSLSocketControl,
public nsIClientAuthUserDecision
{
public:
@@ -224,27 +224,27 @@ private:
mozilla::Mutex mutex;
nsCOMPtr<nsIObserver> mPrefObserver;
};
nsresult nsSSLIOLayerNewSocket(int32_t family,
const char* host,
int32_t port,
nsIProxyInfo *proxy,
- const NeckoOriginAttributes& originAttributes,
+ const OriginAttributes& originAttributes,
PRFileDesc** fd,
nsISupports** securityInfo,
bool forSTARTTLS,
uint32_t flags);
nsresult nsSSLIOLayerAddToSocket(int32_t family,
const char* host,
int32_t port,
nsIProxyInfo *proxy,
- const NeckoOriginAttributes& originAttributes,
+ const OriginAttributes& originAttributes,
PRFileDesc* fd,
nsISupports** securityInfo,
bool forSTARTTLS,
uint32_t flags);
nsresult nsSSLIOLayerFreeTLSIntolerantSites();
nsresult displayUnknownCertErrorAlert(nsNSSSocketInfo* infoObject, int error);
--- a/security/manager/ssl/nsSSLSocketProvider.cpp
+++ b/security/manager/ssl/nsSSLSocketProvider.cpp
@@ -4,34 +4,34 @@
* 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/. */
#include "mozilla/BasePrincipal.h"
#include "nsSSLSocketProvider.h"
#include "nsNSSIOLayer.h"
#include "nsError.h"
-using mozilla::NeckoOriginAttributes;
+using mozilla::OriginAttributes;
nsSSLSocketProvider::nsSSLSocketProvider()
{
}
nsSSLSocketProvider::~nsSSLSocketProvider()
{
}
NS_IMPL_ISUPPORTS(nsSSLSocketProvider, nsISocketProvider)
NS_IMETHODIMP
nsSSLSocketProvider::NewSocket(int32_t family,
const char *host,
int32_t port,
nsIProxyInfo *proxy,
- const NeckoOriginAttributes &originAttributes,
+ const OriginAttributes &originAttributes,
uint32_t flags,
PRFileDesc **_result,
nsISupports **securityInfo)
{
nsresult rv = nsSSLIOLayerNewSocket(family,
host,
port,
proxy,
@@ -44,17 +44,17 @@ nsSSLSocketProvider::NewSocket(int32_t f
}
// Add the SSL IO layer to an existing socket
NS_IMETHODIMP
nsSSLSocketProvider::AddToSocket(int32_t family,
const char *host,
int32_t port,
nsIProxyInfo *proxy,
- const NeckoOriginAttributes &originAttributes,
+ const OriginAttributes &originAttributes,
uint32_t flags,
PRFileDesc *aSocket,
nsISupports **securityInfo)
{
nsresult rv = nsSSLIOLayerAddToSocket(family,
host,
port,
proxy,
--- a/security/manager/ssl/nsTLSSocketProvider.cpp
+++ b/security/manager/ssl/nsTLSSocketProvider.cpp
@@ -4,34 +4,34 @@
* 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/. */
#include "mozilla/BasePrincipal.h"
#include "nsTLSSocketProvider.h"
#include "nsNSSIOLayer.h"
#include "nsError.h"
-using mozilla::NeckoOriginAttributes;
+using mozilla::OriginAttributes;
nsTLSSocketProvider::nsTLSSocketProvider()
{
}
nsTLSSocketProvider::~nsTLSSocketProvider()
{
}
NS_IMPL_ISUPPORTS(nsTLSSocketProvider, nsISocketProvider)
NS_IMETHODIMP
nsTLSSocketProvider::NewSocket(int32_t family,
const char *host,
int32_t port,
nsIProxyInfo *proxy,
- const NeckoOriginAttributes &originAttributes,
+ const OriginAttributes &originAttributes,
uint32_t flags,
PRFileDesc **_result,
nsISupports **securityInfo)
{
nsresult rv = nsSSLIOLayerNewSocket(family,
host,
port,
proxy,
@@ -45,17 +45,17 @@ nsTLSSocketProvider::NewSocket(int32_t f
}
// Add the SSL IO layer to an existing socket
NS_IMETHODIMP
nsTLSSocketProvider::AddToSocket(int32_t family,
const char *host,
int32_t port,
nsIProxyInfo *proxy,
- const NeckoOriginAttributes &originAttributes,
+ const OriginAttributes &originAttributes,
uint32_t flags,
PRFileDesc *aSocket,
nsISupports **securityInfo)
{
nsresult rv = nsSSLIOLayerAddToSocket(family,
host,
port,
proxy,
--- a/security/manager/ssl/tests/gtest/OCSPCacheTest.cpp
+++ b/security/manager/ssl/tests/gtest/OCSPCacheTest.cpp
@@ -14,17 +14,17 @@
#include "pkix/pkixtypes.h"
#include "pkixtestutil.h"
#include "prerr.h"
#include "secerr.h"
using namespace mozilla::pkix;
using namespace mozilla::pkix::test;
-using mozilla::NeckoOriginAttributes;
+using mozilla::OriginAttributes;
template <size_t N>
inline Input
LiteralInput(const char(&valueString)[N])
{
// Ideally we would use mozilla::BitwiseCast() here rather than
// reinterpret_cast for better type checking, but the |N - 1| part trips
// static asserts.
@@ -45,17 +45,17 @@ protected:
const Time now;
mozilla::psm::OCSPCache cache;
};
static void
PutAndGet(mozilla::psm::OCSPCache& cache, const CertID& certID, Result result,
Time time,
- const NeckoOriginAttributes& originAttributes = NeckoOriginAttributes())
+ const OriginAttributes& originAttributes = OriginAttributes())
{
// The first time is thisUpdate. The second is validUntil.
// The caller is expecting the validUntil returned with Get
// to be equal to the passed-in time. Since these values will
// be different in practice, make thisUpdate less than validUntil.
Time thisUpdate(time);
ASSERT_EQ(Success, thisUpdate.SubtractSeconds(10));
Result rv = cache.Put(certID, originAttributes, result, thisUpdate, time);
@@ -78,17 +78,17 @@ TEST_F(psm_OCSPCacheTest, TestPutAndGet)
Input fakeSerial001(LiteralInput("001"));
SCOPED_TRACE("");
PutAndGet(cache, CertID(fakeIssuer1, fakeKey000, fakeSerial001),
Success, now);
Result resultOut;
Time timeOut(Time::uninitialized);
ASSERT_FALSE(cache.Get(CertID(fakeIssuer1, fakeKey001, fakeSerial000),
- NeckoOriginAttributes(), resultOut, timeOut));
+ OriginAttributes(), resultOut, timeOut));
}
TEST_F(psm_OCSPCacheTest, TestVariousGets)
{
SCOPED_TRACE("");
for (int i = 0; i < MaxCacheEntries; i++) {
uint8_t serialBuf[8];
snprintf(mozilla::BitwiseCast<char*, uint8_t*>(serialBuf), sizeof(serialBuf),
@@ -102,41 +102,41 @@ TEST_F(psm_OCSPCacheTest, TestVariousGet
}
Time timeIn(now);
Result resultOut;
Time timeOut(Time::uninitialized);
// This will be at the end of the list in the cache
CertID cert0000(fakeIssuer1, fakeKey000, fakeSerial0000);
- ASSERT_TRUE(cache.Get(cert0000, NeckoOriginAttributes(), resultOut, timeOut));
+ ASSERT_TRUE(cache.Get(cert0000, OriginAttributes(), resultOut, timeOut));
ASSERT_EQ(Success, resultOut);
ASSERT_EQ(timeIn, timeOut);
// Once we access it, it goes to the front
- ASSERT_TRUE(cache.Get(cert0000, NeckoOriginAttributes(), resultOut, timeOut));
+ ASSERT_TRUE(cache.Get(cert0000, OriginAttributes(), resultOut, timeOut));
ASSERT_EQ(Success, resultOut);
ASSERT_EQ(timeIn, timeOut);
// This will be in the middle
Time timeInPlus512(now);
ASSERT_EQ(Success, timeInPlus512.AddSeconds(512));
static const Input fakeSerial0512(LiteralInput("0512"));
CertID cert0512(fakeIssuer1, fakeKey000, fakeSerial0512);
- ASSERT_TRUE(cache.Get(cert0512, NeckoOriginAttributes(), resultOut, timeOut));
+ ASSERT_TRUE(cache.Get(cert0512, OriginAttributes(), resultOut, timeOut));
ASSERT_EQ(Success, resultOut);
ASSERT_EQ(timeInPlus512, timeOut);
- ASSERT_TRUE(cache.Get(cert0512, NeckoOriginAttributes(), resultOut, timeOut));
+ ASSERT_TRUE(cache.Get(cert0512, OriginAttributes(), resultOut, timeOut));
ASSERT_EQ(Success, resultOut);
ASSERT_EQ(timeInPlus512, timeOut);
// We've never seen this certificate
static const Input fakeSerial1111(LiteralInput("1111"));
ASSERT_FALSE(cache.Get(CertID(fakeIssuer1, fakeKey000, fakeSerial1111),
- NeckoOriginAttributes(), resultOut, timeOut));
+ OriginAttributes(), resultOut, timeOut));
}
TEST_F(psm_OCSPCacheTest, TestEviction)
{
SCOPED_TRACE("");
// By putting more distinct entries in the cache than it can hold,
// we cause the least recently used entry to be evicted.
for (int i = 0; i < MaxCacheEntries + 1; i++) {
@@ -149,17 +149,17 @@ TEST_F(psm_OCSPCacheTest, TestEviction)
ASSERT_EQ(Success, timeIn.AddSeconds(i));
PutAndGet(cache, CertID(fakeIssuer1, fakeKey000, fakeSerial),
Success, timeIn);
}
Result resultOut;
Time timeOut(Time::uninitialized);
ASSERT_FALSE(cache.Get(CertID(fakeIssuer1, fakeKey001, fakeSerial0000),
- NeckoOriginAttributes(), resultOut, timeOut));
+ OriginAttributes(), resultOut, timeOut));
}
TEST_F(psm_OCSPCacheTest, TestNoEvictionForRevokedResponses)
{
SCOPED_TRACE("");
CertID notEvicted(fakeIssuer1, fakeKey000, fakeSerial0000);
Time timeIn(now);
PutAndGet(cache, notEvicted, Result::ERROR_REVOKED_CERTIFICATE, timeIn);
@@ -173,23 +173,23 @@ TEST_F(psm_OCSPCacheTest, TestNoEviction
ASSERT_EQ(Success, fakeSerial.Init(serialBuf, 4));
Time timeIn(now);
ASSERT_EQ(Success, timeIn.AddSeconds(i));
PutAndGet(cache, CertID(fakeIssuer1, fakeKey000, fakeSerial),
Success, timeIn);
}
Result resultOut;
Time timeOut(Time::uninitialized);
- ASSERT_TRUE(cache.Get(notEvicted, NeckoOriginAttributes(), resultOut, timeOut));
+ ASSERT_TRUE(cache.Get(notEvicted, OriginAttributes(), resultOut, timeOut));
ASSERT_EQ(Result::ERROR_REVOKED_CERTIFICATE, resultOut);
ASSERT_EQ(timeIn, timeOut);
Input fakeSerial0001(LiteralInput("0001"));
CertID evicted(fakeIssuer1, fakeKey000, fakeSerial0001);
- ASSERT_FALSE(cache.Get(evicted, NeckoOriginAttributes(), resultOut, timeOut));
+ ASSERT_FALSE(cache.Get(evicted, OriginAttributes(), resultOut, timeOut));
}
TEST_F(psm_OCSPCacheTest, TestEverythingIsRevoked)
{
SCOPED_TRACE("");
Time timeIn(now);
// Fill up the cache with revoked responses.
for (int i = 0; i < MaxCacheEntries; i++) {
@@ -206,71 +206,71 @@ TEST_F(psm_OCSPCacheTest, TestEverything
static const Input fakeSerial1025(LiteralInput("1025"));
CertID good(fakeIssuer1, fakeKey000, fakeSerial1025);
// This will "succeed", allowing verification to continue. However,
// nothing was actually put in the cache.
Time timeInPlus1025(timeIn);
ASSERT_EQ(Success, timeInPlus1025.AddSeconds(1025));
Time timeInPlus1025Minus50(timeInPlus1025);
ASSERT_EQ(Success, timeInPlus1025Minus50.SubtractSeconds(50));
- Result result = cache.Put(good, NeckoOriginAttributes(), Success, timeInPlus1025Minus50,
+ Result result = cache.Put(good, OriginAttributes(), Success, timeInPlus1025Minus50,
timeInPlus1025);
ASSERT_EQ(Success, result);
Result resultOut;
Time timeOut(Time::uninitialized);
- ASSERT_FALSE(cache.Get(good, NeckoOriginAttributes(), resultOut, timeOut));
+ ASSERT_FALSE(cache.Get(good, OriginAttributes(), resultOut, timeOut));
static const Input fakeSerial1026(LiteralInput("1026"));
CertID revoked(fakeIssuer1, fakeKey000, fakeSerial1026);
// This will fail, causing verification to fail.
Time timeInPlus1026(timeIn);
ASSERT_EQ(Success, timeInPlus1026.AddSeconds(1026));
Time timeInPlus1026Minus50(timeInPlus1026);
ASSERT_EQ(Success, timeInPlus1026Minus50.SubtractSeconds(50));
- result = cache.Put(revoked, NeckoOriginAttributes(), Result::ERROR_REVOKED_CERTIFICATE,
+ result = cache.Put(revoked, OriginAttributes(), Result::ERROR_REVOKED_CERTIFICATE,
timeInPlus1026Minus50, timeInPlus1026);
ASSERT_EQ(Result::ERROR_REVOKED_CERTIFICATE, result);
}
TEST_F(psm_OCSPCacheTest, VariousIssuers)
{
SCOPED_TRACE("");
Time timeIn(now);
static const Input fakeIssuer2(LiteralInput("CN=issuer2"));
static const Input fakeSerial001(LiteralInput("001"));
CertID subject(fakeIssuer1, fakeKey000, fakeSerial001);
PutAndGet(cache, subject, Success, now);
Result resultOut;
Time timeOut(Time::uninitialized);
- ASSERT_TRUE(cache.Get(subject, NeckoOriginAttributes(), resultOut, timeOut));
+ ASSERT_TRUE(cache.Get(subject, OriginAttributes(), resultOut, timeOut));
ASSERT_EQ(Success, resultOut);
ASSERT_EQ(timeIn, timeOut);
// Test that we don't match a different issuer DN
ASSERT_FALSE(cache.Get(CertID(fakeIssuer2, fakeKey000, fakeSerial001),
- NeckoOriginAttributes(), resultOut, timeOut));
+ OriginAttributes(), resultOut, timeOut));
// Test that we don't match a different issuer key
ASSERT_FALSE(cache.Get(CertID(fakeIssuer1, fakeKey001, fakeSerial001),
- NeckoOriginAttributes(), resultOut, timeOut));
+ OriginAttributes(), resultOut, timeOut));
}
TEST_F(psm_OCSPCacheTest, Times)
{
SCOPED_TRACE("");
CertID certID(fakeIssuer1, fakeKey000, fakeSerial0000);
PutAndGet(cache, certID, Result::ERROR_OCSP_UNKNOWN_CERT,
TimeFromElapsedSecondsAD(100));
PutAndGet(cache, certID, Success, TimeFromElapsedSecondsAD(200));
// This should not override the more recent entry.
ASSERT_EQ(Success,
- cache.Put(certID, NeckoOriginAttributes(), Result::ERROR_OCSP_UNKNOWN_CERT,
+ cache.Put(certID, OriginAttributes(), Result::ERROR_OCSP_UNKNOWN_CERT,
TimeFromElapsedSecondsAD(100),
TimeFromElapsedSecondsAD(100)));
Result resultOut;
Time timeOut(Time::uninitialized);
- ASSERT_TRUE(cache.Get(certID, NeckoOriginAttributes(), resultOut, timeOut));
+ ASSERT_TRUE(cache.Get(certID, OriginAttributes(), resultOut, timeOut));
// Here we see the more recent time.
ASSERT_EQ(Success, resultOut);
ASSERT_EQ(TimeFromElapsedSecondsAD(200), timeOut);
// Result::ERROR_REVOKED_CERTIFICATE overrides everything
PutAndGet(cache, certID, Result::ERROR_REVOKED_CERTIFICATE,
TimeFromElapsedSecondsAD(50));
}
@@ -279,54 +279,54 @@ TEST_F(psm_OCSPCacheTest, NetworkFailure
{
SCOPED_TRACE("");
CertID certID(fakeIssuer1, fakeKey000, fakeSerial0000);
PutAndGet(cache, certID, Result::ERROR_CONNECT_REFUSED,
TimeFromElapsedSecondsAD(100));
PutAndGet(cache, certID, Success, TimeFromElapsedSecondsAD(200));
// This should not override the already present entry.
ASSERT_EQ(Success,
- cache.Put(certID, NeckoOriginAttributes(), Result::ERROR_CONNECT_REFUSED,
+ cache.Put(certID, OriginAttributes(), Result::ERROR_CONNECT_REFUSED,
TimeFromElapsedSecondsAD(300),
TimeFromElapsedSecondsAD(350)));
Result resultOut;
Time timeOut(Time::uninitialized);
- ASSERT_TRUE(cache.Get(certID, NeckoOriginAttributes(), resultOut, timeOut));
+ ASSERT_TRUE(cache.Get(certID, OriginAttributes(), resultOut, timeOut));
ASSERT_EQ(Success, resultOut);
ASSERT_EQ(TimeFromElapsedSecondsAD(200), timeOut);
PutAndGet(cache, certID, Result::ERROR_OCSP_UNKNOWN_CERT,
TimeFromElapsedSecondsAD(400));
// This should not override the already present entry.
ASSERT_EQ(Success,
- cache.Put(certID, NeckoOriginAttributes(), Result::ERROR_CONNECT_REFUSED,
+ cache.Put(certID, OriginAttributes(), Result::ERROR_CONNECT_REFUSED,
TimeFromElapsedSecondsAD(500),
TimeFromElapsedSecondsAD(550)));
- ASSERT_TRUE(cache.Get(certID, NeckoOriginAttributes(), resultOut, timeOut));
+ ASSERT_TRUE(cache.Get(certID, OriginAttributes(), resultOut, timeOut));
ASSERT_EQ(Result::ERROR_OCSP_UNKNOWN_CERT, resultOut);
ASSERT_EQ(TimeFromElapsedSecondsAD(400), timeOut);
PutAndGet(cache, certID, Result::ERROR_REVOKED_CERTIFICATE,
TimeFromElapsedSecondsAD(600));
// This should not override the already present entry.
ASSERT_EQ(Success,
- cache.Put(certID, NeckoOriginAttributes(), Result::ERROR_CONNECT_REFUSED,
+ cache.Put(certID, OriginAttributes(), Result::ERROR_CONNECT_REFUSED,
TimeFromElapsedSecondsAD(700),
TimeFromElapsedSecondsAD(750)));
- ASSERT_TRUE(cache.Get(certID, NeckoOriginAttributes(), resultOut, timeOut));
+ ASSERT_TRUE(cache.Get(certID, OriginAttributes(), resultOut, timeOut));
ASSERT_EQ(Result::ERROR_REVOKED_CERTIFICATE, resultOut);
ASSERT_EQ(TimeFromElapsedSecondsAD(600), timeOut);
}
TEST_F(psm_OCSPCacheTest, TestOriginAttributes)
{
CertID certID(fakeIssuer1, fakeKey000, fakeSerial0000);
SCOPED_TRACE("");
- NeckoOriginAttributes attrs;
+ OriginAttributes attrs;
attrs.mFirstPartyDomain.AssignLiteral("foo.com");
PutAndGet(cache, certID, Success, now, attrs);
Result resultOut;
Time timeOut(Time::uninitialized);
attrs.mFirstPartyDomain.AssignLiteral("bar.com");
ASSERT_FALSE(cache.Get(certID, attrs, resultOut, timeOut));
--- a/toolkit/components/downloads/ApplicationReputation.cpp
+++ b/toolkit/components/downloads/ApplicationReputation.cpp
@@ -49,18 +49,17 @@
#include "nsXPCOMStrings.h"
#include "nsIContentPolicy.h"
#include "nsILoadInfo.h"
#include "nsContentUtils.h"
using mozilla::ArrayLength;
using mozilla::BasePrincipal;
-using mozilla::DocShellOriginAttributes;
-using mozilla::PrincipalOriginAttributes;
+using mozilla::OriginAttributes;
using mozilla::Preferences;
using mozilla::TimeStamp;
using mozilla::Telemetry::Accumulate;
using safe_browsing::ClientDownloadRequest;
using safe_browsing::ClientDownloadRequest_CertificateChain;
using safe_browsing::ClientDownloadRequest_Resource;
using safe_browsing::ClientDownloadRequest_SignatureInfo;
@@ -304,17 +303,17 @@ PendingDBLookup::LookupSpecInternal(cons
{
nsresult rv;
nsCOMPtr<nsIURI> uri;
nsCOMPtr<nsIIOService> ios = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
rv = ios->NewURI(aSpec, nullptr, nullptr, getter_AddRefs(uri));
NS_ENSURE_SUCCESS(rv, rv);
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
nsCOMPtr<nsIPrincipal> principal =
BasePrincipal::CreateCodebasePrincipal(uri, attrs);
if (!principal) {
return NS_ERROR_FAILURE;
}
// Check local lists to see if the URI has already been whitelisted or
// blacklisted.
@@ -1273,19 +1272,19 @@ PendingLookup::SendRemoteQueryInternal()
nullptr, // aTriggeringPrincipal
nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
nsIContentPolicy::TYPE_OTHER,
getter_AddRefs(mChannel));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsILoadInfo> loadInfo = mChannel->GetLoadInfo();
if (loadInfo) {
- mozilla::NeckoOriginAttributes neckoAttrs(false);
- neckoAttrs.mFirstPartyDomain.AssignLiteral(NECKO_SAFEBROWSING_FIRST_PARTY_DOMAIN);
- loadInfo->SetOriginAttributes(neckoAttrs);
+ mozilla::OriginAttributes attrs;
+ attrs.mFirstPartyDomain.AssignLiteral(NECKO_SAFEBROWSING_FIRST_PARTY_DOMAIN);
+ loadInfo->SetOriginAttributes(attrs);
}
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(mChannel, &rv));
NS_ENSURE_SUCCESS(rv, rv);
mozilla::Unused << httpChannel;
// Upload the protobuf to the application reputation service.
nsCOMPtr<nsIUploadChannel2> uploadChannel = do_QueryInterface(mChannel, &rv);
--- a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
@@ -20,18 +20,16 @@
#include "mozilla/ErrorNames.h"
#include "mozilla/Logging.h"
#include "nsIInterfaceRequestor.h"
#include "mozilla/LoadContext.h"
#include "mozilla/Telemetry.h"
#include "nsContentUtils.h"
#include "nsIURLFormatter.h"
-using mozilla::DocShellOriginAttributes;
-
static const char* gQuitApplicationMessage = "quit-application";
// Limit the list file size to 32mb
const uint32_t MAX_FILE_SIZE = (32 * 1024 * 1024);
#undef LOG
// MOZ_LOG=UrlClassifierStreamUpdater:5
@@ -126,19 +124,19 @@ nsUrlClassifierStreamUpdater::FetchUpdat
nsIContentPolicy::TYPE_OTHER,
nullptr, // aLoadGroup
this, // aInterfaceRequestor
loadFlags);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsILoadInfo> loadInfo = mChannel->GetLoadInfo();
- mozilla::NeckoOriginAttributes neckoAttrs(false);
- neckoAttrs.mFirstPartyDomain.AssignLiteral(NECKO_SAFEBROWSING_FIRST_PARTY_DOMAIN);
- loadInfo->SetOriginAttributes(neckoAttrs);
+ mozilla::OriginAttributes attrs;
+ attrs.mFirstPartyDomain.AssignLiteral(NECKO_SAFEBROWSING_FIRST_PARTY_DOMAIN);
+ loadInfo->SetOriginAttributes(attrs);
mBeganStream = false;
if (!aIsPostRequest) {
// We use POST method to send our request in v2. In v4, the request
// needs to be embedded to the URL and use GET method to send.
// However, from the Chromium source code, a extended HTTP header has
// to be sent along with the request to make the request succeed.
--- a/uriloader/prefetch/OfflineCacheUpdateParent.cpp
+++ b/uriloader/prefetch/OfflineCacheUpdateParent.cpp
@@ -13,18 +13,17 @@
#include "nsContentUtils.h"
#include "nsOfflineCacheUpdate.h"
#include "nsIApplicationCache.h"
#include "nsIScriptSecurityManager.h"
#include "nsNetUtil.h"
using namespace mozilla::ipc;
using mozilla::BasePrincipal;
-using mozilla::DocShellOriginAttributes;
-using mozilla::PrincipalOriginAttributes;
+using mozilla::OriginAttributes;
using mozilla::dom::TabParent;
//
// To enable logging (see mozilla/Logging.h for full details):
//
// set MOZ_LOG=nsOfflineCacheUpdate:5
// set MOZ_LOG_FILE=offlineupdate.log
//
--- a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp
+++ b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp
@@ -676,28 +676,28 @@ nsOfflineCacheUpdateService::OfflineAppA
return OfflineAppPermForPrincipal(aPrincipal, aPrefBranch, false, aAllowed);
}
NS_IMETHODIMP
nsOfflineCacheUpdateService::OfflineAppAllowedForURI(nsIURI *aURI,
nsIPrefBranch *aPrefBranch,
bool *aAllowed)
{
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
nsCOMPtr<nsIPrincipal> principal =
BasePrincipal::CreateCodebasePrincipal(aURI, attrs);
return OfflineAppPermForPrincipal(principal, aPrefBranch, false, aAllowed);
}
nsresult
nsOfflineCacheUpdateService::OfflineAppPinnedForURI(nsIURI *aDocumentURI,
nsIPrefBranch *aPrefBranch,
bool *aPinned)
{
- PrincipalOriginAttributes attrs;
+ OriginAttributes attrs;
nsCOMPtr<nsIPrincipal> principal =
BasePrincipal::CreateCodebasePrincipal(aDocumentURI, attrs);
return OfflineAppPermForPrincipal(principal, aPrefBranch, true, aPinned);
}
NS_IMETHODIMP
nsOfflineCacheUpdateService::AllowOfflineApp(nsIPrincipal *aPrincipal)
{