 Chromium Code Reviews
 Chromium Code Reviews Issue 2687593002:
  PlzNavigate: Invoke didFailProvisionalLoad() in the renderer when a navigation request is cancelled…  (Closed)
    
  
    Issue 2687593002:
  PlzNavigate: Invoke didFailProvisionalLoad() in the renderer when a navigation request is cancelled…  (Closed) 
  | 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 3487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3498 // local state here to fix https://crbug.com/671276. | 3498 // local state here to fix https://crbug.com/671276. | 
| 3499 } | 3499 } | 
| 3500 | 3500 | 
| 3501 void RenderFrameImpl::didFailProvisionalLoad( | 3501 void RenderFrameImpl::didFailProvisionalLoad( | 
| 3502 blink::WebLocalFrame* frame, | 3502 blink::WebLocalFrame* frame, | 
| 3503 const blink::WebURLError& error, | 3503 const blink::WebURLError& error, | 
| 3504 blink::WebHistoryCommitType commit_type) { | 3504 blink::WebHistoryCommitType commit_type) { | 
| 3505 TRACE_EVENT1("navigation,benchmark,rail", | 3505 TRACE_EVENT1("navigation,benchmark,rail", | 
| 3506 "RenderFrameImpl::didFailProvisionalLoad", "id", routing_id_); | 3506 "RenderFrameImpl::didFailProvisionalLoad", "id", routing_id_); | 
| 3507 DCHECK_EQ(frame_, frame); | 3507 DCHECK_EQ(frame_, frame); | 
| 3508 WebDataSource* ds = frame->provisionalDataSource(); | |
| 3509 DCHECK(ds); | |
| 3510 | |
| 3511 const WebURLRequest& failed_request = ds->getRequest(); | |
| 3512 | |
| 3513 // Notify the browser that we failed a provisional load with an error. | |
| 3514 // | 3508 // | 
| 
nasko
2017/02/08 23:52:22
nit: You don't need this extra "// " line.
 
ananta
2017/02/08 23:59:21
Thanks. Removed
 | |
| 3515 // Note: It is important this notification occur before DidStopLoading so the | 3509 // Note: It is important this notification occur before DidStopLoading so the | 
| 3516 // SSL manager can react to the provisional load failure before being | 3510 // SSL manager can react to the provisional load failure before being | 
| 3517 // notified the load stopped. | 3511 // notified the load stopped. | 
| 3518 // | 3512 // | 
| 3519 for (auto& observer : render_view_->observers()) | 3513 for (auto& observer : render_view_->observers()) | 
| 3520 observer.DidFailProvisionalLoad(frame, error); | 3514 observer.DidFailProvisionalLoad(frame, error); | 
| 3521 for (auto& observer : observers_) | 3515 for (auto& observer : observers_) | 
| 3522 observer.DidFailProvisionalLoad(error); | 3516 observer.DidFailProvisionalLoad(error); | 
| 3523 | 3517 | 
| 3518 WebDataSource* ds = frame->provisionalDataSource(); | |
| 3519 if (!ds) | |
| 3520 return; | |
| 3521 | |
| 3522 const WebURLRequest& failed_request = ds->getRequest(); | |
| 3523 | |
| 3524 // Notify the browser that we failed a provisional load with an error. | |
| 3524 SendFailedProvisionalLoad(failed_request, error, frame); | 3525 SendFailedProvisionalLoad(failed_request, error, frame); | 
| 3525 | 3526 | 
| 3526 if (!ShouldDisplayErrorPageForFailedLoad(error.reason, error.unreachableURL)) | 3527 if (!ShouldDisplayErrorPageForFailedLoad(error.reason, error.unreachableURL)) | 
| 3527 return; | 3528 return; | 
| 3528 | 3529 | 
| 3529 // Make sure we never show errors in view source mode. | 3530 // Make sure we never show errors in view source mode. | 
| 3530 frame->enableViewSourceMode(false); | 3531 frame->enableViewSourceMode(false); | 
| 3531 | 3532 | 
| 3532 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3533 DocumentState* document_state = DocumentState::FromDataSource(ds); | 
| 3533 NavigationStateImpl* navigation_state = | 3534 NavigationStateImpl* navigation_state = | 
| (...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5216 // This corresponds to Blink's notion of a standard commit. | 5217 // This corresponds to Blink's notion of a standard commit. | 
| 5217 // Also replace the current history entry if the browser asked for it | 5218 // Also replace the current history entry if the browser asked for it | 
| 5218 // specifically. | 5219 // specifically. | 
| 5219 // TODO(clamy): see if initial commits in subframes should be handled | 5220 // TODO(clamy): see if initial commits in subframes should be handled | 
| 5220 // separately. | 5221 // separately. | 
| 5221 bool replace = is_reload || common_params.url == GetLoadingUrl() || | 5222 bool replace = is_reload || common_params.url == GetLoadingUrl() || | 
| 5222 common_params.should_replace_current_entry; | 5223 common_params.should_replace_current_entry; | 
| 5223 std::unique_ptr<HistoryEntry> history_entry; | 5224 std::unique_ptr<HistoryEntry> history_entry; | 
| 5224 if (request_params.page_state.IsValid()) | 5225 if (request_params.page_state.IsValid()) | 
| 5225 history_entry = PageStateToHistoryEntry(request_params.page_state); | 5226 history_entry = PageStateToHistoryEntry(request_params.page_state); | 
| 5227 // For renderer initiated navigations, we send out a didFailProvisionalLoad() | |
| 
nasko
2017/02/08 23:52:22
nit: Empty line before the comment.
 
ananta
2017/02/08 23:59:21
Done.
 | |
| 5228 // notification. | |
| 5229 if (request_params.nav_entry_id == 0) | |
| 5230 didFailProvisionalLoad(frame_, error, blink::WebStandardCommit); | |
| 5226 LoadNavigationErrorPage(failed_request, error, replace, history_entry.get()); | 5231 LoadNavigationErrorPage(failed_request, error, replace, history_entry.get()); | 
| 5227 browser_side_navigation_pending_ = false; | 5232 browser_side_navigation_pending_ = false; | 
| 5228 } | 5233 } | 
| 5229 | 5234 | 
| 5230 WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( | 5235 WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( | 
| 5231 const NavigationPolicyInfo& info) { | 5236 const NavigationPolicyInfo& info) { | 
| 5232 // A content initiated navigation may have originated from a link-click, | 5237 // A content initiated navigation may have originated from a link-click, | 
| 5233 // script, drag-n-drop operation, etc. | 5238 // script, drag-n-drop operation, etc. | 
| 5234 // info.extraData is only non-null if this is a redirect. Use the extraData | 5239 // info.extraData is only non-null if this is a redirect. Use the extraData | 
| 5235 // initiation information for redirects, and check pending_navigation_params_ | 5240 // initiation information for redirects, and check pending_navigation_params_ | 
| (...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6814 // event target. Potentially a Pepper plugin will receive the event. | 6819 // event target. Potentially a Pepper plugin will receive the event. | 
| 6815 // In order to tell whether a plugin gets the last mouse event and which it | 6820 // In order to tell whether a plugin gets the last mouse event and which it | 
| 6816 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6821 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 
| 6817 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6822 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 
| 6818 // |pepper_last_mouse_event_target_|. | 6823 // |pepper_last_mouse_event_target_|. | 
| 6819 pepper_last_mouse_event_target_ = nullptr; | 6824 pepper_last_mouse_event_target_ = nullptr; | 
| 6820 #endif | 6825 #endif | 
| 6821 } | 6826 } | 
| 6822 | 6827 | 
| 6823 } // namespace content | 6828 } // namespace content | 
| OLD | NEW |