Bug 1682285 - Part 2: Track LOAD_FLAGS_FROM_EXTERNAL separately from LOAD_TYPE, r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D103365
This commit is contained in:
@@ -1047,8 +1047,7 @@ bool nsDocShell::MaybeHandleSubframeHistory(
|
||||
// This is a newly created frame. Check for exception cases first.
|
||||
// By default the subframe will inherit the parent's loadType.
|
||||
if (aLoadState->LoadIsFromSessionHistory() &&
|
||||
(parentLoadType == LOAD_NORMAL || parentLoadType == LOAD_LINK ||
|
||||
parentLoadType == LOAD_NORMAL_EXTERNAL)) {
|
||||
(parentLoadType == LOAD_NORMAL || parentLoadType == LOAD_LINK)) {
|
||||
// The parent was loaded normally. In this case, this *brand new*
|
||||
// child really shouldn't have a SHEntry. If it does, it could be
|
||||
// because the parent is replacing an existing frame with a new frame,
|
||||
@@ -9228,7 +9227,7 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
|
||||
{
|
||||
bool inherits;
|
||||
|
||||
if (aLoadState->LoadType() != LOAD_NORMAL_EXTERNAL &&
|
||||
if (!aLoadState->HasLoadFlags(LOAD_FLAGS_FROM_EXTERNAL) &&
|
||||
!aLoadState->PrincipalToInherit() &&
|
||||
(aLoadState->HasInternalLoadFlags(
|
||||
INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL)) &&
|
||||
@@ -9253,7 +9252,9 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
|
||||
}
|
||||
|
||||
// Before going any further vet loads initiated by external programs.
|
||||
if (aLoadState->LoadType() == LOAD_NORMAL_EXTERNAL) {
|
||||
if (aLoadState->HasLoadFlags(LOAD_FLAGS_FROM_EXTERNAL)) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(aLoadState->LoadType() == LOAD_NORMAL);
|
||||
|
||||
// Disallow external chrome: loads targetted at content windows
|
||||
if (SchemeIsChrome(aLoadState->URI())) {
|
||||
NS_WARNING("blocked external chrome: url -- use '--chrome' option");
|
||||
@@ -9265,10 +9266,6 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
|
||||
if (NS_FAILED(rv)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// reset loadType so we don't have to add lots of tests for
|
||||
// LOAD_NORMAL_EXTERNAL after this point
|
||||
aLoadState->SetLoadType(LOAD_NORMAL);
|
||||
}
|
||||
|
||||
mAllowKeywordFixup = aLoadState->HasInternalLoadFlags(
|
||||
@@ -9687,8 +9684,8 @@ nsIPrincipal* nsDocShell::GetInheritedPrincipal(
|
||||
if (aLoadState->PrincipalToInherit()) {
|
||||
aLoadInfo->SetPrincipalToInherit(aLoadState->PrincipalToInherit());
|
||||
}
|
||||
aLoadInfo->SetLoadTriggeredFromExternal(aLoadState->LoadType() ==
|
||||
LOAD_NORMAL_EXTERNAL);
|
||||
aLoadInfo->SetLoadTriggeredFromExternal(
|
||||
aLoadState->HasLoadFlags(LOAD_FLAGS_FROM_EXTERNAL));
|
||||
aLoadInfo->SetForceAllowDataURI(aLoadState->HasInternalLoadFlags(
|
||||
INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI));
|
||||
aLoadInfo->SetOriginalFrameSrcLoad(
|
||||
@@ -10287,8 +10284,6 @@ 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user