Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: chrome/renderer/extensions/module_system.cc

Issue 11312157: Add ExceptionHandler to ModuleSystem, remove heap allocated v8::TryCatch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/extensions/module_system.cc
diff --git a/chrome/renderer/extensions/module_system.cc b/chrome/renderer/extensions/module_system.cc
index 594f645377750507d543c3eab99b98661ecfc88f..69b2c78fddf1b215350b554030c2f7bd7149c871 100644
--- a/chrome/renderer/extensions/module_system.cc
+++ b/chrome/renderer/extensions/module_system.cc
@@ -63,6 +63,12 @@ bool ModuleSystem::IsPresentInCurrentContext() {
return !module_system.IsEmpty() && !module_system->IsUndefined();
}
+void ModuleSystem::HandleException(const v8::TryCatch& try_catch) {
+ DumpException(try_catch);
+ if (exception_handler_.get())
+ exception_handler_->HandleUncaughtException();
+}
+
// static
void ModuleSystem::DumpException(const v8::TryCatch& try_catch) {
v8::HandleScope handle_scope;
@@ -143,7 +149,7 @@ v8::Handle<v8::Value> ModuleSystem::RequireForJsInner(
try_catch.SetCaptureMessage(true);
func->Call(global, 3, args);
if (try_catch.HasCaught()) {
- DumpException(try_catch);
+ HandleException(try_catch);
return v8::Undefined();
}
}
@@ -174,7 +180,7 @@ void ModuleSystem::CallModuleMethod(const std::string& module_name,
try_catch.SetCaptureMessage(true);
func->Call(global, 0, NULL);
if (try_catch.HasCaught())
- DumpException(try_catch);
+ HandleException(try_catch);
}
}
@@ -251,13 +257,13 @@ v8::Handle<v8::Value> ModuleSystem::RunString(v8::Handle<v8::String> code,
try_catch.SetCaptureMessage(true);
v8::Handle<v8::Script> script(v8::Script::New(code, name));
if (try_catch.HasCaught()) {
- DumpException(try_catch);
+ HandleException(try_catch);
return handle_scope.Close(result);
}
result = script->Run();
if (try_catch.HasCaught())
- DumpException(try_catch);
+ HandleException(try_catch);
return handle_scope.Close(result);
}

Powered by Google App Engine
This is Rietveld 408576698