Bug 1682285 - Part 1: Split internal and external load flags, r=kmag,necko-reviewers,valentin

Differential Revision: https://phabricator.services.mozilla.com/D103364
This commit is contained in:
Nika Layzell 2021-01-29 22:06:16 +00:00
Родитель dc191572ea
Коммит 29c2d4d113
11 изменённых файлов: 116 добавлений и 60 удалений

Просмотреть файл

@ -752,6 +752,10 @@ nsresult nsDocShell::LoadURI(nsDocShellLoadState* aLoadState,
bool aSetNavigating,
bool aContinueHandlingSubframeHistory) {
MOZ_ASSERT(aLoadState, "Must have a valid load state!");
// NOTE: This comparison between what appears to be internal/external load
// flags is intentional, as it's ensuring that the caller isn't using any of
// the flags reserved for implementations by the `nsIWebNavigation` interface.
// In the future, this check may be dropped.
MOZ_ASSERT(
(aLoadState->LoadFlags() & INTERNAL_LOAD_FLAGS_LOADURI_SETUP_FLAGS) == 0,
"Should not have these flags set");
@ -771,7 +775,7 @@ nsresult nsDocShell::LoadURI(nsDocShellLoadState* aLoadState,
}
PopupBlocker::PopupControlState popupState;
if (aLoadState->LoadFlags() & LOAD_FLAGS_ALLOW_POPUPS) {
if (aLoadState->HasLoadFlags(LOAD_FLAGS_ALLOW_POPUPS)) {
popupState = PopupBlocker::openAllowed;
} else {
popupState = PopupBlocker::openOverridden;
@ -793,9 +797,9 @@ nsresult nsDocShell::LoadURI(nsDocShellLoadState* aLoadState,
}
nsLoadFlags defaultLoadFlags = mBrowsingContext->GetDefaultLoadFlags();
if (aLoadState->LoadFlags() & LOAD_FLAGS_FORCE_TRR) {
if (aLoadState->HasLoadFlags(LOAD_FLAGS_FORCE_TRR)) {
defaultLoadFlags |= nsIRequest::LOAD_TRR_ONLY_MODE;
} else if (aLoadState->LoadFlags() & LOAD_FLAGS_DISABLE_TRR) {
} else if (aLoadState->HasLoadFlags(LOAD_FLAGS_DISABLE_TRR)) {
defaultLoadFlags |= nsIRequest::LOAD_TRR_DISABLED_MODE;
}
@ -4249,7 +4253,7 @@ nsresult nsDocShell::ReloadDocument(nsDocShell* aDocShell, Document* aDocument,
loadState->SetTriggeringSandboxFlags(triggeringSandboxFlags);
loadState->SetPrincipalToInherit(triggeringPrincipal);
loadState->SetCsp(csp);
loadState->SetLoadFlags(flags);
loadState->SetInternalLoadFlags(flags);
loadState->SetTypeHint(NS_ConvertUTF16toUTF8(contentTypeHint));
loadState->SetLoadType(aLoadType);
loadState->SetFirstParty(true);
@ -8447,8 +8451,8 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) {
// have to be careful to not apply that to the noreferrer case. See bug
// 1358469.
bool allowNamedTarget =
!aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_NO_OPENER) ||
aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER);
!aLoadState->HasInternalLoadFlags(INTERNAL_LOAD_FLAGS_NO_OPENER) ||
aLoadState->HasInternalLoadFlags(INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER);
if (allowNamedTarget ||
aLoadState->Target().LowerCaseEqualsLiteral("_self") ||
aLoadState->Target().LowerCaseEqualsLiteral("_parent") ||
@ -8522,7 +8526,7 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) {
// We've already done our owner-inheriting. Mask out that bit, so we
// don't try inheriting an owner from the target window if we came up
// with a null owner above.
aLoadState->UnsetLoadFlag(INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL);
aLoadState->UnsetInternalLoadFlag(INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL);
if (!targetContext) {
// If the docshell's document is sandboxed, only open a new window
@ -8547,14 +8551,15 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) {
// If we are a noopener load, we just hand the whole thing over to our
// window.
if (aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_NO_OPENER)) {
if (aLoadState->HasInternalLoadFlags(INTERNAL_LOAD_FLAGS_NO_OPENER)) {
// Various asserts that we know to hold because NO_OPENER loads can only
// happen for links.
MOZ_ASSERT(!aLoadState->LoadReplace());
MOZ_ASSERT(aLoadState->PrincipalToInherit() ==
aLoadState->TriggeringPrincipal());
MOZ_ASSERT(aLoadState->LoadFlags() == INTERNAL_LOAD_FLAGS_NO_OPENER ||
aLoadState->LoadFlags() ==
MOZ_ASSERT(aLoadState->InternalLoadFlags() ==
INTERNAL_LOAD_FLAGS_NO_OPENER ||
aLoadState->InternalLoadFlags() ==
(INTERNAL_LOAD_FLAGS_NO_OPENER |
INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER));
MOZ_ASSERT(!aLoadState->PostDataStream());
@ -8587,14 +8592,14 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) {
loadState->SetTriggeringSandboxFlags(
aLoadState->TriggeringSandboxFlags());
loadState->SetCsp(aLoadState->Csp());
loadState->SetInheritPrincipal(
aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL));
loadState->SetInheritPrincipal(aLoadState->HasInternalLoadFlags(
INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL));
// Explicit principal because we do not want any guesses as to what the
// principal to inherit is: it should be aTriggeringPrincipal.
loadState->SetPrincipalIsExplicit(true);
loadState->SetLoadType(LOAD_LINK);
loadState->SetForceAllowDataURI(
aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI));
loadState->SetForceAllowDataURI(aLoadState->HasInternalLoadFlags(
INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI));
loadState->SetHasValidUserGestureActivation(
aLoadState->HasValidUserGestureActivation());
@ -8622,7 +8627,7 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) {
if (piNewWin) {
RefPtr<Document> newDoc = piNewWin->GetExtantDoc();
if (!newDoc || newDoc->IsInitialDocument()) {
aLoadState->SetLoadFlag(INTERNAL_LOAD_FLAGS_FIRST_LOAD);
aLoadState->SetInternalLoadFlag(INTERNAL_LOAD_FLAGS_FIRST_LOAD);
}
}
@ -9225,7 +9230,8 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
if (aLoadState->LoadType() != LOAD_NORMAL_EXTERNAL &&
!aLoadState->PrincipalToInherit() &&
(aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL)) &&
(aLoadState->HasInternalLoadFlags(
INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL)) &&
NS_SUCCEEDED(nsContentUtils::URIInheritsSecurityContext(
aLoadState->URI(), &inherits)) &&
inherits) {
@ -9265,8 +9271,8 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
aLoadState->SetLoadType(LOAD_NORMAL);
}
mAllowKeywordFixup =
aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP);
mAllowKeywordFixup = aLoadState->HasInternalLoadFlags(
INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP);
mURIResultedInDocument = false; // reset the clock...
// See if this is actually a load between two history entries for the same
@ -9490,6 +9496,8 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
nsCOMPtr<nsIChannel> chan(do_QueryInterface(req));
UnblockEmbedderLoadEventForFailure();
if (DisplayLoadError(rv, aLoadState->URI(), nullptr, chan) &&
// FIXME: At this point code was using internal load flags, but checking
// non-internal load flags?
aLoadState->HasLoadFlags(LOAD_FLAGS_ERROR_LOAD_CHANGES_RV)) {
return NS_ERROR_LOAD_SHOWED_ERRORPAGE;
}
@ -9670,7 +9678,8 @@ nsIPrincipal* nsDocShell::GetInheritedPrincipal(
MOZ_ASSERT(aLoadInfo);
nsString srcdoc = VoidString();
bool isSrcdoc = aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_IS_SRCDOC);
bool isSrcdoc =
aLoadState->HasInternalLoadFlags(INTERNAL_LOAD_FLAGS_IS_SRCDOC);
if (isSrcdoc) {
srcdoc = aLoadState->SrcdocData();
}
@ -9680,10 +9689,10 @@ nsIPrincipal* nsDocShell::GetInheritedPrincipal(
}
aLoadInfo->SetLoadTriggeredFromExternal(aLoadState->LoadType() ==
LOAD_NORMAL_EXTERNAL);
aLoadInfo->SetForceAllowDataURI(
aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI));
aLoadInfo->SetForceAllowDataURI(aLoadState->HasInternalLoadFlags(
INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI));
aLoadInfo->SetOriginalFrameSrcLoad(
aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_ORIGINAL_FRAME_SRC));
aLoadState->HasInternalLoadFlags(INTERNAL_LOAD_FLAGS_ORIGINAL_FRAME_SRC));
bool inheritAttrs = false;
if (aLoadState->PrincipalToInherit()) {
@ -9776,7 +9785,8 @@ nsIPrincipal* nsDocShell::GetInheritedPrincipal(
referrerInfo->GetOriginalReferrer(getter_AddRefs(referrer));
}
if (httpChannelInternal) {
if (aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_FORCE_ALLOW_COOKIES)) {
if (aLoadState->HasInternalLoadFlags(
INTERNAL_LOAD_FLAGS_FORCE_ALLOW_COOKIES)) {
aRv = httpChannelInternal->SetThirdPartyFlags(
nsIHttpChannelInternal::THIRD_PARTY_FORCE_ALLOW);
MOZ_ASSERT(NS_SUCCEEDED(aRv));
@ -9842,7 +9852,7 @@ nsIPrincipal* nsDocShell::GetInheritedPrincipal(
// Currently only http and ftp channels support this.
props->SetPropertyAsInterface(u"docshell.internalReferrer"_ns, referrer);
if (aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_FIRST_LOAD)) {
if (aLoadState->HasInternalLoadFlags(INTERNAL_LOAD_FLAGS_FIRST_LOAD)) {
props->SetPropertyAsBool(u"docshell.newWindowTarget"_ns, true);
}
}
@ -10226,7 +10236,8 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState,
bool inheritPrincipal = false;
if (aLoadState->PrincipalToInherit()) {
bool isSrcdoc = aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_IS_SRCDOC);
bool isSrcdoc =
aLoadState->HasInternalLoadFlags(INTERNAL_LOAD_FLAGS_IS_SRCDOC);
bool inheritAttrs = nsContentUtils::ChannelShouldInheritPrincipal(
aLoadState->PrincipalToInherit(), aLoadState->URI(),
true, // aInheritForAboutBlank
@ -10276,6 +10287,8 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState,
// or also the load originates from external, then we pass that information on
// to the loadinfo, which allows e.g. setting Sec-Fetch-User request headers.
if (aLoadState->HasValidUserGestureActivation() ||
// FIXME: This code was reading an external load flag value from the
// internal load flag state!
aLoadState->HasLoadFlags(LOAD_FLAGS_FROM_EXTERNAL)) {
loadInfo->SetHasValidUserGestureActivation(true);
}
@ -12784,7 +12797,7 @@ nsresult nsDocShell::OnLinkClickSync(nsIContent* aContent,
aLoadState->SetTriggeringSandboxFlags(triggeringSandboxFlags);
aLoadState->SetReferrerInfo(referrerInfo);
aLoadState->SetLoadFlags(flags);
aLoadState->SetInternalLoadFlags(flags);
aLoadState->SetTypeHint(NS_ConvertUTF16toUTF8(typeHint));
aLoadState->SetLoadType(loadType);
aLoadState->SetSourceBrowsingContext(mBrowsingContext);

Просмотреть файл

@ -55,6 +55,7 @@ nsDocShellLoadState::nsDocShellLoadState(
mTarget = aLoadState.Target();
mTargetBrowsingContext = aLoadState.TargetBrowsingContext();
mLoadFlags = aLoadState.LoadFlags();
mInternalLoadFlags = aLoadState.InternalLoadFlags();
mFirstParty = aLoadState.FirstParty();
mHasValidUserGestureActivation = aLoadState.HasValidUserGestureActivation();
mTypeHint = aLoadState.TypeHint();
@ -112,6 +113,7 @@ nsDocShellLoadState::nsDocShellLoadState(const nsDocShellLoadState& aOther)
mSourceBrowsingContext(aOther.mSourceBrowsingContext),
mBaseURI(aOther.mBaseURI),
mLoadFlags(aOther.mLoadFlags),
mInternalLoadFlags(aOther.mInternalLoadFlags),
mFirstParty(aOther.mFirstParty),
mHasValidUserGestureActivation(aOther.mHasValidUserGestureActivation),
mTypeHint(aOther.mTypeHint),
@ -144,6 +146,7 @@ nsDocShellLoadState::nsDocShellLoadState(nsIURI* aURI, uint64_t aLoadIdentifier)
mTarget(),
mSrcdocData(VoidString()),
mLoadFlags(0),
mInternalLoadFlags(0),
mFirstParty(false),
mHasValidUserGestureActivation(false),
mTypeHint(VoidCString()),
@ -634,6 +637,26 @@ bool nsDocShellLoadState::HasLoadFlags(uint32_t aFlags) {
return (mLoadFlags & aFlags) == aFlags;
}
uint32_t nsDocShellLoadState::InternalLoadFlags() const {
return mInternalLoadFlags;
}
void nsDocShellLoadState::SetInternalLoadFlags(uint32_t aLoadFlags) {
mInternalLoadFlags = aLoadFlags;
}
void nsDocShellLoadState::SetInternalLoadFlag(uint32_t aFlag) {
mInternalLoadFlags |= aFlag;
}
void nsDocShellLoadState::UnsetInternalLoadFlag(uint32_t aFlag) {
mInternalLoadFlags &= ~aFlag;
}
bool nsDocShellLoadState::HasInternalLoadFlags(uint32_t aFlags) {
return (mInternalLoadFlags & aFlags) == aFlags;
}
bool nsDocShellLoadState::FirstParty() const { return mFirstParty; }
void nsDocShellLoadState::SetFirstParty(bool aFirstParty) {
@ -760,49 +783,48 @@ nsresult nsDocShellLoadState::SetupTriggeringPrincipal(
}
void nsDocShellLoadState::CalculateLoadURIFlags() {
uint32_t oldLoadFlags = mLoadFlags;
mLoadFlags = 0;
if (mInheritPrincipal) {
MOZ_ASSERT(
!mPrincipalToInherit || !mPrincipalToInherit->IsSystemPrincipal(),
"Should not inherit SystemPrincipal");
mLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL;
mInternalLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL;
}
if (mReferrerInfo && !mReferrerInfo->GetSendReferrer()) {
mLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER;
mInternalLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER;
}
if (oldLoadFlags & nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP) {
mLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
if (mLoadFlags & nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP) {
mInternalLoadFlags |=
nsDocShell::INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
}
if (oldLoadFlags & nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD) {
mLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_FIRST_LOAD;
if (mLoadFlags & nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD) {
mInternalLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_FIRST_LOAD;
}
if (oldLoadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_CLASSIFIER) {
mLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER;
if (mLoadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_CLASSIFIER) {
mInternalLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER;
}
if (oldLoadFlags & nsIWebNavigation::LOAD_FLAGS_FORCE_ALLOW_COOKIES) {
mLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_FORCE_ALLOW_COOKIES;
if (mLoadFlags & nsIWebNavigation::LOAD_FLAGS_FORCE_ALLOW_COOKIES) {
mInternalLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_FORCE_ALLOW_COOKIES;
}
if (oldLoadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_LOAD_URI_DELEGATE) {
mLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_BYPASS_LOAD_URI_DELEGATE;
if (mLoadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_LOAD_URI_DELEGATE) {
mInternalLoadFlags |=
nsDocShell::INTERNAL_LOAD_FLAGS_BYPASS_LOAD_URI_DELEGATE;
}
if (!mSrcdocData.IsVoid()) {
mLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_IS_SRCDOC;
mInternalLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_IS_SRCDOC;
}
if (mForceAllowDataURI) {
mLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
mInternalLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
}
if (mOriginalFrameSrc) {
mLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_ORIGINAL_FRAME_SRC;
mInternalLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_ORIGINAL_FRAME_SRC;
}
}
@ -894,7 +916,7 @@ nsLoadFlags nsDocShellLoadState::CalculateChannelLoadFlags(
break;
}
if (HasLoadFlags(nsDocShell::INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER)) {
if (HasInternalLoadFlags(nsDocShell::INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER)) {
loadFlags |= nsIChannel::LOAD_BYPASS_URL_CLASSIFIER;
}
@ -922,6 +944,7 @@ DocShellLoadStateInit nsDocShellLoadState::Serialize() {
loadState.Target() = mTarget;
loadState.TargetBrowsingContext() = mTargetBrowsingContext;
loadState.LoadFlags() = mLoadFlags;
loadState.InternalLoadFlags() = mInternalLoadFlags;
loadState.FirstParty() = mFirstParty;
loadState.HasValidUserGestureActivation() = mHasValidUserGestureActivation;
loadState.TypeHint() = mTypeHint;

Просмотреть файл

@ -213,6 +213,16 @@ class nsDocShellLoadState final {
bool HasLoadFlags(uint32_t aFlag);
uint32_t InternalLoadFlags() const;
void SetInternalLoadFlags(uint32_t aFlags);
void SetInternalLoadFlag(uint32_t aFlag);
void UnsetInternalLoadFlag(uint32_t aFlag);
bool HasInternalLoadFlags(uint32_t aFlag);
bool FirstParty() const;
void SetFirstParty(bool aFirstParty);
@ -434,6 +444,9 @@ class nsDocShellLoadState final {
// Set of Load Flags, taken from nsDocShellLoadTypes.h and nsIWebNavigation
uint32_t mLoadFlags;
// Set of internal load flags
uint32_t mInternalLoadFlags;
// Is this a First Party Load?
bool mFirstParty;

Просмотреть файл

@ -226,7 +226,7 @@ void SessionHistoryInfo::FillLoadInfo(nsDocShellLoadState& aLoadState) const {
}
aLoadState.SetSrcdocData(srcdoc);
aLoadState.SetBaseURI(baseURI);
aLoadState.SetLoadFlags(flags);
aLoadState.SetInternalLoadFlags(flags);
aLoadState.SetFirstParty(true);
}

Просмотреть файл

@ -915,7 +915,7 @@ nsSHEntry::CreateLoadInfo(nsDocShellLoadState** aLoadState) {
}
loadState->SetSrcdocData(srcdoc);
loadState->SetBaseURI(baseURI);
loadState->SetLoadFlags(flags);
loadState->SetInternalLoadFlags(flags);
loadState->SetFirstParty(true);
loadState->SetSHEntry(this);

Просмотреть файл

@ -3417,7 +3417,7 @@ mozilla::ipc::IPCResult ContentChild::RecvCrossProcessRedirect(
}
nsCOMPtr<nsIChannel> newChannel;
MOZ_ASSERT((aArgs.loadStateLoadFlags() &
MOZ_ASSERT((aArgs.loadStateInternalLoadFlags() &
nsDocShell::InternalLoad::INTERNAL_LOAD_FLAGS_IS_SRCDOC) ||
aArgs.srcdocData().IsVoid());
rv = nsDocShell::CreateRealChannelForDocument(
@ -3491,7 +3491,8 @@ mozilla::ipc::IPCResult ContentChild::RecvCrossProcessRedirect(
if (NS_WARN_IF(NS_FAILED(rv))) {
return IPC_OK();
}
loadState->SetLoadFlags(aArgs.loadStateLoadFlags());
loadState->SetLoadFlags(aArgs.loadStateExternalLoadFlags());
loadState->SetInternalLoadFlags(aArgs.loadStateInternalLoadFlags());
if (IsValidLoadType(aArgs.loadStateLoadType())) {
loadState->SetLoadType(aArgs.loadStateLoadType());
}

Просмотреть файл

@ -256,6 +256,7 @@ struct DocShellLoadStateInit
nsString Target;
nsIURI BaseURI;
uint32_t LoadFlags;
uint32_t InternalLoadFlags;
bool FirstParty;
bool HasValidUserGestureActivation;
nsCString TypeHint;

Просмотреть файл

@ -207,7 +207,7 @@ IPCResult DocumentChannelChild::RecvRedirectToRealChannel(
mRedirectResolver = std::move(aResolve);
nsCOMPtr<nsIChannel> newChannel;
MOZ_ASSERT((aArgs.loadStateLoadFlags() &
MOZ_ASSERT((aArgs.loadStateInternalLoadFlags() &
nsDocShell::InternalLoad::INTERNAL_LOAD_FLAGS_IS_SRCDOC) ||
aArgs.srcdocData().IsVoid());
nsresult rv = nsDocShell::CreateRealChannelForDocument(

Просмотреть файл

@ -91,8 +91,8 @@ static auto SecurityFlagsForLoadInfo(nsDocShellLoadState* aLoadState)
}
if (aLoadState->PrincipalToInherit()) {
bool isSrcdoc =
aLoadState->HasLoadFlags(nsDocShell::INTERNAL_LOAD_FLAGS_IS_SRCDOC);
bool isSrcdoc = aLoadState->HasInternalLoadFlags(
nsDocShell::INTERNAL_LOAD_FLAGS_IS_SRCDOC);
bool inheritAttrs = nsContentUtils::ChannelShouldInheritPrincipal(
aLoadState->PrincipalToInherit(), aLoadState->URI(),
true, // aInheritForAboutBlank
@ -569,7 +569,7 @@ auto DocumentLoadListener::Open(nsDocShellLoadState* aLoadState,
#ifdef ANDROID
RefPtr<MozPromise<bool, bool, false>> promise;
if (documentContext && aLoadState->LoadType() != LOAD_ERROR_PAGE &&
!(aLoadState->HasLoadFlags(
!(aLoadState->HasInternalLoadFlags(
nsDocShell::INTERNAL_LOAD_FLAGS_BYPASS_LOAD_URI_DELEGATE)) &&
!(aLoadState->LoadType() & LOAD_HISTORY)) {
nsCOMPtr<nsIWidget> widget =
@ -579,7 +579,7 @@ auto DocumentLoadListener::Open(nsDocShellLoadState* aLoadState,
if (window) {
promise = window->OnLoadRequest(
aLoadState->URI(), nsIBrowserDOMWindow::OPEN_CURRENTWINDOW,
aLoadState->LoadFlags(), aLoadState->TriggeringPrincipal(),
aLoadState->InternalLoadFlags(), aLoadState->TriggeringPrincipal(),
aLoadState->HasValidUserGestureActivation(),
documentContext->IsTopContent());
}
@ -626,7 +626,8 @@ auto DocumentLoadListener::Open(nsDocShellLoadState* aLoadState,
mOtherPid = aPid;
mChannelCreationURI = aLoadState->URI();
mLoadStateLoadFlags = aLoadState->LoadFlags();
mLoadStateExternalLoadFlags = aLoadState->LoadFlags();
mLoadStateInternalLoadFlags = aLoadState->InternalLoadFlags();
mLoadStateLoadType = aLoadState->LoadType();
mTiming = aTiming;
mSrcdocData = aLoadState->SrcdocData();
@ -1341,7 +1342,8 @@ void DocumentLoadListener::SerializeRedirectData(
aArgs.properties() = do_QueryObject(mChannel);
aArgs.srcdocData() = mSrcdocData;
aArgs.baseUri() = mBaseURI;
aArgs.loadStateLoadFlags() = mLoadStateLoadFlags;
aArgs.loadStateExternalLoadFlags() = mLoadStateExternalLoadFlags;
aArgs.loadStateInternalLoadFlags() = mLoadStateInternalLoadFlags;
aArgs.loadStateLoadType() = mLoadStateLoadType;
aArgs.originalUriString() = mOriginalUriString;
if (mLoadingSessionHistoryInfo) {
@ -1735,7 +1737,8 @@ DocumentLoadListener::RedirectToParentProcess(uint32_t aRedirectFlags,
nsDocShellLoadState::CreateFromPendingChannel(
mChannel, mLoadIdentifier, mRedirectChannelId, getter_AddRefs(loadState));
loadState->SetLoadFlags(mLoadStateLoadFlags);
loadState->SetLoadFlags(mLoadStateExternalLoadFlags);
loadState->SetInternalLoadFlags(mLoadStateInternalLoadFlags);
loadState->SetLoadType(mLoadStateLoadType);
if (mLoadingSessionHistoryInfo) {
loadState->SetLoadingSessionHistoryInfo(*mLoadingSessionHistoryInfo);
@ -2030,7 +2033,7 @@ bool DocumentLoadListener::MaybeHandleLoadErrorWithURIFixup(nsresult aStatus) {
nsCOMPtr<nsIInputStream> newPostData;
nsCOMPtr<nsIURI> newURI = nsDocShell::AttemptURIFixup(
mChannel, aStatus, mOriginalUriString, mLoadStateLoadType, bc->IsTop(),
mLoadStateLoadFlags &
mLoadStateInternalLoadFlags &
nsDocShell::INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP,
bc->UsePrivateBrowsing(), true, getter_AddRefs(newPostData));
if (!newURI) {

Просмотреть файл

@ -507,7 +507,8 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
// Flags from nsDocShellLoadState::LoadFlags/Type that we want to make
// available to the new docshell if we switch processes.
uint32_t mLoadStateLoadFlags = 0;
uint32_t mLoadStateExternalLoadFlags = 0;
uint32_t mLoadStateInternalLoadFlags = 0;
uint32_t mLoadStateLoadType = 0;
// Corresponding redirect channel registrar Id for the final channel that

Просмотреть файл

@ -469,7 +469,8 @@ struct RedirectToRealChannelArgs {
uint32_t? contentDisposition;
nsString? contentDispositionFilename;
nsIPropertyBag2 properties;
uint32_t loadStateLoadFlags;
uint32_t loadStateExternalLoadFlags;
uint32_t loadStateInternalLoadFlags;
uint32_t loadStateLoadType;
nsDOMNavigationTiming? timing;
nsString srcdocData;