]> khamidou — GitHub mirrors - electron.git/commitdiff
Crash when there is fatal error in V8.
authorCheng Zhao <zcbenz@gmail.com>
Thu, 23 Jan 2014 12:30:44 +0000 (20:30 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 23 Jan 2014 12:30:44 +0000 (20:30 +0800)
common/api/atom_bindings.cc
vendor/node

index 8dc3b85a45a1b6062fd2a9d4b37e3fd9ede89363..3e58d8fe72facfc1e99654e6017454345a7340a1 100644 (file)
@@ -53,6 +53,13 @@ void UvOnCallback(uv_async_t* handle, int status) {
   g_v8_callback->NewHandle()->Call(global, 0, NULL);
 }
 
+// Called when there is a fatal error in V8, we just crash the process here so
+// we can get the stack trace.
+void FatalErrorCallback(const char* location, const char* message) {
+  LOG(ERROR) << "Fatal error in V8: " << location << " " << message;
+  static_cast<DummyClass*>(NULL)->crash = true;
+}
+
 v8::Handle<v8::Object> DumpStackFrame(v8::Handle<v8::StackFrame> stack_frame) {
   v8::Local<v8::Object> result = v8::Object::New();
   result->Set(ToV8Value("line"), ToV8Value(stack_frame->GetLineNumber()));
@@ -76,6 +83,7 @@ node::node_module_struct* GetBuiltinModule(const char *name, bool is_browser);
 AtomBindings::AtomBindings() {
   uv_async_init(uv_default_loop(), &g_next_tick_uv_handle, UvCallNextTick);
   uv_async_init(uv_default_loop(), &g_callback_uv_handle, UvOnCallback);
+  v8::V8::SetFatalErrorHandler(FatalErrorCallback);
 }
 
 AtomBindings::~AtomBindings() {
index 7fa644854f91c8dd23d8cec21be1310f0b69d813..80c5e17c09fdf2fc0b74353b285bb33a6ecf5e62 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 7fa644854f91c8dd23d8cec21be1310f0b69d813
+Subproject commit 80c5e17c09fdf2fc0b74353b285bb33a6ecf5e62