diff --git a/atom/common/api/atom_bindings.cc b/atom/common/api/atom_bindings.cc index 5655d4fe1d0f..f6eed1e17965 100644 --- a/atom/common/api/atom_bindings.cc +++ b/atom/common/api/atom_bindings.cc @@ -11,7 +11,7 @@ #include "atom/common/chrome_version.h" #include "atom/common/native_mate_converters/string16_converter.h" #include "base/logging.h" -#include "native_mate/callback.h" +#include "base/debug/debugger.h" #include "native_mate/dictionary.h" #include "atom/common/node_includes.h" @@ -20,22 +20,8 @@ namespace atom { namespace { -// Async handle to execute the stored v8 callback. -uv_async_t g_callback_uv_handle; - -// Stored v8 callback, to be called by the async handler. -base::Closure g_v8_callback; - -// Dummy class type that used for crashing the program. -struct DummyClass { bool crash; }; - -// Async handler to execute the stored v8 callback. -void UvOnCallback(uv_async_t* handle) { - g_v8_callback.Run(); -} - void Crash() { - static_cast(NULL)->crash = true; + base::debug::BreakDebugger(); } // Called when there is a fatal error in V8, we just crash the process here so @@ -49,19 +35,12 @@ void Log(const base::string16& message) { logging::LogMessage("CONSOLE", 0, 0).stream() << message; } -void ScheduleCallback(const base::Closure& callback) { - g_v8_callback = callback; - uv_async_send(&g_callback_uv_handle); -} - } // namespace AtomBindings::AtomBindings() { uv_async_init(uv_default_loop(), &call_next_tick_async_, OnCallNextTick); call_next_tick_async_.data = this; - - uv_async_init(uv_default_loop(), &g_callback_uv_handle, UvOnCallback); } AtomBindings::~AtomBindings() { @@ -74,16 +53,13 @@ void AtomBindings::BindTo(v8::Isolate* isolate, mate::Dictionary dict(isolate, process); dict.SetMethod("crash", &Crash); dict.SetMethod("log", &Log); - dict.SetMethod("scheduleCallback", &ScheduleCallback); dict.SetMethod("activateUvLoop", base::Bind(&AtomBindings::ActivateUVLoop, base::Unretained(this))); - v8::Handle versions; + mate::Dictionary versions; if (dict.Get("versions", &versions)) { - versions->Set(mate::StringToV8(isolate, "atom-shell"), - mate::StringToV8(isolate, ATOM_VERSION_STRING)); - versions->Set(mate::StringToV8(isolate, "chrome"), - mate::StringToV8(isolate, CHROME_VERSION_STRING)); + versions.Set("atom-shell", ATOM_VERSION_STRING); + versions.Set("chrome", CHROME_VERSION_STRING); } } diff --git a/spec/node-spec.coffee b/spec/node-spec.coffee index 89944683cbdd..82503bab7c19 100644 --- a/spec/node-spec.coffee +++ b/spec/node-spec.coffee @@ -54,11 +54,6 @@ describe 'node feature', -> fs.readFile __filename, -> setTimeout done, 0 - describe 'setTimeout in pure uv callback', -> - it 'does not crash', (done) -> - process.scheduleCallback -> - setTimeout done, 0 - describe 'throw error in node context', -> it 'gets caught', (done) -> error = new Error('boo!')