| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/callback.h" | 5 #include "base/callback.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
| 10 #include "content/browser/frame_host/render_frame_host_impl.h" | 10 #include "content/browser/frame_host/render_frame_host_impl.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 // this without also cancelling the pending navigation (as blink would, if you | 232 // this without also cancelling the pending navigation (as blink would, if you |
| 233 // removed the iframe from the document via js). | 233 // removed the iframe from the document via js). |
| 234 rfh->OnMessageReceived(FrameHostMsg_Detach(frame_routing_id)); | 234 rfh->OnMessageReceived(FrameHostMsg_Detach(frame_routing_id)); |
| 235 done_cb.Run(); | 235 done_cb.Run(); |
| 236 } | 236 } |
| 237 | 237 |
| 238 } // namespace | 238 } // namespace |
| 239 | 239 |
| 240 // Regression test for https://crbug.com/538784 -- ensures that one can't | 240 // Regression test for https://crbug.com/538784 -- ensures that one can't |
| 241 // sidestep CrossSiteResourceHandler by detaching a frame mid-request. | 241 // sidestep CrossSiteResourceHandler by detaching a frame mid-request. |
| 242 // |
| 243 // TODO(nick): Disabled until we re-land the fix for https://crbug.com/538784. |
| 242 IN_PROC_BROWSER_TEST_F(CrossSiteResourceHandlerTest, | 244 IN_PROC_BROWSER_TEST_F(CrossSiteResourceHandlerTest, |
| 243 NoDeliveryToDetachedFrame) { | 245 DISABLED_NoDeliveryToDetachedFrame) { |
| 244 GURL attacker_page = embedded_test_server()->GetURL( | 246 GURL attacker_page = embedded_test_server()->GetURL( |
| 245 "evil.com", "/cross_site_iframe_factory.html?evil(evil)"); | 247 "evil.com", "/cross_site_iframe_factory.html?evil(evil)"); |
| 246 EXPECT_TRUE(NavigateToURL(shell(), attacker_page)); | 248 EXPECT_TRUE(NavigateToURL(shell(), attacker_page)); |
| 247 | 249 |
| 248 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 250 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) |
| 249 ->GetFrameTree() | 251 ->GetFrameTree() |
| 250 ->root(); | 252 ->root(); |
| 251 | 253 |
| 252 RenderFrameHost* child_frame = root->child_at(0)->current_frame_host(); | 254 RenderFrameHost* child_frame = root->child_at(0)->current_frame_host(); |
| 253 | 255 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 268 base::StringPrintf("document.getElementById('child-0').src='%s'", | 270 base::StringPrintf("document.getElementById('child-0').src='%s'", |
| 269 target_resource.spec().c_str()))); | 271 target_resource.spec().c_str()))); |
| 270 | 272 |
| 271 // Wait for the scenario to play out. If this returns false, it means the | 273 // Wait for the scenario to play out. If this returns false, it means the |
| 272 // request did not succeed, which is good in this case. | 274 // request did not succeed, which is good in this case. |
| 273 EXPECT_FALSE(tracking_delegate().WaitForTrackedURLAndGetCompleted()) | 275 EXPECT_FALSE(tracking_delegate().WaitForTrackedURLAndGetCompleted()) |
| 274 << "Request should have been cancelled before reaching the renderer."; | 276 << "Request should have been cancelled before reaching the renderer."; |
| 275 } | 277 } |
| 276 | 278 |
| 277 } // namespace content | 279 } // namespace content |
| OLD | NEW |