OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/macros.h" | 5 #include "base/macros.h" |
6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
7 #include "content/browser/frame_host/frame_tree.h" | 7 #include "content/browser/frame_host/frame_tree.h" |
8 #include "content/browser/frame_host/frame_tree_node.h" | 8 #include "content/browser/frame_host/frame_tree_node.h" |
9 #include "content/browser/renderer_host/render_view_host_impl.h" | 9 #include "content/browser/renderer_host/render_view_host_impl.h" |
10 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 // frame initiating the navigation. We disable those checks for this test, to | 725 // frame initiating the navigation. We disable those checks for this test, to |
726 // test what happens in a compromise scenario. | 726 // test what happens in a compromise scenario. |
727 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 727 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
728 switches::kDisableWebSecurity); | 728 switches::kDisableWebSecurity); |
729 | 729 |
730 // Set up an iframe. | 730 // Set up an iframe. |
731 WebContents* contents = shell()->web_contents(); | 731 WebContents* contents = shell()->web_contents(); |
732 FrameTreeNode* root = | 732 FrameTreeNode* root = |
733 static_cast<WebContentsImpl*>(contents)->GetFrameTree()->root(); | 733 static_cast<WebContentsImpl*>(contents)->GetFrameTree()->root(); |
734 GURL main_url(embedded_test_server()->GetURL( | 734 GURL main_url(embedded_test_server()->GetURL( |
735 "a.com", "/cross_site_iframe_factory.html?a(b)")); | 735 "a.com", "/cross_site_iframe_factory.html?a(a)")); |
736 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 736 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
737 | 737 |
738 // The navigation targets an invalid blob url; that's intentional to trigger | 738 // The navigation targets an invalid blob url; that's intentional to trigger |
739 // an error response. The response should commit in a process dedicated to | 739 // an error response. The response should commit in a process dedicated to |
740 // http://b.is. | 740 // http://b.is. |
741 std::string result; | 741 std::string result; |
742 EXPECT_TRUE(ExecuteScriptAndExtractString( | 742 EXPECT_TRUE(ExecuteScriptAndExtractString( |
743 root, | 743 root, |
744 "var iframe_element = document.getElementsByTagName('iframe')[0];" | 744 "var iframe_element = document.getElementsByTagName('iframe')[0];" |
745 "iframe_element.onload = () => {" | 745 "iframe_element.onload = () => {" |
746 " domAutomationController.send('done');" | 746 " domAutomationController.send('done');" |
747 "};" | 747 "};" |
748 "iframe_element.src = 'blob:http://b.is:2932/';", | 748 "iframe_element.src = 'blob:http://b.is:2932/';", |
749 &result)); | 749 &result)); |
750 WaitForLoadStop(contents); | 750 WaitForLoadStop(contents); |
751 | 751 |
752 // Make sure we did a process transfer back to "b.is". | 752 // Make sure we did a process transfer back to "b.is". |
753 EXPECT_EQ( | 753 EXPECT_EQ( |
754 " Site A ------------ proxies for B\n" | 754 " Site A ------------ proxies for B\n" |
755 " +--Site B ------- proxies for A\n" | 755 " +--Site B ------- proxies for A\n" |
756 "Where A = http://a.com/\n" | 756 "Where A = http://a.com/\n" |
757 " B = http://b.is/", | 757 " B = http://b.is/", |
758 FrameTreeVisualizer().DepictFrameTree(root)); | 758 FrameTreeVisualizer().DepictFrameTree(root)); |
759 } | 759 } |
760 | 760 |
761 } // namespace content | 761 } // namespace content |
OLD | NEW |