Commit 631cf612 authored by arthursonzogni's avatar arthursonzogni Committed by Commit Bot

Test: MHTML document loaded inside a data-URL parent.

In an MHTML document, blink::DocumentLoader::archive_ is transmitted
from parent to children. data-URL aren't loaded from the MHTML archive.
In this case, does it means children of data-URL aren't able to be
loaded from the MHTML archive? Hopefully, it is currently working. They
are able to load from the MHTML document, because |archive_| continue to
be transmitted.

This CL adds a test to ensure this continue to work in the future.

Bug: None.
Change-Id: Icb51dc48691112cf9e45dfe8cb81d389544a0c41
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1635669
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#665876}
parent 252fc8d3
...@@ -413,4 +413,35 @@ IN_PROC_BROWSER_TEST_F(NavigationMhtmlBrowserTest, IframeContentIdNotFound) { ...@@ -413,4 +413,35 @@ IN_PROC_BROWSER_TEST_F(NavigationMhtmlBrowserTest, IframeContentIdNotFound) {
EXPECT_FALSE(iframe_navigation.is_error()); EXPECT_FALSE(iframe_navigation.is_error());
} }
// Check MHTML subframe works when its parent is loaded from a data-URL.
//
// Frame tree: a1(a2(a3))
// - a1: The main document. Loaded from the MHTML archive.
// - a2: An sub-document loaded from a data-URL.
// - a3: A sub-sub-document loaded from the MHTML archive.
IN_PROC_BROWSER_TEST_F(NavigationMhtmlBrowserTest, MhtmlIframeInsideDataUrl) {
MhtmlArchive mhtml_archive;
mhtml_archive.AddHtmlDocument(
GURL("http://example.com/a1.html"),
"<iframe src=\"data:text/html,"
" <iframe src=&quot;http://example.com/a3.html&quot;></iframe>"
"\"></iframe>");
mhtml_archive.AddHtmlDocument(GURL("http://example.com/a3.html"),
"<iframe></iframe>");
GURL mhtml_url = mhtml_archive.Write("index.mhtml");
EXPECT_TRUE(NavigateToURL(shell(), mhtml_url));
RenderFrameHostImpl* a1_rfh = main_frame_host();
ASSERT_EQ(1u, a1_rfh->child_count());
RenderFrameHostImpl* a2_rfh = a1_rfh->child_at(0)->current_frame_host();
ASSERT_EQ(1u, a2_rfh->child_count());
// Check a3 is properly loaded. EvalJs("document.body.innerHTML") can't be
// used, because javascript is disabled. Instead, check it was able to load an
// iframe.
RenderFrameHostImpl* a3_rfh = a2_rfh->child_at(0)->current_frame_host();
ASSERT_EQ(1u, a3_rfh->child_count());
}
} // namespace content } // namespace content
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment