OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 | 1231 |
1232 EXPECT_EQ( | 1232 EXPECT_EQ( |
1233 " Site A ------------ proxies for B\n" | 1233 " Site A ------------ proxies for B\n" |
1234 " |--Site B ------- proxies for A\n" | 1234 " |--Site B ------- proxies for A\n" |
1235 " +--Site B ------- proxies for A\n" | 1235 " +--Site B ------- proxies for A\n" |
1236 "Where A = http://a.com/\n" | 1236 "Where A = http://a.com/\n" |
1237 " B = http://bar.com/", | 1237 " B = http://bar.com/", |
1238 DepictFrameTree(root)); | 1238 DepictFrameTree(root)); |
1239 } | 1239 } |
1240 | 1240 |
| 1241 // Ensure that the renderer process doesn't crash when the main frame navigates |
| 1242 // a remote child to a page that results in a network error. |
| 1243 // See https://crbug.com/558016. |
| 1244 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateRemoteAfterError) { |
| 1245 GURL main_url(embedded_test_server()->GetURL( |
| 1246 "a.com", "/cross_site_iframe_factory.html?a(a)")); |
| 1247 NavigateToURL(shell(), main_url); |
| 1248 |
| 1249 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1250 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) |
| 1251 ->GetFrameTree() |
| 1252 ->root(); |
| 1253 |
| 1254 TestNavigationObserver observer(shell()->web_contents()); |
| 1255 |
| 1256 // Load same-site page into iframe. |
| 1257 FrameTreeNode* child = root->child_at(0); |
| 1258 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 1259 NavigateFrameToURL(child, http_url); |
| 1260 EXPECT_EQ(http_url, observer.last_navigation_url()); |
| 1261 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 1262 |
| 1263 // Load cross-site page into iframe. |
| 1264 GURL url = embedded_test_server()->GetURL("foo.com", "/title2.html"); |
| 1265 NavigateFrameToURL(root->child_at(0), url); |
| 1266 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 1267 EXPECT_EQ(url, observer.last_navigation_url()); |
| 1268 |
| 1269 // Ensure that we have created a new process for the subframe. |
| 1270 EXPECT_EQ( |
| 1271 " Site A ------------ proxies for B\n" |
| 1272 " +--Site B ------- proxies for A\n" |
| 1273 "Where A = http://a.com/\n" |
| 1274 " B = http://foo.com/", |
| 1275 DepictFrameTree(root)); |
| 1276 SiteInstance* site_instance = child->current_frame_host()->GetSiteInstance(); |
| 1277 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), site_instance); |
| 1278 |
| 1279 // Stop the test server and try to navigate the remote frame. |
| 1280 url = embedded_test_server()->GetURL("bar.com", "/title3.html"); |
| 1281 EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); |
| 1282 NavigateIframeToURL(shell()->web_contents(), "child-0", url); |
| 1283 } |
| 1284 |
1241 // Verify that killing a cross-site frame's process B and then navigating a | 1285 // Verify that killing a cross-site frame's process B and then navigating a |
1242 // frame to B correctly recreates all proxies in B. | 1286 // frame to B correctly recreates all proxies in B. |
1243 // | 1287 // |
1244 // 1 A A A | 1288 // 1 A A A |
1245 // / | \ / | \ / | \ / | \ . | 1289 // / | \ / | \ / | \ / | \ . |
1246 // 2 3 4 -> B A A -> Kill B -> B* A A -> B* B A | 1290 // 2 3 4 -> B A A -> Kill B -> B* A A -> B* B A |
1247 // | 1291 // |
1248 // After the last step, the test sends a postMessage from node 3 to node 4, | 1292 // After the last step, the test sends a postMessage from node 3 to node 4, |
1249 // verifying that a proxy for node 4 has been recreated in process B. This | 1293 // verifying that a proxy for node 4 has been recreated in process B. This |
1250 // verifies the fix for https://crbug.com/478892. | 1294 // verifies the fix for https://crbug.com/478892. |
(...skipping 3600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4851 EXPECT_EQ(blink::WebSandboxFlags::None, grandchild->pending_sandbox_flags()); | 4895 EXPECT_EQ(blink::WebSandboxFlags::None, grandchild->pending_sandbox_flags()); |
4852 EXPECT_EQ(blink::WebSandboxFlags::None, | 4896 EXPECT_EQ(blink::WebSandboxFlags::None, |
4853 grandchild->effective_sandbox_flags()); | 4897 grandchild->effective_sandbox_flags()); |
4854 | 4898 |
4855 // Check that the grandchild frame isn't sandboxed on the renderer side. If | 4899 // Check that the grandchild frame isn't sandboxed on the renderer side. If |
4856 // sandboxed, its origin would be unique ("null"). | 4900 // sandboxed, its origin would be unique ("null"). |
4857 EXPECT_EQ(frame_url.GetOrigin().spec(), GetDocumentOrigin(grandchild) + "/"); | 4901 EXPECT_EQ(frame_url.GetOrigin().spec(), GetDocumentOrigin(grandchild) + "/"); |
4858 } | 4902 } |
4859 | 4903 |
4860 } // namespace content | 4904 } // namespace content |
OLD | NEW |