Bug 1343933 - Renaming Principal classes - part 2 - NullPrincipal, r=qdot

--HG--
rename : caps/nsNullPrincipal.cpp => caps/NullPrincipal.cpp
rename : caps/nsNullPrincipal.h => caps/NullPrincipal.h
rename : caps/nsNullPrincipalURI.cpp => caps/NullPrincipalURI.cpp
rename : caps/nsNullPrincipalURI.h => caps/NullPrincipalURI.h
This commit is contained in:
Andrea Marchesini 2017-03-22 11:38:40 +01:00
parent 68207654f2
commit 1fd1bc3935
42 changed files with 205 additions and 203 deletions

View File

@ -19,7 +19,7 @@
#include "nsPrincipal.h"
#include "nsNetUtil.h"
#include "nsIURIWithPrincipal.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "nsScriptSecurityManager.h"
#include "nsServiceManagerUtils.h"
@ -645,7 +645,7 @@ BasePrincipal::CreateCodebasePrincipal(nsIURI* aURI, const OriginAttributes& aAt
nsresult rv = NS_URIChainHasFlags(aURI, nsIProtocolHandler::URI_INHERITS_SECURITY_CONTEXT,
&inheritsPrincipal);
if (NS_FAILED(rv) || inheritsPrincipal) {
return nsNullPrincipal::Create(aAttrs);
return NullPrincipal::Create(aAttrs);
}
// Check whether the URI knows what its principal is supposed to be.
@ -654,7 +654,7 @@ BasePrincipal::CreateCodebasePrincipal(nsIURI* aURI, const OriginAttributes& aAt
nsCOMPtr<nsIPrincipal> principal;
uriPrinc->GetPrincipal(getter_AddRefs(principal));
if (!principal) {
return nsNullPrincipal::Create(aAttrs);
return NullPrincipal::Create(aAttrs);
}
RefPtr<BasePrincipal> concrete = Cast(principal);
return concrete.forget();
@ -674,7 +674,7 @@ BasePrincipal::CreateCodebasePrincipal(const nsACString& aOrigin)
"CreateCodebasePrincipal does not support System and Expanded principals");
MOZ_ASSERT(!StringBeginsWith(aOrigin, NS_LITERAL_CSTRING(NS_NULLPRINCIPAL_SCHEME ":")),
"CreateCodebasePrincipal does not support nsNullPrincipal");
"CreateCodebasePrincipal does not support NullPrincipal");
nsAutoCString originNoSuffix;
mozilla::OriginAttributes attrs;

View File

