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

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

Issue 2735183003: PlzNavigate: stop navigations when opening a document for write (Closed)
Patch Set: Rebase Created 3 years, 9 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
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 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after
1580 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties, 1580 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties,
1581 OnSetFrameOwnerProperties) 1581 OnSetFrameOwnerProperties)
1582 IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocus, OnAdvanceFocus) 1582 IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocus, OnAdvanceFocus)
1583 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame) 1583 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame)
1584 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, 1584 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings,
1585 OnTextTrackSettingsChanged) 1585 OnTextTrackSettingsChanged)
1586 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) 1586 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent)
1587 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) 1587 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation)
1588 IPC_MESSAGE_HANDLER(FrameMsg_ReportContentSecurityPolicyViolation, 1588 IPC_MESSAGE_HANDLER(FrameMsg_ReportContentSecurityPolicyViolation,
1589 OnReportContentSecurityPolicyViolation) 1589 OnReportContentSecurityPolicyViolation)
1590 IPC_MESSAGE_HANDLER(FrameMsg_DroppedNavigation, OnDroppedNavigation)
1590 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks, 1591 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks,
1591 OnGetSavableResourceLinks) 1592 OnGetSavableResourceLinks)
1592 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks, 1593 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks,
1593 OnGetSerializedHtmlWithLocalLinks) 1594 OnGetSerializedHtmlWithLocalLinks)
1594 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) 1595 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML)
1595 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) 1596 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind)
1596 IPC_MESSAGE_HANDLER(FrameMsg_ClearActiveFindMatch, OnClearActiveFindMatch) 1597 IPC_MESSAGE_HANDLER(FrameMsg_ClearActiveFindMatch, OnClearActiveFindMatch)
1597 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) 1598 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding)
1598 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) 1599 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode)
1599 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, 1600 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs,
(...skipping 2482 matching lines...) Expand 10 before | Expand all | Expand 10 after
4082 4083
4083 void RenderFrameImpl::dispatchLoad() { 4084 void RenderFrameImpl::dispatchLoad() {
4084 Send(new FrameHostMsg_DispatchLoad(routing_id_)); 4085 Send(new FrameHostMsg_DispatchLoad(routing_id_));
4085 } 4086 }
4086 4087
4087 blink::WebEffectiveConnectionType 4088 blink::WebEffectiveConnectionType
4088 RenderFrameImpl::getEffectiveConnectionType() { 4089 RenderFrameImpl::getEffectiveConnectionType() {
4089 return effective_connection_type_; 4090 return effective_connection_type_;
4090 } 4091 }
4091 4092
4093 void RenderFrameImpl::abortClientNavigation() {
4094 Send(new FrameHostMsg_AbortNavigation(routing_id_));
4095 }
4096
4092 void RenderFrameImpl::didChangeSelection(bool is_empty_selection) { 4097 void RenderFrameImpl::didChangeSelection(bool is_empty_selection) {
4093 if (!GetRenderWidget()->input_handler().handling_input_event() && 4098 if (!GetRenderWidget()->input_handler().handling_input_event() &&
4094 !handling_select_range_) 4099 !handling_select_range_)
4095 return; 4100 return;
4096 4101
4097 if (is_empty_selection) 4102 if (is_empty_selection)
4098 selection_text_.clear(); 4103 selection_text_.clear();
4099 4104
4100 // UpdateTextInputState should be called before SyncSelectionIfRequired. 4105 // UpdateTextInputState should be called before SyncSelectionIfRequired.
4101 // UpdateTextInputState may send TextInputStateChanged to notify the focus 4106 // UpdateTextInputState may send TextInputStateChanged to notify the focus
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
5265 5270
5266 browser_side_navigation_pending_ = false; 5271 browser_side_navigation_pending_ = false;
5267 } 5272 }
5268 5273
5269 void RenderFrameImpl::OnReportContentSecurityPolicyViolation( 5274 void RenderFrameImpl::OnReportContentSecurityPolicyViolation(
5270 const content::CSPViolationParams& violation_params) { 5275 const content::CSPViolationParams& violation_params) {
5271 frame_->reportContentSecurityPolicyViolation( 5276 frame_->reportContentSecurityPolicyViolation(
5272 BuildWebContentSecurityPolicyViolation(violation_params)); 5277 BuildWebContentSecurityPolicyViolation(violation_params));
5273 } 5278 }
5274 5279
5280 void RenderFrameImpl::OnDroppedNavigation(int navigation_id) {
5281 // Check that the navigation dropped was the last one sent to the browser
5282 // process. If not, do nothing as the browser process still has some more
5283 // navigations to process.
5284 if (navigation_id != navigation_id_)
5285 return;
5286 browser_side_navigation_pending_ = false;
5287 frame_->clientDroppedNavigation();
Charlie Reis 2017/03/20 06:34:44 Why does this code need to wait until we hear back
clamy 2017/03/20 14:56:22 The patch is fixing two issues: the first one is c
Charlie Reis 2017/03/20 23:02:49 Right.
5288 }
5289
5275 WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( 5290 WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
5276 const NavigationPolicyInfo& info) { 5291 const NavigationPolicyInfo& info) {
5277 // A content initiated navigation may have originated from a link-click, 5292 // A content initiated navigation may have originated from a link-click,
5278 // script, drag-n-drop operation, etc. 5293 // script, drag-n-drop operation, etc.
5279 // info.extraData is only non-null if this is a redirect. Use the extraData 5294 // info.extraData is only non-null if this is a redirect. Use the extraData
5280 // initiation information for redirects, and check pending_navigation_params_ 5295 // initiation information for redirects, and check pending_navigation_params_
5281 // otherwise. 5296 // otherwise.
5282 bool is_content_initiated = 5297 bool is_content_initiated =
5283 info.extraData 5298 info.extraData
5284 ? static_cast<DocumentState*>(info.extraData) 5299 ? static_cast<DocumentState*>(info.extraData)
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after
6346 net::LOAD_ONLY_FROM_CACHE | net::LOAD_DISABLE_CACHE); 6361 net::LOAD_ONLY_FROM_CACHE | net::LOAD_DISABLE_CACHE);
6347 load_flags |= net::LOAD_BYPASS_CACHE; 6362 load_flags |= net::LOAD_BYPASS_CACHE;
6348 } 6363 }
6349 BeginNavigationParams begin_navigation_params( 6364 BeginNavigationParams begin_navigation_params(
6350 GetWebURLRequestHeaders(info.urlRequest), load_flags, 6365 GetWebURLRequestHeaders(info.urlRequest), load_flags,
6351 info.urlRequest.hasUserGesture(), 6366 info.urlRequest.hasUserGesture(),
6352 info.urlRequest.getServiceWorkerMode() != 6367 info.urlRequest.getServiceWorkerMode() !=
6353 blink::WebURLRequest::ServiceWorkerMode::All, 6368 blink::WebURLRequest::ServiceWorkerMode::All,
6354 GetRequestContextTypeForWebURLRequest(info.urlRequest), 6369 GetRequestContextTypeForWebURLRequest(info.urlRequest),
6355 GetMixedContentContextTypeForWebURLRequest(info.urlRequest), 6370 GetMixedContentContextTypeForWebURLRequest(info.urlRequest),
6356 initiator_origin); 6371 initiator_origin, ++navigation_id_);
6357 6372
6358 if (!info.form.isNull()) { 6373 if (!info.form.isNull()) {
6359 WebSearchableFormData web_searchable_form_data(info.form); 6374 WebSearchableFormData web_searchable_form_data(info.form);
6360 begin_navigation_params.searchable_form_url = 6375 begin_navigation_params.searchable_form_url =
6361 web_searchable_form_data.url(); 6376 web_searchable_form_data.url();
6362 begin_navigation_params.searchable_form_encoding = 6377 begin_navigation_params.searchable_form_encoding =
6363 web_searchable_form_data.encoding().utf8(); 6378 web_searchable_form_data.encoding().utf8();
6364 } 6379 }
6365 6380
6366 if (info.isClientRedirect) 6381 if (info.isClientRedirect)
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
6912 // event target. Potentially a Pepper plugin will receive the event. 6927 // event target. Potentially a Pepper plugin will receive the event.
6913 // In order to tell whether a plugin gets the last mouse event and which it 6928 // In order to tell whether a plugin gets the last mouse event and which it
6914 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6929 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6915 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6930 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6916 // |pepper_last_mouse_event_target_|. 6931 // |pepper_last_mouse_event_target_|.
6917 pepper_last_mouse_event_target_ = nullptr; 6932 pepper_last_mouse_event_target_ = nullptr;
6918 #endif 6933 #endif
6919 } 6934 }
6920 6935
6921 } // namespace content 6936 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698