forked from mirrors/gecko-dev
Bug 1790207 - Forward declaration of mozilla::Result in nsIGlobalObject.h and other cleanup; r=dom-storage-reviewers,jesup
Depends on D162087 Differential Revision: https://phabricator.services.mozilla.com/D162088
This commit is contained in:
parent
7ce6e92fa1
commit
f40ce49b02
13 changed files with 72 additions and 76 deletions
|
|
@ -35,11 +35,12 @@ class nsJSPrincipals : public nsIPrincipal, public JSPrincipals {
|
||||||
uint32_t aTag,
|
uint32_t aTag,
|
||||||
JSPrincipals** aOutPrincipals);
|
JSPrincipals** aOutPrincipals);
|
||||||
|
|
||||||
|
static bool ReadPrincipalInfo(JSStructuredCloneReader* aReader,
|
||||||
|
mozilla::ipc::PrincipalInfo& aInfo);
|
||||||
|
|
||||||
/* For write() implementations of off-main-thread JSPrincipals. */
|
/* For write() implementations of off-main-thread JSPrincipals. */
|
||||||
static bool WritePrincipalInfo(JSStructuredCloneWriter* aWriter,
|
static bool WritePrincipalInfo(JSStructuredCloneWriter* aWriter,
|
||||||
const mozilla::ipc::PrincipalInfo& aInfo);
|
const mozilla::ipc::PrincipalInfo& aInfo);
|
||||||
static bool ReadPrincipalInfo(JSStructuredCloneReader* aReader,
|
|
||||||
mozilla::ipc::PrincipalInfo& aInfo);
|
|
||||||
|
|
||||||
// This class is used on the main thread to specify which principal to use
|
// This class is used on the main thread to specify which principal to use
|
||||||
// when reading principals data that was set on a DOM worker thread.
|
// when reading principals data that was set on a DOM worker thread.
|
||||||
|
|
|
||||||
|
|
@ -6,17 +6,16 @@
|
||||||
|
|
||||||
#include "nsIGlobalObject.h"
|
#include "nsIGlobalObject.h"
|
||||||
#include "mozilla/CycleCollectedJSContext.h"
|
#include "mozilla/CycleCollectedJSContext.h"
|
||||||
|
#include "mozilla/Result.h"
|
||||||
#include "mozilla/StorageAccess.h"
|
#include "mozilla/StorageAccess.h"
|
||||||
#include "mozilla/dom/BlobURLProtocolHandler.h"
|
#include "mozilla/dom/BlobURLProtocolHandler.h"
|
||||||
#include "mozilla/dom/FunctionBinding.h"
|
#include "mozilla/dom/FunctionBinding.h"
|
||||||
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
|
||||||
#include "mozilla/dom/Report.h"
|
#include "mozilla/dom/Report.h"
|
||||||
#include "mozilla/dom/ReportingObserver.h"
|
#include "mozilla/dom/ReportingObserver.h"
|
||||||
#include "mozilla/dom/ServiceWorker.h"
|
#include "mozilla/dom/ServiceWorker.h"
|
||||||
#include "mozilla/dom/ServiceWorkerRegistration.h"
|
#include "mozilla/dom/ServiceWorkerRegistration.h"
|
||||||
#include "mozilla/dom/WorkerPrivate.h"
|
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsJSPrincipals.h"
|
|
||||||
#include "nsThreadUtils.h"
|
#include "nsThreadUtils.h"
|
||||||
#include "nsGlobalWindowInner.h"
|
#include "nsGlobalWindowInner.h"
|
||||||
|
|
||||||
|
|
@ -387,13 +386,13 @@ nsIGlobalObject::GetStorageKey() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsIGlobalObject::IsEqualStorageKey(
|
bool nsIGlobalObject::IsEqualStorageKey(
|
||||||
mozilla::ipc::PrincipalInfo& aPrincipalInfo) {
|
const mozilla::ipc::PrincipalInfo& aPrincipalInfo) {
|
||||||
auto result = GetStorageKey();
|
auto result = GetStorageKey();
|
||||||
mozilla::ipc::PrincipalInfo storagePrincipalInfo;
|
|
||||||
if (result.isErr()) {
|
if (result.isErr()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
storagePrincipalInfo = result.unwrap();
|
|
||||||
|
const auto& storagePrincipalInfo = result.inspect();
|
||||||
|
|
||||||
return mozilla::ipc::NonExpandedPrincipalInfoEquals(aPrincipalInfo,
|
return mozilla::ipc::NonExpandedPrincipalInfoEquals(aPrincipalInfo,
|
||||||
storagePrincipalInfo);
|
storagePrincipalInfo);
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
#include "mozilla/LinkedList.h"
|
#include "mozilla/LinkedList.h"
|
||||||
#include "mozilla/Maybe.h"
|
#include "mozilla/Maybe.h"
|
||||||
#include "mozilla/Result.h"
|
|
||||||
#include "mozilla/dom/ClientInfo.h"
|
#include "mozilla/dom/ClientInfo.h"
|
||||||
#include "mozilla/dom/DispatcherTrait.h"
|
#include "mozilla/dom/DispatcherTrait.h"
|
||||||
#include "mozilla/dom/ServiceWorkerDescriptor.h"
|
#include "mozilla/dom/ServiceWorkerDescriptor.h"
|
||||||
|
|
@ -35,6 +34,8 @@ class nsPIDOMWindowInner;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
class DOMEventTargetHelper;
|
class DOMEventTargetHelper;
|
||||||
|
template <typename V, typename E>
|
||||||
|
class Result;
|
||||||
enum class StorageAccess;
|
enum class StorageAccess;
|
||||||
namespace dom {
|
namespace dom {
|
||||||
class VoidFunction;
|
class VoidFunction;
|
||||||
|
|
@ -48,6 +49,9 @@ class ServiceWorker;
|
||||||
class ServiceWorkerRegistration;
|
class ServiceWorkerRegistration;
|
||||||
class ServiceWorkerRegistrationDescriptor;
|
class ServiceWorkerRegistrationDescriptor;
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
|
namespace ipc {
|
||||||
|
class PrincipalInfo;
|
||||||
|
} // namespace ipc
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
namespace JS::loader {
|
namespace JS::loader {
|
||||||
|
|
@ -258,7 +262,7 @@ class nsIGlobalObject : public nsISupports,
|
||||||
|
|
||||||
virtual mozilla::Result<mozilla::ipc::PrincipalInfo, nsresult>
|
virtual mozilla::Result<mozilla::ipc::PrincipalInfo, nsresult>
|
||||||
GetStorageKey();
|
GetStorageKey();
|
||||||
virtual bool IsEqualStorageKey(mozilla::ipc::PrincipalInfo& aPrincipalInfo);
|
bool IsEqualStorageKey(const mozilla::ipc::PrincipalInfo& aPrincipalInfo);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~nsIGlobalObject();
|
virtual ~nsIGlobalObject();
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,10 @@ namespace mozilla::dom {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool ConstructHandleMetadata(JSContext* aCx, JSStructuredCloneReader* aReader,
|
bool ConstructHandleMetadata(JSContext* aCx, nsIGlobalObject* aGlobal,
|
||||||
const bool aDirectory, nsIGlobalObject* aGlobal,
|
JSStructuredCloneReader* aReader,
|
||||||
fs::FileSystemEntryMetadata& aMetadata,
|
const bool aDirectory,
|
||||||
mozilla::ipc::PrincipalInfo& info) {
|
fs::FileSystemEntryMetadata& aMetadata) {
|
||||||
using namespace mozilla::dom::fs;
|
using namespace mozilla::dom::fs;
|
||||||
|
|
||||||
EntryId entryId;
|
EntryId entryId;
|
||||||
|
|
@ -54,19 +54,20 @@ bool ConstructHandleMetadata(JSContext* aCx, JSStructuredCloneReader* aReader,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
aMetadata = fs::FileSystemEntryMetadata(entryId, name, aDirectory);
|
mozilla::ipc::PrincipalInfo principalInfo;
|
||||||
|
if (!nsJSPrincipals::ReadPrincipalInfo(aReader, principalInfo)) {
|
||||||
if (!nsJSPrincipals::ReadPrincipalInfo(aReader, info)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!aGlobal->IsEqualStorageKey(info)) {
|
|
||||||
|
if (!aGlobal->IsEqualStorageKey(principalInfo)) {
|
||||||
LOG(("Blocking deserialization of %s due to cross-origin",
|
LOG(("Blocking deserialization of %s due to cross-origin",
|
||||||
NS_ConvertUTF16toUTF8(aMetadata.entryName()).get()));
|
NS_ConvertUTF16toUTF8(name).get()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LOG_VERBOSE(
|
|
||||||
("Deserializing %s", NS_ConvertUTF16toUTF8(aMetadata.entryName()).get()));
|
|
||||||
|
|
||||||
|
LOG_VERBOSE(("Deserializing %s", NS_ConvertUTF16toUTF8(name).get()));
|
||||||
|
|
||||||
|
aMetadata = fs::FileSystemEntryMetadata(entryId, name, aDirectory);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -257,8 +258,7 @@ bool FileSystemHandle::WriteStructuredClone(
|
||||||
|
|
||||||
// Needed to make sure the destination nsIGlobalObject is from the same
|
// Needed to make sure the destination nsIGlobalObject is from the same
|
||||||
// origin/principal
|
// origin/principal
|
||||||
QM_TRY_UNWRAP(mozilla::ipc::PrincipalInfo principalInfo,
|
QM_TRY_INSPECT(const auto& principalInfo, mGlobal->GetStorageKey(), false);
|
||||||
mGlobal->GetStorageKey(), false);
|
|
||||||
|
|
||||||
return nsJSPrincipals::WritePrincipalInfo(aWriter, principalInfo);
|
return nsJSPrincipals::WritePrincipalInfo(aWriter, principalInfo);
|
||||||
}
|
}
|
||||||
|
|
@ -269,14 +269,14 @@ already_AddRefed<FileSystemFileHandle> FileSystemHandle::ConstructFileHandle(
|
||||||
JSStructuredCloneReader* aReader) {
|
JSStructuredCloneReader* aReader) {
|
||||||
using namespace mozilla::dom::fs;
|
using namespace mozilla::dom::fs;
|
||||||
|
|
||||||
mozilla::ipc::PrincipalInfo info;
|
|
||||||
FileSystemEntryMetadata metadata;
|
FileSystemEntryMetadata metadata;
|
||||||
if (!ConstructHandleMetadata(aCx, aReader, /* aDirectory */ false, aGlobal,
|
if (!ConstructHandleMetadata(aCx, aGlobal, aReader, /* aDirectory */ false,
|
||||||
metadata, info)) {
|
metadata)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that the actor may not be connected yet
|
// XXX Get the manager from Navigator!
|
||||||
|
// Note that the actor may not exist or may not be connected yet.
|
||||||
auto fileSystemManager = MakeRefPtr<FileSystemManager>(aGlobal, nullptr);
|
auto fileSystemManager = MakeRefPtr<FileSystemManager>(aGlobal, nullptr);
|
||||||
|
|
||||||
RefPtr<FileSystemFileHandle> fsHandle =
|
RefPtr<FileSystemFileHandle> fsHandle =
|
||||||
|
|
@ -292,14 +292,14 @@ FileSystemHandle::ConstructDirectoryHandle(JSContext* aCx,
|
||||||
JSStructuredCloneReader* aReader) {
|
JSStructuredCloneReader* aReader) {
|
||||||
using namespace mozilla::dom::fs;
|
using namespace mozilla::dom::fs;
|
||||||
|
|
||||||
mozilla::ipc::PrincipalInfo info;
|
|
||||||
FileSystemEntryMetadata metadata;
|
FileSystemEntryMetadata metadata;
|
||||||
if (!ConstructHandleMetadata(aCx, aReader, /* aDirectory */ true, aGlobal,
|
if (!ConstructHandleMetadata(aCx, aGlobal, aReader, /* aDirectory */ true,
|
||||||
metadata, info)) {
|
metadata)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
// Note that the actor may not be connected yet
|
|
||||||
// XXX Get the manager from Navigator!
|
// XXX Get the manager from Navigator!
|
||||||
|
// Note that the actor may not exist or may not be connected yet.
|
||||||
auto fileSystemManager = MakeRefPtr<FileSystemManager>(aGlobal, nullptr);
|
auto fileSystemManager = MakeRefPtr<FileSystemManager>(aGlobal, nullptr);
|
||||||
|
|
||||||
RefPtr<FileSystemDirectoryHandle> fsHandle =
|
RefPtr<FileSystemDirectoryHandle> fsHandle =
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,8 @@
|
||||||
#include "mozilla/dom/FileSystemManagerChild.h"
|
#include "mozilla/dom/FileSystemManagerChild.h"
|
||||||
#include "mozilla/dom/Promise.h"
|
#include "mozilla/dom/Promise.h"
|
||||||
#include "mozilla/dom/StorageManager.h"
|
#include "mozilla/dom/StorageManager.h"
|
||||||
#include "mozilla/dom/WorkerPrivate.h"
|
|
||||||
#include "mozilla/dom/quota/QuotaCommon.h"
|
#include "mozilla/dom/quota/QuotaCommon.h"
|
||||||
#include "mozilla/dom/quota/ResultExtensions.h"
|
#include "mozilla/dom/quota/ResultExtensions.h"
|
||||||
#include "mozilla/ipc/BackgroundUtils.h"
|
|
||||||
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
|
||||||
#include "nsIScriptObjectPrincipal.h"
|
|
||||||
|
|
||||||
namespace mozilla::dom {
|
namespace mozilla::dom {
|
||||||
|
|
||||||
|
|
@ -67,9 +63,8 @@ void FileSystemManager::BeginRequest(
|
||||||
|
|
||||||
MOZ_ASSERT(mGlobal);
|
MOZ_ASSERT(mGlobal);
|
||||||
|
|
||||||
QM_TRY_UNWRAP(mozilla::ipc::PrincipalInfo principalInfo,
|
QM_TRY_INSPECT(const auto& principalInfo, mGlobal->GetStorageKey(), QM_VOID,
|
||||||
mGlobal->GetStorageKey(), QM_VOID,
|
[&aFailure](nsresult rv) { aFailure(rv); });
|
||||||
[aFailure](nsresult rv) { aFailure(rv); });
|
|
||||||
|
|
||||||
mBackgroundRequestHandler->CreateFileSystemManagerChild(principalInfo)
|
mBackgroundRequestHandler->CreateFileSystemManagerChild(principalInfo)
|
||||||
->Then(
|
->Then(
|
||||||
|
|
|
||||||
|
|
@ -335,7 +335,7 @@ mozilla::ipc::RejectCallback GetRejectCallback(
|
||||||
}
|
}
|
||||||
|
|
||||||
struct BeginRequestFailureCallback {
|
struct BeginRequestFailureCallback {
|
||||||
BeginRequestFailureCallback(RefPtr<Promise> aPromise)
|
explicit BeginRequestFailureCallback(RefPtr<Promise> aPromise)
|
||||||
: mPromise(std::move(aPromise)) {}
|
: mPromise(std::move(aPromise)) {}
|
||||||
|
|
||||||
void operator()(nsresult aRv) const {
|
void operator()(nsresult aRv) const {
|
||||||
|
|
|
||||||
|
|
@ -134,12 +134,11 @@ Result<R, nsresult> ToResultGet(const Func& aFunc, Args&&... aArgs) {
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
// TODO: Maybe move this to mfbt/ResultExtensions.h
|
// TODO: Maybe move this to mfbt/ResultExtensions.h
|
||||||
#define MOZ_TO_RESULT(expr) ::mozilla::ToResult(expr)
|
#define MOZ_TO_RESULT(expr) ToResult(expr)
|
||||||
|
|
||||||
#define QM_TO_RESULT(expr) ::mozilla::ToResult<QMResult>(expr)
|
#define QM_TO_RESULT(expr) ToResult<QMResult>(expr)
|
||||||
|
|
||||||
#define QM_TO_RESULT_TRANSFORM(value) \
|
#define QM_TO_RESULT_TRANSFORM(value) ToResultTransform<QMResult>(value)
|
||||||
::mozilla::ToResultTransform<QMResult>(value)
|
|
||||||
|
|
||||||
#define MOZ_TO_RESULT_GET_TYPED(resultType, ...) \
|
#define MOZ_TO_RESULT_GET_TYPED(resultType, ...) \
|
||||||
::mozilla::ToResultGet<MOZ_REMOVE_PAREN(resultType)>(__VA_ARGS__)
|
::mozilla::ToResultGet<MOZ_REMOVE_PAREN(resultType)>(__VA_ARGS__)
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,6 @@ if CONFIG["OS_TARGET"] != "Android":
|
||||||
"TestUnexpectedPrivilegedLoads.cpp",
|
"TestUnexpectedPrivilegedLoads.cpp",
|
||||||
]
|
]
|
||||||
|
|
||||||
include("/ipc/chromium/chromium-config.mozbuild")
|
|
||||||
|
|
||||||
FINAL_LIBRARY = "xul-gtest"
|
FINAL_LIBRARY = "xul-gtest"
|
||||||
|
|
||||||
LOCAL_INCLUDES += [
|
LOCAL_INCLUDES += [
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@
|
||||||
#include "mozilla/dom/ImageBitmapSource.h"
|
#include "mozilla/dom/ImageBitmapSource.h"
|
||||||
#include "mozilla/dom/MessagePortBinding.h"
|
#include "mozilla/dom/MessagePortBinding.h"
|
||||||
#include "mozilla/ipc/PBackgroundChild.h"
|
#include "mozilla/ipc/PBackgroundChild.h"
|
||||||
|
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
||||||
#include "mozilla/dom/Performance.h"
|
#include "mozilla/dom/Performance.h"
|
||||||
#include "mozilla/dom/Promise.h"
|
#include "mozilla/dom/Promise.h"
|
||||||
#include "mozilla/dom/PromiseWorkerProxy.h"
|
#include "mozilla/dom/PromiseWorkerProxy.h"
|
||||||
|
|
@ -296,6 +297,24 @@ Maybe<ServiceWorkerDescriptor> WorkerGlobalScopeBase::GetController() const {
|
||||||
return mClientSource->GetController();
|
return mClientSource->GetController();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mozilla::Result<mozilla::ipc::PrincipalInfo, nsresult>
|
||||||
|
WorkerGlobalScopeBase::GetStorageKey() {
|
||||||
|
AssertIsOnWorkerThread();
|
||||||
|
|
||||||
|
const mozilla::ipc::PrincipalInfo& principalInfo =
|
||||||
|
mWorkerPrivate->GetEffectiveStoragePrincipalInfo();
|
||||||
|
|
||||||
|
// Block expanded and null principals, let content and system through.
|
||||||
|
if (principalInfo.type() !=
|
||||||
|
mozilla::ipc::PrincipalInfo::TContentPrincipalInfo &&
|
||||||
|
principalInfo.type() !=
|
||||||
|
mozilla::ipc::PrincipalInfo::TSystemPrincipalInfo) {
|
||||||
|
return Err(NS_ERROR_DOM_SECURITY_ERR);
|
||||||
|
}
|
||||||
|
|
||||||
|
return principalInfo;
|
||||||
|
}
|
||||||
|
|
||||||
void WorkerGlobalScopeBase::Control(
|
void WorkerGlobalScopeBase::Control(
|
||||||
const ServiceWorkerDescriptor& aServiceWorker) {
|
const ServiceWorkerDescriptor& aServiceWorker) {
|
||||||
AssertIsOnWorkerThread();
|
AssertIsOnWorkerThread();
|
||||||
|
|
@ -313,26 +332,6 @@ void WorkerGlobalScopeBase::Control(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::Result<mozilla::ipc::PrincipalInfo, nsresult>
|
|
||||||
WorkerGlobalScopeBase::GetStorageKey() {
|
|
||||||
using mozilla::ipc::PrincipalInfo;
|
|
||||||
|
|
||||||
MOZ_ASSERT(!NS_IsMainThread());
|
|
||||||
|
|
||||||
const PrincipalInfo& principalInfo =
|
|
||||||
mWorkerPrivate->GetEffectiveStoragePrincipalInfo();
|
|
||||||
|
|
||||||
// Block expanded and null principals, let content and system through.
|
|
||||||
if (principalInfo.type() !=
|
|
||||||
mozilla::ipc::PrincipalInfo::TContentPrincipalInfo &&
|
|
||||||
principalInfo.type() !=
|
|
||||||
mozilla::ipc::PrincipalInfo::TSystemPrincipalInfo) {
|
|
||||||
return Err(NS_ERROR_DOM_SECURITY_ERR);
|
|
||||||
}
|
|
||||||
|
|
||||||
return principalInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult WorkerGlobalScopeBase::Dispatch(
|
nsresult WorkerGlobalScopeBase::Dispatch(
|
||||||
TaskCategory aCategory, already_AddRefed<nsIRunnable>&& aRunnable) {
|
TaskCategory aCategory, already_AddRefed<nsIRunnable>&& aRunnable) {
|
||||||
return EventTargetFor(aCategory)->Dispatch(std::move(aRunnable),
|
return EventTargetFor(aCategory)->Dispatch(std::move(aRunnable),
|
||||||
|
|
|
||||||
|
|
@ -128,10 +128,9 @@ class WorkerGlobalScopeBase : public DOMEventTargetHelper,
|
||||||
|
|
||||||
Maybe<ServiceWorkerDescriptor> GetController() const final;
|
Maybe<ServiceWorkerDescriptor> GetController() const final;
|
||||||
|
|
||||||
virtual void Control(const ServiceWorkerDescriptor& aServiceWorker);
|
mozilla::Result<mozilla::ipc::PrincipalInfo, nsresult> GetStorageKey() final;
|
||||||
|
|
||||||
virtual mozilla::Result<mozilla::ipc::PrincipalInfo, nsresult> GetStorageKey()
|
virtual void Control(const ServiceWorkerDescriptor& aServiceWorker);
|
||||||
override;
|
|
||||||
|
|
||||||
// DispatcherTrait implementation
|
// DispatcherTrait implementation
|
||||||
nsresult Dispatch(TaskCategory aCategory,
|
nsresult Dispatch(TaskCategory aCategory,
|
||||||
|
|
|
||||||
|
|
@ -174,23 +174,23 @@ bool NonExpandedPrincipalInfoEquals(const PrincipalInfo& aLeft,
|
||||||
|
|
||||||
const ContentPrincipalInfo& leftContent = aLeft.get_ContentPrincipalInfo();
|
const ContentPrincipalInfo& leftContent = aLeft.get_ContentPrincipalInfo();
|
||||||
const ContentPrincipalInfo& rightContent = aRight.get_ContentPrincipalInfo();
|
const ContentPrincipalInfo& rightContent = aRight.get_ContentPrincipalInfo();
|
||||||
|
|
||||||
switch (aLeft.type()) {
|
switch (aLeft.type()) {
|
||||||
case PrincipalInfo::TContentPrincipalInfo: {
|
case PrincipalInfo::TContentPrincipalInfo:
|
||||||
return leftContent.attrs() == rightContent.attrs() &&
|
return leftContent.attrs() == rightContent.attrs() &&
|
||||||
leftContent.originNoSuffix() == rightContent.originNoSuffix();
|
leftContent.originNoSuffix() == rightContent.originNoSuffix();
|
||||||
}
|
|
||||||
case PrincipalInfo::TSystemPrincipalInfo: {
|
case PrincipalInfo::TSystemPrincipalInfo:
|
||||||
// system principal always matches
|
// system principal always matches
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
case PrincipalInfo::TNullPrincipalInfo: {
|
case PrincipalInfo::TNullPrincipalInfo:
|
||||||
return leftContent.attrs() == rightContent.attrs() &&
|
return leftContent.attrs() == rightContent.attrs() &&
|
||||||
leftContent.spec() == rightContent.spec();
|
leftContent.spec() == rightContent.spec();
|
||||||
}
|
|
||||||
default: {
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Clients (windows/workers) should never have an expanded principal type.
|
// Clients (windows/workers) should never have an expanded principal type.
|
||||||
MOZ_DIAGNOSTIC_ASSERT(false, "unexpected principal type!");
|
MOZ_DIAGNOSTIC_ASSERT(false, "unexpected principal type!");
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
#include "xpc_make_class.h"
|
#include "xpc_make_class.h"
|
||||||
#include "XPCWrapper.h"
|
#include "XPCWrapper.h"
|
||||||
#include "Crypto.h"
|
#include "Crypto.h"
|
||||||
|
#include "mozilla/Result.h"
|
||||||
#include "mozilla/dom/AbortControllerBinding.h"
|
#include "mozilla/dom/AbortControllerBinding.h"
|
||||||
#include "mozilla/dom/AutoEntryScript.h"
|
#include "mozilla/dom/AutoEntryScript.h"
|
||||||
#include "mozilla/dom/BindingCallContext.h"
|
#include "mozilla/dom/BindingCallContext.h"
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "BackstagePass.h"
|
#include "BackstagePass.h"
|
||||||
|
#include "mozilla/Result.h"
|
||||||
#include "mozilla/dom/BindingUtils.h"
|
#include "mozilla/dom/BindingUtils.h"
|
||||||
#include "mozilla/dom/WebIDLGlobalNameHash.h"
|
#include "mozilla/dom/WebIDLGlobalNameHash.h"
|
||||||
#include "mozilla/dom/IndexedDatabaseManager.h"
|
#include "mozilla/dom/IndexedDatabaseManager.h"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue