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

Unified Diff: content/browser/renderer_host/render_view_host.cc

Issue 9694021: Merge http://src.chromium.org/viewvc/chrome?view=rev&revision=125923 by (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1025/src/
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_view_host.cc
===================================================================
--- content/browser/renderer_host/render_view_host.cc (revision 126243)
+++ content/browser/renderer_host/render_view_host.cc (working copy)
@@ -580,6 +580,20 @@
}
void RenderViewHost::AllowBindings(int bindings_flags) {
+ // Ensure we aren't granting bindings to a process that has already
+ // been used for non-privileged views.
+ if (process()->HasConnection() &&
+ !ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings(
+ process()->GetID())) {
+ // This process has no bindings yet. Make sure it does not have more
+ // than this single view.
+ content::RenderProcessHost::listeners_iterator iter(
+ process()->ListenersIterator());
+ iter.Advance();
+ if (!iter.IsAtEnd())
+ return;
+ }
+
if (bindings_flags & content::BINDINGS_POLICY_WEB_UI) {
ChildProcessSecurityPolicy::GetInstance()->GrantWebUIBindings(
process()->GetID());
@@ -592,8 +606,13 @@
void RenderViewHost::SetWebUIProperty(const std::string& name,
const std::string& value) {
- DCHECK(enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI);
- Send(new ViewMsg_SetWebUIProperty(routing_id(), name, value));
+ // This is just a sanity check before telling the renderer to enable the
+ // property. It could lie and send the corresponding IPC messages anyway,
+ // but we will not act on them if enabled_bindings_ doesn't agree.
+ if (enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI)
+ Send(new ViewMsg_SetWebUIProperty(routing_id(), name, value));
+ else
+ NOTREACHED() << "WebUI bindings not enabled.";
}
void RenderViewHost::GotFocus() {
« no previous file with comments | « content/browser/renderer_host/mock_render_process_host.cc ('k') | content/browser/tab_contents/tab_contents_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698