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

Unified Diff: content/browser/security_exploit_browsertest.cc

Issue 2821473002: Service CreateNewWindow on the UI thread with a new mojo interface (Closed)
Patch Set: MakeShared goodness Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/security_exploit_browsertest.cc
diff --git a/content/browser/security_exploit_browsertest.cc b/content/browser/security_exploit_browsertest.cc
index 7eed4accea1fae59449853c4da990f7c939591e7..d159670552a378f490e83c2296e981a5901f8276 100644
--- a/content/browser/security_exploit_browsertest.cc
+++ b/content/browser/security_exploit_browsertest.cc
@@ -17,6 +17,7 @@
#include "content/browser/renderer_host/render_view_host_factory.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
+#include "content/common/frame.mojom.h"
#include "content/common/frame_messages.h"
#include "content/common/render_message_filter.mojom.h"
#include "content/common/resource_messages.h"
@@ -265,27 +266,11 @@ IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest,
PrepareToDuplicateHosts(shell(), &duplicate_routing_id);
EXPECT_NE(MSG_ROUTING_NONE, duplicate_routing_id);
- // Since this test executes on the UI thread and hopping threads might cause
- // different timing in the test, let's simulate a CreateNewWindow call coming
- // from the IO thread.
- DOMStorageContextWrapper* dom_storage_context =
- static_cast<DOMStorageContextWrapper*>(
- BrowserContext::GetStoragePartition(
- shell()->web_contents()->GetBrowserContext(),
- pending_rvh->GetSiteInstance())->GetDOMStorageContext());
- scoped_refptr<SessionStorageNamespaceImpl> session_storage(
- new SessionStorageNamespaceImpl(dom_storage_context));
- // Cause a deliberate collision in routing ids.
- int32_t main_frame_routing_id = duplicate_routing_id + 1;
- // TODO(avi): This should be made unique from the view routing ID once
- // RenderViewHostImpl has-a RenderWidgetHostImpl. https://crbug.com/545684
- int32_t main_frame_widget_routing_id = duplicate_routing_id;
- static_cast<RenderFrameHostImpl*>(pending_rvh->GetMainFrame())
- ->OnCreateNewWindow(duplicate_routing_id, main_frame_routing_id,
- main_frame_widget_routing_id,
- mojom::CreateNewWindowParams(),
- session_storage.get());
-
+ RenderFrameHostImpl* opener =
+ static_cast<RenderFrameHostImpl*>(pending_rvh->GetMainFrame());
+ mojom::CreateNewWindowParamsPtr params;
+ opener->CreateNewWindow(std::move(params),
+ base::Bind([](mojom::CreateNewWindowReplyPtr) {}));
// If the above operation doesn't cause a crash, the test has succeeded!
}

Powered by Google App Engine
This is Rietveld 408576698