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

Unified Diff: chrome/browser/ui/tab_contents/tab_contents_wrapper.cc

Issue 7069006: Prevent registerProtocolHandler for pseudo-schemes and disabled schemes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing include Created 9 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
index 4f7e6746323ca004a1aa24371f85838a5ed39cba..95d34b782fd56598264dee7a3c36c52b681113b3 100644
--- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
+++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
@@ -45,6 +45,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
+#include "content/browser/child_process_security_policy.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/common/notification_service.h"
@@ -503,10 +504,15 @@ void TabContentsWrapper::OnJSOutOfMemory() {
void TabContentsWrapper::OnRegisterProtocolHandler(const std::string& protocol,
const GURL& url,
const string16& title) {
+ ChildProcessSecurityPolicy* policy =
+ ChildProcessSecurityPolicy::GetInstance();
+ if (policy->IsPseudoScheme(protocol) || policy->IsDisabledScheme(protocol))
+ return;
+
ProtocolHandlerRegistry* registry = profile()->GetProtocolHandlerRegistry();
- if (!registry->enabled()) {
+ if (!registry->enabled())
return;
- }
+
ProtocolHandler handler =
ProtocolHandler::CreateProtocolHandler(protocol, url, title);
if (!handler.IsEmpty() &&
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698