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

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

Issue 9773003: Apply fix for 117418 to M17. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/963/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
« no previous file with comments | « content/browser/renderer_host/mock_render_process_host.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_view_host.cc
===================================================================
--- content/browser/renderer_host/render_view_host.cc (revision 127767)
+++ content/browser/renderer_host/render_view_host.cc (working copy)
@@ -575,6 +575,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());
@@ -587,8 +601,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/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698