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

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

Issue 2697713005: DCHECK: Browser asking renderer to commit URLs it is not allowed to. (Closed)
Patch Set: git cl try Created 3 years, 10 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
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 2385 matching lines...) Expand 10 before | Expand all | Expand 10 after
2396 // navigations to be ignored in OnDidCommitProvisionalLoad. 2396 // navigations to be ignored in OnDidCommitProvisionalLoad.
2397 if (is_waiting_for_beforeunload_ack_) { 2397 if (is_waiting_for_beforeunload_ack_) {
2398 is_waiting_for_beforeunload_ack_ = false; 2398 is_waiting_for_beforeunload_ack_ = false;
2399 render_view_host_->GetWidget()->decrement_in_flight_event_count(); 2399 render_view_host_->GetWidget()->decrement_in_flight_event_count();
2400 render_view_host_->GetWidget()->StopHangMonitorTimeout(); 2400 render_view_host_->GetWidget()->StopHangMonitorTimeout();
2401 } 2401 }
2402 send_before_unload_start_time_ = base::TimeTicks(); 2402 send_before_unload_start_time_ = base::TimeTicks();
2403 render_view_host_->is_waiting_for_close_ack_ = false; 2403 render_view_host_->is_waiting_for_close_ack_ = false;
2404 } 2404 }
2405 2405
2406 bool RenderFrameHostImpl::CanCommitURL(const GURL& url) {
2407 // TODO(creis): We should also check for WebUI pages here. Also, when the
2408 // out-of-process iframes implementation is ready, we should check for
2409 // cross-site URLs that are not allowed to commit in this process.
2410
2411 // Give the client a chance to disallow URLs from committing.
2412 return GetContentClient()->browser()->CanCommitURL(GetProcess(), url);
2413 }
2414
2415 bool RenderFrameHostImpl::CanCommitOrigin( 2406 bool RenderFrameHostImpl::CanCommitOrigin(
2416 const url::Origin& origin, 2407 const url::Origin& origin,
2417 const GURL& url) { 2408 const GURL& url) {
2418 // If the --disable-web-security flag is specified, all bets are off and the 2409 // If the --disable-web-security flag is specified, all bets are off and the
2419 // renderer process can send any origin it wishes. 2410 // renderer process can send any origin it wishes.
2420 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 2411 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
2421 switches::kDisableWebSecurity)) { 2412 switches::kDisableWebSecurity)) {
2422 return true; 2413 return true;
2423 } 2414 }
2424 2415
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
2905 2896
2906 void RenderFrameHostImpl::SetHasReceivedUserGesture() { 2897 void RenderFrameHostImpl::SetHasReceivedUserGesture() {
2907 Send(new FrameMsg_SetHasReceivedUserGesture(GetRoutingID())); 2898 Send(new FrameMsg_SetHasReceivedUserGesture(GetRoutingID()));
2908 } 2899 }
2909 2900
2910 void RenderFrameHostImpl::ClearFocusedElement() { 2901 void RenderFrameHostImpl::ClearFocusedElement() {
2911 has_focused_editable_element_ = false; 2902 has_focused_editable_element_ = false;
2912 Send(new FrameMsg_ClearFocusedElement(GetRoutingID())); 2903 Send(new FrameMsg_ClearFocusedElement(GetRoutingID()));
2913 } 2904 }
2914 2905
2906 bool RenderFrameHostImpl::CanCommitURL(const GURL& url) {
2907 // TODO(creis): We should also check for WebUI pages here. Also, when the
2908 // out-of-process iframes implementation is ready, we should check for
2909 // cross-site URLs that are not allowed to commit in this process.
2910
2911 // Give the client a chance to disallow URLs from committing.
2912 return GetContentClient()->browser()->CanCommitURL(GetProcess(), url);
2913 }
2914
2915 bool RenderFrameHostImpl::IsSameSiteInstance( 2915 bool RenderFrameHostImpl::IsSameSiteInstance(
2916 RenderFrameHostImpl* other_render_frame_host) { 2916 RenderFrameHostImpl* other_render_frame_host) {
2917 // As a sanity check, make sure the frame belongs to the same BrowserContext. 2917 // As a sanity check, make sure the frame belongs to the same BrowserContext.
2918 CHECK_EQ(GetSiteInstance()->GetBrowserContext(), 2918 CHECK_EQ(GetSiteInstance()->GetBrowserContext(),
2919 other_render_frame_host->GetSiteInstance()->GetBrowserContext()); 2919 other_render_frame_host->GetSiteInstance()->GetBrowserContext());
2920 return GetSiteInstance() == other_render_frame_host->GetSiteInstance(); 2920 return GetSiteInstance() == other_render_frame_host->GetSiteInstance();
2921 } 2921 }
2922 2922
2923 void RenderFrameHostImpl::UpdateAccessibilityMode() { 2923 void RenderFrameHostImpl::UpdateAccessibilityMode() {
2924 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode(); 2924 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode();
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
3447 // There is no pending NavigationEntry in these cases, so pass 0 as the 3447 // There is no pending NavigationEntry in these cases, so pass 0 as the
3448 // pending_nav_entry_id. If the previous handle was a prematurely aborted 3448 // pending_nav_entry_id. If the previous handle was a prematurely aborted
3449 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. 3449 // navigation loaded via LoadDataWithBaseURL, propagate the entry id.
3450 return NavigationHandleImpl::Create( 3450 return NavigationHandleImpl::Create(
3451 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, 3451 params.url, params.redirects, frame_tree_node_, is_renderer_initiated,
3452 params.was_within_same_page, base::TimeTicks::Now(), 3452 params.was_within_same_page, base::TimeTicks::Now(),
3453 entry_id_for_data_nav, false); // started_from_context_menu 3453 entry_id_for_data_nav, false); // started_from_context_menu
3454 } 3454 }
3455 3455
3456 } // namespace content 3456 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698