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/test/test_render_frame_host.h" | 5 #include "content/test/test_render_frame_host.h" |
6 | 6 |
7 #include "base/guid.h" | 7 #include "base/guid.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "content/browser/frame_host/frame_tree.h" | 9 #include "content/browser/frame_host/frame_tree.h" |
10 #include "content/browser/frame_host/navigation_handle_impl.h" | 10 #include "content/browser/frame_host/navigation_handle_impl.h" |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 if (!IsBrowserSideNavigationEnabled()) { | 439 if (!IsBrowserSideNavigationEnabled()) { |
440 // Non PlzNavigate | 440 // Non PlzNavigate |
441 if (is_waiting_for_beforeunload_ack()) | 441 if (is_waiting_for_beforeunload_ack()) |
442 SendBeforeUnloadACK(true); | 442 SendBeforeUnloadACK(true); |
443 return; | 443 return; |
444 } | 444 } |
445 | 445 |
446 // PlzNavigate | 446 // PlzNavigate |
447 NavigationRequest* request = frame_tree_node_->navigation_request(); | 447 NavigationRequest* request = frame_tree_node_->navigation_request(); |
448 CHECK(request); | 448 CHECK(request); |
449 bool have_to_make_network_request = ShouldMakeNetworkRequestForURL( | 449 bool have_to_make_network_request = |
450 request->common_params().url); | 450 ShouldMakeNetworkRequestForURL(request->common_params().url) && |
| 451 !request->request_params().is_same_document_fragment_change && |
| 452 !request->request_params().is_same_document_history_load; |
451 | 453 |
452 // Simulate a beforeUnload ACK from the renderer if the browser is waiting for | 454 // Simulate a beforeUnload ACK from the renderer if the browser is waiting for |
453 // it. If it runs it will update the request state. | 455 // it. If it runs it will update the request state. |
454 if (request->state() == NavigationRequest::WAITING_FOR_RENDERER_RESPONSE) { | 456 if (request->state() == NavigationRequest::WAITING_FOR_RENDERER_RESPONSE) { |
455 static_cast<TestRenderFrameHost*>(frame_tree_node()->current_frame_host()) | 457 static_cast<TestRenderFrameHost*>(frame_tree_node()->current_frame_host()) |
456 ->SendBeforeUnloadACK(true); | 458 ->SendBeforeUnloadACK(true); |
457 } | 459 } |
458 | 460 |
459 if (!have_to_make_network_request) | 461 if (!have_to_make_network_request) |
460 return; // |request| is destructed by now. | 462 return; // |request| is destructed by now. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 // PlzNavigate: NavigationHandle::WillStartRequest has already been called at | 505 // PlzNavigate: NavigationHandle::WillStartRequest has already been called at |
504 // this point. | 506 // this point. |
505 if (!navigation_handle() || IsBrowserSideNavigationEnabled()) | 507 if (!navigation_handle() || IsBrowserSideNavigationEnabled()) |
506 return; | 508 return; |
507 navigation_handle()->CallWillStartRequestForTesting( | 509 navigation_handle()->CallWillStartRequestForTesting( |
508 false /* is_post */, Referrer(GURL(), blink::WebReferrerPolicyDefault), | 510 false /* is_post */, Referrer(GURL(), blink::WebReferrerPolicyDefault), |
509 true /* user_gesture */, transition, false /* is_external_protocol */); | 511 true /* user_gesture */, transition, false /* is_external_protocol */); |
510 } | 512 } |
511 | 513 |
512 } // namespace content | 514 } // namespace content |
OLD | NEW |