| 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 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 context_->safe_builtins()->GetFunction(), | 712 context_->safe_builtins()->GetFunction(), |
| 713 context_->safe_builtins()->GetJSON(), | 713 context_->safe_builtins()->GetJSON(), |
| 714 context_->safe_builtins()->GetObjekt(), | 714 context_->safe_builtins()->GetObjekt(), |
| 715 context_->safe_builtins()->GetRegExp(), | 715 context_->safe_builtins()->GetRegExp(), |
| 716 context_->safe_builtins()->GetString(), | 716 context_->safe_builtins()->GetString(), |
| 717 context_->safe_builtins()->GetError(), | 717 context_->safe_builtins()->GetError(), |
| 718 }; | 718 }; |
| 719 { | 719 { |
| 720 v8::TryCatch try_catch(GetIsolate()); | 720 v8::TryCatch try_catch(GetIsolate()); |
| 721 try_catch.SetCaptureMessage(true); | 721 try_catch.SetCaptureMessage(true); |
| 722 context_->CallFunction(func, arraysize(args), args); | 722 context_->SafeCallFunction(func, arraysize(args), args); |
| 723 if (try_catch.HasCaught()) { | 723 if (try_catch.HasCaught()) { |
| 724 HandleException(try_catch); | 724 HandleException(try_catch); |
| 725 return v8::Undefined(GetIsolate()); | 725 return v8::Undefined(GetIsolate()); |
| 726 } | 726 } |
| 727 } | 727 } |
| 728 return handle_scope.Escape(exports); | 728 return handle_scope.Escape(exports); |
| 729 } | 729 } |
| 730 | 730 |
| 731 void ModuleSystem::OnDidAddPendingModule( | 731 void ModuleSystem::OnDidAddPendingModule( |
| 732 const std::string& id, | 732 const std::string& id, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 762 | 762 |
| 763 void ModuleSystem::ClobberExistingNativeHandler(const std::string& name) { | 763 void ModuleSystem::ClobberExistingNativeHandler(const std::string& name) { |
| 764 NativeHandlerMap::iterator existing_handler = native_handler_map_.find(name); | 764 NativeHandlerMap::iterator existing_handler = native_handler_map_.find(name); |
| 765 if (existing_handler != native_handler_map_.end()) { | 765 if (existing_handler != native_handler_map_.end()) { |
| 766 clobbered_native_handlers_.push_back(std::move(existing_handler->second)); | 766 clobbered_native_handlers_.push_back(std::move(existing_handler->second)); |
| 767 native_handler_map_.erase(existing_handler); | 767 native_handler_map_.erase(existing_handler); |
| 768 } | 768 } |
| 769 } | 769 } |
| 770 | 770 |
| 771 } // namespace extensions | 771 } // namespace extensions |
| OLD | NEW |