Commit 82616d31 authored by koz@chromium.org's avatar koz@chromium.org

Prevent registerProtocolHandler for pseudo-schemes and disabled schemes.

Review URL: http://codereview.chromium.org/7069006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86799 0039d316-1c4b-4281-b951-d872f2087c98
parent 847de66e
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.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/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents.h"
#include "content/common/notification_service.h" #include "content/common/notification_service.h"
...@@ -503,10 +504,15 @@ void TabContentsWrapper::OnJSOutOfMemory() { ...@@ -503,10 +504,15 @@ void TabContentsWrapper::OnJSOutOfMemory() {
void TabContentsWrapper::OnRegisterProtocolHandler(const std::string& protocol, void TabContentsWrapper::OnRegisterProtocolHandler(const std::string& protocol,
const GURL& url, const GURL& url,
const string16& title) { const string16& title) {
ChildProcessSecurityPolicy* policy =
ChildProcessSecurityPolicy::GetInstance();
if (policy->IsPseudoScheme(protocol) || policy->IsDisabledScheme(protocol))
return;
ProtocolHandlerRegistry* registry = profile()->GetProtocolHandlerRegistry(); ProtocolHandlerRegistry* registry = profile()->GetProtocolHandlerRegistry();
if (!registry->enabled()) { if (!registry->enabled())
return; return;
}
ProtocolHandler handler = ProtocolHandler handler =
ProtocolHandler::CreateProtocolHandler(protocol, url, title); ProtocolHandler::CreateProtocolHandler(protocol, url, title);
if (!handler.IsEmpty() && if (!handler.IsEmpty() &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment