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

Side by Side Diff: content/browser/frame_host/render_frame_host_manager_browsertest.cc

Issue 2528813002: Fix Self-Referencing OOPIF Infinite Loop (Closed)
Patch Set: add fix to find and renderframe tests Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 10
(...skipping 3012 matching lines...) Expand 10 before | Expand all | Expand 10 after
3023 // With OOPIFs, this navigation used a cross-process transfer. Ensure that 3023 // With OOPIFs, this navigation used a cross-process transfer. Ensure that
3024 // the iframe's old RFH still has correct origin, even though it's pending 3024 // the iframe's old RFH still has correct origin, even though it's pending
3025 // deletion. 3025 // deletion.
3026 if (AreAllSitesIsolatedForTesting()) { 3026 if (AreAllSitesIsolatedForTesting()) {
3027 EXPECT_FALSE(child_rfh_b->is_active()); 3027 EXPECT_FALSE(child_rfh_b->is_active());
3028 EXPECT_NE(child_rfh_b, child->current_frame_host()); 3028 EXPECT_NE(child_rfh_b, child->current_frame_host());
3029 EXPECT_EQ(url::Origin(url_b), child_rfh_b->GetLastCommittedOrigin()); 3029 EXPECT_EQ(url::Origin(url_b), child_rfh_b->GetLastCommittedOrigin());
3030 } 3030 }
3031 } 3031 }
3032 3032
3033 // Ensure that loading a page with a cross-site coreferencing iframe
3034 // does not cause an infinite number of nested iframes to be created.
3035 // TODO(davidsac): This test should be broken until issue 527367 is resolved.
alexmos 2016/12/28 00:25:59 I don't see how issue 527367 is related to this te
davidsac (gone - try alexmos) 2017/01/06 00:44:57 Done.
3036 // Also, a decision of how to handle the issue will determine what FrameTree
3037 // string to expect
3038 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, CoReferencingFrames) {
3039 // Load a page with a cross-site coreferencing iframe.
3040 StartEmbeddedServer();
3041 GURL url_1(
3042 embedded_test_server()->GetURL("a.com", "/coreferencingframe_1.html"));
3043 EXPECT_TRUE(NavigateToURL(shell(), url_1));
3044
3045 WebContentsImpl* web_contents =
3046 static_cast<WebContentsImpl*>(shell()->web_contents());
3047
3048 FrameTreeNode* root = web_contents->GetFrameTree()->root();
3049
3050 if (AreAllSitesIsolatedForTesting()) {
3051 // The Frame Tree contains two successful instances of each site plus an
3052 // unsuccessfully-navigated third instance of B with a blank URL.
3053 EXPECT_EQ(
3054 " Site A ------------ proxies for B\n"
3055 " +--Site B ------- proxies for A\n"
3056 " +--Site A -- proxies for B\n"
3057 " +--Site B -- proxies for A\n"
3058 " +--Site B -- proxies for A\n"
3059 "Where A = http://a.com/\n"
3060 " B = http://b.com/",
3061 FrameTreeVisualizer().DepictFrameTree(root));
3062 } else {
3063 // The Frame Tree contains two successful instances of each site plus an
alexmos 2016/12/28 00:25:59 nit: s/Frame Tree/FrameTree/g (to match class nam
davidsac (gone - try alexmos) 2017/01/06 00:44:57 Done.
3064 // unsuccessfully-navigated third instance of B with a blank URL. The
3065 // FrameTreeVisualizer depicts all nodes as referencing Site A because
3066 // iframes
alexmos 2016/12/28 00:25:59 nit: unnecessary line break
davidsac (gone - try alexmos) 2017/01/06 00:44:57 Done.
3067 // are identified with their root site when outside of site-per-process
3068 // mode.
alexmos 2016/12/28 00:25:59 I think you can just put this comment above the if
davidsac (gone - try alexmos) 2017/01/06 00:44:57 Done.
3069 EXPECT_EQ(
3070 " Site A\n"
3071 " +--Site A\n"
3072 " +--Site A\n"
3073 " +--Site A\n"
3074 " +--Site A\nWhere A = http://a.com/",
alexmos 2016/12/28 00:25:59 nit: line break after \n
davidsac (gone - try alexmos) 2017/01/06 00:44:57 Done.
3075 FrameTreeVisualizer().DepictFrameTree(root));
3076 }
3077
3078 EXPECT_EQ(
3079 root->child_at(0)->child_at(0)->child_at(0)->child_at(0)->current_url(),
alexmos 2016/12/28 00:25:59 You can use GURL::is_empty() for this, along with
davidsac (gone - try alexmos) 2017/01/06 00:44:57 Done.
3080 "");
3081 }
3082
3033 } // namespace content 3083 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698