Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2088793002: Revert of OpenURL post data handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@post-data-my-stuff
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 url::Origin(GURL(main_ds->request().url()))) || 801 url::Origin(GURL(main_ds->request().url()))) ||
802 main_resource_ssl_status.security_style != 802 main_resource_ssl_status.security_style !=
803 ssl_status.security_style || 803 ssl_status.security_style ||
804 main_resource_ssl_status.cert_id != ssl_status.cert_id || 804 main_resource_ssl_status.cert_id != ssl_status.cert_id ||
805 main_resource_ssl_status.cert_status != ssl_status.cert_status || 805 main_resource_ssl_status.cert_status != ssl_status.cert_status ||
806 main_resource_ssl_status.security_bits != ssl_status.security_bits || 806 main_resource_ssl_status.security_bits != ssl_status.security_bits ||
807 main_resource_ssl_status.connection_status != 807 main_resource_ssl_status.connection_status !=
808 ssl_status.connection_status); 808 ssl_status.connection_status);
809 } 809 }
810 810
811 bool IsHttpPost(const blink::WebURLRequest& request) {
812 return request.httpMethod().utf8() == "POST";
813 }
814
815 #if defined(OS_ANDROID) 811 #if defined(OS_ANDROID)
816 // Returns true if WMPI should be used for playback, false otherwise. 812 // Returns true if WMPI should be used for playback, false otherwise.
817 // 813 //
818 // Note that HLS and MP4 detection are pre-redirect and path-based. It is 814 // Note that HLS and MP4 detection are pre-redirect and path-based. It is
819 // possible to load such a URL and find different content. 815 // possible to load such a URL and find different content.
820 bool UseWebMediaPlayerImpl(const GURL& url) { 816 bool UseWebMediaPlayerImpl(const GURL& url) {
821 // WMPI does not support HLS. 817 // WMPI does not support HLS.
822 if (media::MediaCodecUtil::IsHLSURL(url)) 818 if (media::MediaCodecUtil::IsHLSURL(url))
823 return false; 819 return false;
824 820
(...skipping 2159 matching lines...) Expand 10 before | Expand all | Expand 10 after
2984 blink::WebNavigationPolicy policy, 2980 blink::WebNavigationPolicy policy,
2985 const blink::WebString& suggested_name, 2981 const blink::WebString& suggested_name,
2986 bool should_replace_current_entry) { 2982 bool should_replace_current_entry) {
2987 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(frame_, request)); 2983 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(frame_, request));
2988 if (policy == blink::WebNavigationPolicyDownload) { 2984 if (policy == blink::WebNavigationPolicyDownload) {
2989 render_view_->Send(new ViewHostMsg_DownloadUrl(render_view_->GetRoutingID(), 2985 render_view_->Send(new ViewHostMsg_DownloadUrl(render_view_->GetRoutingID(),
2990 GetRoutingID(), 2986 GetRoutingID(),
2991 request.url(), referrer, 2987 request.url(), referrer,
2992 suggested_name)); 2988 suggested_name));
2993 } else { 2989 } else {
2994 OpenURL(request.url(), IsHttpPost(request), 2990 OpenURL(request.url(), referrer, policy, should_replace_current_entry,
2995 GetRequestBodyForWebURLRequest(request), referrer, policy, 2991 false);
2996 should_replace_current_entry, false);
2997 } 2992 }
2998 } 2993 }
2999 2994
3000 blink::WebHistoryItem RenderFrameImpl::historyItemForNewChildFrame() { 2995 blink::WebHistoryItem RenderFrameImpl::historyItemForNewChildFrame() {
3001 // OOPIF enabled modes will punt this navigation to the browser in 2996 // OOPIF enabled modes will punt this navigation to the browser in
3002 // decidePolicyForNavigation. 2997 // decidePolicyForNavigation.
3003 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) 2998 if (SiteIsolationPolicy::UseSubframeNavigationEntries())
3004 return WebHistoryItem(); 2999 return WebHistoryItem();
3005 3000
3006 return render_view_->history_controller()->GetItemForNewChildFrame(this); 3001 return render_view_->history_controller()->GetItemForNewChildFrame(this);
(...skipping 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after
4886 4881
4887 // Webkit is asking whether to navigate to a new URL. 4882 // Webkit is asking whether to navigate to a new URL.
4888 // This is fine normally, except if we're showing UI from one security 4883 // This is fine normally, except if we're showing UI from one security
4889 // context and they're trying to navigate to a different context. 4884 // context and they're trying to navigate to a different context.
4890 const GURL& url = info.urlRequest.url(); 4885 const GURL& url = info.urlRequest.url();
4891 4886
4892 // If the browser is interested, then give it a chance to look at the request. 4887 // If the browser is interested, then give it a chance to look at the request.
4893 if (is_content_initiated && IsTopLevelNavigation(frame_) && 4888 if (is_content_initiated && IsTopLevelNavigation(frame_) &&
4894 render_view_->renderer_preferences_ 4889 render_view_->renderer_preferences_
4895 .browser_handles_all_top_level_requests) { 4890 .browser_handles_all_top_level_requests) {
4896 OpenURL(url, IsHttpPost(info.urlRequest), 4891 OpenURL(url, referrer, info.defaultPolicy, info.replacesCurrentHistoryItem,
4897 GetRequestBodyForWebURLRequest(info.urlRequest), referrer, 4892 false);
4898 info.defaultPolicy, info.replacesCurrentHistoryItem, false);
4899 return blink::WebNavigationPolicyIgnore; // Suppress the load here. 4893 return blink::WebNavigationPolicyIgnore; // Suppress the load here.
4900 } 4894 }
4901 4895
4902 // In OOPIF-enabled modes, back/forward navigations in newly created subframes 4896 // In OOPIF-enabled modes, back/forward navigations in newly created subframes
4903 // should be sent to the browser in case there is a matching 4897 // should be sent to the browser in case there is a matching
4904 // FrameNavigationEntry. If none is found, fall back to the default url. 4898 // FrameNavigationEntry. If none is found, fall back to the default url.
4905 if (SiteIsolationPolicy::UseSubframeNavigationEntries() && 4899 if (SiteIsolationPolicy::UseSubframeNavigationEntries() &&
4906 info.isHistoryNavigationInNewChildFrame && is_content_initiated) { 4900 info.isHistoryNavigationInNewChildFrame && is_content_initiated) {
4907 OpenURL(url, IsHttpPost(info.urlRequest), 4901 OpenURL(url, referrer, info.defaultPolicy, info.replacesCurrentHistoryItem,
4908 GetRequestBodyForWebURLRequest(info.urlRequest), referrer, 4902 true);
4909 info.defaultPolicy, info.replacesCurrentHistoryItem, true);
4910 // Suppress the load in Blink but mark the frame as loading. 4903 // Suppress the load in Blink but mark the frame as loading.
4911 return blink::WebNavigationPolicyHandledByClient; 4904 return blink::WebNavigationPolicyHandledByClient;
4912 } 4905 }
4913 4906
4914 // Use the frame's original request's URL rather than the document's URL for 4907 // Use the frame's original request's URL rather than the document's URL for
4915 // subsequent checks. For a popup, the document's URL may become the opener 4908 // subsequent checks. For a popup, the document's URL may become the opener
4916 // window's URL if the opener has called document.write(). 4909 // window's URL if the opener has called document.write().
4917 // See http://crbug.com/93517. 4910 // See http://crbug.com/93517.
4918 GURL old_url(frame_->dataSource()->request().url()); 4911 GURL old_url(frame_->dataSource()->request().url());
4919 4912
4920 // Detect when we're crossing a permission-based boundary (e.g. into or out of 4913 // Detect when we're crossing a permission-based boundary (e.g. into or out of
4921 // an extension or app origin, leaving a WebUI page, etc). We only care about 4914 // an extension or app origin, leaving a WebUI page, etc). We only care about
4922 // top-level navigations (not iframes). But we sometimes navigate to 4915 // top-level navigations (not iframes). But we sometimes navigate to
4923 // about:blank to clear a tab, and we want to still allow that. 4916 // about:blank to clear a tab, and we want to still allow that.
4917 //
4918 // Note: this is known to break POST submissions when crossing process
4919 // boundaries until http://crbug.com/101395 is fixed. This is better for
4920 // security than loading a WebUI, extension or app page in the wrong process.
4921 // POST requests don't work because this mechanism does not preserve form
4922 // POST data. We will need to send the request's httpBody data up to the
4923 // browser process, and issue a special POST navigation in WebKit (via
4924 // FrameLoader::loadFrameRequest). See ResourceDispatcher and WebURLLoaderImpl
4925 // for examples of how to send the httpBody data.
4924 if (!frame_->parent() && is_content_initiated && 4926 if (!frame_->parent() && is_content_initiated &&
4925 !url.SchemeIs(url::kAboutScheme)) { 4927 !url.SchemeIs(url::kAboutScheme)) {
4926 bool send_referrer = false; 4928 bool send_referrer = false;
4927 4929
4928 // All navigations to or from WebUI URLs or within WebUI-enabled 4930 // All navigations to or from WebUI URLs or within WebUI-enabled
4929 // RenderProcesses must be handled by the browser process so that the 4931 // RenderProcesses must be handled by the browser process so that the
4930 // correct bindings and data sources can be registered. 4932 // correct bindings and data sources can be registered.
4931 // Similarly, navigations to view-source URLs or within ViewSource mode 4933 // Similarly, navigations to view-source URLs or within ViewSource mode
4932 // must be handled by the browser process (except for reloads - those are 4934 // must be handled by the browser process (except for reloads - those are
4933 // safe to leave within the renderer). 4935 // safe to leave within the renderer).
(...skipping 19 matching lines...) Expand all
4953 } 4955 }
4954 4956
4955 if (!should_fork) { 4957 if (!should_fork) {
4956 // Give the embedder a chance. 4958 // Give the embedder a chance.
4957 should_fork = GetContentClient()->renderer()->ShouldFork( 4959 should_fork = GetContentClient()->renderer()->ShouldFork(
4958 frame_, url, info.urlRequest.httpMethod().utf8(), 4960 frame_, url, info.urlRequest.httpMethod().utf8(),
4959 is_initial_navigation, is_redirect, &send_referrer); 4961 is_initial_navigation, is_redirect, &send_referrer);
4960 } 4962 }
4961 4963
4962 if (should_fork) { 4964 if (should_fork) {
4963 OpenURL(url, IsHttpPost(info.urlRequest), 4965 OpenURL(url, send_referrer ? referrer : Referrer(), info.defaultPolicy,
4964 GetRequestBodyForWebURLRequest(info.urlRequest),
4965 send_referrer ? referrer : Referrer(), info.defaultPolicy,
4966 info.replacesCurrentHistoryItem, false); 4966 info.replacesCurrentHistoryItem, false);
4967 return blink::WebNavigationPolicyIgnore; // Suppress the load here. 4967 return blink::WebNavigationPolicyIgnore; // Suppress the load here.
4968 } 4968 }
4969 } 4969 }
4970 4970
4971 // Detect when a page is "forking" a new tab that can be safely rendered in 4971 // Detect when a page is "forking" a new tab that can be safely rendered in
4972 // its own process. This is done by sites like Gmail that try to open links 4972 // its own process. This is done by sites like Gmail that try to open links
4973 // in new windows without script connections back to the original page. We 4973 // in new windows without script connections back to the original page. We
4974 // treat such cases as browser navigations (in which we will create a new 4974 // treat such cases as browser navigations (in which we will create a new
4975 // renderer for a cross-site navigation), rather than WebKit navigations. 4975 // renderer for a cross-site navigation), rather than WebKit navigations.
(...skipping 19 matching lines...) Expand all
4995 frame_->parent() == NULL && 4995 frame_->parent() == NULL &&
4996 // Must not have issued the request from this page. 4996 // Must not have issued the request from this page.
4997 is_content_initiated && 4997 is_content_initiated &&
4998 // Must be targeted at the current tab. 4998 // Must be targeted at the current tab.
4999 info.defaultPolicy == blink::WebNavigationPolicyCurrentTab && 4999 info.defaultPolicy == blink::WebNavigationPolicyCurrentTab &&
5000 // Must be a JavaScript navigation, which appears as "other". 5000 // Must be a JavaScript navigation, which appears as "other".
5001 info.navigationType == blink::WebNavigationTypeOther; 5001 info.navigationType == blink::WebNavigationTypeOther;
5002 5002
5003 if (is_fork) { 5003 if (is_fork) {
5004 // Open the URL via the browser, not via WebKit. 5004 // Open the URL via the browser, not via WebKit.
5005 OpenURL(url, IsHttpPost(info.urlRequest), 5005 OpenURL(url, Referrer(), info.defaultPolicy,
5006 GetRequestBodyForWebURLRequest(info.urlRequest), Referrer(), 5006 info.replacesCurrentHistoryItem, false);
5007 info.defaultPolicy, info.replacesCurrentHistoryItem, false);
5008 return blink::WebNavigationPolicyIgnore; 5007 return blink::WebNavigationPolicyIgnore;
5009 } 5008 }
5010 5009
5011 // Execute the BeforeUnload event. If asked not to proceed or the frame is 5010 // Execute the BeforeUnload event. If asked not to proceed or the frame is
5012 // destroyed, ignore the navigation. There is no need to execute the 5011 // destroyed, ignore the navigation. There is no need to execute the
5013 // BeforeUnload event during a redirect, since it was already executed at the 5012 // BeforeUnload event during a redirect, since it was already executed at the
5014 // start of the navigation. 5013 // start of the navigation.
5015 // PlzNavigate: this is not executed when commiting the navigation. 5014 // PlzNavigate: this is not executed when commiting the navigation.
5016 if (info.defaultPolicy == blink::WebNavigationPolicyCurrentTab && 5015 if (info.defaultPolicy == blink::WebNavigationPolicyCurrentTab &&
5017 !is_redirect && (!IsBrowserSideNavigationEnabled() || 5016 !is_redirect && (!IsBrowserSideNavigationEnabled() ||
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
5327 // TODO(jcivelli): http:/b/5793321 Implement a better fix, as detailed in bug. 5326 // TODO(jcivelli): http:/b/5793321 Implement a better fix, as detailed in bug.
5328 if (!external_popup_menu_) 5327 if (!external_popup_menu_)
5329 return; 5328 return;
5330 5329
5331 external_popup_menu_->DidSelectItems(canceled, selected_indices); 5330 external_popup_menu_->DidSelectItems(canceled, selected_indices);
5332 external_popup_menu_.reset(); 5331 external_popup_menu_.reset();
5333 } 5332 }
5334 #endif 5333 #endif
5335 #endif 5334 #endif
5336 5335
5337 void RenderFrameImpl::OpenURL( 5336 void RenderFrameImpl::OpenURL(const GURL& url,
5338 const GURL& url, 5337 const Referrer& referrer,
5339 bool uses_post, 5338 WebNavigationPolicy policy,
5340 const scoped_refptr<ResourceRequestBodyImpl>& resource_request_body, 5339 bool should_replace_current_entry,
5341 const Referrer& referrer, 5340 bool is_history_navigation_in_new_child) {
5342 WebNavigationPolicy policy,
5343 bool should_replace_current_entry,
5344 bool is_history_navigation_in_new_child) {
5345 FrameHostMsg_OpenURL_Params params; 5341 FrameHostMsg_OpenURL_Params params;
5346 params.url = url; 5342 params.url = url;
5347 params.uses_post = uses_post;
5348 params.resource_request_body = resource_request_body;
5349 params.referrer = referrer; 5343 params.referrer = referrer;
5350 params.disposition = RenderViewImpl::NavigationPolicyToDisposition(policy); 5344 params.disposition = RenderViewImpl::NavigationPolicyToDisposition(policy);
5351 5345
5352 if (IsBrowserInitiated(pending_navigation_params_.get())) { 5346 if (IsBrowserInitiated(pending_navigation_params_.get())) {
5353 // This is necessary to preserve the should_replace_current_entry value on 5347 // This is necessary to preserve the should_replace_current_entry value on
5354 // cross-process redirects, in the event it was set by a previous process. 5348 // cross-process redirects, in the event it was set by a previous process.
5355 WebDataSource* ds = frame_->provisionalDataSource(); 5349 WebDataSource* ds = frame_->provisionalDataSource();
5356 DCHECK(ds); 5350 DCHECK(ds);
5357 params.should_replace_current_entry = ds->replacesCurrentHistoryItem(); 5351 params.should_replace_current_entry = ds->replacesCurrentHistoryItem();
5358 } else { 5352 } else {
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
6244 // event target. Potentially a Pepper plugin will receive the event. 6238 // event target. Potentially a Pepper plugin will receive the event.
6245 // In order to tell whether a plugin gets the last mouse event and which it 6239 // In order to tell whether a plugin gets the last mouse event and which it
6246 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6240 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6247 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6241 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6248 // |pepper_last_mouse_event_target_|. 6242 // |pepper_last_mouse_event_target_|.
6249 pepper_last_mouse_event_target_ = nullptr; 6243 pepper_last_mouse_event_target_ = nullptr;
6250 #endif 6244 #endif
6251 } 6245 }
6252 6246
6253 } // namespace content 6247 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698