mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 23:35:34 +00:00
Bug 1621192 - P4: Remove documentOpenFlags from DocumentChannelCreationArgs. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D66170 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
2e0a825b23
commit
85893ca83c
@ -10165,16 +10165,24 @@ nsresult nsDocShell::DoChannelLoad(nsIChannel* aChannel,
|
||||
}
|
||||
|
||||
(void)aChannel->SetLoadFlags(loadFlags);
|
||||
uint32_t openFlags = ComputeURILoaderFlags(mBrowsingContext, mLoadType);
|
||||
|
||||
return OpenInitializedChannel(aChannel, aURILoader, openFlags);
|
||||
}
|
||||
|
||||
/* static */ uint32_t nsDocShell::ComputeURILoaderFlags(
|
||||
BrowsingContext* aBrowsingContext, uint32_t aLoadType) {
|
||||
MOZ_ASSERT(aBrowsingContext);
|
||||
|
||||
uint32_t openFlags = 0;
|
||||
if (mLoadType == LOAD_LINK) {
|
||||
if (aLoadType == LOAD_LINK) {
|
||||
openFlags |= nsIURILoader::IS_CONTENT_PREFERRED;
|
||||
}
|
||||
if (!mBrowsingContext->GetAllowContentRetargeting()) {
|
||||
if (!aBrowsingContext->GetAllowContentRetargeting()) {
|
||||
openFlags |= nsIURILoader::DONT_RETARGET;
|
||||
}
|
||||
|
||||
return OpenInitializedChannel(aChannel, aURILoader, openFlags);
|
||||
return openFlags;
|
||||
}
|
||||
|
||||
nsresult nsDocShell::OpenInitializedChannel(nsIChannel* aChannel,
|
||||
@ -10210,9 +10218,7 @@ nsresult nsDocShell::OpenInitializedChannel(nsIChannel* aChannel,
|
||||
// since redirects get handled in the parent process in that case.
|
||||
RefPtr<net::DocumentChannel> docChannel = do_QueryObject(aChannel);
|
||||
if (docChannel && XRE_IsContentProcess()) {
|
||||
docChannel->SetDocumentOpenFlags(aOpenFlags);
|
||||
// Now that we've sent the real flags across to be run on the parent,
|
||||
// tell the content process nsDocumentOpenInfo to not try to do
|
||||
// Tell the content process nsDocumentOpenInfo to not try to do
|
||||
// any sort of targeting.
|
||||
aOpenFlags |= nsIURILoader::DONT_RETARGET;
|
||||
}
|
||||
|
@ -533,6 +533,9 @@ class nsDocShell final : public nsDocLoader,
|
||||
static void ExtractLastVisit(nsIChannel* aChannel, nsIURI** aURI,
|
||||
uint32_t* aChannelRedirectFlags);
|
||||
|
||||
static uint32_t ComputeURILoaderFlags(
|
||||
mozilla::dom::BrowsingContext* aBrowsingContext, uint32_t aLoadType);
|
||||
|
||||
private: // member functions
|
||||
friend class nsDSURIContentListener;
|
||||
friend class FramingChecker;
|
||||
|
@ -57,10 +57,6 @@ class DocumentChannel : public nsIIdentChannel, public nsITraceableChannel {
|
||||
*aChannelRedirectFlags = mLastVisitInfo.previousFlags();
|
||||
}
|
||||
|
||||
void SetDocumentOpenFlags(uint32_t aFlags) {
|
||||
mDocumentOpenFlags = Some(aFlags);
|
||||
}
|
||||
|
||||
void SetNavigationTiming(nsDOMNavigationTiming* aTiming) {
|
||||
mTiming = aTiming;
|
||||
}
|
||||
@ -83,7 +79,6 @@ class DocumentChannel : public nsIIdentChannel, public nsITraceableChannel {
|
||||
|
||||
nsresult mStatus = NS_OK;
|
||||
bool mCanceled = false;
|
||||
Maybe<uint32_t> mDocumentOpenFlags;
|
||||
bool mIsPending = false;
|
||||
bool mWasOpened = false;
|
||||
uint64_t mChannelId;
|
||||
|
@ -86,7 +86,6 @@ DocumentChannelChild::AsyncOpen(nsIStreamListener* aListener) {
|
||||
args.cacheKey() = mCacheKey;
|
||||
args.channelId() = mChannelId;
|
||||
args.asyncOpenTime() = mAsyncOpenTime;
|
||||
args.documentOpenFlags() = mDocumentOpenFlags;
|
||||
args.outerWindowId() = mLoadInfo->GetOuterWindowID();
|
||||
|
||||
Maybe<IPCClientInfo> ipcClientInfo;
|
||||
|
@ -55,8 +55,8 @@ bool DocumentChannelParent::Init(const DocumentChannelCreationArgs& aArgs) {
|
||||
rv = NS_ERROR_UNEXPECTED;
|
||||
if (!mParent->Open(loadState, loadInfo, aArgs.loadFlags(), aArgs.cacheKey(),
|
||||
aArgs.channelId(), aArgs.asyncOpenTime(),
|
||||
aArgs.documentOpenFlags(), aArgs.timing().refOr(nullptr),
|
||||
std::move(clientInfo), aArgs.outerWindowId(), &rv)) {
|
||||
aArgs.timing().refOr(nullptr), std::move(clientInfo),
|
||||
aArgs.outerWindowId(), &rv)) {
|
||||
return SendFailedAsyncOpen(rv);
|
||||
}
|
||||
|
||||
|
@ -334,9 +334,8 @@ GetTopWindowExcludingExtensionAccessibleContentFrames(
|
||||
bool DocumentLoadListener::Open(
|
||||
nsDocShellLoadState* aLoadState, class LoadInfo* aLoadInfo,
|
||||
nsLoadFlags aLoadFlags, uint32_t aCacheKey, const uint64_t& aChannelId,
|
||||
const TimeStamp& aAsyncOpenTime, const Maybe<uint32_t>& aDocumentOpenFlags,
|
||||
nsDOMNavigationTiming* aTiming, Maybe<ClientInfo>&& aInfo,
|
||||
uint64_t aOuterWindowId, nsresult* aRv) {
|
||||
const TimeStamp& aAsyncOpenTime, nsDOMNavigationTiming* aTiming,
|
||||
Maybe<ClientInfo>&& aInfo, uint64_t aOuterWindowId, nsresult* aRv) {
|
||||
LOG(("DocumentLoadListener Open [this=%p, uri=%s]", this,
|
||||
aLoadState->URI()->GetSpecOrDefault().get()));
|
||||
RefPtr<CanonicalBrowsingContext> browsingContext =
|
||||
@ -446,16 +445,19 @@ bool DocumentLoadListener::Open(
|
||||
// across any serviceworker related data between channels as needed.
|
||||
AddClientChannelHelperInParent(mChannel, std::move(aInfo));
|
||||
|
||||
if (aDocumentOpenFlags) {
|
||||
RefPtr<ParentProcessDocumentOpenInfo> openInfo =
|
||||
new ParentProcessDocumentOpenInfo(mParentChannelListener,
|
||||
*aDocumentOpenFlags, browsingContext);
|
||||
openInfo->Prepare();
|
||||
// Recalculate the openFlags, matching the logic in use in Content process.
|
||||
// NOTE: The only case not handled here to mirror Content process is
|
||||
// redirecting to re-use the channel.
|
||||
MOZ_ASSERT(!aLoadState->GetPendingRedirectedChannel());
|
||||
uint32_t openFlags = nsDocShell::ComputeURILoaderFlags(
|
||||
browsingContext, aLoadState->LoadType());
|
||||
|
||||
*aRv = mChannel->AsyncOpen(openInfo);
|
||||
} else {
|
||||
*aRv = mChannel->AsyncOpen(mParentChannelListener);
|
||||
}
|
||||
RefPtr<ParentProcessDocumentOpenInfo> openInfo =
|
||||
new ParentProcessDocumentOpenInfo(mParentChannelListener, openFlags,
|
||||
browsingContext);
|
||||
openInfo->Prepare();
|
||||
|
||||
*aRv = mChannel->AsyncOpen(openInfo);
|
||||
if (NS_FAILED(*aRv)) {
|
||||
mParentChannelListener = nullptr;
|
||||
return false;
|
||||
|
@ -72,7 +72,6 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
|
||||
bool Open(nsDocShellLoadState* aLoadState, LoadInfo* aLoadInfo,
|
||||
nsLoadFlags aLoadFlags, uint32_t aCacheKey,
|
||||
const uint64_t& aChannelId, const TimeStamp& aAsyncOpenTime,
|
||||
const Maybe<uint32_t>& aDocumentOpenFlags,
|
||||
nsDOMNavigationTiming* aTiming, Maybe<dom::ClientInfo>&& aInfo,
|
||||
uint64_t aOuterWindowId, nsresult* aRv);
|
||||
|
||||
|
@ -418,7 +418,6 @@ struct DocumentChannelCreationArgs {
|
||||
uint64_t channelId;
|
||||
uint32_t loadFlags;
|
||||
uint32_t cacheKey;
|
||||
uint32_t? documentOpenFlags;
|
||||
bool pluginsAllowed;
|
||||
nsDOMNavigationTiming? timing;
|
||||
IPCClientInfo? initialClientInfo;
|
||||
|
Loading…
Reference in New Issue
Block a user