forked from mirrors/gecko-dev
Backed out changeset 8dd09fad1f35 (bug 1492648) for bc failures on browser_auto_close_window.js
--HG-- rename : docshell/base/nsDocShellLoadState.cpp => docshell/base/nsDocShellLoadInfo.cpp rename : docshell/base/nsDocShellLoadState.h => docshell/base/nsDocShellLoadInfo.h
This commit is contained in:
parent
961f0c1eca
commit
5d00f78a13
27 changed files with 822 additions and 1021 deletions
|
|
@ -38,24 +38,19 @@ NS_IMPL_CI_INTERFACE_GETTER(NullPrincipal,
|
||||||
/* static */ already_AddRefed<NullPrincipal>
|
/* static */ already_AddRefed<NullPrincipal>
|
||||||
NullPrincipal::CreateWithInheritedAttributes(nsIPrincipal* aInheritFrom)
|
NullPrincipal::CreateWithInheritedAttributes(nsIPrincipal* aInheritFrom)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aInheritFrom);
|
RefPtr<NullPrincipal> nullPrin = new NullPrincipal();
|
||||||
return CreateWithInheritedAttributes(Cast(aInheritFrom)->OriginAttributesRef(), false);
|
nsresult rv = nullPrin->Init(Cast(aInheritFrom)->OriginAttributesRef());
|
||||||
|
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
|
||||||
|
return nullPrin.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ already_AddRefed<NullPrincipal>
|
/* static */ already_AddRefed<NullPrincipal>
|
||||||
NullPrincipal::CreateWithInheritedAttributes(nsIDocShell* aDocShell, bool aIsFirstParty)
|
NullPrincipal::CreateWithInheritedAttributes(nsIDocShell* aDocShell, bool aIsFirstParty)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aDocShell);
|
|
||||||
|
|
||||||
OriginAttributes attrs = nsDocShell::Cast(aDocShell)->GetOriginAttributes();
|
OriginAttributes attrs = nsDocShell::Cast(aDocShell)->GetOriginAttributes();
|
||||||
return CreateWithInheritedAttributes(attrs, aIsFirstParty);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */ already_AddRefed<NullPrincipal>
|
|
||||||
NullPrincipal::CreateWithInheritedAttributes(const OriginAttributes& aOriginAttributes, bool aIsFirstParty)
|
|
||||||
{
|
|
||||||
RefPtr<NullPrincipal> nullPrin = new NullPrincipal();
|
RefPtr<NullPrincipal> nullPrin = new NullPrincipal();
|
||||||
nsresult rv = nullPrin->Init(aOriginAttributes, aIsFirstParty);
|
nsresult rv = nullPrin->Init(attrs, aIsFirstParty);
|
||||||
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
|
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
|
||||||
return nullPrin.forget();
|
return nullPrin.forget();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,19 +56,14 @@ public:
|
||||||
NS_IMETHOD GetBaseDomain(nsACString& aBaseDomain) override;
|
NS_IMETHOD GetBaseDomain(nsACString& aBaseDomain) override;
|
||||||
NS_IMETHOD GetAddonId(nsAString& aAddonId) override;
|
NS_IMETHOD GetAddonId(nsAString& aAddonId) override;
|
||||||
|
|
||||||
static already_AddRefed<NullPrincipal>
|
static already_AddRefed<NullPrincipal> CreateWithInheritedAttributes(nsIPrincipal* aInheritFrom);
|
||||||
CreateWithInheritedAttributes(nsIPrincipal* aInheritFrom);
|
|
||||||
|
|
||||||
// Create NullPrincipal with origin attributes from docshell.
|
// Create NullPrincipal with origin attributes from docshell.
|
||||||
// If aIsFirstParty is true, and the pref 'privacy.firstparty.isolate' is also
|
// If aIsFirstParty is true, and the pref 'privacy.firstparty.isolate' is also
|
||||||
// enabled, the mFirstPartyDomain value of the origin attributes will be set
|
// enabled, the mFirstPartyDomain value of the origin attributes will be set
|
||||||
// to an unique value.
|
// to an unique value.
|
||||||
static already_AddRefed<NullPrincipal>
|
static already_AddRefed<NullPrincipal>
|
||||||
CreateWithInheritedAttributes(nsIDocShell* aDocShell,
|
CreateWithInheritedAttributes(nsIDocShell* aDocShell, bool aIsFirstParty = false);
|
||||||
bool aIsFirstParty = false);
|
|
||||||
static already_AddRefed<NullPrincipal>
|
|
||||||
CreateWithInheritedAttributes(const OriginAttributes& aOriginAttributes,
|
|
||||||
bool aIsFirstParty = false);
|
|
||||||
|
|
||||||
static already_AddRefed<NullPrincipal>
|
static already_AddRefed<NullPrincipal>
|
||||||
Create(const OriginAttributes& aOriginAttributes,
|
Create(const OriginAttributes& aOriginAttributes,
|
||||||
|
|
@ -90,8 +85,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
virtual ~NullPrincipal() = default;
|
virtual ~NullPrincipal() = default;
|
||||||
|
|
||||||
bool SubsumesInternal(nsIPrincipal* aOther,
|
bool SubsumesInternal(nsIPrincipal* aOther, DocumentDomainConsideration aConsideration) override
|
||||||
DocumentDomainConsideration aConsideration) override
|
|
||||||
{
|
{
|
||||||
return aOther == this;
|
return aOther == this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ XPIDL_MODULE = 'docshell'
|
||||||
EXPORTS += [
|
EXPORTS += [
|
||||||
'nsCTooltipTextProvider.h',
|
'nsCTooltipTextProvider.h',
|
||||||
'nsDocShell.h',
|
'nsDocShell.h',
|
||||||
'nsDocShellLoadState.h',
|
'nsDocShellLoadInfo.h',
|
||||||
'nsDocShellLoadTypes.h',
|
'nsDocShellLoadTypes.h',
|
||||||
'nsDocShellTreeOwner.h',
|
'nsDocShellTreeOwner.h',
|
||||||
'nsILinkHandler.h',
|
'nsILinkHandler.h',
|
||||||
|
|
@ -88,7 +88,7 @@ UNIFIED_SOURCES += [
|
||||||
'nsDocShell.cpp',
|
'nsDocShell.cpp',
|
||||||
'nsDocShellEditorData.cpp',
|
'nsDocShellEditorData.cpp',
|
||||||
'nsDocShellEnumerator.cpp',
|
'nsDocShellEnumerator.cpp',
|
||||||
'nsDocShellLoadState.cpp',
|
'nsDocShellLoadInfo.cpp',
|
||||||
'nsDocShellTreeOwner.cpp',
|
'nsDocShellTreeOwner.cpp',
|
||||||
'nsDSURIContentListener.cpp',
|
'nsDSURIContentListener.cpp',
|
||||||
'nsPingListener.cpp',
|
'nsPingListener.cpp',
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@
|
||||||
#include "nsDocShellCID.h"
|
#include "nsDocShellCID.h"
|
||||||
#include "nsDocShellEditorData.h"
|
#include "nsDocShellEditorData.h"
|
||||||
#include "nsDocShellEnumerator.h"
|
#include "nsDocShellEnumerator.h"
|
||||||
#include "nsDocShellLoadState.h"
|
#include "nsDocShellLoadInfo.h"
|
||||||
#include "nsDocShellLoadTypes.h"
|
#include "nsDocShellLoadTypes.h"
|
||||||
#include "nsDOMCID.h"
|
#include "nsDOMCID.h"
|
||||||
#include "nsDOMNavigationTiming.h"
|
#include "nsDOMNavigationTiming.h"
|
||||||
|
|
@ -643,12 +643,14 @@ nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocShell::LoadURI(nsDocShellLoadState* aLoadState)
|
nsDocShell::LoadURI(nsIURI* aURI,
|
||||||
|
nsDocShellLoadInfo* aLoadInfo,
|
||||||
|
uint32_t aLoadFlags,
|
||||||
|
bool aFirstParty)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aLoadState, "Must have a valid load state!");
|
MOZ_ASSERT(aLoadInfo || (aLoadFlags & EXTRA_LOAD_FLAGS) == 0,
|
||||||
MOZ_ASSERT((aLoadState->LoadFlags() & INTERNAL_LOAD_FLAGS_LOADURI_SETUP_FLAGS) == 0,
|
"Unexpected flags");
|
||||||
"Should not have these flags set");
|
MOZ_ASSERT((aLoadFlags & 0xf) == 0, "Should not have these flags set");
|
||||||
MOZ_ASSERT(aLoadState->URI(), "Should have a valid URI to load");
|
|
||||||
|
|
||||||
// Note: we allow loads to get through here even if mFiredUnloadEvent is
|
// Note: we allow loads to get through here even if mFiredUnloadEvent is
|
||||||
// true; that case will get handled in LoadInternal or LoadHistoryEntry,
|
// true; that case will get handled in LoadInternal or LoadHistoryEntry,
|
||||||
|
|
@ -660,121 +662,86 @@ nsDocShell::LoadURI(nsDocShellLoadState* aLoadState)
|
||||||
return NS_OK; // JS may not handle returning of an error code
|
return NS_OK; // JS may not handle returning of an error code
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIURI> referrer;
|
||||||
|
nsCOMPtr<nsIURI> originalURI;
|
||||||
|
Maybe<nsCOMPtr<nsIURI>> resultPrincipalURI;
|
||||||
|
bool keepResultPrincipalURIIfSet = false;
|
||||||
|
bool loadReplace = false;
|
||||||
|
nsCOMPtr<nsIInputStream> postStream;
|
||||||
|
nsCOMPtr<nsIInputStream> headersStream;
|
||||||
|
nsCOMPtr<nsIPrincipal> triggeringPrincipal;
|
||||||
|
bool inheritPrincipal = false;
|
||||||
|
bool principalIsExplicit = false;
|
||||||
|
bool sendReferrer = true;
|
||||||
|
uint32_t referrerPolicy = RP_Unset;
|
||||||
|
bool isSrcdoc = false;
|
||||||
|
nsCOMPtr<nsISHEntry> shEntry;
|
||||||
|
nsString target;
|
||||||
|
nsAutoString srcdoc;
|
||||||
|
bool forceAllowDataURI = false;
|
||||||
|
bool originalFrameSrc = false;
|
||||||
|
nsCOMPtr<nsIDocShell> sourceDocShell;
|
||||||
|
nsCOMPtr<nsIURI> baseURI;
|
||||||
|
|
||||||
|
uint32_t loadType = MAKE_LOAD_TYPE(LOAD_NORMAL, aLoadFlags);
|
||||||
|
|
||||||
|
NS_ENSURE_ARG(aURI);
|
||||||
|
|
||||||
if (!StartupTimeline::HasRecord(StartupTimeline::FIRST_LOAD_URI) &&
|
if (!StartupTimeline::HasRecord(StartupTimeline::FIRST_LOAD_URI) &&
|
||||||
mItemType == typeContent && !NS_IsAboutBlank(aLoadState->URI())) {
|
mItemType == typeContent && !NS_IsAboutBlank(aURI)) {
|
||||||
StartupTimeline::RecordOnce(StartupTimeline::FIRST_LOAD_URI);
|
StartupTimeline::RecordOnce(StartupTimeline::FIRST_LOAD_URI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extract the info from the DocShellLoadInfo struct...
|
||||||
|
if (aLoadInfo) {
|
||||||
|
referrer = aLoadInfo->Referrer();
|
||||||
|
originalURI = aLoadInfo->OriginalURI();
|
||||||
|
aLoadInfo->GetMaybeResultPrincipalURI(resultPrincipalURI);
|
||||||
|
keepResultPrincipalURIIfSet = aLoadInfo->KeepResultPrincipalURIIfSet();
|
||||||
|
loadReplace = aLoadInfo->LoadReplace();
|
||||||
|
// Get the appropriate loadType from nsIDocShellLoadInfo type
|
||||||
|
loadType = aLoadInfo->LoadType();
|
||||||
|
|
||||||
|
triggeringPrincipal = aLoadInfo->TriggeringPrincipal();
|
||||||
|
inheritPrincipal = aLoadInfo->InheritPrincipal();
|
||||||
|
principalIsExplicit = aLoadInfo->PrincipalIsExplicit();
|
||||||
|
shEntry = aLoadInfo->SHEntry();
|
||||||
|
aLoadInfo->GetTarget(target);
|
||||||
|
postStream = aLoadInfo->PostDataStream();
|
||||||
|
headersStream = aLoadInfo->HeadersStream();
|
||||||
|
sendReferrer = aLoadInfo->SendReferrer();
|
||||||
|
referrerPolicy = aLoadInfo->ReferrerPolicy();
|
||||||
|
isSrcdoc = aLoadInfo->IsSrcdocLoad();
|
||||||
|
aLoadInfo->GetSrcdocData(srcdoc);
|
||||||
|
sourceDocShell = aLoadInfo->SourceDocShell();
|
||||||
|
baseURI = aLoadInfo->BaseURI();
|
||||||
|
forceAllowDataURI = aLoadInfo->ForceAllowDataURI();
|
||||||
|
originalFrameSrc = aLoadInfo->OriginalFrameSrc();
|
||||||
|
}
|
||||||
|
|
||||||
MOZ_LOG(gDocShellLeakLog, LogLevel::Debug,
|
MOZ_LOG(gDocShellLeakLog, LogLevel::Debug,
|
||||||
("nsDocShell[%p]: loading %s with flags 0x%08x",
|
("nsDocShell[%p]: loading %s with flags 0x%08x",
|
||||||
this, aLoadState->URI()->GetSpecOrDefault().get(),
|
this, aURI->GetSpecOrDefault().get(), aLoadFlags));
|
||||||
aLoadState->LoadFlags()));
|
|
||||||
|
|
||||||
if (!aLoadState->SHEntry() &&
|
if (!shEntry &&
|
||||||
!LOAD_TYPE_HAS_FLAGS(aLoadState->LoadType(),
|
!LOAD_TYPE_HAS_FLAGS(loadType, LOAD_FLAGS_REPLACE_HISTORY)) {
|
||||||
LOAD_FLAGS_REPLACE_HISTORY)) {
|
// First verify if this is a subframe.
|
||||||
// This is possibly a subframe, so handle it accordingly.
|
|
||||||
//
|
|
||||||
// If history exists, it will be loaded into the aLoadState object, and the
|
|
||||||
// LoadType will be changed.
|
|
||||||
MaybeHandleSubframeHistory(aLoadState);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aLoadState->SHEntry()) {
|
|
||||||
#ifdef DEBUG
|
|
||||||
MOZ_LOG(gDocShellLog, LogLevel::Debug,
|
|
||||||
("nsDocShell[%p]: loading from session history", this));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return LoadHistoryEntry(aLoadState->SHEntry(), aLoadState->LoadType());
|
|
||||||
}
|
|
||||||
|
|
||||||
// On history navigation via Back/Forward buttons, don't execute
|
|
||||||
// automatic JavaScript redirection such as |location.href = ...| or
|
|
||||||
// |window.open()|
|
|
||||||
//
|
|
||||||
// LOAD_NORMAL: window.open(...) etc.
|
|
||||||
// LOAD_STOP_CONTENT: location.href = ..., location.assign(...)
|
|
||||||
if ((aLoadState->LoadType() == LOAD_NORMAL ||
|
|
||||||
aLoadState->LoadType() == LOAD_STOP_CONTENT) &&
|
|
||||||
ShouldBlockLoadingForBackButton()) {
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up the inheriting principal in LoadState.
|
|
||||||
nsresult rv = aLoadState->SetupInheritingPrincipal(mItemType, mOriginAttributes);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
rv = aLoadState->SetupTriggeringPrincipal(mOriginAttributes);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
aLoadState->CalculateDocShellInternalLoadFlags();
|
|
||||||
|
|
||||||
mozilla::Maybe<nsCOMPtr<nsIURI>> resultPrincipalURI;
|
|
||||||
aLoadState->GetMaybeResultPrincipalURI(resultPrincipalURI);
|
|
||||||
|
|
||||||
MOZ_ASSERT(aLoadState->TypeHint().IsVoid(),
|
|
||||||
"Typehint should be null when calling InternalLoad from LoadURI");
|
|
||||||
MOZ_ASSERT(aLoadState->FileName().IsVoid(),
|
|
||||||
"FileName should be null when calling InternalLoad from LoadURI");
|
|
||||||
MOZ_ASSERT(aLoadState->SHEntry() == nullptr,
|
|
||||||
"SHEntry should be null when calling InternalLoad from LoadURI");
|
|
||||||
|
|
||||||
return InternalLoad(aLoadState->URI(),
|
|
||||||
aLoadState->OriginalURI(),
|
|
||||||
resultPrincipalURI,
|
|
||||||
aLoadState->KeepResultPrincipalURIIfSet(),
|
|
||||||
aLoadState->LoadReplace(),
|
|
||||||
aLoadState->Referrer(),
|
|
||||||
aLoadState->ReferrerPolicy(),
|
|
||||||
aLoadState->TriggeringPrincipal(),
|
|
||||||
aLoadState->PrincipalToInherit(),
|
|
||||||
aLoadState->DocShellInternalLoadFlags(),
|
|
||||||
aLoadState->Target(),
|
|
||||||
aLoadState->TypeHint(),
|
|
||||||
aLoadState->FileName(),
|
|
||||||
aLoadState->PostDataStream(),
|
|
||||||
aLoadState->HeadersStream(),
|
|
||||||
aLoadState->LoadType(),
|
|
||||||
aLoadState->SHEntry(),
|
|
||||||
aLoadState->FirstParty(),
|
|
||||||
aLoadState->SrcdocData(),
|
|
||||||
aLoadState->SourceDocShell(),
|
|
||||||
aLoadState->BaseURI(),
|
|
||||||
nullptr, // no nsIDocShell
|
|
||||||
nullptr); // no nsIRequest
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShell::MaybeHandleSubframeHistory(nsDocShellLoadState* aLoadState)
|
|
||||||
{
|
|
||||||
// First, verify if this is a subframe.
|
|
||||||
nsCOMPtr<nsIDocShellTreeItem> parentAsItem;
|
nsCOMPtr<nsIDocShellTreeItem> parentAsItem;
|
||||||
GetSameTypeParent(getter_AddRefs(parentAsItem));
|
GetSameTypeParent(getter_AddRefs(parentAsItem));
|
||||||
nsCOMPtr<nsIDocShell> parentDS(do_QueryInterface(parentAsItem));
|
nsCOMPtr<nsIDocShell> parentDS(do_QueryInterface(parentAsItem));
|
||||||
|
uint32_t parentLoadType;
|
||||||
|
|
||||||
if (!parentDS || parentDS == static_cast<nsIDocShell*>(this)) {
|
if (parentDS && parentDS != static_cast<nsIDocShell*>(this)) {
|
||||||
// This is the root docshell. If we got here while
|
/* OK. It is a subframe. Checkout the
|
||||||
// executing an onLoad Handler,this load will not go
|
* parent's loadtype. If the parent was loaded thro' a history
|
||||||
// into session history.
|
* mechanism, then get the SH entry for the child from the parent.
|
||||||
bool inOnLoadHandler = false;
|
* This is done to restore frameset navigation while going back/forward.
|
||||||
GetIsExecutingOnLoadHandler(&inOnLoadHandler);
|
* If the parent was loaded through any other loadType, set the
|
||||||
if (inOnLoadHandler) {
|
* child's loadType too accordingly, so that session history does not
|
||||||
aLoadState->SetLoadType(LOAD_NORMAL_REPLACE);
|
* get confused.
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* OK. It is a subframe. Checkout the parent's loadtype. If the parent was
|
|
||||||
* loaded through a history mechanism, then get the SH entry for the child from
|
|
||||||
* the parent. This is done to restore frameset navigation while going
|
|
||||||
* back/forward. If the parent was loaded through any other loadType, set the
|
|
||||||
* child's loadType too accordingly, so that session history does not get
|
|
||||||
* confused.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Get the parent's load type
|
// Get the parent's load type
|
||||||
uint32_t parentLoadType;
|
|
||||||
parentDS->GetLoadType(&parentLoadType);
|
parentDS->GetLoadType(&parentLoadType);
|
||||||
|
|
||||||
// Get the ShEntry for the child from the parent
|
// Get the ShEntry for the child from the parent
|
||||||
|
|
@ -782,17 +749,13 @@ nsDocShell::MaybeHandleSubframeHistory(nsDocShellLoadState* aLoadState)
|
||||||
bool oshe = false;
|
bool oshe = false;
|
||||||
parentDS->GetCurrentSHEntry(getter_AddRefs(currentSH), &oshe);
|
parentDS->GetCurrentSHEntry(getter_AddRefs(currentSH), &oshe);
|
||||||
bool dynamicallyAddedChild = mDynamicallyCreated;
|
bool dynamicallyAddedChild = mDynamicallyCreated;
|
||||||
|
|
||||||
if (!dynamicallyAddedChild && !oshe && currentSH) {
|
if (!dynamicallyAddedChild && !oshe && currentSH) {
|
||||||
currentSH->HasDynamicallyAddedChild(&dynamicallyAddedChild);
|
currentSH->HasDynamicallyAddedChild(&dynamicallyAddedChild);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dynamicallyAddedChild) {
|
if (!dynamicallyAddedChild) {
|
||||||
// Only use the old SHEntry, if we're sure enough that
|
// Only use the old SHEntry, if we're sure enough that
|
||||||
// it wasn't originally for some other frame.
|
// it wasn't originally for some other frame.
|
||||||
nsCOMPtr<nsISHEntry> shEntry;
|
|
||||||
parentDS->GetChildSHEntry(mChildOffset, getter_AddRefs(shEntry));
|
parentDS->GetChildSHEntry(mChildOffset, getter_AddRefs(shEntry));
|
||||||
aLoadState->SetSHEntry(shEntry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make some decisions on the child frame's loadType based on the
|
// Make some decisions on the child frame's loadType based on the
|
||||||
|
|
@ -805,13 +768,58 @@ nsDocShell::MaybeHandleSubframeHistory(nsDocShellLoadState* aLoadState)
|
||||||
// currentSHEntry is null.
|
// currentSHEntry is null.
|
||||||
nsCOMPtr<nsISHEntry> currentChildEntry;
|
nsCOMPtr<nsISHEntry> currentChildEntry;
|
||||||
GetCurrentSHEntry(getter_AddRefs(currentChildEntry), &oshe);
|
GetCurrentSHEntry(getter_AddRefs(currentChildEntry), &oshe);
|
||||||
|
if (!mCurrentURI || (NS_IsAboutBlank(mCurrentURI) && !currentChildEntry)) {
|
||||||
if (mCurrentURI && (!NS_IsAboutBlank(mCurrentURI) || currentChildEntry)) {
|
// This is a newly created frame. Check for exception cases first.
|
||||||
|
// By default the subframe will inherit the parent's loadType.
|
||||||
|
if (shEntry && (parentLoadType == LOAD_NORMAL ||
|
||||||
|
parentLoadType == LOAD_LINK ||
|
||||||
|
parentLoadType == LOAD_NORMAL_EXTERNAL)) {
|
||||||
|
// 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,
|
||||||
|
// in the onLoadHandler. We don't want this url to get into session
|
||||||
|
// history. Clear off shEntry, and set load type to
|
||||||
|
// LOAD_BYPASS_HISTORY.
|
||||||
|
bool inOnLoadHandler = false;
|
||||||
|
parentDS->GetIsExecutingOnLoadHandler(&inOnLoadHandler);
|
||||||
|
if (inOnLoadHandler) {
|
||||||
|
loadType = LOAD_NORMAL_REPLACE;
|
||||||
|
shEntry = nullptr;
|
||||||
|
}
|
||||||
|
} else if (parentLoadType == LOAD_REFRESH) {
|
||||||
|
// Clear shEntry. For refresh loads, we have to load
|
||||||
|
// what comes thro' the pipe, not what's in history.
|
||||||
|
shEntry = nullptr;
|
||||||
|
} else if ((parentLoadType == LOAD_BYPASS_HISTORY) ||
|
||||||
|
(shEntry &&
|
||||||
|
((parentLoadType & LOAD_CMD_HISTORY) ||
|
||||||
|
(parentLoadType == LOAD_RELOAD_NORMAL) ||
|
||||||
|
(parentLoadType == LOAD_RELOAD_CHARSET_CHANGE) ||
|
||||||
|
(parentLoadType == LOAD_RELOAD_CHARSET_CHANGE_BYPASS_CACHE) ||
|
||||||
|
(parentLoadType == LOAD_RELOAD_CHARSET_CHANGE_BYPASS_PROXY_AND_CACHE)))) {
|
||||||
|
// If the parent url, bypassed history or was loaded from
|
||||||
|
// history, pass on the parent's loadType to the new child
|
||||||
|
// frame too, so that the child frame will also
|
||||||
|
// avoid getting into history.
|
||||||
|
loadType = parentLoadType;
|
||||||
|
} else if (parentLoadType == LOAD_ERROR_PAGE) {
|
||||||
|
// If the parent document is an error page, we don't
|
||||||
|
// want to update global/session history. However,
|
||||||
|
// this child frame is not an error page.
|
||||||
|
loadType = LOAD_BYPASS_HISTORY;
|
||||||
|
} else if ((parentLoadType == LOAD_RELOAD_BYPASS_CACHE) ||
|
||||||
|
(parentLoadType == LOAD_RELOAD_BYPASS_PROXY) ||
|
||||||
|
(parentLoadType == LOAD_RELOAD_BYPASS_PROXY_AND_CACHE)) {
|
||||||
|
// the new frame should inherit the parent's load type so that it also
|
||||||
|
// bypasses the cache and/or proxy
|
||||||
|
loadType = parentLoadType;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
// This is a pre-existing subframe. If
|
// This is a pre-existing subframe. If
|
||||||
// 1. The load of this frame was not originally initiated by session
|
// 1. The load of this frame was not originally initiated by session
|
||||||
// history directly (i.e. (!shEntry) condition succeeded, but it can
|
// history directly (i.e. (!shEntry) condition succeeded, but it can
|
||||||
// still be a history load on parent which causes this frame being
|
// still be a history load on parent which causes this frame being
|
||||||
// loaded), which we checked with the above assert, and
|
// loaded), and
|
||||||
// 2. mCurrentURI is not null, nor the initial about:blank,
|
// 2. mCurrentURI is not null, nor the initial about:blank,
|
||||||
// it is possible that a parent's onLoadHandler or even self's
|
// it is possible that a parent's onLoadHandler or even self's
|
||||||
// onLoadHandler is loading a new page in this child. Check parent's and
|
// onLoadHandler is loading a new page in this child. Check parent's and
|
||||||
|
|
@ -823,57 +831,187 @@ nsDocShell::MaybeHandleSubframeHistory(nsDocShellLoadState* aLoadState)
|
||||||
GetBusyFlags(&selfBusy);
|
GetBusyFlags(&selfBusy);
|
||||||
if (parentBusy & BUSY_FLAGS_BUSY ||
|
if (parentBusy & BUSY_FLAGS_BUSY ||
|
||||||
selfBusy & BUSY_FLAGS_BUSY) {
|
selfBusy & BUSY_FLAGS_BUSY) {
|
||||||
aLoadState->SetLoadType(LOAD_NORMAL_REPLACE);
|
loadType = LOAD_NORMAL_REPLACE;
|
||||||
aLoadState->SetSHEntry(nullptr);
|
shEntry = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // parentDS
|
||||||
|
else {
|
||||||
|
// This is the root docshell. If we got here while
|
||||||
|
// executing an onLoad Handler,this load will not go
|
||||||
|
// into session history.
|
||||||
|
bool inOnLoadHandler = false;
|
||||||
|
GetIsExecutingOnLoadHandler(&inOnLoadHandler);
|
||||||
|
if (inOnLoadHandler) {
|
||||||
|
loadType = LOAD_NORMAL_REPLACE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
} // !shEntry
|
||||||
|
|
||||||
|
if (shEntry) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
MOZ_LOG(gDocShellLog, LogLevel::Debug,
|
||||||
|
("nsDocShell[%p]: loading from session history", this));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return LoadHistoryEntry(shEntry, loadType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is a newly created frame. Check for exception cases first.
|
// On history navigation via Back/Forward buttons, don't execute
|
||||||
// By default the subframe will inherit the parent's loadType.
|
// automatic JavaScript redirection such as |location.href = ...| or
|
||||||
if (aLoadState->SHEntry() && (parentLoadType == LOAD_NORMAL ||
|
// |window.open()|
|
||||||
parentLoadType == LOAD_LINK ||
|
//
|
||||||
parentLoadType == LOAD_NORMAL_EXTERNAL)) {
|
// LOAD_NORMAL: window.open(...) etc.
|
||||||
// The parent was loaded normally. In this case, this *brand new*
|
// LOAD_STOP_CONTENT: location.href = ..., location.assign(...)
|
||||||
// child really shouldn't have a SHEntry. If it does, it could be
|
if ((loadType == LOAD_NORMAL || loadType == LOAD_STOP_CONTENT) &&
|
||||||
// because the parent is replacing an existing frame with a new frame,
|
ShouldBlockLoadingForBackButton()) {
|
||||||
// in the onLoadHandler. We don't want this url to get into session
|
return NS_OK;
|
||||||
// history. Clear off shEntry, and set load type to
|
|
||||||
// LOAD_BYPASS_HISTORY.
|
|
||||||
bool inOnLoadHandler = false;
|
|
||||||
parentDS->GetIsExecutingOnLoadHandler(&inOnLoadHandler);
|
|
||||||
if (inOnLoadHandler) {
|
|
||||||
aLoadState->SetLoadType(LOAD_NORMAL_REPLACE);
|
|
||||||
aLoadState->SetSHEntry(nullptr);
|
|
||||||
}
|
|
||||||
} else if (parentLoadType == LOAD_REFRESH) {
|
|
||||||
// Clear shEntry. For refresh loads, we have to load
|
|
||||||
// what comes through the pipe, not what's in history.
|
|
||||||
aLoadState->SetSHEntry(nullptr);
|
|
||||||
} else if ((parentLoadType == LOAD_BYPASS_HISTORY) ||
|
|
||||||
(aLoadState->SHEntry() &&
|
|
||||||
((parentLoadType & LOAD_CMD_HISTORY) ||
|
|
||||||
(parentLoadType == LOAD_RELOAD_NORMAL) ||
|
|
||||||
(parentLoadType == LOAD_RELOAD_CHARSET_CHANGE) ||
|
|
||||||
(parentLoadType == LOAD_RELOAD_CHARSET_CHANGE_BYPASS_CACHE) ||
|
|
||||||
(parentLoadType == LOAD_RELOAD_CHARSET_CHANGE_BYPASS_PROXY_AND_CACHE)))) {
|
|
||||||
// If the parent url, bypassed history or was loaded from
|
|
||||||
// history, pass on the parent's loadType to the new child
|
|
||||||
// frame too, so that the child frame will also
|
|
||||||
// avoid getting into history.
|
|
||||||
aLoadState->SetLoadType(parentLoadType);
|
|
||||||
} else if (parentLoadType == LOAD_ERROR_PAGE) {
|
|
||||||
// If the parent document is an error page, we don't
|
|
||||||
// want to update global/session history. However,
|
|
||||||
// this child frame is not an error page.
|
|
||||||
aLoadState->SetLoadType(LOAD_BYPASS_HISTORY);
|
|
||||||
} else if ((parentLoadType == LOAD_RELOAD_BYPASS_CACHE) ||
|
|
||||||
(parentLoadType == LOAD_RELOAD_BYPASS_PROXY) ||
|
|
||||||
(parentLoadType == LOAD_RELOAD_BYPASS_PROXY_AND_CACHE)) {
|
|
||||||
// the new frame should inherit the parent's load type so that it also
|
|
||||||
// bypasses the cache and/or proxy
|
|
||||||
aLoadState->SetLoadType(parentLoadType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Perform the load...
|
||||||
|
|
||||||
|
// We need a principalToInherit.
|
||||||
|
//
|
||||||
|
// If principalIsExplicit is not set there are 4 possibilities:
|
||||||
|
// (1) If the system principal or an expanded principal was passed
|
||||||
|
// in and we're a typeContent docshell, inherit the principal
|
||||||
|
// from the current document instead.
|
||||||
|
// (2) In all other cases when the principal passed in is not null,
|
||||||
|
// use that principal.
|
||||||
|
// (3) If the caller has allowed inheriting from the current document,
|
||||||
|
// or if we're being called from system code (eg chrome JS or pure
|
||||||
|
// C++) then inheritPrincipal should be true and InternalLoad will get
|
||||||
|
// a principal from the current document. If none of these things are
|
||||||
|
// true, then
|
||||||
|
// (4) we don't pass a principal into the channel, and a principal will be
|
||||||
|
// created later from the channel's internal data.
|
||||||
|
//
|
||||||
|
// If principalIsExplicit *is* set, there are 4 possibilities
|
||||||
|
// (1) If the system principal or an expanded principal was passed in
|
||||||
|
// and we're a typeContent docshell, return an error.
|
||||||
|
// (2) In all other cases when the principal passed in is not null,
|
||||||
|
// use that principal.
|
||||||
|
// (3) If the caller has allowed inheriting from the current document,
|
||||||
|
// then inheritPrincipal should be true and InternalLoad will get
|
||||||
|
// a principal from the current document. If none of these things are
|
||||||
|
// true, then
|
||||||
|
// (4) we dont' pass a principal into the channel, and a principal will be
|
||||||
|
// created later from the channel's internal data.
|
||||||
|
nsCOMPtr<nsIPrincipal> principalToInherit = triggeringPrincipal;
|
||||||
|
if (principalToInherit && mItemType != typeChrome) {
|
||||||
|
if (nsContentUtils::IsSystemPrincipal(principalToInherit)) {
|
||||||
|
if (principalIsExplicit) {
|
||||||
|
return NS_ERROR_DOM_SECURITY_ERR;
|
||||||
|
}
|
||||||
|
principalToInherit = nullptr;
|
||||||
|
inheritPrincipal = true;
|
||||||
|
} else if (nsContentUtils::IsExpandedPrincipal(principalToInherit)) {
|
||||||
|
if (principalIsExplicit) {
|
||||||
|
return NS_ERROR_DOM_SECURITY_ERR;
|
||||||
|
}
|
||||||
|
// Don't inherit from the current page. Just do the safe thing
|
||||||
|
// and pretend that we were loaded by a nullprincipal.
|
||||||
|
//
|
||||||
|
// We didn't inherit OriginAttributes here as ExpandedPrincipal doesn't
|
||||||
|
// have origin attributes.
|
||||||
|
principalToInherit = NullPrincipal::CreateWithInheritedAttributes(this);
|
||||||
|
inheritPrincipal = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!principalToInherit && !inheritPrincipal && !principalIsExplicit) {
|
||||||
|
// See if there's system or chrome JS code running
|
||||||
|
inheritPrincipal = nsContentUtils::LegacyIsCallerChromeOrNativeCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aLoadFlags & LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL) {
|
||||||
|
inheritPrincipal = false;
|
||||||
|
// If aFirstParty is true and the pref 'privacy.firstparty.isolate' is
|
||||||
|
// enabled, we will set firstPartyDomain on the origin attributes.
|
||||||
|
principalToInherit = NullPrincipal::CreateWithInheritedAttributes(this, aFirstParty);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the triggeringPrincipal is not passed explicitly, we first try to create
|
||||||
|
// a principal from the referrer, since the referrer URI reflects the web origin
|
||||||
|
// that triggered the load. If there is no referrer URI, we fall back to using
|
||||||
|
// the SystemPrincipal. It's safe to assume that no provided triggeringPrincipal
|
||||||
|
// and no referrer simulate a load that was triggered by the system.
|
||||||
|
// It's important to note that this block of code needs to appear *after* the block
|
||||||
|
// where we munge the principalToInherit, because otherwise we would never enter
|
||||||
|
// code blocks checking if the principalToInherit is null and we will end up with
|
||||||
|
// a wrong inheritPrincipal flag.
|
||||||
|
if (!triggeringPrincipal) {
|
||||||
|
if (referrer) {
|
||||||
|
nsresult rv = CreatePrincipalFromReferrer(referrer,
|
||||||
|
getter_AddRefs(triggeringPrincipal));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
triggeringPrincipal = nsContentUtils::GetSystemPrincipal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t flags = 0;
|
||||||
|
|
||||||
|
if (inheritPrincipal) {
|
||||||
|
MOZ_ASSERT(!nsContentUtils::IsSystemPrincipal(principalToInherit), "Should not inherit SystemPrincipal");
|
||||||
|
flags |= INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sendReferrer) {
|
||||||
|
flags |= INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aLoadFlags & LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP) {
|
||||||
|
flags |= INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aLoadFlags & LOAD_FLAGS_FIRST_LOAD) {
|
||||||
|
flags |= INTERNAL_LOAD_FLAGS_FIRST_LOAD;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aLoadFlags & LOAD_FLAGS_BYPASS_CLASSIFIER) {
|
||||||
|
flags |= INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aLoadFlags & LOAD_FLAGS_FORCE_ALLOW_COOKIES) {
|
||||||
|
flags |= INTERNAL_LOAD_FLAGS_FORCE_ALLOW_COOKIES;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSrcdoc) {
|
||||||
|
flags |= INTERNAL_LOAD_FLAGS_IS_SRCDOC;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (forceAllowDataURI) {
|
||||||
|
flags |= INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (originalFrameSrc) {
|
||||||
|
flags |= INTERNAL_LOAD_FLAGS_ORIGINAL_FRAME_SRC;
|
||||||
|
}
|
||||||
|
|
||||||
|
return InternalLoad(aURI,
|
||||||
|
originalURI,
|
||||||
|
resultPrincipalURI,
|
||||||
|
keepResultPrincipalURIIfSet,
|
||||||
|
loadReplace,
|
||||||
|
referrer,
|
||||||
|
referrerPolicy,
|
||||||
|
triggeringPrincipal,
|
||||||
|
principalToInherit,
|
||||||
|
flags,
|
||||||
|
target,
|
||||||
|
nullptr, // No type hint
|
||||||
|
VoidString(), // No forced download
|
||||||
|
postStream,
|
||||||
|
headersStream,
|
||||||
|
loadType,
|
||||||
|
nullptr, // No SHEntry
|
||||||
|
aFirstParty,
|
||||||
|
srcdoc,
|
||||||
|
sourceDocShell,
|
||||||
|
baseURI,
|
||||||
|
nullptr, // No nsIDocShell
|
||||||
|
nullptr); // No nsIRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -4088,7 +4226,7 @@ nsDocShell::LoadURIWithOptions(const nsAString& aURI,
|
||||||
nsIURI* aBaseURI,
|
nsIURI* aBaseURI,
|
||||||
nsIPrincipal* aTriggeringPrincipal)
|
nsIPrincipal* aTriggeringPrincipal)
|
||||||
{
|
{
|
||||||
NS_ASSERTION((aLoadFlags & INTERNAL_LOAD_FLAGS_LOADURI_SETUP_FLAGS) == 0, "Unexpected flags");
|
NS_ASSERTION((aLoadFlags & 0xf) == 0, "Unexpected flags");
|
||||||
|
|
||||||
if (!IsNavigationAllowed()) {
|
if (!IsNavigationAllowed()) {
|
||||||
return NS_OK; // JS may not handle returning of an error code
|
return NS_OK; // JS may not handle returning of an error code
|
||||||
|
|
@ -4183,28 +4321,27 @@ nsDocShell::LoadURIWithOptions(const nsAString& aURI,
|
||||||
uint32_t extraFlags = (aLoadFlags & EXTRA_LOAD_FLAGS);
|
uint32_t extraFlags = (aLoadFlags & EXTRA_LOAD_FLAGS);
|
||||||
aLoadFlags &= ~EXTRA_LOAD_FLAGS;
|
aLoadFlags &= ~EXTRA_LOAD_FLAGS;
|
||||||
|
|
||||||
RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState();
|
RefPtr<nsDocShellLoadInfo> loadInfo = new nsDocShellLoadInfo();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the user "Disables Protection on This Page", we have to make sure to
|
* If the user "Disables Protection on This Page", we have to make sure to
|
||||||
* remember the users decision when opening links in child tabs [Bug 906190]
|
* remember the users decision when opening links in child tabs [Bug 906190]
|
||||||
*/
|
*/
|
||||||
|
uint32_t loadType;
|
||||||
if (aLoadFlags & LOAD_FLAGS_ALLOW_MIXED_CONTENT) {
|
if (aLoadFlags & LOAD_FLAGS_ALLOW_MIXED_CONTENT) {
|
||||||
loadState->SetLoadType(MAKE_LOAD_TYPE(LOAD_NORMAL_ALLOW_MIXED_CONTENT, aLoadFlags));
|
loadType = MAKE_LOAD_TYPE(LOAD_NORMAL_ALLOW_MIXED_CONTENT, aLoadFlags);
|
||||||
} else {
|
} else {
|
||||||
loadState->SetLoadType(MAKE_LOAD_TYPE(LOAD_NORMAL, aLoadFlags));
|
loadType = MAKE_LOAD_TYPE(LOAD_NORMAL, aLoadFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadState->SetURI(uri);
|
loadInfo->SetLoadType(loadType);
|
||||||
loadState->SetLoadFlags(extraFlags);
|
loadInfo->SetPostDataStream(postStream);
|
||||||
loadState->SetFirstParty(true);
|
loadInfo->SetReferrer(aReferringURI);
|
||||||
loadState->SetPostDataStream(postStream);
|
loadInfo->SetReferrerPolicy((mozilla::net::ReferrerPolicy)aReferrerPolicy);
|
||||||
loadState->SetReferrer(aReferringURI);
|
loadInfo->SetHeadersStream(aHeaderStream);
|
||||||
loadState->SetReferrerPolicy((mozilla::net::ReferrerPolicy)aReferrerPolicy);
|
loadInfo->SetBaseURI(aBaseURI);
|
||||||
loadState->SetHeadersStream(aHeaderStream);
|
loadInfo->SetTriggeringPrincipal(aTriggeringPrincipal);
|
||||||
loadState->SetBaseURI(aBaseURI);
|
loadInfo->SetForceAllowDataURI(forceAllowDataURI);
|
||||||
loadState->SetTriggeringPrincipal(aTriggeringPrincipal);
|
|
||||||
loadState->SetForceAllowDataURI(forceAllowDataURI);
|
|
||||||
|
|
||||||
if (fixupInfo) {
|
if (fixupInfo) {
|
||||||
nsAutoString searchProvider, keyword;
|
nsAutoString searchProvider, keyword;
|
||||||
|
|
@ -4213,7 +4350,7 @@ nsDocShell::LoadURIWithOptions(const nsAString& aURI,
|
||||||
MaybeNotifyKeywordSearchLoading(searchProvider, keyword);
|
MaybeNotifyKeywordSearchLoading(searchProvider, keyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = LoadURI(loadState);
|
rv = LoadURI(uri, loadInfo, extraFlags, true);
|
||||||
|
|
||||||
// Save URI string in case it's needed later when
|
// Save URI string in case it's needed later when
|
||||||
// sending to search engine service in EndPageLoad()
|
// sending to search engine service in EndPageLoad()
|
||||||
|
|
@ -4781,7 +4918,7 @@ nsDocShell::LoadErrorPage(nsIURI* aErrorURI, nsIURI* aFailedURI, nsIChannel* aFa
|
||||||
return InternalLoad(aErrorURI, nullptr, Nothing(), false, false, nullptr, RP_Unset,
|
return InternalLoad(aErrorURI, nullptr, Nothing(), false, false, nullptr, RP_Unset,
|
||||||
nsContentUtils::GetSystemPrincipal(), nullptr,
|
nsContentUtils::GetSystemPrincipal(), nullptr,
|
||||||
INTERNAL_LOAD_FLAGS_NONE, EmptyString(),
|
INTERNAL_LOAD_FLAGS_NONE, EmptyString(),
|
||||||
VoidCString(), VoidString(), nullptr, nullptr,
|
nullptr, VoidString(), nullptr, nullptr,
|
||||||
LOAD_ERROR_PAGE, nullptr, true, VoidString(), this,
|
LOAD_ERROR_PAGE, nullptr, true, VoidString(), this,
|
||||||
nullptr, nullptr, nullptr);
|
nullptr, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
@ -4793,7 +4930,7 @@ nsDocShell::Reload(uint32_t aReloadFlags)
|
||||||
return NS_OK; // JS may not handle returning of an error code
|
return NS_OK; // JS may not handle returning of an error code
|
||||||
}
|
}
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
NS_ASSERTION(((aReloadFlags & INTERNAL_LOAD_FLAGS_LOADURI_SETUP_FLAGS) == 0),
|
NS_ASSERTION(((aReloadFlags & 0xf) == 0),
|
||||||
"Reload command not updated to use load flags!");
|
"Reload command not updated to use load flags!");
|
||||||
NS_ASSERTION((aReloadFlags & EXTRA_LOAD_FLAGS) == 0,
|
NS_ASSERTION((aReloadFlags & EXTRA_LOAD_FLAGS) == 0,
|
||||||
"Don't pass these flags to Reload");
|
"Don't pass these flags to Reload");
|
||||||
|
|
@ -4881,7 +5018,7 @@ nsDocShell::Reload(uint32_t aReloadFlags)
|
||||||
triggeringPrincipal,
|
triggeringPrincipal,
|
||||||
flags,
|
flags,
|
||||||
EmptyString(), // No window target
|
EmptyString(), // No window target
|
||||||
NS_LossyConvertUTF16toASCII(contentTypeHint),
|
NS_LossyConvertUTF16toASCII(contentTypeHint).get(),
|
||||||
VoidString(), // No forced download
|
VoidString(), // No forced download
|
||||||
nullptr, // No post data
|
nullptr, // No post data
|
||||||
nullptr, // No headers data
|
nullptr, // No headers data
|
||||||
|
|
@ -6133,22 +6270,22 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal, int32_t aDel
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG(aURI);
|
NS_ENSURE_ARG(aURI);
|
||||||
|
|
||||||
RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState();
|
RefPtr<nsDocShellLoadInfo> loadInfo = new nsDocShellLoadInfo();
|
||||||
|
|
||||||
/* We do need to pass in a referrer, but we don't want it to
|
/* We do need to pass in a referrer, but we don't want it to
|
||||||
* be sent to the server.
|
* be sent to the server.
|
||||||
*/
|
*/
|
||||||
loadState->SetSendReferrer(false);
|
loadInfo->SetSendReferrer(false);
|
||||||
|
|
||||||
/* for most refreshes the current URI is an appropriate
|
/* for most refreshes the current URI is an appropriate
|
||||||
* internal referrer
|
* internal referrer
|
||||||
*/
|
*/
|
||||||
loadState->SetReferrer(mCurrentURI);
|
loadInfo->SetReferrer(mCurrentURI);
|
||||||
|
|
||||||
loadState->SetOriginalURI(mCurrentURI);
|
loadInfo->SetOriginalURI(mCurrentURI);
|
||||||
loadState->SetResultPrincipalURI(aURI);
|
loadInfo->SetResultPrincipalURI(aURI);
|
||||||
loadState->SetResultPrincipalURIIsSome(true);
|
loadInfo->SetResultPrincipalURIIsSome(true);
|
||||||
loadState->SetKeepResultPrincipalURIIfSet(true);
|
loadInfo->SetKeepResultPrincipalURIIfSet(true);
|
||||||
|
|
||||||
// Set the triggering pricipal to aPrincipal if available, or current
|
// Set the triggering pricipal to aPrincipal if available, or current
|
||||||
// document's principal otherwise.
|
// document's principal otherwise.
|
||||||
|
|
@ -6160,8 +6297,8 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal, int32_t aDel
|
||||||
}
|
}
|
||||||
principal = doc->NodePrincipal();
|
principal = doc->NodePrincipal();
|
||||||
}
|
}
|
||||||
loadState->SetTriggeringPrincipal(principal);
|
loadInfo->SetTriggeringPrincipal(principal);
|
||||||
loadState->SetPrincipalIsExplicit(true);
|
loadInfo->SetPrincipalIsExplicit(true);
|
||||||
|
|
||||||
/* Check if this META refresh causes a redirection
|
/* Check if this META refresh causes a redirection
|
||||||
* to another site.
|
* to another site.
|
||||||
|
|
@ -6174,7 +6311,7 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal, int32_t aDel
|
||||||
* we have in mind (15000 ms as defined by REFRESH_REDIRECT_TIMER).
|
* we have in mind (15000 ms as defined by REFRESH_REDIRECT_TIMER).
|
||||||
* Pass a REPLACE flag to LoadURI().
|
* Pass a REPLACE flag to LoadURI().
|
||||||
*/
|
*/
|
||||||
loadState->SetLoadType(LOAD_NORMAL_REPLACE);
|
loadInfo->SetLoadType(LOAD_NORMAL_REPLACE);
|
||||||
|
|
||||||
/* for redirects we mimic HTTP, which passes the
|
/* for redirects we mimic HTTP, which passes the
|
||||||
* original referrer
|
* original referrer
|
||||||
|
|
@ -6182,21 +6319,17 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal, int32_t aDel
|
||||||
nsCOMPtr<nsIURI> internalReferrer;
|
nsCOMPtr<nsIURI> internalReferrer;
|
||||||
GetReferringURI(getter_AddRefs(internalReferrer));
|
GetReferringURI(getter_AddRefs(internalReferrer));
|
||||||
if (internalReferrer) {
|
if (internalReferrer) {
|
||||||
loadState->SetReferrer(internalReferrer);
|
loadInfo->SetReferrer(internalReferrer);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
loadState->SetLoadType(LOAD_REFRESH);
|
loadInfo->SetLoadType(LOAD_REFRESH);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadState->SetURI(aURI);
|
|
||||||
loadState->SetLoadFlags(nsIWebNavigation::LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL);
|
|
||||||
loadState->SetFirstParty(true);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* LoadURI(...) will cancel all refresh timers... This causes the
|
* LoadURI(...) will cancel all refresh timers... This causes the
|
||||||
* Timer and its refreshData instance to be released...
|
* Timer and its refreshData instance to be released...
|
||||||
*/
|
*/
|
||||||
LoadURI(loadState);
|
LoadURI(aURI, loadInfo, nsIWebNavigation::LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL, true);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -8962,7 +9095,7 @@ public:
|
||||||
nsIPrincipal* aTriggeringPrincipal,
|
nsIPrincipal* aTriggeringPrincipal,
|
||||||
nsIPrincipal* aPrincipalToInherit,
|
nsIPrincipal* aPrincipalToInherit,
|
||||||
uint32_t aFlags,
|
uint32_t aFlags,
|
||||||
const nsACString& aTypeHint,
|
const char* aTypeHint,
|
||||||
nsIInputStream* aPostData,
|
nsIInputStream* aPostData,
|
||||||
nsIInputStream* aHeadersData,
|
nsIInputStream* aHeadersData,
|
||||||
uint32_t aLoadType,
|
uint32_t aLoadType,
|
||||||
|
|
@ -8972,7 +9105,6 @@ public:
|
||||||
nsIDocShell* aSourceDocShell,
|
nsIDocShell* aSourceDocShell,
|
||||||
nsIURI* aBaseURI)
|
nsIURI* aBaseURI)
|
||||||
: mozilla::Runnable("InternalLoadEvent")
|
: mozilla::Runnable("InternalLoadEvent")
|
||||||
, mTypeHint(aTypeHint)
|
|
||||||
, mSrcdoc(aSrcdoc)
|
, mSrcdoc(aSrcdoc)
|
||||||
, mDocShell(aDocShell)
|
, mDocShell(aDocShell)
|
||||||
, mURI(aURI)
|
, mURI(aURI)
|
||||||
|
|
@ -8993,6 +9125,12 @@ public:
|
||||||
, mSourceDocShell(aSourceDocShell)
|
, mSourceDocShell(aSourceDocShell)
|
||||||
, mBaseURI(aBaseURI)
|
, mBaseURI(aBaseURI)
|
||||||
{
|
{
|
||||||
|
// Make sure to keep null things null as needed
|
||||||
|
if (aTypeHint) {
|
||||||
|
mTypeHint = aTypeHint;
|
||||||
|
} else {
|
||||||
|
mTypeHint.SetIsVoid(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHOD
|
NS_IMETHOD
|
||||||
|
|
@ -9005,7 +9143,8 @@ public:
|
||||||
mReferrerPolicy,
|
mReferrerPolicy,
|
||||||
mTriggeringPrincipal, mPrincipalToInherit,
|
mTriggeringPrincipal, mPrincipalToInherit,
|
||||||
mFlags, EmptyString(),
|
mFlags, EmptyString(),
|
||||||
mTypeHint,
|
mTypeHint.IsVoid() ? nullptr
|
||||||
|
: mTypeHint.get(),
|
||||||
VoidString(), mPostData,
|
VoidString(), mPostData,
|
||||||
mHeadersData, mLoadType, mSHEntry,
|
mHeadersData, mLoadType, mSHEntry,
|
||||||
mFirstParty, mSrcdoc, mSourceDocShell,
|
mFirstParty, mSrcdoc, mSourceDocShell,
|
||||||
|
|
@ -9076,7 +9215,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
||||||
nsIPrincipal* aPrincipalToInherit,
|
nsIPrincipal* aPrincipalToInherit,
|
||||||
uint32_t aFlags,
|
uint32_t aFlags,
|
||||||
const nsAString& aWindowTarget,
|
const nsAString& aWindowTarget,
|
||||||
const nsACString& aTypeHint,
|
const char* aTypeHint,
|
||||||
const nsAString& aFileName,
|
const nsAString& aFileName,
|
||||||
nsIInputStream* aPostData,
|
nsIInputStream* aPostData,
|
||||||
nsIInputStream* aHeadersData,
|
nsIInputStream* aHeadersData,
|
||||||
|
|
@ -9357,31 +9496,31 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
||||||
MOZ_ASSERT(!aSHEntry);
|
MOZ_ASSERT(!aSHEntry);
|
||||||
MOZ_ASSERT(aFirstParty); // Windowwatcher will assume this.
|
MOZ_ASSERT(aFirstParty); // Windowwatcher will assume this.
|
||||||
|
|
||||||
RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState();
|
RefPtr<nsDocShellLoadInfo> loadInfo = new nsDocShellLoadInfo();
|
||||||
|
|
||||||
// Set up our loadinfo so it will do the load as much like we would have
|
// Set up our loadinfo so it will do the load as much like we would have
|
||||||
// as possible.
|
// as possible.
|
||||||
loadState->SetReferrer(aReferrer);
|
loadInfo->SetReferrer(aReferrer);
|
||||||
loadState->SetReferrerPolicy((mozilla::net::ReferrerPolicy)aReferrerPolicy);
|
loadInfo->SetReferrerPolicy((mozilla::net::ReferrerPolicy)aReferrerPolicy);
|
||||||
loadState->SetSendReferrer(!(aFlags &
|
loadInfo->SetSendReferrer(!(aFlags &
|
||||||
INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER));
|
INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER));
|
||||||
loadState->SetOriginalURI(aOriginalURI);
|
loadInfo->SetOriginalURI(aOriginalURI);
|
||||||
loadState->SetMaybeResultPrincipalURI(aResultPrincipalURI);
|
loadInfo->SetMaybeResultPrincipalURI(aResultPrincipalURI);
|
||||||
loadState->SetKeepResultPrincipalURIIfSet(aKeepResultPrincipalURIIfSet);
|
loadInfo->SetKeepResultPrincipalURIIfSet(aKeepResultPrincipalURIIfSet);
|
||||||
loadState->SetLoadReplace(aLoadReplace);
|
loadInfo->SetLoadReplace(aLoadReplace);
|
||||||
loadState->SetTriggeringPrincipal(aTriggeringPrincipal);
|
loadInfo->SetTriggeringPrincipal(aTriggeringPrincipal);
|
||||||
loadState->SetInheritPrincipal(
|
loadInfo->SetInheritPrincipal(
|
||||||
aFlags & INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL);
|
aFlags & INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL);
|
||||||
// Explicit principal because we do not want any guesses as to what the
|
// Explicit principal because we do not want any guesses as to what the
|
||||||
// principal to inherit is: it should be aTriggeringPrincipal.
|
// principal to inherit is: it should be aTriggeringPrincipal.
|
||||||
loadState->SetPrincipalIsExplicit(true);
|
loadInfo->SetPrincipalIsExplicit(true);
|
||||||
loadState->SetLoadType(LOAD_LINK);
|
loadInfo->SetLoadType(LOAD_LINK);
|
||||||
loadState->SetForceAllowDataURI(aFlags & INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI);
|
loadInfo->SetForceAllowDataURI(aFlags & INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI);
|
||||||
|
|
||||||
rv = win->Open(NS_ConvertUTF8toUTF16(spec),
|
rv = win->Open(NS_ConvertUTF8toUTF16(spec),
|
||||||
aWindowTarget, // window name
|
aWindowTarget, // window name
|
||||||
EmptyString(), // Features
|
EmptyString(), // Features
|
||||||
loadState,
|
loadInfo,
|
||||||
true, // aForceNoOpener
|
true, // aForceNoOpener
|
||||||
getter_AddRefs(newWin));
|
getter_AddRefs(newWin));
|
||||||
MOZ_ASSERT(!newWin);
|
MOZ_ASSERT(!newWin);
|
||||||
|
|
@ -10192,7 +10331,7 @@ nsDocShell::DoURILoad(nsIURI* aURI,
|
||||||
uint32_t aReferrerPolicy,
|
uint32_t aReferrerPolicy,
|
||||||
nsIPrincipal* aTriggeringPrincipal,
|
nsIPrincipal* aTriggeringPrincipal,
|
||||||
nsIPrincipal* aPrincipalToInherit,
|
nsIPrincipal* aPrincipalToInherit,
|
||||||
const nsACString& aTypeHint,
|
const char* aTypeHint,
|
||||||
const nsAString& aFileName,
|
const nsAString& aFileName,
|
||||||
nsIInputStream* aPostData,
|
nsIInputStream* aPostData,
|
||||||
nsIInputStream* aHeadersData,
|
nsIInputStream* aHeadersData,
|
||||||
|
|
@ -10541,8 +10680,8 @@ nsDocShell::DoURILoad(nsIURI* aURI,
|
||||||
loadInfo->SetResultPrincipalURI(aResultPrincipalURI.ref());
|
loadInfo->SetResultPrincipalURI(aResultPrincipalURI.ref());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!aTypeHint.IsVoid()) {
|
if (aTypeHint && *aTypeHint) {
|
||||||
channel->SetContentType(aTypeHint);
|
channel->SetContentType(nsDependentCString(aTypeHint));
|
||||||
mContentTypeHint = aTypeHint;
|
mContentTypeHint = aTypeHint;
|
||||||
} else {
|
} else {
|
||||||
mContentTypeHint.Truncate();
|
mContentTypeHint.Truncate();
|
||||||
|
|
@ -12096,7 +12235,7 @@ nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry, uint32_t aLoadType)
|
||||||
principalToInherit,
|
principalToInherit,
|
||||||
flags,
|
flags,
|
||||||
EmptyString(), // No window target
|
EmptyString(), // No window target
|
||||||
contentType, // Type hint
|
contentType.get(), // Type hint
|
||||||
VoidString(), // No forced file download
|
VoidString(), // No forced file download
|
||||||
postData, // Post data stream
|
postData, // Post data stream
|
||||||
nullptr, // No headers stream
|
nullptr, // No headers stream
|
||||||
|
|
@ -13284,7 +13423,7 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent,
|
||||||
aContent->NodePrincipal(),
|
aContent->NodePrincipal(),
|
||||||
flags,
|
flags,
|
||||||
target, // Window target
|
target, // Window target
|
||||||
NS_LossyConvertUTF16toASCII(typeHint),
|
NS_LossyConvertUTF16toASCII(typeHint).get(),
|
||||||
aFileName, // Download as file
|
aFileName, // Download as file
|
||||||
aPostDataStream, // Post data stream
|
aPostDataStream, // Post data stream
|
||||||
aHeadersDataStream, // Headers stream
|
aHeadersDataStream, // Headers stream
|
||||||
|
|
|
||||||
|
|
@ -534,7 +534,7 @@ private: // member functions
|
||||||
uint32_t aReferrerPolicy,
|
uint32_t aReferrerPolicy,
|
||||||
nsIPrincipal* aTriggeringPrincipal,
|
nsIPrincipal* aTriggeringPrincipal,
|
||||||
nsIPrincipal* aPrincipalToInherit,
|
nsIPrincipal* aPrincipalToInherit,
|
||||||
const nsACString& aTypeHint,
|
const char* aTypeHint,
|
||||||
const nsAString& aFileName,
|
const nsAString& aFileName,
|
||||||
nsIInputStream* aPostData,
|
nsIInputStream* aPostData,
|
||||||
nsIInputStream* aHeadersData,
|
nsIInputStream* aHeadersData,
|
||||||
|
|
@ -905,14 +905,6 @@ private: // member functions
|
||||||
return mCSSErrorReportingEnabled;
|
return mCSSErrorReportingEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handles retrieval of subframe session history for nsDocShell::LoadURI. If a
|
|
||||||
// load is requested in a subframe of the current DocShell, the subframe
|
|
||||||
// loadType may need to reflect the loadType of the parent document, or in
|
|
||||||
// some cases (like reloads), the history load may need to be cancelled. See
|
|
||||||
// function comments for in-depth logic descriptions.
|
|
||||||
void
|
|
||||||
MaybeHandleSubframeHistory(nsDocShellLoadState* aLoadState);
|
|
||||||
|
|
||||||
private: // data members
|
private: // data members
|
||||||
static nsIURIFixup* sURIFixup;
|
static nsIURIFixup* sURIFixup;
|
||||||
|
|
||||||
|
|
|
||||||
318
docshell/base/nsDocShellLoadInfo.cpp
Normal file
318
docshell/base/nsDocShellLoadInfo.cpp
Normal file
|
|
@ -0,0 +1,318 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#include "nsDocShellLoadInfo.h"
|
||||||
|
#include "nsISHEntry.h"
|
||||||
|
#include "nsIInputStream.h"
|
||||||
|
#include "nsIURI.h"
|
||||||
|
#include "nsIDocShell.h"
|
||||||
|
#include "mozilla/net/ReferrerPolicy.h"
|
||||||
|
#include "mozilla/Unused.h"
|
||||||
|
#include "mozilla/Maybe.h"
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
|
||||||
|
|
||||||
|
} // mozilla
|
||||||
|
|
||||||
|
nsDocShellLoadInfo::nsDocShellLoadInfo()
|
||||||
|
: mResultPrincipalURIIsSome(false)
|
||||||
|
, mKeepResultPrincipalURIIfSet(false)
|
||||||
|
, mLoadReplace(false)
|
||||||
|
, mInheritPrincipal(false)
|
||||||
|
, mPrincipalIsExplicit(false)
|
||||||
|
, mForceAllowDataURI(false)
|
||||||
|
, mOriginalFrameSrc(false)
|
||||||
|
, mSendReferrer(true)
|
||||||
|
, mReferrerPolicy(mozilla::net::RP_Unset)
|
||||||
|
, mLoadType(LOAD_NORMAL)
|
||||||
|
, mIsSrcdocLoad(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
nsDocShellLoadInfo::~nsDocShellLoadInfo()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
nsIURI*
|
||||||
|
nsDocShellLoadInfo::Referrer() const
|
||||||
|
{
|
||||||
|
return mReferrer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetReferrer(nsIURI* aReferrer)
|
||||||
|
{
|
||||||
|
mReferrer = aReferrer;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsIURI*
|
||||||
|
nsDocShellLoadInfo::OriginalURI() const
|
||||||
|
{
|
||||||
|
return mOriginalURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetOriginalURI(nsIURI* aOriginalURI)
|
||||||
|
{
|
||||||
|
mOriginalURI = aOriginalURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsIURI*
|
||||||
|
nsDocShellLoadInfo::ResultPrincipalURI() const
|
||||||
|
{
|
||||||
|
return mResultPrincipalURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetResultPrincipalURI(nsIURI* aResultPrincipalURI)
|
||||||
|
{
|
||||||
|
mResultPrincipalURI = aResultPrincipalURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
nsDocShellLoadInfo::ResultPrincipalURIIsSome() const
|
||||||
|
{
|
||||||
|
return mResultPrincipalURIIsSome;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetResultPrincipalURIIsSome(bool aIsSome)
|
||||||
|
{
|
||||||
|
mResultPrincipalURIIsSome = aIsSome;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
nsDocShellLoadInfo::KeepResultPrincipalURIIfSet() const
|
||||||
|
{
|
||||||
|
return mKeepResultPrincipalURIIfSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetKeepResultPrincipalURIIfSet(bool aKeep)
|
||||||
|
{
|
||||||
|
mKeepResultPrincipalURIIfSet = aKeep;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
nsDocShellLoadInfo::LoadReplace() const
|
||||||
|
{
|
||||||
|
return mLoadReplace;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetLoadReplace(bool aLoadReplace)
|
||||||
|
{
|
||||||
|
mLoadReplace = aLoadReplace;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsIPrincipal*
|
||||||
|
nsDocShellLoadInfo::TriggeringPrincipal() const
|
||||||
|
{
|
||||||
|
return mTriggeringPrincipal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetTriggeringPrincipal(nsIPrincipal* aTriggeringPrincipal)
|
||||||
|
{
|
||||||
|
mTriggeringPrincipal = aTriggeringPrincipal;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
nsDocShellLoadInfo::InheritPrincipal() const
|
||||||
|
{
|
||||||
|
return mInheritPrincipal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetInheritPrincipal(bool aInheritPrincipal)
|
||||||
|
{
|
||||||
|
mInheritPrincipal = aInheritPrincipal;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
nsDocShellLoadInfo::PrincipalIsExplicit() const
|
||||||
|
{
|
||||||
|
return mPrincipalIsExplicit;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetPrincipalIsExplicit(bool aPrincipalIsExplicit)
|
||||||
|
{
|
||||||
|
mPrincipalIsExplicit = aPrincipalIsExplicit;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
nsDocShellLoadInfo::ForceAllowDataURI() const
|
||||||
|
{
|
||||||
|
return mForceAllowDataURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetForceAllowDataURI(bool aForceAllowDataURI)
|
||||||
|
{
|
||||||
|
mForceAllowDataURI = aForceAllowDataURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
nsDocShellLoadInfo::OriginalFrameSrc() const
|
||||||
|
{
|
||||||
|
return mOriginalFrameSrc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetOriginalFrameSrc(bool aOriginalFrameSrc)
|
||||||
|
{
|
||||||
|
mOriginalFrameSrc = aOriginalFrameSrc;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
nsDocShellLoadInfo::LoadType() const
|
||||||
|
{
|
||||||
|
return mLoadType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetLoadType(uint32_t aLoadType)
|
||||||
|
{
|
||||||
|
mLoadType = aLoadType;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsISHEntry*
|
||||||
|
nsDocShellLoadInfo::SHEntry() const
|
||||||
|
{
|
||||||
|
return mSHEntry;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetSHEntry(nsISHEntry* aSHEntry)
|
||||||
|
{
|
||||||
|
mSHEntry = aSHEntry;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::GetTarget(nsAString& aTarget) const
|
||||||
|
{
|
||||||
|
aTarget = mTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetTarget(const nsAString& aTarget)
|
||||||
|
{
|
||||||
|
mTarget = aTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsIInputStream*
|
||||||
|
nsDocShellLoadInfo::PostDataStream() const
|
||||||
|
{
|
||||||
|
return mPostDataStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetPostDataStream(nsIInputStream* aStream)
|
||||||
|
{
|
||||||
|
mPostDataStream = aStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsIInputStream*
|
||||||
|
nsDocShellLoadInfo::HeadersStream() const
|
||||||
|
{
|
||||||
|
return mHeadersStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetHeadersStream(nsIInputStream* aHeadersStream)
|
||||||
|
{
|
||||||
|
mHeadersStream = aHeadersStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
nsDocShellLoadInfo::SendReferrer() const
|
||||||
|
{
|
||||||
|
return mSendReferrer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetSendReferrer(bool aSendReferrer)
|
||||||
|
{
|
||||||
|
mSendReferrer = aSendReferrer;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
nsDocShellLoadInfo::ReferrerPolicy() const
|
||||||
|
{
|
||||||
|
return mReferrerPolicy;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetReferrerPolicy(mozilla::net::ReferrerPolicy aReferrerPolicy)
|
||||||
|
{
|
||||||
|
mReferrerPolicy = aReferrerPolicy;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
nsDocShellLoadInfo::IsSrcdocLoad() const
|
||||||
|
{
|
||||||
|
return mIsSrcdocLoad;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::GetSrcdocData(nsAString& aSrcdocData) const
|
||||||
|
{
|
||||||
|
aSrcdocData = mSrcdocData;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetSrcdocData(const nsAString& aSrcdocData)
|
||||||
|
{
|
||||||
|
mSrcdocData = aSrcdocData;
|
||||||
|
mIsSrcdocLoad = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsIDocShell*
|
||||||
|
nsDocShellLoadInfo::SourceDocShell() const
|
||||||
|
{
|
||||||
|
return mSourceDocShell;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetSourceDocShell(nsIDocShell* aSourceDocShell)
|
||||||
|
{
|
||||||
|
mSourceDocShell = aSourceDocShell;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsIURI*
|
||||||
|
nsDocShellLoadInfo::BaseURI() const
|
||||||
|
{
|
||||||
|
return mBaseURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetBaseURI(nsIURI* aBaseURI)
|
||||||
|
{
|
||||||
|
mBaseURI = aBaseURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::GetMaybeResultPrincipalURI(mozilla::Maybe<nsCOMPtr<nsIURI>>& aRPURI) const
|
||||||
|
{
|
||||||
|
bool isSome = ResultPrincipalURIIsSome();
|
||||||
|
aRPURI.reset();
|
||||||
|
|
||||||
|
if (!isSome) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIURI> uri = ResultPrincipalURI();
|
||||||
|
aRPURI.emplace(std::move(uri));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocShellLoadInfo::SetMaybeResultPrincipalURI(mozilla::Maybe<nsCOMPtr<nsIURI>> const& aRPURI)
|
||||||
|
{
|
||||||
|
SetResultPrincipalURI(aRPURI.refOr(nullptr));
|
||||||
|
SetResultPrincipalURIIsSome(aRPURI.isSome());
|
||||||
|
}
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef nsDocShellLoadState_h__
|
#ifndef nsDocShellLoadInfo_h__
|
||||||
#define nsDocShellLoadState_h__
|
#define nsDocShellLoadInfo_h__
|
||||||
|
|
||||||
// Helper Classes
|
// Helper Classes
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
|
@ -17,29 +17,22 @@ class nsIInputStream;
|
||||||
class nsISHEntry;
|
class nsISHEntry;
|
||||||
class nsIURI;
|
class nsIURI;
|
||||||
class nsIDocShell;
|
class nsIDocShell;
|
||||||
class OriginAttibutes;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nsDocShellLoadState contains setup information used in a nsIDocShell::loadURI
|
* nsDocShellLoadInfo contains setup information used in a nsIDocShell::loadURI
|
||||||
* call.
|
* call.
|
||||||
*/
|
*/
|
||||||
class nsDocShellLoadState final
|
class nsDocShellLoadInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_INLINE_DECL_REFCOUNTING(nsDocShellLoadState);
|
NS_INLINE_DECL_REFCOUNTING(nsDocShellLoadInfo);
|
||||||
|
|
||||||
nsDocShellLoadState();
|
nsDocShellLoadInfo();
|
||||||
|
|
||||||
// Getters and Setters
|
|
||||||
|
|
||||||
nsIURI* Referrer() const;
|
nsIURI* Referrer() const;
|
||||||
|
|
||||||
void SetReferrer(nsIURI* aReferrer);
|
void SetReferrer(nsIURI* aReferrer);
|
||||||
|
|
||||||
nsIURI* URI() const;
|
|
||||||
|
|
||||||
void SetURI(nsIURI* aURI);
|
|
||||||
|
|
||||||
nsIURI* OriginalURI() const;
|
nsIURI* OriginalURI() const;
|
||||||
|
|
||||||
void SetOriginalURI(nsIURI* aOriginalURI);
|
void SetOriginalURI(nsIURI* aOriginalURI);
|
||||||
|
|
@ -56,10 +49,6 @@ public:
|
||||||
|
|
||||||
void SetKeepResultPrincipalURIIfSet(bool aKeep);
|
void SetKeepResultPrincipalURIIfSet(bool aKeep);
|
||||||
|
|
||||||
nsIPrincipal* PrincipalToInherit() const;
|
|
||||||
|
|
||||||
void SetPrincipalToInherit(nsIPrincipal* aPrincipalToInherit);
|
|
||||||
|
|
||||||
bool LoadReplace() const;
|
bool LoadReplace() const;
|
||||||
|
|
||||||
void SetLoadReplace(bool aLoadReplace);
|
void SetLoadReplace(bool aLoadReplace);
|
||||||
|
|
@ -92,7 +81,7 @@ public:
|
||||||
|
|
||||||
void SetSHEntry(nsISHEntry* aSHEntry);
|
void SetSHEntry(nsISHEntry* aSHEntry);
|
||||||
|
|
||||||
const nsString& Target() const;
|
void GetTarget(nsAString& aTarget) const;
|
||||||
|
|
||||||
void SetTarget(const nsAString& aTarget);
|
void SetTarget(const nsAString& aTarget);
|
||||||
|
|
||||||
|
|
@ -114,7 +103,7 @@ public:
|
||||||
|
|
||||||
bool IsSrcdocLoad() const;
|
bool IsSrcdocLoad() const;
|
||||||
|
|
||||||
const nsString& SrcdocData() const;
|
void GetSrcdocData(nsAString& aSrcdocData) const;
|
||||||
|
|
||||||
void SetSrcdocData(const nsAString& aSrcdocData);
|
void SetSrcdocData(const nsAString& aSrcdocData);
|
||||||
|
|
||||||
|
|
@ -134,54 +123,13 @@ public:
|
||||||
void
|
void
|
||||||
SetMaybeResultPrincipalURI(mozilla::Maybe<nsCOMPtr<nsIURI>> const& aRPURI);
|
SetMaybeResultPrincipalURI(mozilla::Maybe<nsCOMPtr<nsIURI>> const& aRPURI);
|
||||||
|
|
||||||
uint32_t LoadFlags() const;
|
|
||||||
|
|
||||||
void SetLoadFlags(uint32_t aFlags);
|
|
||||||
|
|
||||||
bool FirstParty() const;
|
|
||||||
|
|
||||||
void SetFirstParty(bool aFirstParty);
|
|
||||||
|
|
||||||
const nsCString& TypeHint() const;
|
|
||||||
|
|
||||||
void SetTypeHint(const nsCString& aTypeHint);
|
|
||||||
|
|
||||||
const nsString& FileName() const;
|
|
||||||
|
|
||||||
void SetFileName(const nsAString& aFileName);
|
|
||||||
|
|
||||||
uint32_t DocShellInternalLoadFlags() const;
|
|
||||||
|
|
||||||
void SetDocShellInternalLoadFlags(uint32_t aFlags);
|
|
||||||
|
|
||||||
// Give the type of DocShell we're loading into (chrome/content/etc) and
|
|
||||||
// origin attributes for the URI we're loading, figure out if we should
|
|
||||||
// inherit our principal from the document the load was requested from, or
|
|
||||||
// else if the principal should be set up later in the process (after loads).
|
|
||||||
// See comments in function for more info on principal selection algorithm
|
|
||||||
nsresult SetupInheritingPrincipal(uint32_t aItemType, const mozilla::OriginAttributes& aOriginAttributes);
|
|
||||||
|
|
||||||
// If no triggering principal exists at the moment, create one using referrer
|
|
||||||
// information and origin attributes.
|
|
||||||
nsresult SetupTriggeringPrincipal(const mozilla::OriginAttributes& aOriginAttributes);
|
|
||||||
|
|
||||||
// When loading a document through nsDocShell::LoadURI(), a special set of
|
|
||||||
// flags needs to be set based on other values in nsDocShellLoadState. This
|
|
||||||
// function calculates those flags, before the LoadState is passed to
|
|
||||||
// nsDocShell::InternalLoad.
|
|
||||||
void CalculateDocShellInternalLoadFlags();
|
|
||||||
protected:
|
protected:
|
||||||
// Destructor can't be defaulted or inlined, as header doesn't have all type
|
virtual ~nsDocShellLoadInfo();
|
||||||
// includes it needs to do so.
|
|
||||||
~nsDocShellLoadState();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// This is the referrer for the load.
|
// This is the referrer for the load.
|
||||||
nsCOMPtr<nsIURI> mReferrer;
|
nsCOMPtr<nsIURI> mReferrer;
|
||||||
|
|
||||||
// The URI we are navigating to. Will not be null once set.
|
|
||||||
nsCOMPtr<nsIURI> mURI;
|
|
||||||
|
|
||||||
// The originalURI to be passed to nsIDocShell.internalLoad. May be null.
|
// The originalURI to be passed to nsIDocShell.internalLoad. May be null.
|
||||||
nsCOMPtr<nsIURI> mOriginalURI;
|
nsCOMPtr<nsIURI> mOriginalURI;
|
||||||
|
|
||||||
|
|
@ -214,12 +162,6 @@ protected:
|
||||||
// for a content docshell the load fails.
|
// for a content docshell the load fails.
|
||||||
bool mPrincipalIsExplicit;
|
bool mPrincipalIsExplicit;
|
||||||
|
|
||||||
// Principal we're inheriting. If null, this means the principal should be
|
|
||||||
// inherited from the current document. If set to NullPrincipal, the channel
|
|
||||||
// will fill in principal information later in the load. See internal function
|
|
||||||
// comments for more info.
|
|
||||||
nsCOMPtr<nsIPrincipal> mPrincipalToInherit;
|
|
||||||
|
|
||||||
// If this attribute is true, then a top-level navigation
|
// If this attribute is true, then a top-level navigation
|
||||||
// to a data URI will be allowed.
|
// to a data URI will be allowed.
|
||||||
bool mForceAllowDataURI;
|
bool mForceAllowDataURI;
|
||||||
|
|
@ -267,27 +209,6 @@ protected:
|
||||||
// Used for srcdoc loads to give view-source knowledge of the load's base URI
|
// Used for srcdoc loads to give view-source knowledge of the load's base URI
|
||||||
// as this information isn't embedded in the load's URI.
|
// as this information isn't embedded in the load's URI.
|
||||||
nsCOMPtr<nsIURI> mBaseURI;
|
nsCOMPtr<nsIURI> mBaseURI;
|
||||||
|
|
||||||
// Set of Load Flags, taken from nsDocShellLoadTypes.h
|
|
||||||
uint32_t mLoadFlags;
|
|
||||||
|
|
||||||
// Is this a First Party Load?
|
|
||||||
bool mFirstParty;
|
|
||||||
|
|
||||||
// A hint as to the content-type of the resulting data. If no hint, IsVoid()
|
|
||||||
// should return true.
|
|
||||||
nsCString mTypeHint;
|
|
||||||
|
|
||||||
// Non-void when the link should be downloaded as the given filename.
|
|
||||||
// mFileName being non-void but empty means that no filename hint was
|
|
||||||
// specified, but link should still trigger a download. If not a download,
|
|
||||||
// mFileName.IsVoid() should return true.
|
|
||||||
nsString mFileName;
|
|
||||||
|
|
||||||
// LoadFlags calculated in nsDocShell::LoadURI and passed to
|
|
||||||
// nsDocShell::InternalLoad, taken from the INTERNAL_LOAD consts in
|
|
||||||
// nsIDocShell.idl
|
|
||||||
uint32_t mDocShellInternalLoadFlags;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* nsDocShellLoadState_h__ */
|
#endif /* nsDocShellLoadInfo_h__ */
|
||||||
|
|
@ -1,554 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#include "nsDocShellLoadState.h"
|
|
||||||
#include "nsIDocShell.h"
|
|
||||||
#include "nsIDocShellTreeItem.h"
|
|
||||||
#include "nsIScriptSecurityManager.h"
|
|
||||||
#include "nsIWebNavigation.h"
|
|
||||||
|
|
||||||
#include "mozilla/OriginAttributes.h"
|
|
||||||
#include "mozilla/NullPrincipal.h"
|
|
||||||
|
|
||||||
nsDocShellLoadState::nsDocShellLoadState()
|
|
||||||
: mResultPrincipalURIIsSome(false)
|
|
||||||
, mKeepResultPrincipalURIIfSet(false)
|
|
||||||
, mLoadReplace(false)
|
|
||||||
, mInheritPrincipal(false)
|
|
||||||
, mPrincipalIsExplicit(false)
|
|
||||||
, mForceAllowDataURI(false)
|
|
||||||
, mOriginalFrameSrc(false)
|
|
||||||
, mSendReferrer(true)
|
|
||||||
, mReferrerPolicy(mozilla::net::RP_Unset)
|
|
||||||
, mLoadType(LOAD_NORMAL)
|
|
||||||
, mIsSrcdocLoad(false)
|
|
||||||
, mLoadFlags(0)
|
|
||||||
, mFirstParty(false)
|
|
||||||
, mTypeHint(VoidCString())
|
|
||||||
, mFileName(VoidString())
|
|
||||||
, mDocShellInternalLoadFlags(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
nsDocShellLoadState::~nsDocShellLoadState()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIURI*
|
|
||||||
nsDocShellLoadState::Referrer() const
|
|
||||||
{
|
|
||||||
return mReferrer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetReferrer(nsIURI* aReferrer)
|
|
||||||
{
|
|
||||||
mReferrer = aReferrer;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIURI*
|
|
||||||
nsDocShellLoadState::URI() const
|
|
||||||
{
|
|
||||||
return mURI;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetURI(nsIURI* aURI)
|
|
||||||
{
|
|
||||||
mURI = aURI;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIURI*
|
|
||||||
nsDocShellLoadState::OriginalURI() const
|
|
||||||
{
|
|
||||||
return mOriginalURI;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetOriginalURI(nsIURI* aOriginalURI)
|
|
||||||
{
|
|
||||||
mOriginalURI = aOriginalURI;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIURI*
|
|
||||||
nsDocShellLoadState::ResultPrincipalURI() const
|
|
||||||
{
|
|
||||||
return mResultPrincipalURI;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetResultPrincipalURI(nsIURI* aResultPrincipalURI)
|
|
||||||
{
|
|
||||||
mResultPrincipalURI = aResultPrincipalURI;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
nsDocShellLoadState::ResultPrincipalURIIsSome() const
|
|
||||||
{
|
|
||||||
return mResultPrincipalURIIsSome;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetResultPrincipalURIIsSome(bool aIsSome)
|
|
||||||
{
|
|
||||||
mResultPrincipalURIIsSome = aIsSome;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
nsDocShellLoadState::KeepResultPrincipalURIIfSet() const
|
|
||||||
{
|
|
||||||
return mKeepResultPrincipalURIIfSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetKeepResultPrincipalURIIfSet(bool aKeep)
|
|
||||||
{
|
|
||||||
mKeepResultPrincipalURIIfSet = aKeep;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
nsDocShellLoadState::LoadReplace() const
|
|
||||||
{
|
|
||||||
return mLoadReplace;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetLoadReplace(bool aLoadReplace)
|
|
||||||
{
|
|
||||||
mLoadReplace = aLoadReplace;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIPrincipal*
|
|
||||||
nsDocShellLoadState::TriggeringPrincipal() const
|
|
||||||
{
|
|
||||||
return mTriggeringPrincipal;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetTriggeringPrincipal(nsIPrincipal* aTriggeringPrincipal)
|
|
||||||
{
|
|
||||||
mTriggeringPrincipal = aTriggeringPrincipal;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIPrincipal*
|
|
||||||
nsDocShellLoadState::PrincipalToInherit() const
|
|
||||||
{
|
|
||||||
return mPrincipalToInherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetPrincipalToInherit(nsIPrincipal* aPrincipalToInherit)
|
|
||||||
{
|
|
||||||
mPrincipalToInherit = aPrincipalToInherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
nsDocShellLoadState::InheritPrincipal() const
|
|
||||||
{
|
|
||||||
return mInheritPrincipal;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetInheritPrincipal(bool aInheritPrincipal)
|
|
||||||
{
|
|
||||||
mInheritPrincipal = aInheritPrincipal;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
nsDocShellLoadState::PrincipalIsExplicit() const
|
|
||||||
{
|
|
||||||
return mPrincipalIsExplicit;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetPrincipalIsExplicit(bool aPrincipalIsExplicit)
|
|
||||||
{
|
|
||||||
mPrincipalIsExplicit = aPrincipalIsExplicit;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
nsDocShellLoadState::ForceAllowDataURI() const
|
|
||||||
{
|
|
||||||
return mForceAllowDataURI;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetForceAllowDataURI(bool aForceAllowDataURI)
|
|
||||||
{
|
|
||||||
mForceAllowDataURI = aForceAllowDataURI;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
nsDocShellLoadState::OriginalFrameSrc() const
|
|
||||||
{
|
|
||||||
return mOriginalFrameSrc;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetOriginalFrameSrc(bool aOriginalFrameSrc)
|
|
||||||
{
|
|
||||||
mOriginalFrameSrc = aOriginalFrameSrc;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t
|
|
||||||
nsDocShellLoadState::LoadType() const
|
|
||||||
{
|
|
||||||
return mLoadType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetLoadType(uint32_t aLoadType)
|
|
||||||
{
|
|
||||||
mLoadType = aLoadType;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsISHEntry*
|
|
||||||
nsDocShellLoadState::SHEntry() const
|
|
||||||
{
|
|
||||||
return mSHEntry;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetSHEntry(nsISHEntry* aSHEntry)
|
|
||||||
{
|
|
||||||
mSHEntry = aSHEntry;
|
|
||||||
}
|
|
||||||
|
|
||||||
const nsString&
|
|
||||||
nsDocShellLoadState::Target() const
|
|
||||||
{
|
|
||||||
return mTarget;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetTarget(const nsAString& aTarget)
|
|
||||||
{
|
|
||||||
mTarget = aTarget;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIInputStream*
|
|
||||||
nsDocShellLoadState::PostDataStream() const
|
|
||||||
{
|
|
||||||
return mPostDataStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetPostDataStream(nsIInputStream* aStream)
|
|
||||||
{
|
|
||||||
mPostDataStream = aStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIInputStream*
|
|
||||||
nsDocShellLoadState::HeadersStream() const
|
|
||||||
{
|
|
||||||
return mHeadersStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetHeadersStream(nsIInputStream* aHeadersStream)
|
|
||||||
{
|
|
||||||
mHeadersStream = aHeadersStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
nsDocShellLoadState::SendReferrer() const
|
|
||||||
{
|
|
||||||
return mSendReferrer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetSendReferrer(bool aSendReferrer)
|
|
||||||
{
|
|
||||||
mSendReferrer = aSendReferrer;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t
|
|
||||||
nsDocShellLoadState::ReferrerPolicy() const
|
|
||||||
{
|
|
||||||
return mReferrerPolicy;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetReferrerPolicy(mozilla::net::ReferrerPolicy aReferrerPolicy)
|
|
||||||
{
|
|
||||||
mReferrerPolicy = aReferrerPolicy;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
nsDocShellLoadState::IsSrcdocLoad() const
|
|
||||||
{
|
|
||||||
return mIsSrcdocLoad;
|
|
||||||
}
|
|
||||||
|
|
||||||
const nsString&
|
|
||||||
nsDocShellLoadState::SrcdocData() const
|
|
||||||
{
|
|
||||||
return mSrcdocData;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetSrcdocData(const nsAString& aSrcdocData)
|
|
||||||
{
|
|
||||||
mSrcdocData = aSrcdocData;
|
|
||||||
mIsSrcdocLoad = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIDocShell*
|
|
||||||
nsDocShellLoadState::SourceDocShell() const
|
|
||||||
{
|
|
||||||
return mSourceDocShell;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetSourceDocShell(nsIDocShell* aSourceDocShell)
|
|
||||||
{
|
|
||||||
mSourceDocShell = aSourceDocShell;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIURI*
|
|
||||||
nsDocShellLoadState::BaseURI() const
|
|
||||||
{
|
|
||||||
return mBaseURI;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetBaseURI(nsIURI* aBaseURI)
|
|
||||||
{
|
|
||||||
mBaseURI = aBaseURI;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::GetMaybeResultPrincipalURI(mozilla::Maybe<nsCOMPtr<nsIURI>>& aRPURI) const
|
|
||||||
{
|
|
||||||
bool isSome = ResultPrincipalURIIsSome();
|
|
||||||
aRPURI.reset();
|
|
||||||
|
|
||||||
if (!isSome) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> uri = ResultPrincipalURI();
|
|
||||||
aRPURI.emplace(std::move(uri));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetMaybeResultPrincipalURI(mozilla::Maybe<nsCOMPtr<nsIURI>> const& aRPURI)
|
|
||||||
{
|
|
||||||
SetResultPrincipalURI(aRPURI.refOr(nullptr));
|
|
||||||
SetResultPrincipalURIIsSome(aRPURI.isSome());
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t
|
|
||||||
nsDocShellLoadState::LoadFlags() const
|
|
||||||
{
|
|
||||||
return mLoadFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetLoadFlags(uint32_t aLoadFlags)
|
|
||||||
{
|
|
||||||
mLoadFlags = aLoadFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
nsDocShellLoadState::FirstParty() const
|
|
||||||
{
|
|
||||||
return mFirstParty;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetFirstParty(bool aFirstParty)
|
|
||||||
{
|
|
||||||
mFirstParty = aFirstParty;
|
|
||||||
}
|
|
||||||
|
|
||||||
const nsCString&
|
|
||||||
nsDocShellLoadState::TypeHint() const
|
|
||||||
{
|
|
||||||
return mTypeHint;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetTypeHint(const nsCString& aTypeHint)
|
|
||||||
{
|
|
||||||
mTypeHint = aTypeHint;
|
|
||||||
}
|
|
||||||
|
|
||||||
const nsString&
|
|
||||||
nsDocShellLoadState::FileName() const
|
|
||||||
{
|
|
||||||
return mFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetFileName(const nsAString& aFileName)
|
|
||||||
{
|
|
||||||
mFileName = aFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t
|
|
||||||
nsDocShellLoadState::DocShellInternalLoadFlags() const
|
|
||||||
{
|
|
||||||
return mDocShellInternalLoadFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::SetDocShellInternalLoadFlags(uint32_t aFlags)
|
|
||||||
{
|
|
||||||
mDocShellInternalLoadFlags = aFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsDocShellLoadState::SetupInheritingPrincipal(uint32_t aItemType,
|
|
||||||
const mozilla::OriginAttributes& aOriginAttributes)
|
|
||||||
{
|
|
||||||
// We need a principalToInherit.
|
|
||||||
//
|
|
||||||
// If principalIsExplicit is not set there are 4 possibilities:
|
|
||||||
// (1) If the system principal or an expanded principal was passed
|
|
||||||
// in and we're a typeContent docshell, inherit the principal
|
|
||||||
// from the current document instead.
|
|
||||||
// (2) In all other cases when the principal passed in is not null,
|
|
||||||
// use that principal.
|
|
||||||
// (3) If the caller has allowed inheriting from the current document,
|
|
||||||
// or if we're being called from system code (eg chrome JS or pure
|
|
||||||
// C++) then inheritPrincipal should be true and InternalLoad will get
|
|
||||||
// a principal from the current document. If none of these things are
|
|
||||||
// true, then
|
|
||||||
// (4) we don't pass a principal into the channel, and a principal will be
|
|
||||||
// created later from the channel's internal data.
|
|
||||||
//
|
|
||||||
// If principalIsExplicit *is* set, there are 4 possibilities
|
|
||||||
// (1) If the system principal or an expanded principal was passed in
|
|
||||||
// and we're a typeContent docshell, return an error.
|
|
||||||
// (2) In all other cases when the principal passed in is not null,
|
|
||||||
// use that principal.
|
|
||||||
// (3) If the caller has allowed inheriting from the current document,
|
|
||||||
// then inheritPrincipal should be true and InternalLoad will get
|
|
||||||
// a principal from the current document. If none of these things are
|
|
||||||
// true, then
|
|
||||||
// (4) we dont' pass a principal into the channel, and a principal will be
|
|
||||||
// created later from the channel's internal data.
|
|
||||||
mPrincipalToInherit = mTriggeringPrincipal;
|
|
||||||
if (mPrincipalToInherit && aItemType != nsIDocShellTreeItem::typeChrome) {
|
|
||||||
if (nsContentUtils::IsSystemPrincipal(mPrincipalToInherit)) {
|
|
||||||
if (mPrincipalIsExplicit) {
|
|
||||||
return NS_ERROR_DOM_SECURITY_ERR;
|
|
||||||
}
|
|
||||||
mPrincipalToInherit = nullptr;
|
|
||||||
mInheritPrincipal = true;
|
|
||||||
} else if (nsContentUtils::IsExpandedPrincipal(mPrincipalToInherit)) {
|
|
||||||
if (mPrincipalIsExplicit) {
|
|
||||||
return NS_ERROR_DOM_SECURITY_ERR;
|
|
||||||
}
|
|
||||||
// Don't inherit from the current page. Just do the safe thing
|
|
||||||
// and pretend that we were loaded by a nullprincipal.
|
|
||||||
//
|
|
||||||
// We didn't inherit OriginAttributes here as ExpandedPrincipal doesn't
|
|
||||||
// have origin attributes.
|
|
||||||
mPrincipalToInherit =
|
|
||||||
NullPrincipal::CreateWithInheritedAttributes(aOriginAttributes,
|
|
||||||
false);
|
|
||||||
mInheritPrincipal = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mPrincipalToInherit && !mInheritPrincipal && !mPrincipalIsExplicit) {
|
|
||||||
// See if there's system or chrome JS code running
|
|
||||||
mInheritPrincipal = nsContentUtils::LegacyIsCallerChromeOrNativeCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mLoadFlags & nsIWebNavigation::LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL) {
|
|
||||||
mInheritPrincipal = false;
|
|
||||||
// If mFirstParty is true and the pref 'privacy.firstparty.isolate' is
|
|
||||||
// enabled, we will set firstPartyDomain on the origin attributes.
|
|
||||||
mPrincipalToInherit =
|
|
||||||
NullPrincipal::CreateWithInheritedAttributes(aOriginAttributes,
|
|
||||||
mFirstParty);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsDocShellLoadState::SetupTriggeringPrincipal(const mozilla::OriginAttributes& aOriginAttributes)
|
|
||||||
{
|
|
||||||
// If the triggeringPrincipal is not set, we first try to create a principal
|
|
||||||
// from the referrer, since the referrer URI reflects the web origin that
|
|
||||||
// triggered the load. If there is no referrer URI, we fall back to using the
|
|
||||||
// SystemPrincipal. It's safe to assume that no provided triggeringPrincipal
|
|
||||||
// and no referrer simulate a load that was triggered by the system. It's
|
|
||||||
// important to note that this block of code needs to appear *after* the block
|
|
||||||
// where we munge the principalToInherit, because otherwise we would never
|
|
||||||
// enter code blocks checking if the principalToInherit is null and we will
|
|
||||||
// end up with a wrong inheritPrincipal flag.
|
|
||||||
if (!mTriggeringPrincipal) {
|
|
||||||
if (mReferrer) {
|
|
||||||
mTriggeringPrincipal =
|
|
||||||
BasePrincipal::CreateCodebasePrincipal(mReferrer, aOriginAttributes);
|
|
||||||
|
|
||||||
if (!mTriggeringPrincipal) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mTriggeringPrincipal = nsContentUtils::GetSystemPrincipal();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDocShellLoadState::CalculateDocShellInternalLoadFlags()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(mDocShellInternalLoadFlags == 0,
|
|
||||||
"Shouldn't have any load flags set at this point.");
|
|
||||||
|
|
||||||
if (mInheritPrincipal) {
|
|
||||||
MOZ_ASSERT(!nsContentUtils::IsSystemPrincipal(mPrincipalToInherit),
|
|
||||||
"Should not inherit SystemPrincipal");
|
|
||||||
mDocShellInternalLoadFlags |=
|
|
||||||
nsIDocShell::INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mSendReferrer) {
|
|
||||||
mDocShellInternalLoadFlags |=
|
|
||||||
nsIDocShell::INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mDocShellInternalLoadFlags & nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP) {
|
|
||||||
mDocShellInternalLoadFlags |=
|
|
||||||
nsIDocShell::INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mDocShellInternalLoadFlags & nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD) {
|
|
||||||
mDocShellInternalLoadFlags |= nsIDocShell::INTERNAL_LOAD_FLAGS_FIRST_LOAD;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mDocShellInternalLoadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_CLASSIFIER) {
|
|
||||||
mDocShellInternalLoadFlags |=
|
|
||||||
nsIDocShell::INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mDocShellInternalLoadFlags & nsIWebNavigation::LOAD_FLAGS_FORCE_ALLOW_COOKIES) {
|
|
||||||
mDocShellInternalLoadFlags |=
|
|
||||||
nsIDocShell::INTERNAL_LOAD_FLAGS_FORCE_ALLOW_COOKIES;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mIsSrcdocLoad) {
|
|
||||||
mDocShellInternalLoadFlags |= nsIDocShell::INTERNAL_LOAD_FLAGS_IS_SRCDOC;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mForceAllowDataURI) {
|
|
||||||
mDocShellInternalLoadFlags |=
|
|
||||||
nsIDocShell::INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mOriginalFrameSrc) {
|
|
||||||
mDocShellInternalLoadFlags |=
|
|
||||||
nsIDocShell::INTERNAL_LOAD_FLAGS_ORIGINAL_FRAME_SRC;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include "nsDOMNavigationTiming.h"
|
#include "nsDOMNavigationTiming.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
|
#include "nsDocShellLoadInfo.h"
|
||||||
#include "nsIWebNavigation.h"
|
#include "nsIWebNavigation.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
class nsPresContext;
|
class nsPresContext;
|
||||||
class nsIPresShell;
|
class nsIPresShell;
|
||||||
class nsDocShellLoadState;
|
class nsDocShellLoadInfo;
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
class Encoding;
|
class Encoding;
|
||||||
class HTMLEditor;
|
class HTMLEditor;
|
||||||
|
|
@ -63,7 +63,7 @@ interface nsICommandManager;
|
||||||
interface nsICommandParams;
|
interface nsICommandParams;
|
||||||
interface nsILoadURIDelegate;
|
interface nsILoadURIDelegate;
|
||||||
native TabChildRef(already_AddRefed<nsITabChild>);
|
native TabChildRef(already_AddRefed<nsITabChild>);
|
||||||
native nsDocShellLoadStatePtr(nsDocShellLoadState*);
|
native nsDocShellLoadInfoPtr(nsDocShellLoadInfo*);
|
||||||
|
|
||||||
webidl BrowsingContext;
|
webidl BrowsingContext;
|
||||||
webidl ContentFrameMessageManager;
|
webidl ContentFrameMessageManager;
|
||||||
|
|
@ -78,9 +78,23 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||||
* however, the URL dispatcher will go through its normal process of content
|
* however, the URL dispatcher will go through its normal process of content
|
||||||
* loading.
|
* loading.
|
||||||
*
|
*
|
||||||
* @param loadState - This is the extended load info for this load.
|
* @param uri - The URI to load.
|
||||||
|
* @param loadInfo - This is the extended load info for this load. This
|
||||||
|
* most often will be null, but if you need to do
|
||||||
|
* additional setup for this load you can get a loadInfo
|
||||||
|
* object by calling createLoadInfo. Once you have this
|
||||||
|
* object you can set the needed properties on it and
|
||||||
|
* then pass it to loadURI.
|
||||||
|
* @param aLoadFlags - Flags to modify load behaviour. Flags are defined in
|
||||||
|
* nsIWebNavigation. Note that using flags outside
|
||||||
|
* LOAD_FLAGS_MASK is only allowed if passing in a
|
||||||
|
* non-null loadInfo. And even some of those might not
|
||||||
|
* be allowed. Use at your own risk.
|
||||||
*/
|
*/
|
||||||
[noscript]void loadURI(in nsDocShellLoadStatePtr loadState);
|
[noscript]void loadURI(in nsIURI uri,
|
||||||
|
in nsDocShellLoadInfoPtr loadInfo,
|
||||||
|
in unsigned long aLoadFlags,
|
||||||
|
in boolean firstParty);
|
||||||
|
|
||||||
const long INTERNAL_LOAD_FLAGS_NONE = 0x0;
|
const long INTERNAL_LOAD_FLAGS_NONE = 0x0;
|
||||||
const long INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL = 0x1;
|
const long INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL = 0x1;
|
||||||
|
|
@ -91,12 +105,6 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||||
// @see nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD
|
// @see nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD
|
||||||
const long INTERNAL_LOAD_FLAGS_FIRST_LOAD = 0x8;
|
const long INTERNAL_LOAD_FLAGS_FIRST_LOAD = 0x8;
|
||||||
|
|
||||||
|
|
||||||
// The set of flags that should not be set before calling into
|
|
||||||
// nsDocShell::LoadURI and other nsDocShell loading functions.
|
|
||||||
const long INTERNAL_LOAD_FLAGS_LOADURI_SETUP_FLAGS = 0xf;
|
|
||||||
|
|
||||||
|
|
||||||
const long INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER = 0x10;
|
const long INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER = 0x10;
|
||||||
const long INTERNAL_LOAD_FLAGS_FORCE_ALLOW_COOKIES = 0x20;
|
const long INTERNAL_LOAD_FLAGS_FORCE_ALLOW_COOKIES = 0x20;
|
||||||
|
|
||||||
|
|
@ -190,7 +198,7 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||||
in nsIPrincipal aPrincipalToInherit,
|
in nsIPrincipal aPrincipalToInherit,
|
||||||
in uint32_t aFlags,
|
in uint32_t aFlags,
|
||||||
in AString aWindowTarget,
|
in AString aWindowTarget,
|
||||||
in ACString aTypeHint,
|
in string aTypeHint,
|
||||||
in AString aFileName,
|
in AString aFileName,
|
||||||
in nsIInputStream aPostDataStream,
|
in nsIInputStream aPostDataStream,
|
||||||
in nsIInputStream aHeadersStream,
|
in nsIInputStream aHeadersStream,
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "nsDocShellEditorData.h"
|
#include "nsDocShellEditorData.h"
|
||||||
#include "nsDocShellLoadTypes.h"
|
|
||||||
#include "nsIContentViewer.h"
|
#include "nsIContentViewer.h"
|
||||||
|
#include "nsDocShellLoadInfo.h"
|
||||||
#include "nsIDocShellTreeItem.h"
|
#include "nsIDocShellTreeItem.h"
|
||||||
#include "nsIInputStream.h"
|
#include "nsIInputStream.h"
|
||||||
#include "nsILayoutHistoryState.h"
|
#include "nsILayoutHistoryState.h"
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
#include "nsDocShell.h"
|
#include "nsDocShell.h"
|
||||||
#include "nsIContentViewer.h"
|
#include "nsIContentViewer.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
#include "nsDocShellLoadState.h"
|
#include "nsDocShellLoadInfo.h"
|
||||||
#include "nsIDocShellTreeItem.h"
|
#include "nsIDocShellTreeItem.h"
|
||||||
#include "nsILayoutHistoryState.h"
|
#include "nsILayoutHistoryState.h"
|
||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
|
|
@ -1575,7 +1575,7 @@ nsSHistory::InitiateLoad(nsISHEntry* aFrameEntry, nsIDocShell* aFrameDS,
|
||||||
{
|
{
|
||||||
NS_ENSURE_STATE(aFrameDS && aFrameEntry);
|
NS_ENSURE_STATE(aFrameDS && aFrameEntry);
|
||||||
|
|
||||||
RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState();
|
RefPtr<nsDocShellLoadInfo> loadInfo = new nsDocShellLoadInfo();
|
||||||
|
|
||||||
/* Set the loadType in the SHEntry too to what was passed on.
|
/* Set the loadType in the SHEntry too to what was passed on.
|
||||||
* This will be passed on to child subframes later in nsDocShell,
|
* This will be passed on to child subframes later in nsDocShell,
|
||||||
|
|
@ -1583,21 +1583,19 @@ nsSHistory::InitiateLoad(nsISHEntry* aFrameEntry, nsIDocShell* aFrameDS,
|
||||||
*/
|
*/
|
||||||
aFrameEntry->SetLoadType(aLoadType);
|
aFrameEntry->SetLoadType(aLoadType);
|
||||||
|
|
||||||
loadState->SetLoadType(aLoadType);
|
loadInfo->SetLoadType(aLoadType);
|
||||||
loadState->SetSHEntry(aFrameEntry);
|
loadInfo->SetSHEntry(aFrameEntry);
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> originalURI = aFrameEntry->GetOriginalURI();
|
nsCOMPtr<nsIURI> originalURI = aFrameEntry->GetOriginalURI();
|
||||||
loadState->SetOriginalURI(originalURI);
|
loadInfo->SetOriginalURI(originalURI);
|
||||||
|
|
||||||
loadState->SetLoadReplace(aFrameEntry->GetLoadReplace());
|
loadInfo->SetLoadReplace(aFrameEntry->GetLoadReplace());
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> newURI = aFrameEntry->GetURI();
|
|
||||||
loadState->SetURI(newURI);
|
|
||||||
loadState->SetLoadFlags(nsIWebNavigation::LOAD_FLAGS_NONE);
|
|
||||||
loadState->SetFirstParty(false);
|
|
||||||
|
|
||||||
|
nsCOMPtr<nsIURI> nextURI = aFrameEntry->GetURI();
|
||||||
// Time to initiate a document load
|
// Time to initiate a document load
|
||||||
return aFrameDS->LoadURI(loadState);
|
return aFrameDS->LoadURI(nextURI, loadInfo,
|
||||||
|
nsIWebNavigation::LOAD_FLAGS_NONE, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP_(void)
|
NS_IMETHODIMP_(void)
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
#include "nsIScriptObjectPrincipal.h"
|
#include "nsIScriptObjectPrincipal.h"
|
||||||
#include "nsIScriptContext.h"
|
#include "nsIScriptContext.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
#include "nsDocShellLoadState.h"
|
#include "nsDocShellLoadInfo.h"
|
||||||
#include "nsIWebNavigation.h"
|
#include "nsIWebNavigation.h"
|
||||||
#include "nsCDefaultURIFixup.h"
|
#include "nsCDefaultURIFixup.h"
|
||||||
#include "nsIURIFixup.h"
|
#include "nsIURIFixup.h"
|
||||||
|
|
@ -61,7 +61,7 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Location, mInnerWindow)
|
||||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(Location)
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(Location)
|
||||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(Location)
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(Location)
|
||||||
|
|
||||||
already_AddRefed<nsDocShellLoadState>
|
already_AddRefed<nsDocShellLoadInfo>
|
||||||
Location::CheckURL(nsIURI* aURI, nsIPrincipal& aSubjectPrincipal,
|
Location::CheckURL(nsIURI* aURI, nsIPrincipal& aSubjectPrincipal,
|
||||||
ErrorResult& aRv)
|
ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
|
|
@ -152,16 +152,16 @@ Location::CheckURL(nsIURI* aURI, nsIPrincipal& aSubjectPrincipal,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create load info
|
// Create load info
|
||||||
RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState();
|
RefPtr<nsDocShellLoadInfo> loadInfo = new nsDocShellLoadInfo();
|
||||||
|
|
||||||
loadState->SetTriggeringPrincipal(triggeringPrincipal);
|
loadInfo->SetTriggeringPrincipal(triggeringPrincipal);
|
||||||
|
|
||||||
if (sourceURI) {
|
if (sourceURI) {
|
||||||
loadState->SetReferrer(sourceURI);
|
loadInfo->SetReferrer(sourceURI);
|
||||||
loadState->SetReferrerPolicy(referrerPolicy);
|
loadInfo->SetReferrerPolicy(referrerPolicy);
|
||||||
}
|
}
|
||||||
|
|
||||||
return loadState.forget();
|
return loadInfo.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
@ -212,31 +212,27 @@ Location::SetURI(nsIURI* aURI, nsIPrincipal& aSubjectPrincipal,
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mDocShell));
|
nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mDocShell));
|
||||||
if (docShell) {
|
if (docShell) {
|
||||||
|
RefPtr<nsDocShellLoadInfo> loadInfo =
|
||||||
RefPtr<nsDocShellLoadState> loadState =
|
|
||||||
CheckURL(aURI, aSubjectPrincipal, aRv);
|
CheckURL(aURI, aSubjectPrincipal, aRv);
|
||||||
if (aRv.Failed()) {
|
if (aRv.Failed()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aReplace) {
|
if (aReplace) {
|
||||||
loadState->SetLoadType(LOAD_STOP_CONTENT_AND_REPLACE);
|
loadInfo->SetLoadType(LOAD_STOP_CONTENT_AND_REPLACE);
|
||||||
} else {
|
} else {
|
||||||
loadState->SetLoadType(LOAD_STOP_CONTENT);
|
loadInfo->SetLoadType(LOAD_STOP_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the incumbent script's browsing context to set as source.
|
// Get the incumbent script's browsing context to set as source.
|
||||||
nsCOMPtr<nsPIDOMWindowInner> sourceWindow =
|
nsCOMPtr<nsPIDOMWindowInner> sourceWindow =
|
||||||
do_QueryInterface(mozilla::dom::GetIncumbentGlobal());
|
do_QueryInterface(mozilla::dom::GetIncumbentGlobal());
|
||||||
if (sourceWindow) {
|
if (sourceWindow) {
|
||||||
loadState->SetSourceDocShell(sourceWindow->GetDocShell());
|
loadInfo->SetSourceDocShell(sourceWindow->GetDocShell());
|
||||||
}
|
}
|
||||||
|
|
||||||
loadState->SetURI(aURI);
|
nsresult rv = docShell->LoadURI(aURI, loadInfo,
|
||||||
loadState->SetLoadFlags(nsIWebNavigation::LOAD_FLAGS_NONE);
|
nsIWebNavigation::LOAD_FLAGS_NONE, true);
|
||||||
loadState->SetFirstParty(true);
|
|
||||||
|
|
||||||
nsresult rv = docShell->LoadURI(loadState);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
aRv.Throw(rv);
|
aRv.Throw(rv);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
class nsIDocShell;
|
class nsIDocShell;
|
||||||
class nsIURI;
|
class nsIURI;
|
||||||
class nsDocShellLoadState;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
@ -168,7 +167,6 @@ protected:
|
||||||
// Note, this method can return NS_OK with a null value for aURL. This happens
|
// Note, this method can return NS_OK with a null value for aURL. This happens
|
||||||
// if the docShell is null.
|
// if the docShell is null.
|
||||||
nsresult GetURI(nsIURI** aURL, bool aGetInnermostURI = false);
|
nsresult GetURI(nsIURI** aURL, bool aGetInnermostURI = false);
|
||||||
|
|
||||||
void SetURI(nsIURI* aURL, nsIPrincipal& aSubjectPrincipal,
|
void SetURI(nsIURI* aURL, nsIPrincipal& aSubjectPrincipal,
|
||||||
ErrorResult& aRv, bool aReplace = false);
|
ErrorResult& aRv, bool aReplace = false);
|
||||||
void SetHrefWithBase(const nsAString& aHref, nsIURI* aBase,
|
void SetHrefWithBase(const nsAString& aHref, nsIURI* aBase,
|
||||||
|
|
@ -186,7 +184,7 @@ protected:
|
||||||
// Check whether it's OK to load the given url with the given subject
|
// Check whether it's OK to load the given url with the given subject
|
||||||
// principal, and if so construct the right nsDocShellLoadInfo for the load
|
// principal, and if so construct the right nsDocShellLoadInfo for the load
|
||||||
// and return it.
|
// and return it.
|
||||||
already_AddRefed<nsDocShellLoadState> CheckURL(nsIURI *url,
|
already_AddRefed<nsDocShellLoadInfo> CheckURL(nsIURI *url,
|
||||||
nsIPrincipal& aSubjectPrincipal,
|
nsIPrincipal& aSubjectPrincipal,
|
||||||
ErrorResult& aRv);
|
ErrorResult& aRv);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
#include "nsIWebProgress.h"
|
#include "nsIWebProgress.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
#include "nsIDocShellTreeOwner.h"
|
#include "nsIDocShellTreeOwner.h"
|
||||||
#include "nsDocShellLoadState.h"
|
#include "nsDocShellLoadInfo.h"
|
||||||
#include "nsIBaseWindow.h"
|
#include "nsIBaseWindow.h"
|
||||||
#include "nsIBrowser.h"
|
#include "nsIBrowser.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
|
|
@ -390,9 +390,9 @@ nsFrameLoader::ReallyStartLoadingInternal()
|
||||||
rv = CheckURILoad(mURIToLoad, mTriggeringPrincipal);
|
rv = CheckURILoad(mURIToLoad, mTriggeringPrincipal);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState();
|
RefPtr<nsDocShellLoadInfo> loadInfo = new nsDocShellLoadInfo();
|
||||||
|
|
||||||
loadState->SetOriginalFrameSrc(mLoadingOriginalSrc);
|
loadInfo->SetOriginalFrameSrc(mLoadingOriginalSrc);
|
||||||
mLoadingOriginalSrc = false;
|
mLoadingOriginalSrc = false;
|
||||||
|
|
||||||
// If this frame is sandboxed with respect to origin we will set it up with
|
// If this frame is sandboxed with respect to origin we will set it up with
|
||||||
|
|
@ -403,9 +403,9 @@ nsFrameLoader::ReallyStartLoadingInternal()
|
||||||
// is very important; needed to prevent XSS attacks on documents loaded in
|
// is very important; needed to prevent XSS attacks on documents loaded in
|
||||||
// subframes!
|
// subframes!
|
||||||
if (mTriggeringPrincipal) {
|
if (mTriggeringPrincipal) {
|
||||||
loadState->SetTriggeringPrincipal(mTriggeringPrincipal);
|
loadInfo->SetTriggeringPrincipal(mTriggeringPrincipal);
|
||||||
} else {
|
} else {
|
||||||
loadState->SetTriggeringPrincipal(mOwnerContent->NodePrincipal());
|
loadInfo->SetTriggeringPrincipal(mOwnerContent->NodePrincipal());
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> referrer;
|
nsCOMPtr<nsIURI> referrer;
|
||||||
|
|
@ -420,9 +420,9 @@ nsFrameLoader::ReallyStartLoadingInternal()
|
||||||
mOwnerContent->OwnerDoc()->GetReferrer(referrerStr);
|
mOwnerContent->OwnerDoc()->GetReferrer(referrerStr);
|
||||||
rv = NS_NewURI(getter_AddRefs(referrer), referrerStr);
|
rv = NS_NewURI(getter_AddRefs(referrer), referrerStr);
|
||||||
|
|
||||||
loadState->SetSrcdocData(srcdoc);
|
loadInfo->SetSrcdocData(srcdoc);
|
||||||
nsCOMPtr<nsIURI> baseURI = mOwnerContent->GetBaseURI();
|
nsCOMPtr<nsIURI> baseURI = mOwnerContent->GetBaseURI();
|
||||||
loadState->SetBaseURI(baseURI);
|
loadInfo->SetBaseURI(baseURI);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rv = mOwnerContent->NodePrincipal()->GetURI(getter_AddRefs(referrer));
|
rv = mOwnerContent->NodePrincipal()->GetURI(getter_AddRefs(referrer));
|
||||||
|
|
@ -437,7 +437,7 @@ nsFrameLoader::ReallyStartLoadingInternal()
|
||||||
bool isNullPrincipalScheme;
|
bool isNullPrincipalScheme;
|
||||||
rv = referrer->SchemeIs(NS_NULLPRINCIPAL_SCHEME, &isNullPrincipalScheme);
|
rv = referrer->SchemeIs(NS_NULLPRINCIPAL_SCHEME, &isNullPrincipalScheme);
|
||||||
if (NS_SUCCEEDED(rv) && !isNullPrincipalScheme) {
|
if (NS_SUCCEEDED(rv) && !isNullPrincipalScheme) {
|
||||||
loadState->SetReferrer(referrer);
|
loadInfo->SetReferrer(referrer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -453,7 +453,7 @@ nsFrameLoader::ReallyStartLoadingInternal()
|
||||||
referrerPolicy = iframeReferrerPolicy;
|
referrerPolicy = iframeReferrerPolicy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadState->SetReferrerPolicy(referrerPolicy);
|
loadInfo->SetReferrerPolicy(referrerPolicy);
|
||||||
|
|
||||||
// Default flags:
|
// Default flags:
|
||||||
int32_t flags = nsIWebNavigation::LOAD_FLAGS_NONE;
|
int32_t flags = nsIWebNavigation::LOAD_FLAGS_NONE;
|
||||||
|
|
@ -467,10 +467,8 @@ nsFrameLoader::ReallyStartLoadingInternal()
|
||||||
// Kick off the load...
|
// Kick off the load...
|
||||||
bool tmpState = mNeedsAsyncDestroy;
|
bool tmpState = mNeedsAsyncDestroy;
|
||||||
mNeedsAsyncDestroy = true;
|
mNeedsAsyncDestroy = true;
|
||||||
loadState->SetURI(mURIToLoad);
|
nsCOMPtr<nsIURI> uriToLoad = mURIToLoad;
|
||||||
loadState->SetLoadFlags(flags);
|
rv = mDocShell->LoadURI(uriToLoad, loadInfo, flags, false);
|
||||||
loadState->SetFirstParty(false);
|
|
||||||
rv = mDocShell->LoadURI(loadState);
|
|
||||||
mNeedsAsyncDestroy = tmpState;
|
mNeedsAsyncDestroy = tmpState;
|
||||||
mURIToLoad = nullptr;
|
mURIToLoad = nullptr;
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
#include "nsPrintfCString.h"
|
#include "nsPrintfCString.h"
|
||||||
#include "mozilla/intl/LocaleService.h"
|
#include "mozilla/intl/LocaleService.h"
|
||||||
#include "WindowDestroyedEvent.h"
|
#include "WindowDestroyedEvent.h"
|
||||||
#include "nsDocShellLoadState.h"
|
#include "nsDocShellLoadInfo.h"
|
||||||
|
|
||||||
// Helper Classes
|
// Helper Classes
|
||||||
#include "nsJSUtils.h"
|
#include "nsJSUtils.h"
|
||||||
|
|
@ -5520,7 +5520,7 @@ nsGlobalWindowOuter::OpenOuter(const nsAString& aUrl, const nsAString& aName,
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsGlobalWindowOuter::Open(const nsAString& aUrl, const nsAString& aName,
|
nsGlobalWindowOuter::Open(const nsAString& aUrl, const nsAString& aName,
|
||||||
const nsAString& aOptions, nsDocShellLoadState* aLoadState,
|
const nsAString& aOptions, nsDocShellLoadInfo* aLoadInfo,
|
||||||
bool aForceNoOpener, nsPIDOMWindowOuter **_retval)
|
bool aForceNoOpener, nsPIDOMWindowOuter **_retval)
|
||||||
{
|
{
|
||||||
return OpenInternal(aUrl, aName, aOptions,
|
return OpenInternal(aUrl, aName, aOptions,
|
||||||
|
|
@ -5530,7 +5530,7 @@ nsGlobalWindowOuter::Open(const nsAString& aUrl, const nsAString& aName,
|
||||||
false, // aDoJSFixups
|
false, // aDoJSFixups
|
||||||
true, // aNavigate
|
true, // aNavigate
|
||||||
nullptr, nullptr, // No args
|
nullptr, nullptr, // No args
|
||||||
aLoadState,
|
aLoadInfo,
|
||||||
aForceNoOpener,
|
aForceNoOpener,
|
||||||
_retval);
|
_retval);
|
||||||
}
|
}
|
||||||
|
|
@ -5546,7 +5546,7 @@ nsGlobalWindowOuter::OpenJS(const nsAString& aUrl, const nsAString& aName,
|
||||||
true, // aDoJSFixups
|
true, // aDoJSFixups
|
||||||
true, // aNavigate
|
true, // aNavigate
|
||||||
nullptr, nullptr, // No args
|
nullptr, nullptr, // No args
|
||||||
nullptr, // aLoadState
|
nullptr, // aLoadInfo
|
||||||
false, // aForceNoOpener
|
false, // aForceNoOpener
|
||||||
_retval);
|
_retval);
|
||||||
}
|
}
|
||||||
|
|
@ -5566,7 +5566,7 @@ nsGlobalWindowOuter::OpenDialog(const nsAString& aUrl, const nsAString& aName,
|
||||||
false, // aDoJSFixups
|
false, // aDoJSFixups
|
||||||
true, // aNavigate
|
true, // aNavigate
|
||||||
nullptr, aExtraArgument, // Arguments
|
nullptr, aExtraArgument, // Arguments
|
||||||
nullptr, // aLoadState
|
nullptr, // aLoadInfo
|
||||||
false, // aForceNoOpener
|
false, // aForceNoOpener
|
||||||
_retval);
|
_retval);
|
||||||
}
|
}
|
||||||
|
|
@ -5585,7 +5585,7 @@ nsGlobalWindowOuter::OpenNoNavigate(const nsAString& aUrl,
|
||||||
false, // aDoJSFixups
|
false, // aDoJSFixups
|
||||||
false, // aNavigate
|
false, // aNavigate
|
||||||
nullptr, nullptr, // No args
|
nullptr, nullptr, // No args
|
||||||
nullptr, // aLoadState
|
nullptr, // aLoadInfo
|
||||||
false, // aForceNoOpener
|
false, // aForceNoOpener
|
||||||
_retval);
|
_retval);
|
||||||
|
|
||||||
|
|
@ -5613,7 +5613,7 @@ nsGlobalWindowOuter::OpenDialogOuter(JSContext* aCx, const nsAString& aUrl,
|
||||||
false, // aDoJSFixups
|
false, // aDoJSFixups
|
||||||
true, // aNavigate
|
true, // aNavigate
|
||||||
argvArray, nullptr, // Arguments
|
argvArray, nullptr, // Arguments
|
||||||
nullptr, // aLoadState
|
nullptr, // aLoadInfo
|
||||||
false, // aForceNoOpener
|
false, // aForceNoOpener
|
||||||
getter_AddRefs(dialog));
|
getter_AddRefs(dialog));
|
||||||
return dialog.forget();
|
return dialog.forget();
|
||||||
|
|
@ -6937,7 +6937,7 @@ nsGlobalWindowOuter::OpenInternal(const nsAString& aUrl, const nsAString& aName,
|
||||||
bool aDoJSFixups, bool aNavigate,
|
bool aDoJSFixups, bool aNavigate,
|
||||||
nsIArray *argv,
|
nsIArray *argv,
|
||||||
nsISupports *aExtraArgument,
|
nsISupports *aExtraArgument,
|
||||||
nsDocShellLoadState* aLoadState,
|
nsDocShellLoadInfo* aLoadInfo,
|
||||||
bool aForceNoOpener,
|
bool aForceNoOpener,
|
||||||
nsPIDOMWindowOuter **aReturn)
|
nsPIDOMWindowOuter **aReturn)
|
||||||
{
|
{
|
||||||
|
|
@ -7086,7 +7086,7 @@ nsGlobalWindowOuter::OpenInternal(const nsAString& aUrl, const nsAString& aName,
|
||||||
aDialog, aNavigate, argv,
|
aDialog, aNavigate, argv,
|
||||||
isPopupSpamWindow,
|
isPopupSpamWindow,
|
||||||
forceNoOpener,
|
forceNoOpener,
|
||||||
aLoadState,
|
aLoadInfo,
|
||||||
getter_AddRefs(domReturn));
|
getter_AddRefs(domReturn));
|
||||||
} else {
|
} else {
|
||||||
// Force a system caller here so that the window watcher won't screw us
|
// Force a system caller here so that the window watcher won't screw us
|
||||||
|
|
@ -7109,7 +7109,7 @@ nsGlobalWindowOuter::OpenInternal(const nsAString& aUrl, const nsAString& aName,
|
||||||
aDialog, aNavigate, aExtraArgument,
|
aDialog, aNavigate, aExtraArgument,
|
||||||
isPopupSpamWindow,
|
isPopupSpamWindow,
|
||||||
forceNoOpener,
|
forceNoOpener,
|
||||||
aLoadState,
|
aLoadInfo,
|
||||||
getter_AddRefs(domReturn));
|
getter_AddRefs(domReturn));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ class nsITimeoutHandler;
|
||||||
class nsIWebBrowserChrome;
|
class nsIWebBrowserChrome;
|
||||||
class mozIDOMWindowProxy;
|
class mozIDOMWindowProxy;
|
||||||
|
|
||||||
class nsDocShellLoadState;
|
class nsDocShellLoadInfo;
|
||||||
class nsDOMWindowList;
|
class nsDOMWindowList;
|
||||||
class nsScreen;
|
class nsScreen;
|
||||||
class nsHistory;
|
class nsHistory;
|
||||||
|
|
@ -607,7 +607,7 @@ public:
|
||||||
mozilla::ErrorResult& aError);
|
mozilla::ErrorResult& aError);
|
||||||
nsresult Open(const nsAString& aUrl, const nsAString& aName,
|
nsresult Open(const nsAString& aUrl, const nsAString& aName,
|
||||||
const nsAString& aOptions,
|
const nsAString& aOptions,
|
||||||
nsDocShellLoadState* aLoadState,
|
nsDocShellLoadInfo* aLoadInfo,
|
||||||
bool aForceNoOpener,
|
bool aForceNoOpener,
|
||||||
nsPIDOMWindowOuter **_retval) override;
|
nsPIDOMWindowOuter **_retval) override;
|
||||||
mozilla::dom::Navigator* GetNavigator() override;
|
mozilla::dom::Navigator* GetNavigator() override;
|
||||||
|
|
@ -879,7 +879,7 @@ private:
|
||||||
* @param aExtraArgument Another way to pass arguments in. This is mutually
|
* @param aExtraArgument Another way to pass arguments in. This is mutually
|
||||||
* exclusive with the argv approach.
|
* exclusive with the argv approach.
|
||||||
*
|
*
|
||||||
* @param aLoadState to be passed on along to the windowwatcher.
|
* @param aLoadInfo to be passed on along to the windowwatcher.
|
||||||
*
|
*
|
||||||
* @param aForceNoOpener if true, will act as if "noopener" were passed in
|
* @param aForceNoOpener if true, will act as if "noopener" were passed in
|
||||||
* aOptions, but without affecting any other window
|
* aOptions, but without affecting any other window
|
||||||
|
|
@ -901,7 +901,7 @@ private:
|
||||||
bool aNavigate,
|
bool aNavigate,
|
||||||
nsIArray *argv,
|
nsIArray *argv,
|
||||||
nsISupports *aExtraArgument,
|
nsISupports *aExtraArgument,
|
||||||
nsDocShellLoadState* aLoadState,
|
nsDocShellLoadInfo* aLoadInfo,
|
||||||
bool aForceNoOpener,
|
bool aForceNoOpener,
|
||||||
nsPIDOMWindowOuter **aReturn);
|
nsPIDOMWindowOuter **aReturn);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class nsIChannel;
|
||||||
class nsIContent;
|
class nsIContent;
|
||||||
class nsICSSDeclaration;
|
class nsICSSDeclaration;
|
||||||
class nsIDocShell;
|
class nsIDocShell;
|
||||||
class nsDocShellLoadState;
|
class nsDocShellLoadInfo;
|
||||||
class nsIDocument;
|
class nsIDocument;
|
||||||
class nsIPrincipal;
|
class nsIPrincipal;
|
||||||
class nsIScriptTimeoutHandler;
|
class nsIScriptTimeoutHandler;
|
||||||
|
|
@ -1121,12 +1121,12 @@ public:
|
||||||
|
|
||||||
virtual nsDOMWindowList* GetFrames() = 0;
|
virtual nsDOMWindowList* GetFrames() = 0;
|
||||||
|
|
||||||
// aLoadState will be passed on through to the windowwatcher.
|
// aLoadInfo will be passed on through to the windowwatcher.
|
||||||
// aForceNoOpener will act just like a "noopener" feature in aOptions except
|
// aForceNoOpener will act just like a "noopener" feature in aOptions except
|
||||||
// will not affect any other window features.
|
// will not affect any other window features.
|
||||||
virtual nsresult Open(const nsAString& aUrl, const nsAString& aName,
|
virtual nsresult Open(const nsAString& aUrl, const nsAString& aName,
|
||||||
const nsAString& aOptions,
|
const nsAString& aOptions,
|
||||||
nsDocShellLoadState* aLoadState,
|
nsDocShellLoadInfo* aLoadInfo,
|
||||||
bool aForceNoOpener,
|
bool aForceNoOpener,
|
||||||
nsPIDOMWindowOuter **_retval) = 0;
|
nsPIDOMWindowOuter **_retval) = 0;
|
||||||
virtual nsresult OpenDialog(const nsAString& aUrl, const nsAString& aName,
|
virtual nsresult OpenDialog(const nsAString& aUrl, const nsAString& aName,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
#include "ClientState.h"
|
#include "ClientState.h"
|
||||||
#include "mozilla/Unused.h"
|
#include "mozilla/Unused.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
#include "nsDocShellLoadState.h"
|
#include "nsDocShellLoadInfo.h"
|
||||||
#include "nsIWebNavigation.h"
|
#include "nsIWebNavigation.h"
|
||||||
#include "nsIWebProgress.h"
|
#include "nsIWebProgress.h"
|
||||||
#include "nsIWebProgressListener.h"
|
#include "nsIWebProgressListener.h"
|
||||||
|
|
@ -236,16 +236,13 @@ ClientNavigateOpChild::DoNavigate(const ClientNavigateOpConstructorArgs& aArgs)
|
||||||
return ref.forget();
|
return ref.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState();
|
RefPtr<nsDocShellLoadInfo> loadInfo = new nsDocShellLoadInfo();
|
||||||
|
|
||||||
loadState->SetTriggeringPrincipal(principal);
|
loadInfo->SetTriggeringPrincipal(principal);
|
||||||
loadState->SetReferrerPolicy(doc->GetReferrerPolicy());
|
loadInfo->SetReferrerPolicy(doc->GetReferrerPolicy());
|
||||||
loadState->SetLoadType(LOAD_STOP_CONTENT);
|
loadInfo->SetLoadType(LOAD_STOP_CONTENT);
|
||||||
loadState->SetSourceDocShell(docShell);
|
loadInfo->SetSourceDocShell(docShell);
|
||||||
loadState->SetURI(url);
|
rv = docShell->LoadURI(url, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE, true);
|
||||||
loadState->SetLoadFlags(nsIWebNavigation::LOAD_FLAGS_NONE);
|
|
||||||
loadState->SetFirstParty(true);
|
|
||||||
rv = docShell->LoadURI(loadState);
|
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
ref = ClientOpPromise::CreateAndReject(rv, __func__);
|
ref = ClientOpPromise::CreateAndReject(rv, __func__);
|
||||||
return ref.forget();
|
return ref.forget();
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@
|
||||||
|
|
||||||
#include "mozInlineSpellChecker.h"
|
#include "mozInlineSpellChecker.h"
|
||||||
#include "nsDocShell.h"
|
#include "nsDocShell.h"
|
||||||
#include "nsDocShellLoadState.h"
|
#include "nsDocShellLoadInfo.h"
|
||||||
#include "nsIConsoleListener.h"
|
#include "nsIConsoleListener.h"
|
||||||
#include "nsIContentViewer.h"
|
#include "nsIContentViewer.h"
|
||||||
#include "nsICycleCollectorListener.h"
|
#include "nsICycleCollectorListener.h"
|
||||||
|
|
@ -774,19 +774,19 @@ ContentChild::ProvideWindow(mozIDOMWindowProxy* aParent,
|
||||||
const nsAString& aName,
|
const nsAString& aName,
|
||||||
const nsACString& aFeatures,
|
const nsACString& aFeatures,
|
||||||
bool aForceNoOpener,
|
bool aForceNoOpener,
|
||||||
nsDocShellLoadState* aLoadState,
|
nsDocShellLoadInfo* aLoadInfo,
|
||||||
bool* aWindowIsNew,
|
bool* aWindowIsNew,
|
||||||
mozIDOMWindowProxy** aReturn)
|
mozIDOMWindowProxy** aReturn)
|
||||||
{
|
{
|
||||||
return ProvideWindowCommon(nullptr, aParent, false, aChromeFlags,
|
return ProvideWindowCommon(nullptr, aParent, false, aChromeFlags,
|
||||||
aCalledFromJS, aPositionSpecified,
|
aCalledFromJS, aPositionSpecified,
|
||||||
aSizeSpecified, aURI, aName, aFeatures,
|
aSizeSpecified, aURI, aName, aFeatures,
|
||||||
aForceNoOpener, aLoadState, aWindowIsNew, aReturn);
|
aForceNoOpener, aLoadInfo, aWindowIsNew, aReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsresult
|
static nsresult
|
||||||
GetCreateWindowParams(mozIDOMWindowProxy* aParent,
|
GetCreateWindowParams(mozIDOMWindowProxy* aParent,
|
||||||
nsDocShellLoadState* aLoadState,
|
nsDocShellLoadInfo* aLoadInfo,
|
||||||
nsACString& aBaseURIString, float* aFullZoom,
|
nsACString& aBaseURIString, float* aFullZoom,
|
||||||
uint32_t* aReferrerPolicy,
|
uint32_t* aReferrerPolicy,
|
||||||
nsIPrincipal** aTriggeringPrincipal)
|
nsIPrincipal** aTriggeringPrincipal)
|
||||||
|
|
@ -814,11 +814,11 @@ GetCreateWindowParams(mozIDOMWindowProxy* aParent,
|
||||||
|
|
||||||
baseURI->GetSpec(aBaseURIString);
|
baseURI->GetSpec(aBaseURIString);
|
||||||
|
|
||||||
if (aLoadState) {
|
if (aLoadInfo) {
|
||||||
if (!aLoadState->SendReferrer()) {
|
if (!aLoadInfo->SendReferrer()) {
|
||||||
*aReferrerPolicy = mozilla::net::RP_No_Referrer;
|
*aReferrerPolicy = mozilla::net::RP_No_Referrer;
|
||||||
} else {
|
} else {
|
||||||
*aReferrerPolicy = aLoadState->ReferrerPolicy();
|
*aReferrerPolicy = aLoadInfo->ReferrerPolicy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -849,7 +849,7 @@ ContentChild::ProvideWindowCommon(TabChild* aTabOpener,
|
||||||
const nsAString& aName,
|
const nsAString& aName,
|
||||||
const nsACString& aFeatures,
|
const nsACString& aFeatures,
|
||||||
bool aForceNoOpener,
|
bool aForceNoOpener,
|
||||||
nsDocShellLoadState* aLoadState,
|
nsDocShellLoadInfo* aLoadInfo,
|
||||||
bool* aWindowIsNew,
|
bool* aWindowIsNew,
|
||||||
mozIDOMWindowProxy** aReturn)
|
mozIDOMWindowProxy** aReturn)
|
||||||
{
|
{
|
||||||
|
|
@ -896,7 +896,7 @@ ContentChild::ProvideWindowCommon(TabChild* aTabOpener,
|
||||||
float fullZoom;
|
float fullZoom;
|
||||||
nsCOMPtr<nsIPrincipal> triggeringPrincipal;
|
nsCOMPtr<nsIPrincipal> triggeringPrincipal;
|
||||||
uint32_t referrerPolicy = mozilla::net::RP_Unset;
|
uint32_t referrerPolicy = mozilla::net::RP_Unset;
|
||||||
rv = GetCreateWindowParams(aParent, aLoadState, baseURIString, &fullZoom,
|
rv = GetCreateWindowParams(aParent, aLoadInfo, baseURIString, &fullZoom,
|
||||||
&referrerPolicy,
|
&referrerPolicy,
|
||||||
getter_AddRefs(triggeringPrincipal));
|
getter_AddRefs(triggeringPrincipal));
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
|
|
@ -1110,7 +1110,7 @@ ContentChild::ProvideWindowCommon(TabChild* aTabOpener,
|
||||||
float fullZoom;
|
float fullZoom;
|
||||||
nsCOMPtr<nsIPrincipal> triggeringPrincipal;
|
nsCOMPtr<nsIPrincipal> triggeringPrincipal;
|
||||||
uint32_t referrerPolicy = mozilla::net::RP_Unset;
|
uint32_t referrerPolicy = mozilla::net::RP_Unset;
|
||||||
rv = GetCreateWindowParams(aParent, aLoadState, baseURIString, &fullZoom,
|
rv = GetCreateWindowParams(aParent, aLoadInfo, baseURIString, &fullZoom,
|
||||||
&referrerPolicy,
|
&referrerPolicy,
|
||||||
getter_AddRefs(triggeringPrincipal));
|
getter_AddRefs(triggeringPrincipal));
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ struct OverrideMapping;
|
||||||
class nsIDomainPolicy;
|
class nsIDomainPolicy;
|
||||||
class nsIURIClassifierCallback;
|
class nsIURIClassifierCallback;
|
||||||
struct LookAndFeelInt;
|
struct LookAndFeelInt;
|
||||||
class nsDocShellLoadState;
|
class nsDocShellLoadInfo;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
class RemoteSpellcheckEngineChild;
|
class RemoteSpellcheckEngineChild;
|
||||||
|
|
@ -119,7 +119,7 @@ public:
|
||||||
const nsAString& aName,
|
const nsAString& aName,
|
||||||
const nsACString& aFeatures,
|
const nsACString& aFeatures,
|
||||||
bool aForceNoOpener,
|
bool aForceNoOpener,
|
||||||
nsDocShellLoadState* aLoadState,
|
nsDocShellLoadInfo* aLoadInfo,
|
||||||
bool* aWindowIsNew,
|
bool* aWindowIsNew,
|
||||||
mozIDOMWindowProxy** aReturn);
|
mozIDOMWindowProxy** aReturn);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsISupportsPrimitives.h"
|
#include "nsISupportsPrimitives.h"
|
||||||
#include "mozilla/Telemetry.h"
|
#include "mozilla/Telemetry.h"
|
||||||
#include "nsDocShellLoadState.h"
|
#include "nsDocShellLoadInfo.h"
|
||||||
#include "nsWebBrowser.h"
|
#include "nsWebBrowser.h"
|
||||||
|
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
|
|
@ -960,7 +960,7 @@ TabChild::ProvideWindow(mozIDOMWindowProxy* aParent,
|
||||||
bool aPositionSpecified, bool aSizeSpecified,
|
bool aPositionSpecified, bool aSizeSpecified,
|
||||||
nsIURI* aURI, const nsAString& aName,
|
nsIURI* aURI, const nsAString& aName,
|
||||||
const nsACString& aFeatures, bool aForceNoOpener,
|
const nsACString& aFeatures, bool aForceNoOpener,
|
||||||
nsDocShellLoadState* aLoadState, bool* aWindowIsNew,
|
nsDocShellLoadInfo* aLoadInfo, bool* aWindowIsNew,
|
||||||
mozIDOMWindowProxy** aReturn)
|
mozIDOMWindowProxy** aReturn)
|
||||||
{
|
{
|
||||||
*aReturn = nullptr;
|
*aReturn = nullptr;
|
||||||
|
|
@ -1004,7 +1004,7 @@ TabChild::ProvideWindow(mozIDOMWindowProxy* aParent,
|
||||||
aName,
|
aName,
|
||||||
aFeatures,
|
aFeatures,
|
||||||
aForceNoOpener,
|
aForceNoOpener,
|
||||||
aLoadState,
|
aLoadInfo,
|
||||||
aWindowIsNew,
|
aWindowIsNew,
|
||||||
aReturn);
|
aReturn);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,12 @@
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
|
|
||||||
%{ C++
|
%{ C++
|
||||||
class nsDocShellLoadState;
|
class nsDocShellLoadInfo;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
interface mozIDOMWindowProxy;
|
interface mozIDOMWindowProxy;
|
||||||
interface nsIURI;
|
interface nsIURI;
|
||||||
native nsDocShellLoadStatePtr(nsDocShellLoadState*);
|
native nsDocShellLoadInfoPtr(nsDocShellLoadInfo*);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The nsIWindowProvider interface exists so that the window watcher's default
|
* The nsIWindowProvider interface exists so that the window watcher's default
|
||||||
|
|
@ -76,7 +76,7 @@ interface nsIWindowProvider : nsISupports
|
||||||
* the feature string to the window it returns in any way it sees fit.
|
* the feature string to the window it returns in any way it sees fit.
|
||||||
* See the nsIWindowWatcher interface for details on feature strings.
|
* See the nsIWindowWatcher interface for details on feature strings.
|
||||||
*
|
*
|
||||||
* @param aLoadState Specify setup information of the load in the new window
|
* @param aLoadInfo Specify setup information of the load in the new window
|
||||||
*
|
*
|
||||||
* @param aWindowIsNew [out] Whether the window being returned was just
|
* @param aWindowIsNew [out] Whether the window being returned was just
|
||||||
* created by the window provider implementation. This can be used by
|
* created by the window provider implementation. This can be used by
|
||||||
|
|
@ -106,6 +106,6 @@ interface nsIWindowProvider : nsISupports
|
||||||
in AString aName,
|
in AString aName,
|
||||||
in AUTF8String aFeatures,
|
in AUTF8String aFeatures,
|
||||||
in boolean aForceNoOpener,
|
in boolean aForceNoOpener,
|
||||||
in nsDocShellLoadStatePtr aLoadState,
|
in nsDocShellLoadInfoPtr aLoadInfo,
|
||||||
out boolean aWindowIsNew);
|
out boolean aWindowIsNew);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
|
|
||||||
%{ C++
|
%{ C++
|
||||||
class nsDocShellLoadState;
|
class nsDocShellLoadInfo;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
interface mozIDOMWindowProxy;
|
interface mozIDOMWindowProxy;
|
||||||
|
|
@ -21,7 +21,7 @@ interface nsIWebBrowserChrome;
|
||||||
interface nsIDocShellTreeItem;
|
interface nsIDocShellTreeItem;
|
||||||
interface nsIArray;
|
interface nsIArray;
|
||||||
interface nsITabParent;
|
interface nsITabParent;
|
||||||
native nsDocShellLoadStatePtr(nsDocShellLoadState*);
|
native nsDocShellLoadInfoPtr(nsDocShellLoadInfo*);
|
||||||
|
|
||||||
[uuid(d162f9c4-19d5-4723-931f-f1e51bfa9f68)]
|
[uuid(d162f9c4-19d5-4723-931f-f1e51bfa9f68)]
|
||||||
|
|
||||||
|
|
@ -66,8 +66,8 @@ interface nsPIWindowWatcher : nsISupports
|
||||||
looking for existing windows with the given name,
|
looking for existing windows with the given name,
|
||||||
not setting an opener on the newly opened window,
|
not setting an opener on the newly opened window,
|
||||||
and returning null from this method.
|
and returning null from this method.
|
||||||
@param aLoadState if aNavigate is true, this allows the caller to pass in
|
@param aLoadInfo if aNavigate is true, this allows the caller to pass in
|
||||||
an nsIDocShellLoadState to use for the navigation.
|
an nsIDocShellLoadInfo to use for the navigation.
|
||||||
Callers can pass in null if they want the windowwatcher
|
Callers can pass in null if they want the windowwatcher
|
||||||
to just construct a loadinfo itself. If aNavigate is
|
to just construct a loadinfo itself. If aNavigate is
|
||||||
false, this argument is ignored.
|
false, this argument is ignored.
|
||||||
|
|
@ -90,7 +90,7 @@ interface nsPIWindowWatcher : nsISupports
|
||||||
in nsISupports aArgs,
|
in nsISupports aArgs,
|
||||||
in boolean aIsPopupSpam,
|
in boolean aIsPopupSpam,
|
||||||
in boolean aForceNoOpener,
|
in boolean aForceNoOpener,
|
||||||
in nsDocShellLoadStatePtr aLoadState);
|
in nsDocShellLoadInfoPtr aLoadInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a new window so that the window that aOpeningTab belongs to
|
* Opens a new window so that the window that aOpeningTab belongs to
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#include "nsIBaseWindow.h"
|
#include "nsIBaseWindow.h"
|
||||||
#include "nsIBrowserDOMWindow.h"
|
#include "nsIBrowserDOMWindow.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
#include "nsDocShellLoadState.h"
|
#include "nsDocShellLoadInfo.h"
|
||||||
#include "nsIDocShellTreeItem.h"
|
#include "nsIDocShellTreeItem.h"
|
||||||
#include "nsIDocShellTreeOwner.h"
|
#include "nsIDocShellTreeOwner.h"
|
||||||
#include "nsIDocumentLoader.h"
|
#include "nsIDocumentLoader.h"
|
||||||
|
|
@ -325,7 +325,7 @@ nsWindowWatcher::OpenWindow(mozIDOMWindowProxy* aParent,
|
||||||
/* navigate = */ true, argv,
|
/* navigate = */ true, argv,
|
||||||
/* aIsPopupSpam = */ false,
|
/* aIsPopupSpam = */ false,
|
||||||
/* aForceNoOpener = */ false,
|
/* aForceNoOpener = */ false,
|
||||||
/* aLoadState = */ nullptr,
|
/* aLoadInfo = */ nullptr,
|
||||||
aResult);
|
aResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -391,7 +391,7 @@ nsWindowWatcher::OpenWindow2(mozIDOMWindowProxy* aParent,
|
||||||
nsISupports* aArguments,
|
nsISupports* aArguments,
|
||||||
bool aIsPopupSpam,
|
bool aIsPopupSpam,
|
||||||
bool aForceNoOpener,
|
bool aForceNoOpener,
|
||||||
nsDocShellLoadState* aLoadState,
|
nsDocShellLoadInfo* aLoadInfo,
|
||||||
mozIDOMWindowProxy** aResult)
|
mozIDOMWindowProxy** aResult)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIArray> argv = ConvertArgsToArray(aArguments);
|
nsCOMPtr<nsIArray> argv = ConvertArgsToArray(aArguments);
|
||||||
|
|
@ -412,7 +412,7 @@ nsWindowWatcher::OpenWindow2(mozIDOMWindowProxy* aParent,
|
||||||
return OpenWindowInternal(aParent, aUrl, aName, aFeatures,
|
return OpenWindowInternal(aParent, aUrl, aName, aFeatures,
|
||||||
aCalledFromScript, dialog,
|
aCalledFromScript, dialog,
|
||||||
aNavigate, argv, aIsPopupSpam,
|
aNavigate, argv, aIsPopupSpam,
|
||||||
aForceNoOpener, aLoadState, aResult);
|
aForceNoOpener, aLoadInfo, aResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This static function checks if the aDocShell uses an UserContextId equal to
|
// This static function checks if the aDocShell uses an UserContextId equal to
|
||||||
|
|
@ -637,7 +637,7 @@ nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy* aParent,
|
||||||
nsIArray* aArgv,
|
nsIArray* aArgv,
|
||||||
bool aIsPopupSpam,
|
bool aIsPopupSpam,
|
||||||
bool aForceNoOpener,
|
bool aForceNoOpener,
|
||||||
nsDocShellLoadState* aLoadState,
|
nsDocShellLoadInfo* aLoadInfo,
|
||||||
mozIDOMWindowProxy** aResult)
|
mozIDOMWindowProxy** aResult)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
@ -821,7 +821,7 @@ nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy* aParent,
|
||||||
sizeSpec.PositionSpecified(),
|
sizeSpec.PositionSpecified(),
|
||||||
sizeSpec.SizeSpecified(),
|
sizeSpec.SizeSpecified(),
|
||||||
uriToLoad, name, features, aForceNoOpener,
|
uriToLoad, name, features, aForceNoOpener,
|
||||||
aLoadState, &windowIsNew,
|
aLoadInfo, &windowIsNew,
|
||||||
getter_AddRefs(newWindow));
|
getter_AddRefs(newWindow));
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
|
@ -1118,12 +1118,12 @@ nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy* aParent,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<nsDocShellLoadState> loadState = aLoadState;
|
RefPtr<nsDocShellLoadInfo> loadInfo = aLoadInfo;
|
||||||
if (uriToLoad && aNavigate && !loadState) {
|
if (uriToLoad && aNavigate && !loadInfo) {
|
||||||
loadState = new nsDocShellLoadState();
|
loadInfo = new nsDocShellLoadInfo();
|
||||||
|
|
||||||
if (subjectPrincipal) {
|
if (subjectPrincipal) {
|
||||||
loadState->SetTriggeringPrincipal(subjectPrincipal);
|
loadInfo->SetTriggeringPrincipal(subjectPrincipal);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* use the URL from the *extant* document, if any. The usual accessor
|
/* use the URL from the *extant* document, if any. The usual accessor
|
||||||
|
|
@ -1138,8 +1138,8 @@ nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy* aParent,
|
||||||
}
|
}
|
||||||
if (doc) {
|
if (doc) {
|
||||||
// Set the referrer
|
// Set the referrer
|
||||||
loadState->SetReferrer(doc->GetDocumentURI());
|
loadInfo->SetReferrer(doc->GetDocumentURI());
|
||||||
loadState->SetReferrerPolicy(doc->GetReferrerPolicy());
|
loadInfo->SetReferrerPolicy(doc->GetReferrerPolicy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1181,13 +1181,13 @@ nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy* aParent,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uriToLoad && aNavigate) {
|
if (uriToLoad && aNavigate) {
|
||||||
loadState->SetURI(uriToLoad);
|
newDocShell->LoadURI(
|
||||||
loadState->SetLoadFlags(windowIsNew ?
|
uriToLoad,
|
||||||
|
loadInfo,
|
||||||
|
windowIsNew ?
|
||||||
static_cast<uint32_t>(nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD) :
|
static_cast<uint32_t>(nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD) :
|
||||||
static_cast<uint32_t>(nsIWebNavigation::LOAD_FLAGS_NONE));
|
static_cast<uint32_t>(nsIWebNavigation::LOAD_FLAGS_NONE),
|
||||||
loadState->SetFirstParty(true);
|
true);
|
||||||
// Should this pay attention to errors returned by LoadURI?
|
|
||||||
newDocShell->LoadURI(loadState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy the current session storage for the current domain. Don't perform the
|
// Copy the current session storage for the current domain. Don't perform the
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ protected:
|
||||||
nsIArray* aArgv,
|
nsIArray* aArgv,
|
||||||
bool aIsPopupSpam,
|
bool aIsPopupSpam,
|
||||||
bool aForceNoOpener,
|
bool aForceNoOpener,
|
||||||
nsDocShellLoadState* aLoadState,
|
nsDocShellLoadInfo* aLoadInfo,
|
||||||
mozIDOMWindowProxy** aResult);
|
mozIDOMWindowProxy** aResult);
|
||||||
|
|
||||||
static nsresult URIfromURL(const char* aURL,
|
static nsresult URIfromURL(const char* aURL,
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
#include "nsWindowWatcher.h"
|
#include "nsWindowWatcher.h"
|
||||||
#include "mozilla/BrowserElementParent.h"
|
#include "mozilla/BrowserElementParent.h"
|
||||||
#include "mozilla/NullPrincipal.h"
|
#include "mozilla/NullPrincipal.h"
|
||||||
#include "nsDocShellLoadState.h"
|
#include "nsDocShellLoadInfo.h"
|
||||||
|
|
||||||
#include "nsIScriptObjectPrincipal.h"
|
#include "nsIScriptObjectPrincipal.h"
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
|
|
@ -766,7 +766,7 @@ nsContentTreeOwner::ProvideWindow(mozIDOMWindowProxy* aParent,
|
||||||
const nsAString& aName,
|
const nsAString& aName,
|
||||||
const nsACString& aFeatures,
|
const nsACString& aFeatures,
|
||||||
bool aForceNoOpener,
|
bool aForceNoOpener,
|
||||||
nsDocShellLoadState* aLoadState,
|
nsDocShellLoadInfo* aLoadInfo,
|
||||||
bool* aWindowIsNew,
|
bool* aWindowIsNew,
|
||||||
mozIDOMWindowProxy** aReturn)
|
mozIDOMWindowProxy** aReturn)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue