Index: chrome/renderer/extensions/module_system.h |
diff --git a/chrome/renderer/extensions/module_system.h b/chrome/renderer/extensions/module_system.h |
index e371865d9cacfb3f560d4fe5cbf0c71786fd1916..4f790842aec9f0a5095e355b90c10a2d991a837b 100644 |
--- a/chrome/renderer/extensions/module_system.h |
+++ b/chrome/renderer/extensions/module_system.h |
@@ -37,10 +37,17 @@ class ModuleSystem : public NativeHandler { |
public: |
class SourceMap { |
public: |
+ virtual ~SourceMap() {} |
virtual v8::Handle<v8::Value> GetSource(const std::string& name) = 0; |
virtual bool Contains(const std::string& name) = 0; |
}; |
+ class ExceptionHandler { |
+ public: |
+ virtual ~ExceptionHandler() {} |
+ virtual void HandleUncaughtException() = 0; |
+ }; |
+ |
// Enables native bindings for the duration of its lifetime. |
class NativesEnabledScope { |
public: |
@@ -99,9 +106,16 @@ class ModuleSystem : public NativeHandler { |
const std::string& module_name, |
const std::string& module_field); |
+ void set_exception_handler(scoped_ptr<ExceptionHandler> handler) { |
+ exception_handler_ = handler.Pass(); |
+ } |
+ |
private: |
typedef std::map<std::string, linked_ptr<NativeHandler> > NativeHandlerMap; |
+ // Called when an exception is thrown but not caught. |
+ void HandleException(const v8::TryCatch& try_catch); |
+ |
// Ensure that require_ has been evaluated from require.js. |
void EnsureRequireLoaded(); |
@@ -139,6 +153,9 @@ class ModuleSystem : public NativeHandler { |
// pinned natives as enabled. |
int natives_enabled_; |
+ // Called when an exception is thrown but not caught in JS. |
+ scoped_ptr<ExceptionHandler> exception_handler_; |
+ |
std::set<std::string> overridden_native_handlers_; |
DISALLOW_COPY_AND_ASSIGN(ModuleSystem); |