blob: c515609c576f74cf8fbc60f1a6e8de11c3a19e90 [file] [log] [blame]
[email protected]81374f22013-02-07 02:03:451// 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
3// found in the LICENSE file.
4
avib7348942015-12-25 20:57:105#include <stdint.h>
6
[email protected]81374f22013-02-07 02:03:457#include "base/command_line.h"
[email protected]04cbd3d2013-12-04 04:58:208#include "base/containers/hash_tables.h"
avib7348942015-12-25 20:57:109#include "base/macros.h"
nick4c8dfd42014-11-14 04:11:4910#include "base/strings/utf_string_conversions.h"
avib7348942015-12-25 20:57:1011#include "build/build_config.h"
[email protected]04cbd3d2013-12-04 04:58:2012#include "content/browser/dom_storage/dom_storage_context_wrapper.h"
13#include "content/browser/dom_storage/session_storage_namespace_impl.h"
[email protected]65920f332014-03-04 21:14:1814#include "content/browser/frame_host/navigator.h"
creis3710b2382015-08-18 00:12:1515#include "content/browser/frame_host/render_frame_host_impl.h"
[email protected]04cbd3d2013-12-04 04:58:2016#include "content/browser/renderer_host/render_view_host_factory.h"
[email protected]81374f22013-02-07 02:03:4517#include "content/browser/renderer_host/render_view_host_impl.h"
18#include "content/browser/web_contents/web_contents_impl.h"
nick4c8dfd42014-11-14 04:11:4919#include "content/common/frame_messages.h"
creis3710b2382015-08-18 00:12:1520#include "content/common/resource_messages.h"
[email protected]04cbd3d2013-12-04 04:58:2021#include "content/common/view_messages.h"
22#include "content/public/browser/browser_context.h"
creis3710b2382015-08-18 00:12:1523#include "content/public/browser/content_browser_client.h"
nick4c8dfd42014-11-14 04:11:4924#include "content/public/browser/interstitial_page.h"
25#include "content/public/browser/interstitial_page_delegate.h"
[email protected]04cbd3d2013-12-04 04:58:2026#include "content/public/browser/storage_partition.h"
creis3710b2382015-08-18 00:12:1527#include "content/public/common/appcache_info.h"
carloskd80262f52015-12-16 14:40:3528#include "content/public/common/browser_side_navigation_policy.h"
[email protected]81374f22013-02-07 02:03:4529#include "content/public/common/content_switches.h"
wfh815c4872015-02-25 21:01:3130#include "content/public/common/file_chooser_params.h"
[email protected]04cbd3d2013-12-04 04:58:2031#include "content/public/test/browser_test_utils.h"
[email protected]6e9def12014-03-27 20:23:2832#include "content/public/test/content_browser_test.h"
33#include "content/public/test/content_browser_test_utils.h"
[email protected]81374f22013-02-07 02:03:4534#include "content/public/test/test_utils.h"
[email protected]de7d61ff2013-08-20 11:30:4135#include "content/shell/browser/shell.h"
creis3710b2382015-08-18 00:12:1536#include "content/test/test_content_browser_client.h"
nick4c8dfd42014-11-14 04:11:4937#include "ipc/ipc_security_test_util.h"
38#include "net/dns/mock_host_resolver.h"
39#include "net/test/embedded_test_server/embedded_test_server.h"
40
41using IPC::IpcSecurityTestUtil;
[email protected]81374f22013-02-07 02:03:4542
43namespace content {
44
[email protected]04cbd3d2013-12-04 04:58:2045namespace {
46
47// This is a helper function for the tests which attempt to create a
48// duplicate RenderViewHost or RenderWidgetHost. It tries to create two objects
49// with the same process and routing ids, which causes a collision.
50// It creates a couple of windows in process 1, which causes a few routing ids
51// to be allocated. Then a cross-process navigation is initiated, which causes a
52// new process 2 to be created and have a pending RenderViewHost for it. The
53// routing id of the RenderViewHost which is target for a duplicate is set
54// into |target_routing_id| and the pending RenderViewHost which is used for
55// the attempt is the return value.
56RenderViewHostImpl* PrepareToDuplicateHosts(Shell* shell,
57 int* target_routing_id) {
nick4c8dfd42014-11-14 04:11:4958 GURL foo("http://foo.com/simple_page.html");
[email protected]04cbd3d2013-12-04 04:58:2059
60 // Start off with initial navigation, so we get the first process allocated.
61 NavigateToURL(shell, foo);
nick4c8dfd42014-11-14 04:11:4962 EXPECT_EQ(base::ASCIIToUTF16("OK"), shell->web_contents()->GetTitle());
[email protected]04cbd3d2013-12-04 04:58:2063
64 // Open another window, so we generate some more routing ids.
65 ShellAddedObserver shell2_observer;
66 EXPECT_TRUE(ExecuteScript(
67 shell->web_contents(), "window.open(document.URL + '#2');"));
68 Shell* shell2 = shell2_observer.GetShell();
69
70 // The new window must be in the same process, but have a new routing id.
71 EXPECT_EQ(shell->web_contents()->GetRenderViewHost()->GetProcess()->GetID(),
72 shell2->web_contents()->GetRenderViewHost()->GetProcess()->GetID());
73 *target_routing_id =
74 shell2->web_contents()->GetRenderViewHost()->GetRoutingID();
75 EXPECT_NE(*target_routing_id,
76 shell->web_contents()->GetRenderViewHost()->GetRoutingID());
77
78 // Now, simulate a link click coming from the renderer.
nick4c8dfd42014-11-14 04:11:4979 GURL extension_url("https://bar.com/simple_page.html");
[email protected]04cbd3d2013-12-04 04:58:2080 WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell->web_contents());
[email protected]65920f332014-03-04 21:14:1881 wc->GetFrameTree()->root()->navigator()->RequestOpenURL(
lfg9ef7d2d2014-12-15 22:32:3082 wc->GetFrameTree()->root()->current_frame_host(), extension_url, nullptr,
nick94144d42015-04-27 19:21:4083 Referrer(), CURRENT_TAB, false, true);
[email protected]04cbd3d2013-12-04 04:58:2084
85 // Since the navigation above requires a cross-process swap, there will be a
carloskc49005eb2015-06-16 11:25:0786 // speculative/pending RenderFrameHost. Ensure it exists and is in a different
87 // process than the initial page.
88 RenderFrameHostImpl* next_rfh;
carloskd80262f52015-12-16 14:40:3589 if (IsBrowserSideNavigationEnabled())
90 next_rfh = wc->GetRenderManagerForTesting()->speculative_frame_host();
91 else
carloskc49005eb2015-06-16 11:25:0792 next_rfh = wc->GetRenderManagerForTesting()->pending_frame_host();
[email protected]04cbd3d2013-12-04 04:58:2093
carloskc49005eb2015-06-16 11:25:0794 EXPECT_TRUE(next_rfh);
95 EXPECT_NE(shell->web_contents()->GetRenderProcessHost()->GetID(),
96 next_rfh->GetProcess()->GetID());
97
98 return next_rfh->render_view_host();
[email protected]04cbd3d2013-12-04 04:58:2099}
100
creis3710b2382015-08-18 00:12:15101ResourceHostMsg_Request CreateXHRRequestWithOrigin(const char* origin) {
102 ResourceHostMsg_Request request;
103 request.method = "GET";
104 request.url = GURL("http://bar.com/simple_page.html");
105 request.first_party_for_cookies = GURL(origin);
106 request.referrer_policy = blink::WebReferrerPolicyDefault;
107 request.headers = base::StringPrintf("Origin: %s\r\n", origin);
108 request.load_flags = 0;
109 request.origin_pid = 0;
110 request.resource_type = RESOURCE_TYPE_XHR;
111 request.request_context = 0;
112 request.appcache_host_id = kAppCacheNoHostId;
113 request.download_to_file = false;
114 request.should_reset_appcache = false;
115 request.is_main_frame = true;
116 request.parent_is_main_frame = false;
117 request.parent_render_frame_id = -1;
118 request.transition_type = ui::PAGE_TRANSITION_LINK;
119 request.allow_download = true;
120 return request;
121}
122
[email protected]04cbd3d2013-12-04 04:58:20123} // namespace
124
125
[email protected]81374f22013-02-07 02:03:45126// The goal of these tests will be to "simulate" exploited renderer processes,
127// which can send arbitrary IPC messages and confuse browser process internal
128// state, leading to security bugs. We are trying to verify that the browser
129// doesn't perform any dangerous operations in such cases.
130class SecurityExploitBrowserTest : public ContentBrowserTest {
131 public:
132 SecurityExploitBrowserTest() {}
nick4c8dfd42014-11-14 04:11:49133
avi83883c82014-12-23 00:08:49134 void SetUpCommandLine(base::CommandLine* command_line) override {
svaldezc3a9a172015-11-03 22:01:33135 ASSERT_TRUE(embedded_test_server()->Start());
[email protected]81374f22013-02-07 02:03:45136
137 // Add a host resolver rule to map all outgoing requests to the test server.
138 // This allows us to use "real" hostnames in URLs, which we can use to
139 // create arbitrary SiteInstances.
140 command_line->AppendSwitchASCII(
141 switches::kHostResolverRules,
nick4c8dfd42014-11-14 04:11:49142 "MAP * " +
143 net::HostPortPair::FromURL(embedded_test_server()->base_url())
144 .ToString() +
[email protected]81374f22013-02-07 02:03:45145 ",EXCLUDE localhost");
146 }
wfh815c4872015-02-25 21:01:31147
148 protected:
149 // Tests that a given file path sent in a ViewHostMsg_RunFileChooser will
150 // cause renderer to be killed.
151 void TestFileChooserWithPath(const base::FilePath& path);
[email protected]81374f22013-02-07 02:03:45152};
153
wfh815c4872015-02-25 21:01:31154void SecurityExploitBrowserTest::TestFileChooserWithPath(
155 const base::FilePath& path) {
156 GURL foo("http://foo.com/simple_page.html");
157 NavigateToURL(shell(), foo);
158 EXPECT_EQ(base::ASCIIToUTF16("OK"), shell()->web_contents()->GetTitle());
159
creis3710b2382015-08-18 00:12:15160 RenderViewHost* compromised_renderer =
wfh815c4872015-02-25 21:01:31161 shell()->web_contents()->GetRenderViewHost();
creis3710b2382015-08-18 00:12:15162 RenderProcessHostWatcher terminated(
wfh815c4872015-02-25 21:01:31163 shell()->web_contents(),
creis3710b2382015-08-18 00:12:15164 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
wfh815c4872015-02-25 21:01:31165
166 FileChooserParams params;
167 params.default_file_name = path;
168
169 ViewHostMsg_RunFileChooser evil(compromised_renderer->GetRoutingID(), params);
170
171 IpcSecurityTestUtil::PwnMessageReceived(
172 compromised_renderer->GetProcess()->GetChannel(), evil);
173 terminated.Wait();
174}
175
[email protected]81374f22013-02-07 02:03:45176// Ensure that we kill the renderer process if we try to give it WebUI
177// properties and it doesn't have enabled WebUI bindings.
jaekyun37e572a32014-12-04 23:33:35178IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, SetWebUIProperty) {
nick4c8dfd42014-11-14 04:11:49179 GURL foo("http://foo.com/simple_page.html");
[email protected]81374f22013-02-07 02:03:45180
181 NavigateToURL(shell(), foo);
nick4c8dfd42014-11-14 04:11:49182 EXPECT_EQ(base::ASCIIToUTF16("OK"), shell()->web_contents()->GetTitle());
[email protected]81374f22013-02-07 02:03:45183 EXPECT_EQ(0,
184 shell()->web_contents()->GetRenderViewHost()->GetEnabledBindings());
185
creis3710b2382015-08-18 00:12:15186 RenderProcessHostWatcher terminated(
[email protected]8ffad4e2014-01-02 23:18:26187 shell()->web_contents(),
creis3710b2382015-08-18 00:12:15188 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
[email protected]81374f22013-02-07 02:03:45189 shell()->web_contents()->GetRenderViewHost()->SetWebUIProperty(
190 "toolkit", "views");
191 terminated.Wait();
192}
193
[email protected]04cbd3d2013-12-04 04:58:20194// This is a test for crbug.com/312016 attempting to create duplicate
195// RenderViewHosts. SetupForDuplicateHosts sets up this test case and leaves
196// it in a state with pending RenderViewHost. Before the commit of the new
197// pending RenderViewHost, this test case creates a new window through the new
198// process.
199IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest,
200 AttemptDuplicateRenderViewHost) {
dcheng3ce04b62015-10-26 23:30:55201 int32_t duplicate_routing_id = MSG_ROUTING_NONE;
[email protected]04cbd3d2013-12-04 04:58:20202 RenderViewHostImpl* pending_rvh =
203 PrepareToDuplicateHosts(shell(), &duplicate_routing_id);
204 EXPECT_NE(MSG_ROUTING_NONE, duplicate_routing_id);
205
206 // Since this test executes on the UI thread and hopping threads might cause
207 // different timing in the test, let's simulate a CreateNewWindow call coming
208 // from the IO thread.
209 ViewHostMsg_CreateWindow_Params params;
210 DOMStorageContextWrapper* dom_storage_context =
211 static_cast<DOMStorageContextWrapper*>(
212 BrowserContext::GetStoragePartition(
213 shell()->web_contents()->GetBrowserContext(),
214 pending_rvh->GetSiteInstance())->GetDOMStorageContext());
[email protected]4af624512013-12-13 14:58:43215 scoped_refptr<SessionStorageNamespaceImpl> session_storage(
216 new SessionStorageNamespaceImpl(dom_storage_context));
[email protected]04cbd3d2013-12-04 04:58:20217 // Cause a deliberate collision in routing ids.
dcheng3ce04b62015-10-26 23:30:55218 int32_t main_frame_routing_id = duplicate_routing_id + 1;
219 // TODO(avi): This should be made unique from the view routing ID once
220 // RenderViewHostImpl has-a RenderWidgetHostImpl. https://crbug.com/545684
221 int32_t main_frame_widget_routing_id = duplicate_routing_id;
222 pending_rvh->CreateNewWindow(duplicate_routing_id, main_frame_routing_id,
223 main_frame_widget_routing_id, params,
dcheng54c3719d2014-08-26 21:52:56224 session_storage.get());
[email protected]04cbd3d2013-12-04 04:58:20225
226 // If the above operation doesn't cause a crash, the test has succeeded!
[email protected]81374f22013-02-07 02:03:45227}
[email protected]04cbd3d2013-12-04 04:58:20228
[email protected]a8504022013-12-04 20:23:51229// This is a test for crbug.com/312016. It tries to create two RenderWidgetHosts
230// with the same process and routing ids, which causes a collision. It is almost
231// identical to the AttemptDuplicateRenderViewHost test case.
232IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest,
233 AttemptDuplicateRenderWidgetHost) {
234 int duplicate_routing_id = MSG_ROUTING_NONE;
235 RenderViewHostImpl* pending_rvh =
236 PrepareToDuplicateHosts(shell(), &duplicate_routing_id);
237 EXPECT_NE(MSG_ROUTING_NONE, duplicate_routing_id);
238
239 // Since this test executes on the UI thread and hopping threads might cause
240 // different timing in the test, let's simulate a CreateNewWidget call coming
241 // from the IO thread. Use the existing window routing id to cause a
242 // deliberate collision.
piman5d36dae2015-09-24 22:47:05243 pending_rvh->CreateNewWidget(duplicate_routing_id, blink::WebPopupTypePage);
[email protected]a8504022013-12-04 20:23:51244
245 // If the above operation doesn't crash, the test has succeeded!
246}
247
wfh815c4872015-02-25 21:01:31248// This is a test for crbug.com/444198. It tries to send a
249// ViewHostMsg_RunFileChooser containing an invalid path. The browser should
250// correctly terminate the renderer in these cases.
251IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, AttemptRunFileChoosers) {
252 TestFileChooserWithPath(base::FilePath(FILE_PATH_LITERAL("../../*.txt")));
253 TestFileChooserWithPath(base::FilePath(FILE_PATH_LITERAL("/etc/*.conf")));
254#if defined(OS_WIN)
255 TestFileChooserWithPath(
256 base::FilePath(FILE_PATH_LITERAL("\\\\evilserver\\evilshare\\*.txt")));
257 TestFileChooserWithPath(base::FilePath(FILE_PATH_LITERAL("c:\\*.txt")));
258 TestFileChooserWithPath(base::FilePath(FILE_PATH_LITERAL("..\\..\\*.txt")));
259#endif
260}
261
nick4c8dfd42014-11-14 04:11:49262class SecurityExploitTestInterstitialPage : public InterstitialPageDelegate {
263 public:
264 explicit SecurityExploitTestInterstitialPage(WebContents* contents) {
265 InterstitialPage* interstitial = InterstitialPage::Create(
266 contents, true, contents->GetLastCommittedURL(), this);
267 interstitial->Show();
268 }
269
270 // InterstitialPageDelegate implementation.
271 void CommandReceived(const std::string& command) override {
272 last_command_ = command;
273 }
274
275 std::string GetHTMLContents() override {
276 return "<html><head><script>"
277 "window.domAutomationController.setAutomationId(1);"
278 "window.domAutomationController.send(\"okay\");"
279 "</script></head>"
280 "<body>this page is an interstitial</body></html>";
281 }
282
283 std::string last_command() { return last_command_; }
284
285 private:
286 std::string last_command_;
287 DISALLOW_COPY_AND_ASSIGN(SecurityExploitTestInterstitialPage);
288};
289
290// Fails due to InterstitialPage's reliance on PostNonNestableTask
291// http://crbug.com/432737
292#if defined(OS_ANDROID)
293#define MAYBE_InterstitialCommandFromUnderlyingContent \
294 DISABLED_InterstitialCommandFromUnderlyingContent
295#else
296#define MAYBE_InterstitialCommandFromUnderlyingContent \
297 InterstitialCommandFromUnderlyingContent
298#endif
299
300// The interstitial should not be controllable by the underlying content.
301IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest,
302 MAYBE_InterstitialCommandFromUnderlyingContent) {
303 // Start off with initial navigation, to allocate the process.
304 GURL foo("http://foo.com/simple_page.html");
305 NavigateToURL(shell(), foo);
306 EXPECT_EQ(base::ASCIIToUTF16("OK"), shell()->web_contents()->GetTitle());
307
308 DOMMessageQueue message_queue;
309
310 // Install and show an interstitial page.
311 SecurityExploitTestInterstitialPage* interstitial =
312 new SecurityExploitTestInterstitialPage(shell()->web_contents());
313
314 ASSERT_EQ("", interstitial->last_command());
creis3710b2382015-08-18 00:12:15315 WaitForInterstitialAttach(shell()->web_contents());
nick4c8dfd42014-11-14 04:11:49316
317 InterstitialPage* interstitial_page =
318 shell()->web_contents()->GetInterstitialPage();
319 ASSERT_TRUE(interstitial_page != NULL);
320 ASSERT_TRUE(shell()->web_contents()->ShowingInterstitialPage());
321 ASSERT_TRUE(interstitial_page->GetDelegateForTesting() == interstitial);
322
323 // The interstitial page ought to be able to send a message.
324 std::string message;
325 ASSERT_TRUE(message_queue.WaitForMessage(&message));
326 ASSERT_EQ("\"okay\"", message);
327 ASSERT_EQ("\"okay\"", interstitial->last_command());
328
329 // Send an automation message from the underlying content and wait for it to
330 // be dispatched on this thread. This message should not be received by the
331 // interstitial.
creis3710b2382015-08-18 00:12:15332 RenderFrameHost* compromised_renderer =
nick4c8dfd42014-11-14 04:11:49333 shell()->web_contents()->GetMainFrame();
334 FrameHostMsg_DomOperationResponse evil(compromised_renderer->GetRoutingID(),
avi60bd4902015-09-23 20:39:24335 "evil");
nick4c8dfd42014-11-14 04:11:49336 IpcSecurityTestUtil::PwnMessageReceived(
337 compromised_renderer->GetProcess()->GetChannel(), evil);
338
339 ASSERT_TRUE(message_queue.WaitForMessage(&message));
340 ASSERT_EQ("evil", message)
341 << "Automation message should be received by WebContents.";
342 ASSERT_EQ("\"okay\"", interstitial->last_command())
343 << "Interstitial should not be affected.";
344
345 // Send a second message from the interstitial page, and make sure that the
346 // "evil" message doesn't arrive in the intervening period.
creis3710b2382015-08-18 00:12:15347 ASSERT_TRUE(ExecuteScript(interstitial_page->GetMainFrame(),
348 "window.domAutomationController.send(\"okay2\");"));
nick4c8dfd42014-11-14 04:11:49349 ASSERT_TRUE(message_queue.WaitForMessage(&message));
350 ASSERT_EQ("\"okay2\"", message);
351 ASSERT_EQ("\"okay2\"", interstitial->last_command());
352}
353
creis3710b2382015-08-18 00:12:15354class IsolatedAppContentBrowserClient : public TestContentBrowserClient {
355 public:
356 bool IsIllegalOrigin(content::ResourceContext* resource_context,
357 int child_process_id,
358 const GURL& origin) override {
359 // Simulate a case where an app origin is not in an app process.
360 return true;
361 }
362};
363
364// Renderer processes should not be able to spoof Origin HTTP headers.
365IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, InvalidOriginHeaders) {
366 // Create a set of IPC messages with various Origin headers.
367 ResourceHostMsg_Request chrome_origin_msg(
368 CreateXHRRequestWithOrigin("chrome://settings"));
369 ResourceHostMsg_Request embedder_isolated_origin_msg(
370 CreateXHRRequestWithOrigin("https://isolated.bar.com"));
371 ResourceHostMsg_Request invalid_origin_msg(
372 CreateXHRRequestWithOrigin("invalidurl"));
373 ResourceHostMsg_Request invalid_scheme_origin_msg(
374 CreateXHRRequestWithOrigin("fake-scheme://foo"));
375
376 GURL web_url("http://foo.com/simple_page.html");
377 NavigateToURL(shell(), web_url);
378 RenderFrameHost* web_rfh = shell()->web_contents()->GetMainFrame();
379
380 // Web processes cannot make XHRs with chrome:// Origin headers.
381 {
382 RenderProcessHostWatcher web_process_killed(
383 web_rfh->GetProcess(),
384 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
385 IPC::IpcSecurityTestUtil::PwnMessageReceived(
386 web_rfh->GetProcess()->GetChannel(),
387 ResourceHostMsg_RequestResource(web_rfh->GetRoutingID(), 1,
388 chrome_origin_msg));
389 web_process_killed.Wait();
390 }
391
392 // Web processes cannot make XHRs with URLs that the content embedder expects
393 // to have process isolation. Ideally this would test chrome-extension://
394 // URLs for Chrome Apps, but those can't be tested inside content/ and the
395 // ResourceHostMsg_Request IPC can't be created in a test outside content/.
396 NavigateToURL(shell(), web_url);
397 {
398 // Set up a ContentBrowserClient that simulates an app URL in a non-app
399 // process.
400 IsolatedAppContentBrowserClient app_client;
401 ContentBrowserClient* old_client = SetBrowserClientForTesting(&app_client);
402 RenderProcessHostWatcher web_process_killed(
403 web_rfh->GetProcess(),
404 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
405 IPC::IpcSecurityTestUtil::PwnMessageReceived(
406 web_rfh->GetProcess()->GetChannel(),
407 ResourceHostMsg_RequestResource(web_rfh->GetRoutingID(), 1,
408 embedder_isolated_origin_msg));
409 web_process_killed.Wait();
410 SetBrowserClientForTesting(old_client);
411 }
412
413 // Web processes cannot make XHRs with invalid Origin headers.
414 NavigateToURL(shell(), web_url);
415 {
416 RenderProcessHostWatcher web_process_killed(
417 web_rfh->GetProcess(),
418 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
419 IPC::IpcSecurityTestUtil::PwnMessageReceived(
420 web_rfh->GetProcess()->GetChannel(),
421 ResourceHostMsg_RequestResource(web_rfh->GetRoutingID(), 1,
422 invalid_origin_msg));
423 web_process_killed.Wait();
424 }
425
426 // Web processes cannot make XHRs with invalid scheme Origin headers.
427 NavigateToURL(shell(), web_url);
428 {
429 RenderProcessHostWatcher web_process_killed(
430 web_rfh->GetProcess(),
431 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
432 IPC::IpcSecurityTestUtil::PwnMessageReceived(
433 web_rfh->GetProcess()->GetChannel(),
434 ResourceHostMsg_RequestResource(web_rfh->GetRoutingID(), 1,
435 invalid_scheme_origin_msg));
436 web_process_killed.Wait();
437 }
438}
439
[email protected]04cbd3d2013-12-04 04:58:20440} // namespace content