| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 BrowserContext::GetStoragePartition( | 266 BrowserContext::GetStoragePartition( |
| 267 shell()->web_contents()->GetBrowserContext(), | 267 shell()->web_contents()->GetBrowserContext(), |
| 268 pending_rvh->GetSiteInstance())->GetDOMStorageContext()); | 268 pending_rvh->GetSiteInstance())->GetDOMStorageContext()); |
| 269 scoped_refptr<SessionStorageNamespaceImpl> session_storage( | 269 scoped_refptr<SessionStorageNamespaceImpl> session_storage( |
| 270 new SessionStorageNamespaceImpl(dom_storage_context)); | 270 new SessionStorageNamespaceImpl(dom_storage_context)); |
| 271 // Cause a deliberate collision in routing ids. | 271 // Cause a deliberate collision in routing ids. |
| 272 int32_t main_frame_routing_id = duplicate_routing_id + 1; | 272 int32_t main_frame_routing_id = duplicate_routing_id + 1; |
| 273 // TODO(avi): This should be made unique from the view routing ID once | 273 // TODO(avi): This should be made unique from the view routing ID once |
| 274 // RenderViewHostImpl has-a RenderWidgetHostImpl. https://crbug.com/545684 | 274 // RenderViewHostImpl has-a RenderWidgetHostImpl. https://crbug.com/545684 |
| 275 int32_t main_frame_widget_routing_id = duplicate_routing_id; | 275 int32_t main_frame_widget_routing_id = duplicate_routing_id; |
| 276 pending_rvh->CreateNewWindow(duplicate_routing_id, main_frame_routing_id, | 276 static_cast<RenderFrameHostImpl*>(pending_rvh->GetMainFrame()) |
| 277 main_frame_widget_routing_id, | 277 ->OnCreateNewWindow(duplicate_routing_id, main_frame_routing_id, |
| 278 mojom::CreateNewWindowParams(), | 278 main_frame_widget_routing_id, |
| 279 session_storage.get()); | 279 mojom::CreateNewWindowParams(), |
| 280 session_storage.get()); |
| 280 | 281 |
| 281 // If the above operation doesn't cause a crash, the test has succeeded! | 282 // If the above operation doesn't cause a crash, the test has succeeded! |
| 282 } | 283 } |
| 283 | 284 |
| 284 // This is a test for crbug.com/312016. It tries to create two RenderWidgetHosts | 285 // This is a test for crbug.com/312016. It tries to create two RenderWidgetHosts |
| 285 // with the same process and routing ids, which causes a collision. It is almost | 286 // with the same process and routing ids, which causes a collision. It is almost |
| 286 // identical to the AttemptDuplicateRenderViewHost test case. | 287 // identical to the AttemptDuplicateRenderViewHost test case. |
| 287 IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, | 288 IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, |
| 288 AttemptDuplicateRenderWidgetHost) { | 289 AttemptDuplicateRenderWidgetHost) { |
| 289 int duplicate_routing_id = MSG_ROUTING_NONE; | 290 int duplicate_routing_id = MSG_ROUTING_NONE; |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 // separate task of the message loop, so ensure that the process is still | 553 // separate task of the message loop, so ensure that the process is still |
| 553 // considered alive. | 554 // considered alive. |
| 554 EXPECT_TRUE(root->current_frame_host()->GetProcess()->HasConnection()); | 555 EXPECT_TRUE(root->current_frame_host()->GetProcess()->HasConnection()); |
| 555 | 556 |
| 556 exit_observer.Wait(); | 557 exit_observer.Wait(); |
| 557 EXPECT_FALSE(exit_observer.did_exit_normally()); | 558 EXPECT_FALSE(exit_observer.did_exit_normally()); |
| 558 ResourceDispatcherHost::Get()->SetDelegate(nullptr); | 559 ResourceDispatcherHost::Get()->SetDelegate(nullptr); |
| 559 } | 560 } |
| 560 | 561 |
| 561 } // namespace content | 562 } // namespace content |
| OLD | NEW |