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

Side by Side Diff: content/browser/site_per_process_browsertest.cc

Issue 2411693003: Move blocking of top-level navigations to nested URLs with extension origins from non-extension pro… (Closed)
Patch Set: review comments Created 4 years, 2 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 unified diff | Download patch
OLDNEW
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 23 matching lines...) Expand all
34 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" 34 #include "content/browser/renderer_host/render_widget_host_input_event_router.h"
35 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 35 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
36 #include "content/browser/web_contents/web_contents_impl.h" 36 #include "content/browser/web_contents/web_contents_impl.h"
37 #include "content/common/child_process_messages.h" 37 #include "content/common/child_process_messages.h"
38 #include "content/common/frame_messages.h" 38 #include "content/common/frame_messages.h"
39 #include "content/common/input/synthetic_tap_gesture_params.h" 39 #include "content/common/input/synthetic_tap_gesture_params.h"
40 #include "content/common/input_messages.h" 40 #include "content/common/input_messages.h"
41 #include "content/common/renderer.mojom.h" 41 #include "content/common/renderer.mojom.h"
42 #include "content/common/view_messages.h" 42 #include "content/common/view_messages.h"
43 #include "content/public/browser/interstitial_page_delegate.h" 43 #include "content/public/browser/interstitial_page_delegate.h"
44 #include "content/public/browser/navigation_handle.h"
44 #include "content/public/browser/notification_observer.h" 45 #include "content/public/browser/notification_observer.h"
45 #include "content/public/browser/notification_service.h" 46 #include "content/public/browser/notification_service.h"
46 #include "content/public/browser/notification_types.h" 47 #include "content/public/browser/notification_types.h"
47 #include "content/public/browser/resource_dispatcher_host.h" 48 #include "content/public/browser/resource_dispatcher_host.h"
48 #include "content/public/common/browser_side_navigation_policy.h" 49 #include "content/public/common/browser_side_navigation_policy.h"
49 #include "content/public/common/content_switches.h" 50 #include "content/public/common/content_switches.h"
50 #include "content/public/common/url_constants.h" 51 #include "content/public/common/url_constants.h"
51 #include "content/public/test/browser_test_utils.h" 52 #include "content/public/test/browser_test_utils.h"
52 #include "content/public/test/content_browser_test_utils.h" 53 #include "content/public/test/content_browser_test_utils.h"
53 #include "content/public/test/test_navigation_observer.h" 54 #include "content/public/test/test_navigation_observer.h"
(...skipping 8285 matching lines...) Expand 10 before | Expand all | Expand 10 after
8339 8340
8340 // Now have the cross-process navigation commit and mark the current RFH as 8341 // Now have the cross-process navigation commit and mark the current RFH as
8341 // pending deletion. 8342 // pending deletion.
8342 cross_site_manager.WaitForNavigationFinished(); 8343 cross_site_manager.WaitForNavigationFinished();
8343 8344
8344 // Resume the navigation in the previous RFH that has just been marked as 8345 // Resume the navigation in the previous RFH that has just been marked as
8345 // pending deletion. We should not crash. 8346 // pending deletion. We should not crash.
8346 transfer_manager.WaitForNavigationFinished(); 8347 transfer_manager.WaitForNavigationFinished();
8347 } 8348 }
8348 8349
8350 class NavigatigationHandleWatcher : public WebContentsObserver {
alexmos 2016/10/13 00:46:27 nit: s/Navigatigation/Navigation/
jam 2016/10/13 03:12:28 Done.
8351 public:
8352 NavigatigationHandleWatcher(WebContents* web_contents)
8353 : WebContentsObserver(web_contents) {}
8354 void DidStartNavigation(NavigationHandle* navigation_handle) override {
8355 DCHECK_EQ("http://b.com/",
8356 navigation_handle->GetCreatorSiteInstance()->GetSiteURL().spec());
alexmos 2016/10/13 00:46:27 GetStartingSiteInstance (should fix compile)
8357 }
8358 };
8359
8360 // Verifies that the SiteInstance of a NavigationHandle correctly identifies the
8361 // RenderFrameHost that started the navigation (and not the destination RFH).
8362 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
8363 NavigationHandleSiteInstance) {
8364 // Navigate to a page with a cross-site iframe.
8365 GURL main_url(embedded_test_server()->GetURL(
8366 "a.com", "/cross_site_iframe_factory.html?a(b)"));
8367 EXPECT_TRUE(NavigateToURL(shell(), main_url));
8368
8369 // Navigate the iframe cross-site.
8370 NavigatigationHandleWatcher watcher(shell()->web_contents());
8371 TestNavigationObserver load_observer(shell()->web_contents());
8372 GURL frame_url = embedded_test_server()->GetURL("c.com", "/title1.html");
8373 EXPECT_TRUE(ExecuteScript(
8374 shell()->web_contents(),
8375 "window.frames[0].location = \"" + frame_url.spec() + "\";"));
8376 load_observer.Wait();
8377 }
8378
8349 } // namespace content 8379 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698