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

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

Issue 8142009: Add a second line of defense for receiving a bad message in the renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/renderer/render_view.cc » ('j') | content/renderer/render_view.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/tab_contents/tab_contents.h" 5 #include "content/browser/tab_contents/tab_contents.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 } 566 }
567 567
568 bool TabContents::NavigateToPendingEntry( 568 bool TabContents::NavigateToPendingEntry(
569 NavigationController::ReloadType reload_type) { 569 NavigationController::ReloadType reload_type) {
570 return NavigateToEntry(*controller_.pending_entry(), reload_type); 570 return NavigateToEntry(*controller_.pending_entry(), reload_type);
571 } 571 }
572 572
573 bool TabContents::NavigateToEntry( 573 bool TabContents::NavigateToEntry(
574 const NavigationEntry& entry, 574 const NavigationEntry& entry,
575 NavigationController::ReloadType reload_type) { 575 NavigationController::ReloadType reload_type) {
576 RenderViewHost* dest_render_view_host = render_manager_.Navigate(entry);
577 if (!dest_render_view_host)
578 return false; // Unable to create the desired render view host.
579
580 // The renderer will reject IPC messages with URLs longer than 576 // The renderer will reject IPC messages with URLs longer than
581 // this limit, so don't attempt to navigate with a longer URL. 577 // this limit, so don't attempt to navigate with a longer URL.
582 if (entry.url().spec().size() > content::kMaxURLChars) 578 if (entry.url().spec().size() > content::kMaxURLChars)
583 return false; 579 return false;
584 580
581 RenderViewHost* dest_render_view_host = render_manager_.Navigate(entry);
582 if (!dest_render_view_host)
583 return false; // Unable to create the desired render view host.
584
585 // For security, we should never send non-Web-UI URLs to a Web UI renderer. 585 // For security, we should never send non-Web-UI URLs to a Web UI renderer.
586 // Double check that here. 586 // Double check that here.
587 int enabled_bindings = dest_render_view_host->enabled_bindings(); 587 int enabled_bindings = dest_render_view_host->enabled_bindings();
588 bool is_allowed_in_web_ui_renderer = content::GetContentClient()-> 588 bool is_allowed_in_web_ui_renderer = content::GetContentClient()->
589 browser()->GetWebUIFactory()->IsURLAcceptableForWebUI(browser_context(), 589 browser()->GetWebUIFactory()->IsURLAcceptableForWebUI(browser_context(),
590 entry.url()); 590 entry.url());
591 CHECK(!BindingsPolicy::is_web_ui_enabled(enabled_bindings) || 591 CHECK(!BindingsPolicy::is_web_ui_enabled(enabled_bindings) ||
592 is_allowed_in_web_ui_renderer); 592 is_allowed_in_web_ui_renderer);
593 593
594 // Tell DevTools agent that it is attached prior to the navigation. 594 // Tell DevTools agent that it is attached prior to the navigation.
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after
1958 1958
1959 void TabContents::set_encoding(const std::string& encoding) { 1959 void TabContents::set_encoding(const std::string& encoding) {
1960 encoding_ = content::GetContentClient()->browser()-> 1960 encoding_ = content::GetContentClient()->browser()->
1961 GetCanonicalEncodingNameByAliasName(encoding); 1961 GetCanonicalEncodingNameByAliasName(encoding);
1962 } 1962 }
1963 1963
1964 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 1964 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
1965 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); 1965 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh);
1966 rwh_view->SetSize(view()->GetContainerSize()); 1966 rwh_view->SetSize(view()->GetContainerSize());
1967 } 1967 }
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_view.cc » ('j') | content/renderer/render_view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698