Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 4940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4951 GetRequestBodyForWebURLRequest(info.urlRequest), referrer, | 4951 GetRequestBodyForWebURLRequest(info.urlRequest), referrer, |
| 4952 info.defaultPolicy, info.replacesCurrentHistoryItem, false); | 4952 info.defaultPolicy, info.replacesCurrentHistoryItem, false); |
| 4953 return blink::WebNavigationPolicyIgnore; // Suppress the load here. | 4953 return blink::WebNavigationPolicyIgnore; // Suppress the load here. |
| 4954 } | 4954 } |
| 4955 | 4955 |
| 4956 // In OOPIF-enabled modes, back/forward navigations in newly created subframes | 4956 // In OOPIF-enabled modes, back/forward navigations in newly created subframes |
| 4957 // should be sent to the browser in case there is a matching | 4957 // should be sent to the browser in case there is a matching |
| 4958 // FrameNavigationEntry. If none is found, fall back to the default url. | 4958 // FrameNavigationEntry. If none is found, fall back to the default url. |
| 4959 if (SiteIsolationPolicy::UseSubframeNavigationEntries() && | 4959 if (SiteIsolationPolicy::UseSubframeNavigationEntries() && |
| 4960 info.isHistoryNavigationInNewChildFrame && is_content_initiated) { | 4960 info.isHistoryNavigationInNewChildFrame && is_content_initiated) { |
| 4961 OpenURL(url, IsHttpPost(info.urlRequest), | 4961 // Don't do this if |info| also says it is a client redirect, in which case |
| 4962 GetRequestBodyForWebURLRequest(info.urlRequest), referrer, | 4962 // JavaScript on the page is trying to interrupt the history navigation. |
|
nasko
2016/08/04 16:00:38
nit: s/on the page/in a different frame/ to be mor
Charlie Reis
2016/08/04 16:46:27
Will fix in the followup CL with OOPIF test, as yo
| |
| 4963 info.defaultPolicy, info.replacesCurrentHistoryItem, true); | 4963 if (!info.isClientRedirect) { |
|
Charlie Reis
2016/08/04 14:48:46
Before, we were punting both the original iframe l
Nate Chapin
2016/08/04 16:40:42
It surprised me that info.isHistoryNavigationInNew
Charlie Reis
2016/08/04 16:46:27
Yeah, I was surprised at first, too. I suppose we
| |
| 4964 // Suppress the load in Blink but mark the frame as loading. | 4964 OpenURL(url, IsHttpPost(info.urlRequest), |
| 4965 return blink::WebNavigationPolicyHandledByClient; | 4965 GetRequestBodyForWebURLRequest(info.urlRequest), referrer, |
| 4966 info.defaultPolicy, info.replacesCurrentHistoryItem, true); | |
| 4967 // Suppress the load in Blink but mark the frame as loading. | |
| 4968 return blink::WebNavigationPolicyHandledByClient; | |
| 4969 } else { | |
| 4970 // Client redirects during an initial history load should attempt to | |
| 4971 // cancel the history navigation. They will create a provisional document | |
| 4972 // loader, causing the history load to be ignored in NavigateInternal, and | |
| 4973 // this IPC will try to cancel any cross-process history load. | |
| 4974 Send(new FrameHostMsg_CancelInitialHistoryLoad(routing_id_)); | |
|
Charlie Reis
2016/08/04 14:48:46
This is only necessary if the history item was bei
| |
| 4975 } | |
| 4966 } | 4976 } |
| 4967 | 4977 |
| 4968 // Use the frame's original request's URL rather than the document's URL for | 4978 // Use the frame's original request's URL rather than the document's URL for |
| 4969 // subsequent checks. For a popup, the document's URL may become the opener | 4979 // subsequent checks. For a popup, the document's URL may become the opener |
| 4970 // window's URL if the opener has called document.write(). | 4980 // window's URL if the opener has called document.write(). |
| 4971 // See http://crbug.com/93517. | 4981 // See http://crbug.com/93517. |
| 4972 GURL old_url(frame_->dataSource()->request().url()); | 4982 GURL old_url(frame_->dataSource()->request().url()); |
| 4973 | 4983 |
| 4974 // Detect when we're crossing a permission-based boundary (e.g. into or out of | 4984 // Detect when we're crossing a permission-based boundary (e.g. into or out of |
| 4975 // an extension or app origin, leaving a WebUI page, etc). We only care about | 4985 // an extension or app origin, leaving a WebUI page, etc). We only care about |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5561 // PageState. | 5571 // PageState. |
| 5562 item_for_history_navigation = entry->root(); | 5572 item_for_history_navigation = entry->root(); |
| 5563 history_load_type = request_params.is_same_document_history_load | 5573 history_load_type = request_params.is_same_document_history_load |
| 5564 ? blink::WebHistorySameDocumentLoad | 5574 ? blink::WebHistorySameDocumentLoad |
| 5565 : blink::WebHistoryDifferentDocumentLoad; | 5575 : blink::WebHistoryDifferentDocumentLoad; |
| 5566 load_type = request_params.is_history_navigation_in_new_child | 5576 load_type = request_params.is_history_navigation_in_new_child |
| 5567 ? blink::WebFrameLoadType::InitialHistoryLoad | 5577 ? blink::WebFrameLoadType::InitialHistoryLoad |
| 5568 : blink::WebFrameLoadType::BackForward; | 5578 : blink::WebFrameLoadType::BackForward; |
| 5569 should_load_request = true; | 5579 should_load_request = true; |
| 5570 | 5580 |
| 5581 // If this navigation is to a history item for a new child frame, we | |
| 5582 // should cancel it if we were interrupted by a Javascript navigation | |
| 5583 // that has already committed or has started a provisional loader. | |
| 5584 if (request_params.is_history_navigation_in_new_child && | |
| 5585 (!current_history_item_.isNull() || | |
| 5586 frame_->provisionalDataSource())) { | |
| 5587 should_load_request = false; | |
| 5588 has_history_navigation_in_frame = false; | |
| 5589 } | |
| 5590 | |
| 5571 // Generate the request for the load from the HistoryItem. | 5591 // Generate the request for the load from the HistoryItem. |
| 5572 // PlzNavigate: use the data sent by the browser for the url and the | 5592 // PlzNavigate: use the data sent by the browser for the url and the |
| 5573 // HTTP state. The restoration of user state such as scroll position | 5593 // HTTP state. The restoration of user state such as scroll position |
| 5574 // will be done based on the history item during the load. | 5594 // will be done based on the history item during the load. |
| 5575 if (!browser_side_navigation) { | 5595 if (!browser_side_navigation && should_load_request) { |
| 5576 request = frame_->requestFromHistoryItem(item_for_history_navigation, | 5596 request = frame_->requestFromHistoryItem(item_for_history_navigation, |
| 5577 cache_policy); | 5597 cache_policy); |
| 5578 } | 5598 } |
| 5579 } | 5599 } |
| 5580 } | 5600 } |
| 5581 } else { | 5601 } else { |
| 5582 // Navigate to the given URL. | 5602 // Navigate to the given URL. |
| 5583 if (!start_params.extra_headers.empty() && !browser_side_navigation) { | 5603 if (!start_params.extra_headers.empty() && !browser_side_navigation) { |
| 5584 for (net::HttpUtil::HeadersIterator i(start_params.extra_headers.begin(), | 5604 for (net::HttpUtil::HeadersIterator i(start_params.extra_headers.begin(), |
| 5585 start_params.extra_headers.end(), | 5605 start_params.extra_headers.end(), |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6347 // event target. Potentially a Pepper plugin will receive the event. | 6367 // event target. Potentially a Pepper plugin will receive the event. |
| 6348 // In order to tell whether a plugin gets the last mouse event and which it | 6368 // In order to tell whether a plugin gets the last mouse event and which it |
| 6349 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6369 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6350 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6370 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6351 // |pepper_last_mouse_event_target_|. | 6371 // |pepper_last_mouse_event_target_|. |
| 6352 pepper_last_mouse_event_target_ = nullptr; | 6372 pepper_last_mouse_event_target_ = nullptr; |
| 6353 #endif | 6373 #endif |
| 6354 } | 6374 } |
| 6355 | 6375 |
| 6356 } // namespace content | 6376 } // namespace content |
| OLD | NEW |