OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "extensions/renderer/module_system.h" | 5 #include "extensions/renderer/module_system.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(func_as_value); | 660 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(func_as_value); |
661 | 661 |
662 v8::Local<v8::Object> define_object = v8::Object::New(GetIsolate()); | 662 v8::Local<v8::Object> define_object = v8::Object::New(GetIsolate()); |
663 gin::ModuleRegistry::InstallGlobals(GetIsolate(), define_object); | 663 gin::ModuleRegistry::InstallGlobals(GetIsolate(), define_object); |
664 | 664 |
665 v8::Local<v8::Object> exports = v8::Object::New(GetIsolate()); | 665 v8::Local<v8::Object> exports = v8::Object::New(GetIsolate()); |
666 | 666 |
667 v8::Local<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New( | 667 v8::Local<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New( |
668 GetIsolate(), | 668 GetIsolate(), |
669 &SetExportsProperty); | 669 &SetExportsProperty); |
| 670 tmpl->RemovePrototype(); |
670 v8::Local<v8::String> v8_key; | 671 v8::Local<v8::String> v8_key; |
671 if (!v8_helpers::ToV8String(GetIsolate(), "$set", &v8_key)) { | 672 if (!v8_helpers::ToV8String(GetIsolate(), "$set", &v8_key)) { |
672 NOTREACHED(); | 673 NOTREACHED(); |
673 return v8::Undefined(GetIsolate()); | 674 return v8::Undefined(GetIsolate()); |
674 } | 675 } |
675 | 676 |
676 v8::Local<v8::Function> function; | 677 v8::Local<v8::Function> function; |
677 if (!tmpl->GetFunction(v8_context).ToLocal(&function)) { | 678 if (!tmpl->GetFunction(v8_context).ToLocal(&function)) { |
678 NOTREACHED(); | 679 NOTREACHED(); |
679 return v8::Undefined(GetIsolate()); | 680 return v8::Undefined(GetIsolate()); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 | 757 |
757 void ModuleSystem::ClobberExistingNativeHandler(const std::string& name) { | 758 void ModuleSystem::ClobberExistingNativeHandler(const std::string& name) { |
758 NativeHandlerMap::iterator existing_handler = native_handler_map_.find(name); | 759 NativeHandlerMap::iterator existing_handler = native_handler_map_.find(name); |
759 if (existing_handler != native_handler_map_.end()) { | 760 if (existing_handler != native_handler_map_.end()) { |
760 clobbered_native_handlers_.push_back(std::move(existing_handler->second)); | 761 clobbered_native_handlers_.push_back(std::move(existing_handler->second)); |
761 native_handler_map_.erase(existing_handler); | 762 native_handler_map_.erase(existing_handler); |
762 } | 763 } |
763 } | 764 } |
764 | 765 |
765 } // namespace extensions | 766 } // namespace extensions |
OLD | NEW |