@ -13,8 +13,8 @@
#include "mozilla/ArrayUtils.h"
#include "nsDocShell.h"
#include "nsNullPrincipal.h"
#include "nsNullPrincipalURI.h"
#include "NullPrincipal.h"
#include "NullPrincipalURI.h"
#include "nsMemory.h"
#include "nsIURIWithPrincipal.h"
#include "nsIClassInfoImpl.h"
@ -27,40 +27,40 @@
using namespace mozilla;
NS_IMPL_CLASSINFO(nsNullPrincipal, nullptr, nsIClassInfo::MAIN_THREAD_ONLY,
NS_IMPL_CLASSINFO(NullPrincipal, nullptr, nsIClassInfo::MAIN_THREAD_ONLY,
NS_NULLPRINCIPAL_CID)
NS_IMPL_QUERY_INTERFACE_CI(nsNullPrincipal,
NS_IMPL_QUERY_INTERFACE_CI(NullPrincipal,
nsIPrincipal,
nsISerializable)
NS_IMPL_CI_INTERFACE_GETTER(nsNullPrincipal,
NS_IMPL_CI_INTERFACE_GETTER(NullPrincipal,
nsIPrincipal,
nsISerializable)
/* static */ already_AddRefed<nsNullPrincipal>
nsNullPrincipal::CreateWithInheritedAttributes(nsIPrincipal* aInheritFrom)
/* static */ already_AddRefed<NullPrincipal>
NullPrincipal::CreateWithInheritedAttributes(nsIPrincipal* aInheritFrom)
{
RefPtr<nsNullPrincipal> nullPrin = new nsNullPrincipal();
RefPtr<NullPrincipal> nullPrin = new NullPrincipal();
nsresult rv = nullPrin->Init(Cast(aInheritFrom)->OriginAttributesRef());
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
return nullPrin.forget();
}
/* static */ already_AddRefed<nsNullPrincipal>
nsNullPrincipal::CreateWithInheritedAttributes(nsIDocShell* aDocShell, bool aIsFirstParty)
/* static */ already_AddRefed<NullPrincipal>
NullPrincipal::CreateWithInheritedAttributes(nsIDocShell* aDocShell, bool aIsFirstParty)
{
OriginAttributes attrs = nsDocShell::Cast(aDocShell)->GetOriginAttributes();
attrs.SetFirstPartyDomain(aIsFirstParty, NS_LITERAL_CSTRING(NULL_PRINCIPAL_FIRST_PARTY_DOMAIN));
RefPtr<nsNullPrincipal> nullPrin = new nsNullPrincipal();
RefPtr<NullPrincipal> nullPrin = new NullPrincipal();
nsresult rv = nullPrin->Init(attrs);
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
return nullPrin.forget();
}
/* static */ already_AddRefed<nsNullPrincipal>
nsNullPrincipal::Create(const OriginAttributes& aOriginAttributes, nsIURI* aURI)
/* static */ already_AddRefed<NullPrincipal>
NullPrincipal::Create(const OriginAttributes& aOriginAttributes, nsIURI* aURI)
{
RefPtr<nsNullPrincipal> nullPrin = new nsNullPrincipal();
RefPtr<NullPrincipal> nullPrin = new NullPrincipal();
nsresult rv = nullPrin->Init(aOriginAttributes, aURI);
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
@ -68,7 +68,7 @@ nsNullPrincipal::Create(const OriginAttributes& aOriginAttributes, nsIURI* aURI)
}
nsresult
nsNullPrincipal::Init(const OriginAttributes& aOriginAttributes, nsIURI* aURI)
NullPrincipal::Init(const OriginAttributes& aOriginAttributes, nsIURI* aURI)
{
mOriginAttributes = aOriginAttributes;
@ -82,7 +82,7 @@ nsNullPrincipal::Init(const OriginAttributes& aOriginAttributes, nsIURI* aURI)
mURI = aURI;
} else {
mURI = nsNullPrincipalURI::Create();
mURI = NullPrincipalURI::Create();
NS_ENSURE_TRUE(mURI, NS_ERROR_NOT_AVAILABLE);
}
@ -92,7 +92,7 @@ nsNullPrincipal::Init(const OriginAttributes& aOriginAttributes, nsIURI* aURI)
}
nsresult
nsNullPrincipal::GetScriptLocation(nsACString &aStr)
NullPrincipal::GetScriptLocation(nsACString &aStr)
{
return mURI->GetSpec(aStr);
}
@ -102,14 +102,15 @@ nsNullPrincipal::GetScriptLocation(nsACString &aStr)
*/
NS_IMETHODIMP
nsNullPrincipal::GetHashValue(uint32_t *aResult)
NullPrincipal::GetHashValue(uint32_t *aResult)
{
*aResult = (NS_PTR_TO_INT32(this) >> 2);
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipal::SetCsp(nsIContentSecurityPolicy* aCsp) {
NullPrincipal::SetCsp(nsIContentSecurityPolicy* aCsp)
{
// Never destroy an existing CSP on the principal.
// This method should only be called in rare cases.
@ -123,19 +124,19 @@ nsNullPrincipal::SetCsp(nsIContentSecurityPolicy* aCsp) {
}
NS_IMETHODIMP
nsNullPrincipal::GetURI(nsIURI** aURI)
NullPrincipal::GetURI(nsIURI** aURI)
{
return NS_EnsureSafeToReturn(mURI, aURI);
}
NS_IMETHODIMP
nsNullPrincipal::GetDomain(nsIURI** aDomain)
NullPrincipal::GetDomain(nsIURI** aDomain)
{
return NS_EnsureSafeToReturn(mURI, aDomain);
}
NS_IMETHODIMP
nsNullPrincipal::SetDomain(nsIURI* aDomain)
NullPrincipal::SetDomain(nsIURI* aDomain)
{
// I think the right thing to do here is to just throw... Silently failing
// seems counterproductive.
@ -143,13 +144,13 @@ nsNullPrincipal::SetDomain(nsIURI* aDomain)
}
nsresult
nsNullPrincipal::GetOriginInternal(nsACString& aOrigin)
NullPrincipal::GetOriginInternal(nsACString& aOrigin)
{
return mURI->GetSpec(aOrigin);
}
bool
nsNullPrincipal::MayLoadInternal(nsIURI* aURI)
NullPrincipal::MayLoadInternal(nsIURI* aURI)
{
// Also allow the load if we are the principal of the URI being checked.
nsCOMPtr<nsIURIWithPrincipal> uriPrinc = do_QueryInterface(aURI);
@ -166,14 +167,14 @@ nsNullPrincipal::MayLoadInternal(nsIURI* aURI)
}
NS_IMETHODIMP
nsNullPrincipal::GetBaseDomain(nsACString& aBaseDomain)
NullPrincipal::GetBaseDomain(nsACString& aBaseDomain)
{
// For a null principal, we use our unique uuid as the base domain.
return mURI->GetPath(aBaseDomain);
}
NS_IMETHODIMP
nsNullPrincipal::GetAddonId(nsAString& aAddonId)
NullPrincipal::GetAddonId(nsAString& aAddonId)
{
aAddonId.Truncate();
return NS_OK;
@ -183,9 +184,9 @@ nsNullPrincipal::GetAddonId(nsAString& aAddonId)
* nsISerializable implementation
*/
NS_IMETHODIMP
nsNullPrincipal::Read(nsIObjectInputStream* aStream)
NullPrincipal::Read(nsIObjectInputStream* aStream)
{
// Note - nsNullPrincipal use NS_GENERIC_FACTORY_CONSTRUCTOR_INIT, which means
// Note - NullPrincipal use NS_GENERIC_FACTORY_CONSTRUCTOR_INIT, which means
// that the Init() method has already been invoked by the time we deserialize.
// This is in contrast to nsPrincipal, which uses NS_GENERIC_FACTORY_CONSTRUCTOR,
// in which case ::Read needs to invoke Init().
@ -210,7 +211,7 @@ nsNullPrincipal::Read(nsIObjectInputStream* aStream)
}
NS_IMETHODIMP
nsNullPrincipal::Write(nsIObjectOutputStream* aStream)
NullPrincipal::Write(nsIObjectOutputStream* aStream)
{
NS_ENSURE_STATE(mURI);

View File

@ -9,8 +9,8 @@
* same-origin with anything but themselves.
*/
#ifndef nsNullPrincipal_h__
#define nsNullPrincipal_h__
#ifndef NullPrincipal_h
#define NullPrincipal_h
#include "nsIPrincipal.h"
#include "nsJSPrincipals.h"
@ -30,13 +30,13 @@ class nsIURI;
#define NS_NULLPRINCIPAL_SCHEME "moz-nullprincipal"
class nsNullPrincipal final : public mozilla::BasePrincipal
class NullPrincipal final : public mozilla::BasePrincipal
{
public:
// This should only be used by deserialization, and the factory constructor.
// Other consumers should use the Create and CreateWithInheritedAttributes
// methods.
nsNullPrincipal()
NullPrincipal()
: BasePrincipal(eNullPrincipal)
{
}
@ -53,15 +53,16 @@ public:
NS_IMETHOD GetAddonId(nsAString& aAddonId) override;
nsresult GetOriginInternal(nsACString& aOrigin) override;
static already_AddRefed<nsNullPrincipal> CreateWithInheritedAttributes(nsIPrincipal* aInheritFrom);
static already_AddRefed<NullPrincipal> CreateWithInheritedAttributes(nsIPrincipal* aInheritFrom);
// Create NullPrincipal with origin attributes from docshell.
// If aIsFirstParty is true, and the pref 'privacy.firstparty.isolate' is also
// enabled, the mFirstPartyDomain value of the origin attributes will be set
// to NULL_PRINCIPAL_FIRST_PARTY_DOMAIN.
static already_AddRefed<nsNullPrincipal> CreateWithInheritedAttributes(nsIDocShell* aDocShell, bool aIsFirstParty = false);
static already_AddRefed<NullPrincipal>
CreateWithInheritedAttributes(nsIDocShell* aDocShell, bool aIsFirstParty = false);
static already_AddRefed<nsNullPrincipal>
static already_AddRefed<NullPrincipal>
Create(const mozilla::OriginAttributes& aOriginAttributes = mozilla::OriginAttributes(),
nsIURI* aURI = nullptr);
@ -71,7 +72,7 @@ public:
virtual nsresult GetScriptLocation(nsACString &aStr) override;
protected:
virtual ~nsNullPrincipal() {}
virtual ~NullPrincipal() = default;
bool SubsumesInternal(nsIPrincipal* aOther, DocumentDomainConsideration aConsideration) override
{
@ -83,4 +84,4 @@ public:
nsCOMPtr<nsIURI> mURI;
};
#endif // nsNullPrincipal_h__
#endif // NullPrincipal_h__

View File

@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsNullPrincipalURI.h"
#include "NullPrincipalURI.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/MemoryReporting.h"
@ -16,21 +16,21 @@
#include "nsIUUIDGenerator.h"
////////////////////////////////////////////////////////////////////////////////
//// nsNullPrincipalURI
//// NullPrincipalURI
nsNullPrincipalURI::nsNullPrincipalURI()
NullPrincipalURI::NullPrincipalURI()
: mPath(mPathBytes, ArrayLength(mPathBytes), ArrayLength(mPathBytes) - 1)
{
}
nsNullPrincipalURI::nsNullPrincipalURI(const nsNullPrincipalURI& aOther)
NullPrincipalURI::NullPrincipalURI(const NullPrincipalURI& aOther)
: mPath(mPathBytes, ArrayLength(mPathBytes), ArrayLength(mPathBytes) - 1)
{
mPath.Assign(aOther.mPath);
}
nsresult
nsNullPrincipalURI::Init()
NullPrincipalURI::Init()
{
// FIXME: bug 327161 -- make sure the uuid generator is reseeding-resistant.
nsCOMPtr<nsIUUIDGenerator> uuidgen = services::GetUUIDGenerator();
@ -51,10 +51,10 @@ nsNullPrincipalURI::Init()
}
/* static */
already_AddRefed<nsNullPrincipalURI>
nsNullPrincipalURI::Create()
already_AddRefed<NullPrincipalURI>
NullPrincipalURI::Create()
{
RefPtr<nsNullPrincipalURI> uri = new nsNullPrincipalURI();
RefPtr<NullPrincipalURI> uri = new NullPrincipalURI();
nsresult rv = uri->Init();
NS_ENSURE_SUCCESS(rv, nullptr);
return uri.forget();
@ -63,13 +63,13 @@ nsNullPrincipalURI::Create()
static NS_DEFINE_CID(kNullPrincipalURIImplementationCID,
NS_NULLPRINCIPALURI_IMPLEMENTATION_CID);
NS_IMPL_ADDREF(nsNullPrincipalURI)
NS_IMPL_RELEASE(nsNullPrincipalURI)
NS_IMPL_ADDREF(NullPrincipalURI)
NS_IMPL_RELEASE(NullPrincipalURI)
NS_INTERFACE_MAP_BEGIN(nsNullPrincipalURI)
NS_INTERFACE_MAP_BEGIN(NullPrincipalURI)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIURI)
if (aIID.Equals(kNullPrincipalURIImplementationCID))
foundInterface = static_cast<nsIURI *>(this);
foundInterface = static_cast<nsIURI*>(this);
else
NS_INTERFACE_MAP_ENTRY(nsIURI)
NS_INTERFACE_MAP_ENTRY(nsISizeOf)
@ -80,23 +80,23 @@ NS_INTERFACE_MAP_END
//// nsIURI
NS_IMETHODIMP
nsNullPrincipalURI::GetAsciiHost(nsACString &_host)
NullPrincipalURI::GetAsciiHost(nsACString& _host)
{
_host.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetAsciiHostPort(nsACString &_hostport)
NullPrincipalURI::GetAsciiHostPort(nsACString& _hostport)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetAsciiSpec(nsACString &_spec)
NullPrincipalURI::GetAsciiSpec(nsACString& _spec)
{
nsAutoCString buffer;
// Ignore the return value -- nsNullPrincipalURI::GetSpec() is infallible.
// Ignore the return value -- NullPrincipalURI::GetSpec() is infallible.
Unused << GetSpec(buffer);
// This uses the infallible version of |NS_EscapeURL| as |GetSpec| is
// already infallible.
@ -105,141 +105,141 @@ nsNullPrincipalURI::GetAsciiSpec(nsACString &_spec)
}
NS_IMETHODIMP
nsNullPrincipalURI::GetHost(nsACString &_host)
NullPrincipalURI::GetHost(nsACString& _host)
{
_host.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetHost(const nsACString &aHost)
NullPrincipalURI::SetHost(const nsACString& aHost)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetHostPort(nsACString &_host)
NullPrincipalURI::GetHostPort(nsACString& _host)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetHostPort(const nsACString &aHost)
NullPrincipalURI::SetHostPort(const nsACString& aHost)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetHostAndPort(const nsACString &aHost)
NullPrincipalURI::SetHostAndPort(const nsACString& aHost)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetOriginCharset(nsACString &_charset)
NullPrincipalURI::GetOriginCharset(nsACString& _charset)
{
_charset.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetPassword(nsACString &_password)
NullPrincipalURI::GetPassword(nsACString& _password)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetPassword(const nsACString &aPassword)
NullPrincipalURI::SetPassword(const nsACString& aPassword)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetPath(nsACString &_path)
NullPrincipalURI::GetPath(nsACString& _path)
{
_path = mPath;
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetPath(const nsACString &aPath)
NullPrincipalURI::SetPath(const nsACString& aPath)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetFilePath(nsACString &aFilePath)
NullPrincipalURI::GetFilePath(nsACString& aFilePath)
{
aFilePath.Truncate();
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetFilePath(const nsACString &aFilePath)
NullPrincipalURI::SetFilePath(const nsACString& aFilePath)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetQuery(nsACString &aQuery)
NullPrincipalURI::GetQuery(nsACString& aQuery)
{
aQuery.Truncate();
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetQuery(const nsACString &aQuery)
NullPrincipalURI::SetQuery(const nsACString& aQuery)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetRef(nsACString &_ref)
NullPrincipalURI::GetRef(nsACString& _ref)
{
_ref.Truncate();
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetRef(const nsACString &aRef)
NullPrincipalURI::SetRef(const nsACString& aRef)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetPrePath(nsACString &_prePath)
NullPrincipalURI::GetPrePath(nsACString& _prePath)
{
_prePath = NS_LITERAL_CSTRING(NS_NULLPRINCIPAL_SCHEME ":");
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetPort(int32_t *_port)
NullPrincipalURI::GetPort(int32_t* _port)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetPort(int32_t aPort)
NullPrincipalURI::SetPort(int32_t aPort)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetScheme(nsACString &_scheme)
NullPrincipalURI::GetScheme(nsACString& _scheme)
{
_scheme = NS_LITERAL_CSTRING(NS_NULLPRINCIPAL_SCHEME);
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetScheme(const nsACString &aScheme)
NullPrincipalURI::SetScheme(const nsACString& aScheme)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetSpec(nsACString &_spec)
NullPrincipalURI::GetSpec(nsACString& _spec)
{
_spec = NS_LITERAL_CSTRING(NS_NULLPRINCIPAL_SCHEME ":") + mPath;
return NS_OK;
@ -247,77 +247,77 @@ nsNullPrincipalURI::GetSpec(nsACString &_spec)
// result may contain unescaped UTF-8 characters
NS_IMETHODIMP
nsNullPrincipalURI::GetSpecIgnoringRef(nsACString &result)
NullPrincipalURI::GetSpecIgnoringRef(nsACString& _result)
{
return GetSpec(result);
return GetSpec(_result);
}
NS_IMETHODIMP
nsNullPrincipalURI::GetHasRef(bool *result)
NullPrincipalURI::GetHasRef(bool* _result)
{
*result = false;
*_result = false;
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetSpec(const nsACString &aSpec)
NullPrincipalURI::SetSpec(const nsACString& aSpec)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetUsername(nsACString &_username)
NullPrincipalURI::GetUsername(nsACString& _username)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetUsername(const nsACString &aUsername)
NullPrincipalURI::SetUsername(const nsACString& aUsername)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetUserPass(nsACString &_userPass)
NullPrincipalURI::GetUserPass(nsACString& _userPass)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetUserPass(const nsACString &aUserPass)
NullPrincipalURI::SetUserPass(const nsACString& aUserPass)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::Clone(nsIURI **_newURI)
NullPrincipalURI::Clone(nsIURI** _newURI)
{
nsCOMPtr<nsIURI> uri = new nsNullPrincipalURI(*this);
nsCOMPtr<nsIURI> uri = new NullPrincipalURI(*this);
uri.forget(_newURI);
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::CloneIgnoringRef(nsIURI **_newURI)
NullPrincipalURI::CloneIgnoringRef(nsIURI** _newURI)
{
// GetRef/SetRef not supported by nsNullPrincipalURI, so
// GetRef/SetRef not supported by NullPrincipalURI, so
// CloneIgnoringRef() is the same as Clone().
return Clone(_newURI);
}
NS_IMETHODIMP
nsNullPrincipalURI::CloneWithNewRef(const nsACString& newRef, nsIURI **_newURI)
NullPrincipalURI::CloneWithNewRef(const nsACString& newRef, nsIURI** _newURI)
{
// GetRef/SetRef not supported by nsNullPrincipalURI, so
// GetRef/SetRef not supported by NullPrincipalURI, so
// CloneWithNewRef() is the same as Clone().
return Clone(_newURI);
}
NS_IMETHODIMP
nsNullPrincipalURI::Equals(nsIURI *aOther, bool *_equals)
NullPrincipalURI::Equals(nsIURI* aOther, bool* _equals)
{
*_equals = false;
RefPtr<nsNullPrincipalURI> otherURI;
RefPtr<NullPrincipalURI> otherURI;
nsresult rv = aOther->QueryInterface(kNullPrincipalURIImplementationCID,
getter_AddRefs(otherURI));
if (NS_SUCCEEDED(rv)) {
@ -327,23 +327,23 @@ nsNullPrincipalURI::Equals(nsIURI *aOther, bool *_equals)
}
NS_IMETHODIMP
nsNullPrincipalURI::EqualsExceptRef(nsIURI *aOther, bool *_equals)
NullPrincipalURI::EqualsExceptRef(nsIURI* aOther, bool* _equals)
{
// GetRef/SetRef not supported by nsNullPrincipalURI, so
// GetRef/SetRef not supported by NullPrincipalURI, so
// EqualsExceptRef() is the same as Equals().
return Equals(aOther, _equals);
}
NS_IMETHODIMP
nsNullPrincipalURI::Resolve(const nsACString &aRelativePath,
nsACString &_resolvedURI)
NullPrincipalURI::Resolve(const nsACString& aRelativePath,
nsACString& _resolvedURI)
{
_resolvedURI = aRelativePath;
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::SchemeIs(const char *aScheme, bool *_schemeIs)
NullPrincipalURI::SchemeIs(const char* aScheme, bool* _schemeIs)
{
*_schemeIs = (0 == nsCRT::strcasecmp(NS_NULLPRINCIPAL_SCHEME, aScheme));
return NS_OK;
@ -353,13 +353,13 @@ nsNullPrincipalURI::SchemeIs(const char *aScheme, bool *_schemeIs)
//// nsIIPCSerializableURI
void
nsNullPrincipalURI::Serialize(mozilla::ipc::URIParams &aParams)
NullPrincipalURI::Serialize(mozilla::ipc::URIParams& aParams)
{
aParams = mozilla::ipc::NullPrincipalURIParams();
}
bool
nsNullPrincipalURI::Deserialize(const mozilla::ipc::URIParams &aParams)
NullPrincipalURI::Deserialize(const mozilla::ipc::URIParams& aParams)
{
if (aParams.type() != mozilla::ipc::URIParams::TNullPrincipalURIParams) {
MOZ_ASSERT_UNREACHABLE("unexpected URIParams type");
@ -376,13 +376,13 @@ nsNullPrincipalURI::Deserialize(const mozilla::ipc::URIParams &aParams)
//// nsISizeOf
size_t
nsNullPrincipalURI::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
NullPrincipalURI::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{
return mPath.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
}
size_t
nsNullPrincipalURI::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
NullPrincipalURI::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}

View File

@ -8,8 +8,8 @@
* This wraps nsSimpleURI so that all calls to it are done on the main thread.
*/
#ifndef __nsNullPrincipalURI_h__
#define __nsNullPrincipalURI_h__
#ifndef __NullPrincipalURI_h__
#define __NullPrincipalURI_h__
#include "nsIURI.h"
#include "nsISizeOf.h"
@ -17,7 +17,7 @@
#include "mozilla/Attributes.h"
#include "nsIIPCSerializableURI.h"
#include "mozilla/MemoryReporting.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "nsID.h"
// {51fcd543-3b52-41f7-b91b-6b54102236e6}
@ -25,9 +25,9 @@
{0x51fcd543, 0x3b52, 0x41f7, \
{0xb9, 0x1b, 0x6b, 0x54, 0x10, 0x22, 0x36, 0xe6} }
class nsNullPrincipalURI final : public nsIURI
, public nsISizeOf
, public nsIIPCSerializableURI
class NullPrincipalURI final : public nsIURI
, public nsISizeOf
, public nsIIPCSerializableURI
{
public:
NS_DECL_THREADSAFE_ISUPPORTS
@ -40,15 +40,15 @@ public:
// NB: This constructor exists only for deserialization. Everyone
// else should call Create.
nsNullPrincipalURI();
NullPrincipalURI();
// Returns null on failure.
static already_AddRefed<nsNullPrincipalURI> Create();
static already_AddRefed<NullPrincipalURI> Create();
private:
nsNullPrincipalURI(const nsNullPrincipalURI& aOther);
NullPrincipalURI(const NullPrincipalURI& aOther);
~nsNullPrincipalURI() {}
~NullPrincipalURI() {}
nsresult Init();
@ -56,4 +56,4 @@ private:
nsFixedCString mPath;
};
#endif // __nsNullPrincipalURI_h__
#endif // __NullPrincipalURI_h__

View File

@ -25,8 +25,8 @@ XPIDL_MODULE = 'caps'
EXPORTS += [
'nsJSPrincipals.h',
'nsNullPrincipal.h',
'nsNullPrincipalURI.h',
'NullPrincipal.h',
'NullPrincipalURI.h',
]
EXPORTS.mozilla = [
@ -35,7 +35,7 @@ EXPORTS.mozilla = [
SOURCES += [
# Compile this separately since nsExceptionHandler.h conflicts
# with something from nsNullPrincipal.cpp.
# with something from NullPrincipal.cpp.
'BasePrincipal.cpp',
]
@ -43,11 +43,11 @@ UNIFIED_SOURCES += [
'DomainPolicy.cpp',
'ExpandedPrincipal.cpp',
'nsJSPrincipals.cpp',
'nsNullPrincipal.cpp',
'nsNullPrincipalURI.cpp',
'nsPrincipal.cpp',
'nsScriptSecurityManager.cpp',
'nsSystemPrincipal.cpp',
'NullPrincipal.cpp',
'NullPrincipalURI.cpp',
]
LOCAL_INCLUDES += [

View File

@ -22,7 +22,7 @@
#include "mozilla/BasePrincipal.h"
#include "nsSystemPrincipal.h"
#include "nsPrincipal.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "DomainPolicy.h"
#include "nsXPIDLString.h"
#include "nsCRT.h"
@ -1141,7 +1141,7 @@ nsScriptSecurityManager::CreateNullPrincipal(JS::Handle<JS::Value> aOriginAttrib
if (!aOriginAttributes.isObject() || !attrs.Init(aCx, aOriginAttributes)) {
return NS_ERROR_INVALID_ARG;
}
nsCOMPtr<nsIPrincipal> prin = nsNullPrincipal::Create(attrs);
nsCOMPtr<nsIPrincipal> prin = NullPrincipal::Create(attrs);
prin.forget(aPrincipal);
return NS_OK;
}

View File

@ -120,7 +120,7 @@
#include "nsITimer.h"
#include "nsISHistoryInternal.h"
#include "nsIPrincipal.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "nsISHEntry.h"
#include "nsIWindowWatcher.h"
#include "nsIPromptFactory.h"
@ -1501,7 +1501,7 @@ nsDocShell::LoadURI(nsIURI* aURI,
//
// We didn't inherit OriginAttributes here as ExpandedPrincipal doesn't
// have origin attributes.
principalToInherit = nsNullPrincipal::CreateWithInheritedAttributes(this);
principalToInherit = NullPrincipal::CreateWithInheritedAttributes(this);
inheritPrincipal = false;
}
}
@ -1514,7 +1514,7 @@ nsDocShell::LoadURI(nsIURI* aURI,
inheritPrincipal = false;
// If aFirstParty is true and the pref 'privacy.firstparty.isolate' is
// enabled, we will set firstPartyDomain on the origin attributes.
principalToInherit = nsNullPrincipal::CreateWithInheritedAttributes(this, aFirstParty);
principalToInherit = NullPrincipal::CreateWithInheritedAttributes(this, aFirstParty);
}
// If the triggeringPrincipal is not passed explicitly, we first try to create
@ -8127,9 +8127,9 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
nsCOMPtr<nsIPrincipal> principal;
if (mSandboxFlags & SANDBOXED_ORIGIN) {
if (aPrincipal) {
principal = nsNullPrincipal::CreateWithInheritedAttributes(aPrincipal);
principal = NullPrincipal::CreateWithInheritedAttributes(aPrincipal);
} else {
principal = nsNullPrincipal::CreateWithInheritedAttributes(this);
principal = NullPrincipal::CreateWithInheritedAttributes(this);
}
} else {
principal = aPrincipal;
@ -12409,13 +12409,13 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
if (!principalToInherit) {
if (loadInfo->GetLoadingSandboxed()) {
if (loadInfo->LoadingPrincipal()) {
principalToInherit = nsNullPrincipal::CreateWithInheritedAttributes(
principalToInherit = NullPrincipal::CreateWithInheritedAttributes(
loadInfo->LoadingPrincipal());
} else {
// get the OriginAttributes
OriginAttributes attrs;
loadInfo->GetOriginAttributes(&attrs);
principalToInherit = nsNullPrincipal::Create(attrs);
principalToInherit = NullPrincipal::Create(attrs);
}
} else {
principalToInherit = loadInfo->PrincipalToInherit();
@ -12606,7 +12606,7 @@ nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry, uint32_t aLoadType)
// Ensure that we have a triggeringPrincipal. Otherwise javascript:
// URIs will pick it up from the about:blank page we just loaded,
// and we don't really want even that in this case.
triggeringPrincipal = nsNullPrincipal::CreateWithInheritedAttributes(this);
triggeringPrincipal = NullPrincipal::CreateWithInheritedAttributes(this);
}
}
@ -14378,7 +14378,7 @@ nsDocShell::GetPrintPreview(nsIWebBrowserPrint** aPrintPreview)
// we QI the mContentViewer if the current URI is either about:blank
// or about:printpreview.
Stop(nsIWebNavigation::STOP_ALL);
nsCOMPtr<nsIPrincipal> principal = nsNullPrincipal::CreateWithInheritedAttributes(this);
nsCOMPtr<nsIPrincipal> principal = NullPrincipal::CreateWithInheritedAttributes(this);
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("about:printpreview"));
nsresult rv = CreateAboutBlankContentViewer(principal, uri);

View File

@ -18,7 +18,7 @@
#include "nsDOMJSUtils.h"
#include "nsError.h"
#include "nsPIDOMWindow.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "mozilla/LoadInfo.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/ScriptSettings.h"
@ -345,7 +345,7 @@ DOMParser::Init(nsIPrincipal* principal, nsIURI* documentURI,
// Don't give DOMParsers the system principal. Use a null
// principal instead.
mOriginalPrincipalWasSystem = true;
mPrincipal = nsNullPrincipal::Create();
mPrincipal = NullPrincipal::Create();
if (!mDocumentURI) {
rv = mPrincipal->GetURI(getter_AddRefs(mDocumentURI));
@ -456,7 +456,7 @@ DOMParser::SetUpDocument(DocumentFlavor aFlavor, nsIDOMDocument** aResult)
NS_ENSURE_TRUE(!mAttemptedInit, NS_ERROR_NOT_INITIALIZED);
AttemptedInitMarker marker(&mAttemptedInit);
nsCOMPtr<nsIPrincipal> prin = nsNullPrincipal::Create();
nsCOMPtr<nsIPrincipal> prin = NullPrincipal::Create();
rv = Init(prin, nullptr, nullptr, scriptHandlingObject);
NS_ENSURE_SUCCESS(rv, rv);
}

View File

@ -31,7 +31,7 @@
#include "nsGlobalWindow.h"
#include "mozilla/Likely.h"
#include "nsCycleCollectionParticipant.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "ScriptSettings.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/LocationBinding.h"
@ -164,7 +164,7 @@ Location::CheckURL(nsIURI* aURI, nsIDocShellLoadInfo** aLoadInfo)
sourceURI = docCurrentURI;
}
else {
// Use principalURI as long as it is not an nsNullPrincipalURI. We
// Use principalURI as long as it is not an NullPrincipalURI. We
// could add a method such as GetReferrerURI to principals to make this
// cleaner, but given that we need to start using Source Browsing
// Context for referrer (see Bug 960639) this may be wasted effort at

View File

@ -182,7 +182,7 @@
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsNodeInfoManager.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "nsParserCIID.h"
#include "nsParserConstants.h"
#include "nsPIDOMWindow.h"
@ -514,7 +514,7 @@ nsContentUtils::Init()
sSecurityManager->GetSystemPrincipal(&sSystemPrincipal);
MOZ_ASSERT(sSystemPrincipal);
RefPtr<nsNullPrincipal> nullPrincipal = nsNullPrincipal::Create();
RefPtr<NullPrincipal> nullPrincipal = NullPrincipal::Create();
if (!nullPrincipal) {
return NS_ERROR_FAILURE;
}
@ -4790,7 +4790,7 @@ nsContentUtils::ConvertToPlainText(const nsAString& aSourceBuffer,
{
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), "about:blank");
nsCOMPtr<nsIPrincipal> principal = nsNullPrincipal::Create();
nsCOMPtr<nsIPrincipal> principal = NullPrincipal::Create();
nsCOMPtr<nsIDOMDocument> domDocument;
nsresult rv = NS_NewDOMDocument(getter_AddRefs(domDocument),
EmptyString(),

View File

@ -106,7 +106,7 @@
#include "nsIScriptSecurityManager.h"
#include "nsIPermissionManager.h"
#include "nsIPrincipal.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "nsIDOMWindow.h"
#include "nsPIDOMWindow.h"
@ -2723,7 +2723,7 @@ nsDocument::InitCSP(nsIChannel* aChannel)
if (cspSandboxFlags & SANDBOXED_ORIGIN) {
// If the new CSP sandbox flags do not have the allow-same-origin flag
// reset the document principal to a null principal
principal = nsNullPrincipal::Create();
principal = NullPrincipal::Create();
SetPrincipal(principal);
}

View File

@ -50,7 +50,7 @@
#include "nsIEditor.h"
#include "nsIMozBrowserFrame.h"
#include "nsISHistory.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "nsIScriptError.h"
#include "nsGlobalWindow.h"
#include "nsPIWindowRoot.h"
@ -831,7 +831,7 @@ nsFrameLoader::ReallyStartLoadingInternal()
NS_ENSURE_SUCCESS(rv, rv);
}
// Use referrer as long as it is not an nsNullPrincipalURI.
// Use referrer as long as it is not an NullPrincipalURI.
// We could add a method such as GetReferrerURI to principals to make this
// cleaner, but given that we need to start using Source Browsing Context for
// referrer (see Bug 960639) this may be wasted effort at this stage.

View File

@ -30,7 +30,7 @@
#include "nsCCUncollectableMarker.h"
#include "nsNameSpaceManager.h"
#include "nsDocument.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
using namespace mozilla;
using mozilla::dom::NodeInfo;
@ -182,7 +182,7 @@ nsNodeInfoManager::Init(nsIDocument *aDocument)
NS_PRECONDITION(!mPrincipal,
"Being inited when we already have a principal?");
mPrincipal = nsNullPrincipal::Create();
mPrincipal = NullPrincipal::Create();
if (aDocument) {
mBindingManager = new nsBindingManager(aDocument);

View File

@ -19,7 +19,7 @@
#include "nsIScriptSecurityManager.h"
#include "nsNetUtil.h"
#include "nsComponentManagerUtils.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "nsContentUtils.h"
#include "nsIParserUtils.h"
#include "nsIDocument.h"
@ -1522,7 +1522,7 @@ nsTreeSanitizer::InitializeStatics()
sAttributesMathML->PutEntry(*kAttributesMathML[i]);
}
nsCOMPtr<nsIPrincipal> principal = nsNullPrincipal::Create();
nsCOMPtr<nsIPrincipal> principal = NullPrincipal::Create();
principal.forget(&sNullPrincipal);
}

View File

@ -10,7 +10,7 @@
#include "js/Class.h"
#include "nsJSPrincipals.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "nsThreadUtils.h"
#include "nsContentUtils.h"
@ -113,7 +113,7 @@ SimpleGlobalObject::Create(GlobalType globalType, JS::Handle<JS::Value> proto)
.setSystemZone();
if (NS_IsMainThread()) {
nsCOMPtr<nsIPrincipal> principal = nsNullPrincipal::Create();
nsCOMPtr<nsIPrincipal> principal = NullPrincipal::Create();
options.creationOptions().setTrace(xpc::TraceXPCGlobal);
global = xpc::CreateGlobalObject(cx, js::Jsvalify(&SimpleGlobalClass),
nsJSPrincipals::get(principal),

View File

@ -22,7 +22,7 @@
#include "nsIScriptError.h"
#include "nsCRTGlue.h"
#include "nsIScriptSecurityManager.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "mozilla/Maybe.h"
#include <algorithm>
@ -407,7 +407,7 @@ nsJSON::DecodeInternal(JSContext* cx,
}
nsresult rv;
nsCOMPtr<nsIPrincipal> nullPrincipal = nsNullPrincipal::Create();
nsCOMPtr<nsIPrincipal> nullPrincipal = NullPrincipal::Create();
// The ::Decode function is deprecated [Bug 675797] and the following
// channel is never openend, so it does not matter what securityFlags

View File

@ -54,7 +54,7 @@
#include "VideoUtils.h"
#include "Latency.h"
#include "nsProxyRelease.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "nsVariant.h"
// For snprintf
@ -1155,7 +1155,7 @@ public:
nsCOMPtr<nsIPrincipal> principal;
if (mPeerIdentity) {
principal = nsNullPrincipal::CreateWithInheritedAttributes(window->GetExtantDoc()->NodePrincipal());
principal = NullPrincipal::CreateWithInheritedAttributes(window->GetExtantDoc()->NodePrincipal());
} else {
principal = window->GetExtantDoc()->NodePrincipal();
}

View File

@ -97,7 +97,7 @@ public:
* This is used in WebRTC. A peerIdentity constrained MediaStreamTrack cannot
* be sent across the network to anything other than a peer with the provided
* identity. If this is set, then GetPrincipal() should return an instance of
* nsNullPrincipal.
* NullPrincipal.
*
* A track's PeerIdentity is immutable and will not change during the track's
* lifetime.

View File

@ -94,7 +94,7 @@
#include "nsIImageLoadingContent.h"
#include "mozilla/Preferences.h"
#include "nsVersionComparator.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#if defined(XP_WIN)
#include "nsIWindowMediator.h"

View File

@ -33,7 +33,7 @@
#include "GeckoProfiler.h"
#include "nsPluginInstanceOwner.h"
#include "nsDataHashtable.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#define BYTERANGE_REQUEST_CONTEXT 0x01020304

View File

@ -24,7 +24,7 @@
#include "nsIChannel.h"
#include "nsIInputStream.h"
#include "nsIProtocolHandler.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "mozilla/Monitor.h"
#include "plstr.h"
#include "prtime.h"

View File

@ -16,7 +16,7 @@
#include "nsServiceManagerUtils.h"
#include "nsIPresShell.h"
#include "nsNetUtil.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "nsIInputStream.h"
#include "nsStringStream.h"
#include "nsStreamUtils.h"
@ -359,7 +359,7 @@ gfxSVGGlyphsDocument::ParseDocument(const uint8_t *aBuffer, uint32_t aBufLen)
rv = NS_NewURI(getter_AddRefs(uri), mSVGGlyphsDocumentURI);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrincipal> principal = nsNullPrincipal::Create();
nsCOMPtr<nsIPrincipal> principal = NullPrincipal::Create();
nsCOMPtr<nsIDOMDocument> domDoc;
rv = NS_NewDOMDocument(getter_AddRefs(domDoc),

View File

@ -13,7 +13,7 @@
#include "nsIStringStream.h"
#include "nsNetUtil.h"
#include "nsComponentManagerUtils.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
NS_IMPL_ISUPPORTS(nsIconChannel,
nsIRequest,
@ -115,7 +115,7 @@ moz_icon_to_channel(nsIURI* aURI, const nsACString& aFileExt,
// nsIconProtocolHandler::NewChannel2 will provide the correct loadInfo for
// this iconChannel. Use the most restrictive security settings for the
// temporary loadInfo to make sure the channel can not be openend.
nsCOMPtr<nsIPrincipal> nullPrincipal = nsNullPrincipal::Create();
nsCOMPtr<nsIPrincipal> nullPrincipal = NullPrincipal::Create();
return NS_NewInputStreamChannel(aChannel,
aURI,
stream,

View File

@ -27,7 +27,7 @@
#include "nsComponentManagerUtils.h"
#include "nsIStringStream.h"
#include "nsServiceManagerUtils.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "nsIURL.h"
#include "prlink.h"
@ -107,7 +107,7 @@ moz_gdk_pixbuf_to_channel(GdkPixbuf* aPixbuf, nsIURI* aURI,
// nsIconProtocolHandler::NewChannel2 will provide the correct loadInfo for
// this iconChannel. Use the most restrictive security settings for the
// temporary loadInfo to make sure the channel can not be openend.
nsCOMPtr<nsIPrincipal> nullPrincipal = nsNullPrincipal::Create();
nsCOMPtr<nsIPrincipal> nullPrincipal = NullPrincipal::Create();
return NS_NewInputStreamChannel(aChannel,
aURI,
stream,

View File

@ -17,7 +17,7 @@
#include "nsIURI.h"
#include "nsNetUtil.h"
#include "mozilla/LoadInfo.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "nsServiceManagerUtils.h"
#include "nsString.h"
#include "nsTArray.h"
@ -70,7 +70,7 @@ PrincipalInfoToPrincipal(const PrincipalInfo& aPrincipalInfo,
return nullptr;
}
principal = nsNullPrincipal::Create(info.attrs(), uri);
principal = NullPrincipal::Create(info.attrs(), uri);
return principal.forget();
}

View File

@ -16,7 +16,7 @@
#include "nsJARURI.h"
#include "nsIIconURI.h"
#include "nsHostObjectURI.h"
#include "nsNullPrincipalURI.h"
#include "NullPrincipalURI.h"
#include "nsJSProtocolHandler.h"
#include "nsNetCID.h"
#include "nsSimpleNestedURI.h"
@ -100,7 +100,7 @@ DeserializeURI(const URIParams& aParams)
break;
case URIParams::TNullPrincipalURIParams:
serializable = new nsNullPrincipalURI();
serializable = new NullPrincipalURI();
break;
case URIParams::TSimpleNestedURIParams:

View File

@ -19,7 +19,7 @@
#include "nsIURI.h"
#include "nsJSUtils.h"
#include "nsNetUtil.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "ExpandedPrincipal.h"
#include "WrapperFactory.h"
#include "xpcprivate.h"
@ -1049,7 +1049,7 @@ xpc::CreateSandboxObject(JSContext* cx, MutableHandleValue vp, nsISupports* prin
if (sop) {
principal = sop->GetPrincipal();
} else {
RefPtr<nsNullPrincipal> nullPrin = nsNullPrincipal::Create();
RefPtr<NullPrincipal> nullPrin = NullPrincipal::Create();
principal = nullPrin;
}
}
@ -1784,7 +1784,7 @@ nsXPCComponents_utils_Sandbox::CallOrConstruct(nsIXPConnectWrappedNative* wrappe
}
} else if (args[0].isNull()) {
// Null means that we just pass prinOrSop = nullptr, and get an
// nsNullPrincipal.
// NullPrincipal.
ok = true;
}

View File

@ -133,7 +133,7 @@ using mozilla::dom::AudioChannelAgent;
#include "nsScriptSecurityManager.h"
#include "nsPrincipal.h"
#include "nsSystemPrincipal.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "nsNetCID.h"
#ifndef MOZ_WIDGET_GONK
#if defined(MOZ_WIDGET_ANDROID)
@ -593,7 +593,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsMixedContentBlocker)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrincipal)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsSystemPrincipal,
nsScriptSecurityManager::SystemPrincipalSingletonConstructor)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNullPrincipal, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(NullPrincipal, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsStructuredCloneContainer)
NS_GENERIC_FACTORY_CONSTRUCTOR(OSFileConstantsService)
@ -1029,7 +1029,7 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
{ &kNS_SCRIPTSECURITYMANAGER_CID, false, nullptr, Construct_nsIScriptSecurityManager },
{ &kNS_PRINCIPAL_CID, false, nullptr, nsPrincipalConstructor },
{ &kNS_SYSTEMPRINCIPAL_CID, false, nullptr, nsSystemPrincipalConstructor },
{ &kNS_NULLPRINCIPAL_CID, false, nullptr, nsNullPrincipalConstructor },
{ &kNS_NULLPRINCIPAL_CID, false, nullptr, NullPrincipalConstructor },
{ &kNS_DEVICE_SENSORS_CID, false, nullptr, nsDeviceSensorsConstructor },
#ifndef MOZ_WIDGET_GONK
#if defined(ANDROID)

View File

@ -43,7 +43,7 @@
#include "nsDOMClassInfoID.h"
#include "mozilla/Likely.h"
#include "nsComponentManagerUtils.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "mozilla/RuleProcessorCache.h"
#include "nsIStyleSheetLinkingElement.h"
#include "nsDOMWindowUtils.h"

View File

@ -15,7 +15,7 @@
#include "mozAutoDocUpdate.h"
#include "nsMediaList.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
namespace mozilla {
@ -202,7 +202,7 @@ StyleSheet::SetEnabled(bool aEnabled)
StyleSheetInfo::StyleSheetInfo(CORSMode aCORSMode,
ReferrerPolicy aReferrerPolicy,
const dom::SRIMetadata& aIntegrity)
: mPrincipal(nsNullPrincipal::Create())
: mPrincipal(NullPrincipal::Create())
, mCORSMode(aCORSMode)
, mReferrerPolicy(aReferrerPolicy)
, mIntegrity(aIntegrity)
@ -212,7 +212,7 @@ StyleSheetInfo::StyleSheetInfo(CORSMode aCORSMode,
#endif
{
if (!mPrincipal) {
NS_RUNTIMEABORT("nsNullPrincipal::Init failed");
NS_RUNTIMEABORT("NullPrincipal::Init failed");
}
}

View File

@ -74,7 +74,7 @@
#include "nsIURLParser.h"
#include "nsIDOMDataChannel.h"
#include "nsIDOMLocation.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "mozilla/PeerIdentity.h"
#include "mozilla/dom/RTCCertificate.h"
#include "mozilla/dom/RTCConfigurationBinding.h"
@ -1877,7 +1877,7 @@ PeerConnectionImpl::CreateNewRemoteTracks(RefPtr<PeerConnectionObserver>& aPco)
} else {
// we're either certain that we need isolation for the streams, OR
// we're not sure and we can fix the stream in SetDtlsConnected
principal = nsNullPrincipal::CreateWithInheritedAttributes(doc->NodePrincipal());
principal = NullPrincipal::CreateWithInheritedAttributes(doc->NodePrincipal());
}
// We need to select unique ids, just use max + 1

View File

@ -21,7 +21,7 @@
#include "nsContentUtils.h"
#include "nsDocShell.h"
#include "nsGlobalWindow.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
using namespace mozilla::dom;
@ -465,10 +465,10 @@ LoadInfo::GetSandboxedLoadingPrincipal(nsIPrincipal** aPrincipal)
if (!mSandboxedLoadingPrincipal) {
if (mLoadingPrincipal) {
mSandboxedLoadingPrincipal =
nsNullPrincipal::CreateWithInheritedAttributes(mLoadingPrincipal);
NullPrincipal::CreateWithInheritedAttributes(mLoadingPrincipal);
} else {
OriginAttributes attrs(mOriginAttributes);
mSandboxedLoadingPrincipal = nsNullPrincipal::Create(attrs);
mSandboxedLoadingPrincipal = NullPrincipal::Create(attrs);
}
}
MOZ_ASSERT(mSandboxedLoadingPrincipal);
@ -717,7 +717,7 @@ LoadInfo::ResetPrincipalsToNullPrincipal()
// take the originAttributes from the LoadInfo and create
// a new NullPrincipal using those origin attributes.
nsCOMPtr<nsIPrincipal> newNullPrincipal =
nsNullPrincipal::Create(mOriginAttributes);
NullPrincipal::Create(mOriginAttributes);
MOZ_ASSERT(mInternalContentPolicyType != nsIContentPolicy::TYPE_DOCUMENT ||
!mLoadingPrincipal,

View File

@ -41,7 +41,7 @@
#include "nsISocketTransportService.h"
#include "nsIURI.h"
#include "nsILoadInfo.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "nsIAuthPrompt2.h"
#include "nsIFTPChannelParentInternal.h"

View File

@ -39,7 +39,7 @@
#include "nsIDOMWindowUtils.h"
#include "nsIDOMWindow.h"
#include "nsINetworkInterceptController.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "nsICorsPreflightCallback.h"
#include "nsISupportsImpl.h"
#include "mozilla/LoadInfo.h"
@ -762,7 +762,7 @@ nsCORSListenerProxy::AsyncOnChannelRedirect(nsIChannel *aOldChannel,
if (NS_SUCCEEDED(rv) && !equal) {
// Spec says to set our source origin to a unique origin.
mOriginHeaderPrincipal =
nsNullPrincipal::CreateWithInheritedAttributes(oldChannelPrincipal);
NullPrincipal::CreateWithInheritedAttributes(oldChannelPrincipal);
}
}

View File

@ -92,7 +92,7 @@
#include "nsIHttpPushListener.h"
#include "nsIX509Cert.h"
#include "ScopedNSSTypes.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "nsIDeprecationWarner.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"

View File

@ -11,7 +11,7 @@
#include "nsContentUtils.h"
#include "nsIHttpHeaderVisitor.h"
#include "nsContentSecurityManager.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "nsServiceManagerUtils.h"
#include "nsIInputStreamChannel.h"
#include "mozilla/DebugOnly.h"
@ -67,7 +67,7 @@ nsViewSourceChannel::Init(nsIURI* uri)
// Until then we follow the principal of least privilege and use
// nullPrincipal as the loadingPrincipal and the least permissive
// securityflag.
nsCOMPtr<nsIPrincipal> nullPrincipal = nsNullPrincipal::Create();
nsCOMPtr<nsIPrincipal> nullPrincipal = NullPrincipal::Create();
rv = pService->NewChannel2(path,
nullptr, // aOriginCharset

View File

@ -36,7 +36,7 @@
#include "nsTreeSanitizer.h"
#include "nsHtml5Module.h"
#include "mozilla/dom/DocumentFragment.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#define XHTML_DIV_TAG "div xmlns=\"http://www.w3.org/1999/xhtml\""
@ -76,7 +76,7 @@ nsParserUtils::Sanitize(const nsAString& aFromStr,
{
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), "about:blank");
nsCOMPtr<nsIPrincipal> principal = nsNullPrincipal::Create();
nsCOMPtr<nsIPrincipal> principal = NullPrincipal::Create();
nsCOMPtr<nsIDOMDocument> domDocument;
nsresult rv = NS_NewDOMDocument(getter_AddRefs(domDocument),
EmptyString(),

View File

@ -27,7 +27,7 @@
#include "nsXPCOMCIDInternal.h"
#include "nsUnicharInputStream.h"
#include "nsContentUtils.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "mozilla/Logging.h"
#include "mozilla/SizePrintfMacros.h"
@ -793,7 +793,7 @@ nsExpatDriver::OpenInputStreamFromExternalDTD(const char16_t* aFPIStr,
}
}
if (!loadingPrincipal) {
loadingPrincipal = nsNullPrincipal::Create();
loadingPrincipal = NullPrincipal::Create();
}
rv = NS_NewChannel(getter_AddRefs(channel),
uri,

View File

@ -6,7 +6,7 @@
#include "nsIInputStream.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
#include "nsIParser.h"
#include "nsParserCIID.h"
#include "nsStreamUtils.h"
@ -496,7 +496,7 @@ nsSAXXMLReader::ParseFromStream(nsIInputStream *aStream,
rv = EnsureBaseURI();
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrincipal> nullPrincipal = nsNullPrincipal::Create();
nsCOMPtr<nsIPrincipal> nullPrincipal = NullPrincipal::Create();
// The following channel is never openend, so it does not matter what
// securityFlags we pass; let's follow the principle of least privilege.

View File

@ -13,7 +13,7 @@
#include "nsParserCIID.h"
#include "nsStringStream.h"
#include "nsNetUtil.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
static NS_DEFINE_CID(kParserCID, NS_PARSER_CID);
@ -113,7 +113,7 @@ nsRDFXMLParser::ParseString(nsIRDFDataSource* aSink, nsIURI* aBaseURI, const nsA
rv = NS_NewCStringInputStream(getter_AddRefs(stream), aString);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIPrincipal> nullPrincipal = nsNullPrincipal::Create();
nsCOMPtr<nsIPrincipal> nullPrincipal = NullPrincipal::Create();
// The following channel is never openend, so it does not matter what
// securityFlags we pass; let's follow the principle of least privilege.

View File

@ -31,7 +31,7 @@
#include "nsILoadInfo.h"
#include "nsIContentPolicy.h"
#include "nsContentUtils.h"
#include "nsNullPrincipal.h"
#include "NullPrincipal.h"
// For large favicons optimization.
#include "imgITools.h"
@ -240,7 +240,7 @@ nsFaviconService::SetAndFetchFaviconForPage(nsIURI* aPageURI,
nsContentUtils::eNECKO_PROPERTIES,
"APIDeprecationWarning",
params, ArrayLength(params));
loadingPrincipal = nsNullPrincipal::Create();
loadingPrincipal = NullPrincipal::Create();
}
NS_ENSURE_TRUE(loadingPrincipal, NS_ERROR_FAILURE);
@ -402,7 +402,7 @@ nsFaviconService::ReplaceFaviconDataFromDataURL(nsIURI* aFaviconURI,
"APIDeprecationWarning",
params, ArrayLength(params));
loadingPrincipal = nsNullPrincipal::Create();
loadingPrincipal = NullPrincipal::Create();
}
NS_ENSURE_TRUE(loadingPrincipal, NS_ERROR_FAILURE);