Disable overriding built-in protocols with protocol.registerProtocol.

This commit is contained in:
Cheng Zhao 2013-08-30 12:51:15 +08:00
parent 72c604f741
commit 11221979e5

View file

@ -291,7 +291,7 @@ class AdapterProtocolHandler
// static // static
v8::Handle<v8::Value> Protocol::RegisterProtocol(const v8::Arguments& args) { v8::Handle<v8::Value> Protocol::RegisterProtocol(const v8::Arguments& args) {
std::string scheme(*v8::String::Utf8Value(args[0])); std::string scheme(*v8::String::Utf8Value(args[0]));
if (g_handlers.find(scheme) != g_handlers.end()) if (net::URLRequest::IsHandledProtocol(scheme))
return node::ThrowError("The scheme is already registered"); return node::ThrowError("The scheme is already registered");
// Store the handler in a map. // Store the handler in a map.