Commit ead9009e authored by jochen@chromium.org's avatar jochen@chromium.org

When starting a provisional load, indicate whether the provisional URL is about:srcdoc

This corresponds to an iframe loading the document given in its srcdoc attribute

BUG=143337
R=creis@chromium.org


Review URL: https://chromiumcodereview.appspot.com/11788015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175396 0039d316-1c4b-4281-b951-d872f2087c98
parent fc0a0006
......@@ -65,6 +65,7 @@ void CaptivePortalTabHelper::DidStartProvisionalLoadForFrame(
bool is_main_frame,
const GURL& validated_url,
bool is_error_page,
bool is_iframe_srcdoc,
content::RenderViewHost* render_view_host) {
DCHECK(CalledOnValidThread());
......
......@@ -71,6 +71,7 @@ class CaptivePortalTabHelper
bool is_main_frame,
const GURL& validated_url,
bool is_error_page,
bool is_iframe_srcdoc,
content::RenderViewHost* render_view_host) OVERRIDE;
virtual void DidCommitProvisionalLoadForFrame(
......
......@@ -89,7 +89,7 @@ class CaptivePortalTabHelperTest : public ChromeRenderViewHostTestHarness {
content::RenderViewHost* render_view_host) {
EXPECT_CALL(mock_reloader(), OnLoadStart(url.SchemeIsSecure())).Times(1);
tab_helper().DidStartProvisionalLoadForFrame(
1, -1, true, url, false, render_view_host);
1, -1, true, url, false, false, render_view_host);
EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::OK)).Times(1);
tab_helper().DidCommitProvisionalLoadForFrame(
......@@ -101,14 +101,14 @@ class CaptivePortalTabHelperTest : public ChromeRenderViewHostTestHarness {
content::RenderViewHost* render_view_host) {
EXPECT_CALL(mock_reloader(), OnLoadStart(url.SchemeIsSecure())).Times(1);
tab_helper().DidStartProvisionalLoadForFrame(
1, -1, true, url, false, render_view_host);
1, -1, true, url, false, false, render_view_host);
tab_helper().DidFailProvisionalLoad(
1, true, url, net::ERR_TIMED_OUT, string16(), render_view_host);
// Provisional load starts for the error page.
tab_helper().DidStartProvisionalLoadForFrame(
1, -1, true, GURL(kErrorPageUrl), true, render_view_host);
1, -1, true, GURL(kErrorPageUrl), true, false, render_view_host);
EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::ERR_TIMED_OUT)).Times(1);
tab_helper().DidCommitProvisionalLoadForFrame(
......@@ -122,7 +122,7 @@ class CaptivePortalTabHelperTest : public ChromeRenderViewHostTestHarness {
NavigationType navigation_type) {
EXPECT_CALL(mock_reloader(), OnLoadStart(url.SchemeIsSecure())).Times(1);
tab_helper().DidStartProvisionalLoadForFrame(
1, -1, true, url, false, render_view_host);
1, -1, true, url, false, false, render_view_host);
EXPECT_CALL(mock_reloader(), OnAbort()).Times(1);
if (navigation_type == kSameProcess) {
......@@ -149,14 +149,14 @@ class CaptivePortalTabHelperTest : public ChromeRenderViewHostTestHarness {
NavigationType navigation_type) {
EXPECT_CALL(mock_reloader(), OnLoadStart(url.SchemeIsSecure())).Times(1);
tab_helper().DidStartProvisionalLoadForFrame(
1, -1, true, url, false, render_view_host);
1, -1, true, url, false, false, render_view_host);
tab_helper().DidFailProvisionalLoad(
1, true, url, net::ERR_TIMED_OUT, string16(), render_view_host);
// Start event for the error page.
tab_helper().DidStartProvisionalLoadForFrame(
1, -1, true, url, true, render_view_host);
1, -1, true, url, true, false, render_view_host);
EXPECT_CALL(mock_reloader(), OnAbort()).Times(1);
if (navigation_type == kSameProcess) {
......@@ -250,7 +250,7 @@ TEST_F(CaptivePortalTabHelperTest, HttpTimeoutLinkDoctor) {
EXPECT_CALL(mock_reloader(), OnLoadStart(false)).Times(1);
// Provisional load starts for the error page.
tab_helper().DidStartProvisionalLoadForFrame(
1, -1, true, GURL(kErrorPageUrl), true, render_view_host1());
1, -1, true, GURL(kErrorPageUrl), true, false, render_view_host1());
EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::OK)).Times(1);
tab_helper().DidCommitProvisionalLoadForFrame(
......@@ -324,7 +324,7 @@ TEST_F(CaptivePortalTabHelperTest, UnexpectedProvisionalLoad) {
EXPECT_CALL(mock_reloader(),
OnLoadStart(same_site_url.SchemeIsSecure())).Times(1);
tab_helper().DidStartProvisionalLoadForFrame(
1, -1, true, same_site_url, false, render_view_host1());
1, -1, true, same_site_url, false, false, render_view_host1());
// It's unexpectedly interrupted by a cross-process navigation, which starts
// navigating before the old navigation cancels. We generate an abort message
......@@ -333,7 +333,7 @@ TEST_F(CaptivePortalTabHelperTest, UnexpectedProvisionalLoad) {
EXPECT_CALL(mock_reloader(),
OnLoadStart(cross_process_url.SchemeIsSecure())).Times(1);
tab_helper().DidStartProvisionalLoadForFrame(
1, -1, true, cross_process_url, false, render_view_host2());
1, -1, true, cross_process_url, false, false, render_view_host2());
// The cross-process navigation fails.
tab_helper().DidFailProvisionalLoad(
......@@ -348,7 +348,7 @@ TEST_F(CaptivePortalTabHelperTest, UnexpectedProvisionalLoad) {
// The provisional load starts for the error page for the cross-process
// navigation.
tab_helper().DidStartProvisionalLoadForFrame(
1, -1, true, GURL(kErrorPageUrl), true, render_view_host2());
1, -1, true, GURL(kErrorPageUrl), true, false, render_view_host2());
EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::ERR_FAILED)).Times(1);
tab_helper().DidCommitProvisionalLoadForFrame(
......@@ -366,7 +366,7 @@ TEST_F(CaptivePortalTabHelperTest, UnexpectedCommit) {
EXPECT_CALL(mock_reloader(),
OnLoadStart(same_site_url.SchemeIsSecure())).Times(1);
tab_helper().DidStartProvisionalLoadForFrame(
1, -1, true, same_site_url, false, render_view_host1());
1, -1, true, same_site_url, false, false, render_view_host1());
// It's unexpectedly interrupted by a cross-process navigation, which starts
// navigating before the old navigation cancels. We generate an abort message
......@@ -375,7 +375,7 @@ TEST_F(CaptivePortalTabHelperTest, UnexpectedCommit) {
EXPECT_CALL(mock_reloader(),
OnLoadStart(cross_process_url.SchemeIsSecure())).Times(1);
tab_helper().DidStartProvisionalLoadForFrame(
1, -1, true, cross_process_url, false, render_view_host2());
1, -1, true, cross_process_url, false, false, render_view_host2());
// The cross-process navigation fails.
tab_helper().DidFailProvisionalLoad(
......@@ -398,23 +398,23 @@ TEST_F(CaptivePortalTabHelperTest, HttpsSubframe) {
GURL url = GURL(kHttpsUrl);
// Normal load.
tab_helper().DidStartProvisionalLoadForFrame(
1, -1, false, url, false, render_view_host1());
1, -1, false, url, false, false, render_view_host1());
tab_helper().DidCommitProvisionalLoadForFrame(
1, false, url, content::PAGE_TRANSITION_LINK, render_view_host1());
// Timeout.
tab_helper().DidStartProvisionalLoadForFrame(
2, -1, false, url, false, render_view_host1());
2, -1, false, url, false, false, render_view_host1());
tab_helper().DidFailProvisionalLoad(
2, false, url, net::ERR_TIMED_OUT, string16(), render_view_host1());
tab_helper().DidStartProvisionalLoadForFrame(
2, -1, false, url, true, render_view_host1());
2, -1, false, url, true, false, render_view_host1());
tab_helper().DidFailProvisionalLoad(
2, false, url, net::ERR_ABORTED, string16(), render_view_host1());
// Abort.
tab_helper().DidStartProvisionalLoadForFrame(
3, -1, false, url, false, render_view_host1());
3, -1, false, url, false, false, render_view_host1());
tab_helper().DidFailProvisionalLoad(
3, false, url, net::ERR_ABORTED, string16(), render_view_host1());
}
......@@ -432,9 +432,9 @@ TEST_F(CaptivePortalTabHelperTest, HttpsSubframeParallelError) {
// Loads start.
EXPECT_CALL(mock_reloader(), OnLoadStart(url.SchemeIsSecure())).Times(1);
tab_helper().DidStartProvisionalLoadForFrame(
frame_id, -1, true, url, false, render_view_host1());
frame_id, -1, true, url, false, false, render_view_host1());
tab_helper().DidStartProvisionalLoadForFrame(
subframe_id, frame_id, false, url, false, render_view_host1());
subframe_id, frame_id, false, url, false, false, render_view_host1());
// Loads return errors.
tab_helper().DidFailProvisionalLoad(
......@@ -446,9 +446,9 @@ TEST_F(CaptivePortalTabHelperTest, HttpsSubframeParallelError) {
// Provisional load starts for the error pages.
tab_helper().DidStartProvisionalLoadForFrame(
frame_id, -1, true, url, true, render_view_host1());
frame_id, -1, true, url, true, false, render_view_host1());
tab_helper().DidStartProvisionalLoadForFrame(
subframe_id, frame_id, false, url, true, render_view_host1());
subframe_id, frame_id, false, url, true, false, render_view_host1());
// Error page load finishes.
tab_helper().DidCommitProvisionalLoadForFrame(
......@@ -465,7 +465,7 @@ TEST_F(CaptivePortalTabHelperTest, HttpToHttpsRedirectTimeout) {
GURL http_url(kHttpUrl);
EXPECT_CALL(mock_reloader(), OnLoadStart(false)).Times(1);
tab_helper().DidStartProvisionalLoadForFrame(
1, -1, true, http_url, false, render_view_host1());
1, -1, true, http_url, false, false, render_view_host1());
GURL https_url(kHttpsUrl);
EXPECT_CALL(mock_reloader(), OnRedirect(true)).Times(1);
......@@ -478,7 +478,7 @@ TEST_F(CaptivePortalTabHelperTest, HttpToHttpsRedirectTimeout) {
// Provisional load starts for the error page.
tab_helper().DidStartProvisionalLoadForFrame(
1, -1, true, GURL(kErrorPageUrl), true, render_view_host1());
1, -1, true, GURL(kErrorPageUrl), true, false, render_view_host1());
EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::ERR_TIMED_OUT)).Times(1);
tab_helper().DidCommitProvisionalLoadForFrame(
......@@ -492,7 +492,7 @@ TEST_F(CaptivePortalTabHelperTest, HttpsToHttpRedirect) {
EXPECT_CALL(mock_reloader(),
OnLoadStart(https_url.SchemeIsSecure())).Times(1);
tab_helper().DidStartProvisionalLoadForFrame(1, -1, true, https_url, false,
render_view_host1());
false, render_view_host1());
GURL http_url(kHttpUrl);
EXPECT_CALL(mock_reloader(), OnRedirect(http_url.SchemeIsSecure())).Times(1);
......@@ -511,7 +511,7 @@ TEST_F(CaptivePortalTabHelperTest, HttpToHttpRedirect) {
EXPECT_CALL(mock_reloader(),
OnLoadStart(http_url.SchemeIsSecure())).Times(1);
tab_helper().DidStartProvisionalLoadForFrame(
1, -1, true, http_url, false, render_view_host1());
1, -1, true, http_url, false, false, render_view_host1());
EXPECT_CALL(mock_reloader(), OnRedirect(http_url.SchemeIsSecure())).Times(1);
OnRedirect(ResourceType::MAIN_FRAME, http_url,
......@@ -528,7 +528,7 @@ TEST_F(CaptivePortalTabHelperTest, SubframeRedirect) {
GURL http_url(kHttpUrl);
EXPECT_CALL(mock_reloader(), OnLoadStart(false)).Times(1);
tab_helper().DidStartProvisionalLoadForFrame(
1, -1, true, http_url, false, render_view_host1());
1, -1, true, http_url, false, false, render_view_host1());
GURL https_url(kHttpsUrl);
OnRedirect(ResourceType::SUB_FRAME, https_url,
......@@ -545,7 +545,7 @@ TEST_F(CaptivePortalTabHelperTest, OtherRenderViewHostRedirect) {
GURL http_url(kHttpUrl);
EXPECT_CALL(mock_reloader(), OnLoadStart(false)).Times(1);
tab_helper().DidStartProvisionalLoadForFrame(
1, -1, true, http_url, false, render_view_host1());
1, -1, true, http_url, false, false, render_view_host1());
// Another RenderViewHost sees a redirect. None of the reloader's functions
// should be called.
......@@ -559,7 +559,7 @@ TEST_F(CaptivePortalTabHelperTest, OtherRenderViewHostRedirect) {
// Provisional load starts for the error page.
tab_helper().DidStartProvisionalLoadForFrame(
1, -1, true, GURL(kErrorPageUrl), true, render_view_host1());
1, -1, true, GURL(kErrorPageUrl), true, false, render_view_host1());
EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::ERR_TIMED_OUT)).Times(1);
tab_helper().DidCommitProvisionalLoadForFrame(
......
......@@ -499,6 +499,7 @@ void TabSpecificContentSettings::DidStartProvisionalLoadForFrame(
bool is_main_frame,
const GURL& validated_url,
bool is_error_page,
bool is_iframe_srcdoc,
RenderViewHost* render_view_host) {
if (!is_main_frame)
return;
......
......@@ -243,6 +243,7 @@ class TabSpecificContentSettings
bool is_main_frame,
const GURL& validated_url,
bool is_error_page,
bool is_iframe_srcdoc,
content::RenderViewHost* render_view_host) OVERRIDE;
virtual void AppCacheAccessed(const GURL& manifest_url,
bool blocked_by_policy) OVERRIDE;
......
......@@ -360,6 +360,7 @@ void WebNavigationTabObserver::DidStartProvisionalLoadForFrame(
bool is_main_frame,
const GURL& validated_url,
bool is_error_page,
bool is_iframe_srcdoc,
content::RenderViewHost* render_view_host) {
if (!render_view_host_)
render_view_host_ = render_view_host;
......
......@@ -61,6 +61,7 @@ class WebNavigationTabObserver
bool is_main_frame,
const GURL& validated_url,
bool is_error_page,
bool is_iframe_srcdoc,
content::RenderViewHost* render_view_host) OVERRIDE;
virtual void DidCommitProvisionalLoadForFrame(
int64 frame_num,
......
......@@ -189,6 +189,7 @@ class DelayLoadStartAndExecuteJavascript
bool is_main_frame,
const GURL& validated_url,
bool is_error_page,
bool is_iframe_srcdoc,
content::RenderViewHost* render_view_host) OVERRIDE {
if (validated_url != delay_url_ || !rvh_)
return;
......
......@@ -271,6 +271,7 @@ void LoadTimeStatsTabHelper::DidStartProvisionalLoadForFrame(
bool is_main_frame,
const GURL& validated_url,
bool is_error_page,
bool is_iframe_srcdoc,
content::RenderViewHost* render_view_host) {
if (!is_main_frame)
return;
......
......@@ -132,6 +132,7 @@ class LoadTimeStatsTabHelper
bool is_main_frame,
const GURL& validated_url,
bool is_error_page,
bool is_iframe_srcdoc,
content::RenderViewHost* render_view_host) OVERRIDE;
virtual void DidStopLoading(
content::RenderViewHost* render_view_host) OVERRIDE;
......
......@@ -558,6 +558,7 @@ void PrerenderContents::DidStartProvisionalLoadForFrame(
bool is_main_frame,
const GURL& validated_url,
bool is_error_page,
bool is_iframe_srcdoc,
RenderViewHost* render_view_host) {
if (is_main_frame) {
if (!AddAliasURL(validated_url))
......
......@@ -226,6 +226,7 @@ class PrerenderContents : public content::NotificationObserver,
bool is_main_frame,
const GURL& validated_url,
bool is_error_page,
bool is_iframe_srcdoc,
content::RenderViewHost* render_view_host) OVERRIDE;
virtual void DidFinishLoad(
int64 frame_id,
......
......@@ -203,6 +203,7 @@ void PrerenderTabHelper::DidStartProvisionalLoadForFrame(
bool is_main_frame,
const GURL& validated_url,
bool is_error_page,
bool is_iframe_srcdoc,
content::RenderViewHost* render_view_host) {
if (is_main_frame) {
// Record the beginning of a new PPLT navigation.
......
......@@ -35,6 +35,7 @@ class PrerenderTabHelper
bool is_main_frame,
const GURL& validated_url,
bool is_error_page,
bool is_iframe_srcdoc,
content::RenderViewHost* render_view_host) OVERRIDE;
virtual void DidCommitProvisionalLoadForFrame(
int64 frame_id,
......
......@@ -244,6 +244,7 @@ void BrowserPluginGuest::DidStartProvisionalLoadForFrame(
bool is_main_frame,
const GURL& validated_url,
bool is_error_page,
bool is_iframe_srcdoc,
RenderViewHost* render_view_host) {
// Inform the embedder of the loadStart.
SendMessageToEmbedder(
......
......@@ -113,6 +113,7 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver,
bool is_main_frame,
const GURL& validated_url,
bool is_error_page,
bool is_iframe_srcdoc,
RenderViewHost* render_view_host) OVERRIDE;
virtual void DidFailProvisionalLoad(
int64 frame_id,
......
......@@ -1978,6 +1978,7 @@ void WebContentsImpl::DidStartProvisionalLoadForFrame(
bool is_main_frame,
const GURL& url) {
bool is_error_page = (url.spec() == kUnreachableWebDataURL);
bool is_iframe_srcdoc = (url.spec() == chrome::kAboutSrcDocURL);
GURL validated_url(url);
RenderProcessHost* render_process_host =
render_view_host->GetProcess();
......@@ -1987,7 +1988,7 @@ void WebContentsImpl::DidStartProvisionalLoadForFrame(
FOR_EACH_OBSERVER(WebContentsObserver, observers_,
DidStartProvisionalLoadForFrame(frame_id, parent_frame_id,
is_main_frame, validated_url, is_error_page,
render_view_host));
is_iframe_srcdoc, render_view_host));
if (is_main_frame) {
// Notify observers about the provisional change in the main frame URL.
......
......@@ -59,6 +59,7 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Listener,
bool is_main_frame,
const GURL& validated_url,
bool is_error_page,
bool is_iframe_srcdoc,
RenderViewHost* render_view_host) {}
virtual void ProvisionalChangeToMainFrameUrl(
const GURL& url,
......
......@@ -30,6 +30,7 @@ const char kSwappedOutScheme[] = "swappedout";
const char kViewSourceScheme[] = "view-source";
const char kAboutBlankURL[] = "about:blank";
const char kAboutSrcDocURL[] = "about:srcdoc";
const char kChromeUIAppCacheInternalsHost[] = "appcache-internals";
const char kChromeUIBlobInternalsHost[] = "blob-internals";
const char kChromeUIBrowserCrashHost[] = "inducebrowsercrashforrealz";
......
......@@ -36,6 +36,7 @@ CONTENT_EXPORT extern const char kViewSourceScheme[];
// Hosts for about URLs.
CONTENT_EXPORT extern const char kAboutBlankURL[];
CONTENT_EXPORT extern const char kAboutSrcDocURL[];
CONTENT_EXPORT extern const char kChromeUIAppCacheInternalsHost[];
CONTENT_EXPORT extern const char kChromeUIBlobInternalsHost[];
CONTENT_EXPORT extern const char kChromeUIBrowserCrashHost[];
......
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