Bug 1646899 - P4: Handle object & embed via DocumentChannel. r=mattwoodrow,jya

Pass internal content policy type to DLL and switch behavior depending on type
being loaded. This implementation immediately redirects channel back to the
content process for further handling.

Differential Revision: https://phabricator.services.mozilla.com/D80407
This commit is contained in:
Dan Glastonbury
2020-07-13 00:48:57 +00:00
parent 8cc0ad8e59
commit 88f5bd0463
12 changed files with 734 additions and 282 deletions

View File

@@ -9253,9 +9253,26 @@ nsIPrincipal* nsDocShell::GetInheritedPrincipal(
if (nsCOMPtr<nsITimedChannel> timedChannel = do_QueryInterface(channel)) {
timedChannel->SetTimingEnabled(true);
auto& embedderElementType = aBrowsingContext->GetEmbedderElementType();
if (embedderElementType) {
timedChannel->SetInitiatorType(*embedderElementType);
nsString initiatorType;
switch (aLoadInfo->InternalContentPolicyType()) {
case nsIContentPolicy::TYPE_INTERNAL_EMBED:
initiatorType = u"embed"_ns;
break;
case nsIContentPolicy::TYPE_INTERNAL_OBJECT:
initiatorType = u"object"_ns;
break;
default: {
const auto& embedderElementType =
aBrowsingContext->GetEmbedderElementType();
if (embedderElementType) {
initiatorType = *embedderElementType;
}
break;
}
}
if (!initiatorType.IsEmpty()) {
timedChannel->SetInitiatorType(initiatorType);
}
}
@@ -9574,9 +9591,9 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState,
nsCOMPtr<nsIChannel> channel;
if (DocumentChannel::CanUseDocumentChannel(aLoadState->URI(),
aLoadState->LoadFlags())) {
channel = DocumentChannel::CreateDocumentChannel(aLoadState, loadInfo,
loadFlags, this, cacheKey,
uriModified, isXFOError);
channel = DocumentChannel::CreateForDocument(aLoadState, loadInfo,
loadFlags, this, cacheKey,
uriModified, isXFOError);
MOZ_ASSERT(channel);
// Disable keyword fixup when using DocumentChannel, since