зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1598520 - Allow DocumentChannel for srcdoc= loads. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D57587 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
eb5ca8b399
Коммит
fae5ac7731
|
@ -9338,7 +9338,7 @@ static bool SchemeUsesDocChannel(nsIURI* aURI) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StaticPrefs::browser_tabs_documentchannel() && XRE_IsContentProcess() &&
|
if (StaticPrefs::browser_tabs_documentchannel() && XRE_IsContentProcess() &&
|
||||||
SchemeUsesDocChannel(aLoadState->URI()) && !isSrcdoc) {
|
SchemeUsesDocChannel(aLoadState->URI())) {
|
||||||
RefPtr<DocumentChannelChild> child = new DocumentChannelChild(
|
RefPtr<DocumentChannelChild> child = new DocumentChannelChild(
|
||||||
aLoadState, aLoadInfo, aInitiatorType, aLoadFlags, aLoadType, aCacheKey,
|
aLoadState, aLoadInfo, aInitiatorType, aLoadFlags, aLoadType, aCacheKey,
|
||||||
aIsActive, aIsTopLevelDoc, aHasNonEmptySandboxingFlags);
|
aIsActive, aIsTopLevelDoc, aHasNonEmptySandboxingFlags);
|
||||||
|
|
|
@ -114,6 +114,7 @@
|
||||||
#include "nsIConsoleService.h"
|
#include "nsIConsoleService.h"
|
||||||
#include "audio_thread_priority.h"
|
#include "audio_thread_priority.h"
|
||||||
#include "nsIURIMutator.h"
|
#include "nsIURIMutator.h"
|
||||||
|
#include "nsIInputStreamChannel.h"
|
||||||
|
|
||||||
#if !defined(XP_WIN)
|
#if !defined(XP_WIN)
|
||||||
# include "mozilla/Omnijar.h"
|
# include "mozilla/Omnijar.h"
|
||||||
|
@ -3693,11 +3694,24 @@ mozilla::ipc::IPCResult ContentChild::RecvCrossProcessRedirect(
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIChannel> newChannel;
|
nsCOMPtr<nsIChannel> newChannel;
|
||||||
rv = NS_NewChannelInternal(getter_AddRefs(newChannel), aArgs.uri(), loadInfo,
|
if (aArgs.loadStateLoadFlags() &
|
||||||
nullptr, // PerformanceStorage
|
nsDocShell::InternalLoad::INTERNAL_LOAD_FLAGS_IS_SRCDOC) {
|
||||||
nullptr, // aLoadGroup
|
rv = NS_NewInputStreamChannelInternal(
|
||||||
nullptr, // aCallbacks
|
getter_AddRefs(newChannel), aArgs.uri(), aArgs.srcdocData(),
|
||||||
aArgs.newLoadFlags());
|
NS_LITERAL_CSTRING("text/html"), loadInfo, true);
|
||||||
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
nsCOMPtr<nsIInputStreamChannel> isc = do_QueryInterface(newChannel);
|
||||||
|
MOZ_ASSERT(isc);
|
||||||
|
isc->SetBaseURI(aArgs.baseUri());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rv =
|
||||||
|
NS_NewChannelInternal(getter_AddRefs(newChannel), aArgs.uri(), loadInfo,
|
||||||
|
nullptr, // PerformanceStorage
|
||||||
|
nullptr, // aLoadGroup
|
||||||
|
nullptr, // aCallbacks
|
||||||
|
aArgs.newLoadFlags());
|
||||||
|
}
|
||||||
|
|
||||||
// This is used to report any errors back to the parent by calling
|
// This is used to report any errors back to the parent by calling
|
||||||
// CrossProcessRedirectFinished.
|
// CrossProcessRedirectFinished.
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "nsContentSecurityManager.h"
|
#include "nsContentSecurityManager.h"
|
||||||
#include "nsDocShellLoadState.h"
|
#include "nsDocShellLoadState.h"
|
||||||
#include "nsHttpHandler.h"
|
#include "nsHttpHandler.h"
|
||||||
|
#include "nsIInputStreamChannel.h"
|
||||||
#include "nsQueryObject.h"
|
#include "nsQueryObject.h"
|
||||||
#include "nsSerializationHelper.h"
|
#include "nsSerializationHelper.h"
|
||||||
#include "nsStreamListenerWrapper.h"
|
#include "nsStreamListenerWrapper.h"
|
||||||
|
@ -320,12 +321,26 @@ IPCResult DocumentChannelChild::RecvRedirectToRealChannel(
|
||||||
mRedirectResolver = std::move(aResolve);
|
mRedirectResolver = std::move(aResolve);
|
||||||
|
|
||||||
nsCOMPtr<nsIChannel> newChannel;
|
nsCOMPtr<nsIChannel> newChannel;
|
||||||
nsresult rv =
|
nsresult rv;
|
||||||
NS_NewChannelInternal(getter_AddRefs(newChannel), aArgs.uri(), loadInfo,
|
if (aArgs.loadStateLoadFlags() &
|
||||||
nullptr, // PerformanceStorage
|
nsDocShell::InternalLoad::INTERNAL_LOAD_FLAGS_IS_SRCDOC) {
|
||||||
mLoadGroup, // aLoadGroup
|
rv = NS_NewInputStreamChannelInternal(
|
||||||
nullptr, // aCallbacks
|
getter_AddRefs(newChannel), aArgs.uri(), aArgs.srcdocData(),
|
||||||
aArgs.newLoadFlags());
|
NS_LITERAL_CSTRING("text/html"), loadInfo, true);
|
||||||
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
nsCOMPtr<nsIInputStreamChannel> isc = do_QueryInterface(newChannel);
|
||||||
|
MOZ_ASSERT(isc);
|
||||||
|
isc->SetBaseURI(aArgs.baseUri());
|
||||||
|
newChannel->SetLoadGroup(mLoadGroup);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rv =
|
||||||
|
NS_NewChannelInternal(getter_AddRefs(newChannel), aArgs.uri(), loadInfo,
|
||||||
|
nullptr, // PerformanceStorage
|
||||||
|
mLoadGroup, // aLoadGroup
|
||||||
|
nullptr, // aCallbacks
|
||||||
|
aArgs.newLoadFlags());
|
||||||
|
}
|
||||||
|
|
||||||
// This is used to report any errors back to the parent by calling
|
// This is used to report any errors back to the parent by calling
|
||||||
// CrossProcessRedirectFinished.
|
// CrossProcessRedirectFinished.
|
||||||
|
|
|
@ -340,6 +340,8 @@ bool DocumentLoadListener::Open(
|
||||||
|
|
||||||
mChannelCreationURI = aLoadState->URI();
|
mChannelCreationURI = aLoadState->URI();
|
||||||
mLoadStateLoadFlags = aLoadState->LoadFlags();
|
mLoadStateLoadFlags = aLoadState->LoadFlags();
|
||||||
|
mSrcdocData = aLoadState->SrcdocData();
|
||||||
|
mBaseURI = aLoadState->BaseURI();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -722,6 +724,8 @@ void DocumentLoadListener::SerializeRedirectData(
|
||||||
nsDocShell::ExtractLastVisit(mChannel, getter_AddRefs(previousURI),
|
nsDocShell::ExtractLastVisit(mChannel, getter_AddRefs(previousURI),
|
||||||
&previousFlags);
|
&previousFlags);
|
||||||
aArgs.lastVisitInfo() = LastVisitInfo{previousURI, previousFlags};
|
aArgs.lastVisitInfo() = LastVisitInfo{previousURI, previousFlags};
|
||||||
|
aArgs.srcdocData() = mSrcdocData;
|
||||||
|
aArgs.baseUri() = mBaseURI;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DocumentLoadListener::TriggerCrossProcessSwitch() {
|
void DocumentLoadListener::TriggerCrossProcessSwitch() {
|
||||||
|
|
|
@ -322,6 +322,9 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
|
||||||
|
|
||||||
nsTArray<DocumentChannelRedirect> mRedirects;
|
nsTArray<DocumentChannelRedirect> mRedirects;
|
||||||
|
|
||||||
|
nsString mSrcdocData;
|
||||||
|
nsCOMPtr<nsIURI> mBaseURI;
|
||||||
|
|
||||||
// Flags from nsDocShellLoadState::LoadFlags that we want to make available
|
// Flags from nsDocShellLoadState::LoadFlags that we want to make available
|
||||||
// to the new docshell if we switch processes.
|
// to the new docshell if we switch processes.
|
||||||
uint32_t mLoadStateLoadFlags = 0;
|
uint32_t mLoadStateLoadFlags = 0;
|
||||||
|
|
|
@ -441,6 +441,8 @@ struct RedirectToRealChannelArgs {
|
||||||
nsIPropertyBag2 properties;
|
nsIPropertyBag2 properties;
|
||||||
LastVisitInfo lastVisitInfo;
|
LastVisitInfo lastVisitInfo;
|
||||||
uint32_t loadStateLoadFlags;
|
uint32_t loadStateLoadFlags;
|
||||||
|
nsString srcdocData;
|
||||||
|
nsIURI baseUri;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TimingStructArgs {
|
struct TimingStructArgs {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче