diff options
author | fdegans <fdegans@chromium.org> | 2015-07-06 06:59:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-06 14:01:01 +0000 |
commit | 7fbe500b24aa0271f40b9c8e48c0cce365d9f33c (patch) | |
tree | 7b00400d1f9aa974479ee6f1267bd5dd19896055 /content/browser/frame_host | |
parent | 0898e7229adfcafd8e327685083fc587ecd388d6 (diff) | |
download | chromium_src-7fbe500b24aa0271f40b9c8e48c0cce365d9f33c.zip chromium_src-7fbe500b24aa0271f40b9c8e48c0cce365d9f33c.tar.gz chromium_src-7fbe500b24aa0271f40b9c8e48c0cce365d9f33c.tar.bz2 |
PlzNavigate: Do not send synchronous navigations from the renderer to the browser.
This exposes ShouldMakeNetworkRequest to the renderer so it does not end up sending
the navigation to the browser for synchronous navigations.
This fixes WebRtcBrowserTest.CallInsideIframe.
BUG=475027
Review URL: https://codereview.chromium.org/1222203004
Cr-Commit-Position: refs/heads/master@{#337388}
Diffstat (limited to 'content/browser/frame_host')
-rw-r--r-- | content/browser/frame_host/navigation_request.cc | 10 | ||||
-rw-r--r-- | content/browser/frame_host/navigation_request.h | 5 | ||||
-rw-r--r-- | content/browser/frame_host/navigator_impl.cc | 4 | ||||
-rw-r--r-- | content/browser/frame_host/render_frame_host_impl.cc | 2 |
4 files changed, 4 insertions, 17 deletions
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc index b5e8977..1c13a71 100644 --- a/content/browser/frame_host/navigation_request.cc +++ b/content/browser/frame_host/navigation_request.cc @@ -51,14 +51,6 @@ int LoadFlagFromNavigationType(FrameMsg_Navigate_Type::Value navigation_type) { } // namespace // static -bool NavigationRequest::ShouldMakeNetworkRequest(const GURL& url) { - // Data and Javascript urls should not make network requests. - // TODO(clamy): same document navigations should not make network requests. - return !url.SchemeIs(url::kDataScheme) && url != GURL(url::kAboutBlankURL) && - !url.SchemeIs(url::kJavaScriptScheme); -} - -// static scoped_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated( FrameTreeNode* frame_tree_node, const FrameNavigationEntry& frame_entry, @@ -182,7 +174,7 @@ bool NavigationRequest::BeginNavigation() { DCHECK(state_ == NOT_STARTED || state_ == WAITING_FOR_RENDERER_RESPONSE); state_ = STARTED; - if (ShouldMakeNetworkRequest(common_params_.url)) { + if (ShouldMakeNetworkRequestForURL(common_params_.url)) { loader_ = NavigationURLLoader::Create( frame_tree_node_->navigator()->GetController()->GetBrowserContext(), frame_tree_node_->frame_tree_node_id(), info_.Pass(), this); diff --git a/content/browser/frame_host/navigation_request.h b/content/browser/frame_host/navigation_request.h index b92906c..133f698 100644 --- a/content/browser/frame_host/navigation_request.h +++ b/content/browser/frame_host/navigation_request.h @@ -54,11 +54,6 @@ class CONTENT_EXPORT NavigationRequest : public NavigationURLLoaderDelegate { FAILED, }; - // Helper function to determine if the navigation request to |url| should be - // sent to the network stack. It will not be sent for data URLs or JavaScript - // URLs, cases where no network request needs to be made. - static bool ShouldMakeNetworkRequest(const GURL& url); - // Creates a request for a browser-intiated navigation. static scoped_ptr<NavigationRequest> CreateBrowserInitiated( FrameTreeNode* frame_tree_node, diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc index b5d3136..9e01343 100644 --- a/content/browser/frame_host/navigator_impl.cc +++ b/content/browser/frame_host/navigator_impl.cc @@ -673,7 +673,7 @@ void NavigatorImpl::CommitNavigation(FrameTreeNode* frame_tree_node, NavigationRequest* navigation_request = frame_tree_node->navigation_request(); DCHECK(navigation_request); DCHECK(response || - !NavigationRequest::ShouldMakeNetworkRequest( + !ShouldMakeNetworkRequestForURL( navigation_request->common_params().url)); // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not @@ -814,7 +814,7 @@ void NavigatorImpl::RequestNavigation( // is synchronous and same-site) then NavigationRequest::BeginNavigation // should be directly called instead. if (should_dispatch_beforeunload && - NavigationRequest::ShouldMakeNetworkRequest( + ShouldMakeNetworkRequestForURL( navigation_request->common_params().url)) { navigation_request->SetWaitingForRendererResponse(); frame_tree_node->current_frame_host()->DispatchBeforeUnload(true); diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index 45b0891..dbac4f4 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc @@ -1791,7 +1791,7 @@ void RenderFrameHostImpl::CommitNavigation( const CommonNavigationParams& common_params, const RequestNavigationParams& request_params) { DCHECK((response && body.get()) || - !NavigationRequest::ShouldMakeNetworkRequest(common_params.url)); + !ShouldMakeNetworkRequestForURL(common_params.url)); UpdatePermissionsForNavigation(common_params, request_params); // Get back to a clean state, in case we start a new navigation without |