Index: src/debug.cc |
diff --git a/src/debug.cc b/src/debug.cc |
index d8844cc414e3f03c64f803dac22fdfaa8c5a003f..a7321b2b157f074a02e8a8dd5bf7e78148803cbc 100644 |
--- a/src/debug.cc |
+++ b/src/debug.cc |
@@ -2630,8 +2630,12 @@ void Debug::OnException(Handle<Object> exception, bool uncaught, |
void Debug::OnCompileError(Handle<Script> script) { |
- // No more to do if not debugging. |
- if (in_debug_scope() || ignore_events()) return; |
+ if (ignore_events()) return; |
+ |
+ if (in_debug_scope()) { |
+ ProcessCompileEventInDebugScope(v8::CompileError, script); |
+ return; |
+ } |
HandleScope scope(isolate_); |
DebugScope debug_scope(this); |
@@ -2692,8 +2696,12 @@ void Debug::OnAfterCompile(Handle<Script> script) { |
// Add the newly compiled script to the script cache. |
if (script_cache_ != NULL) script_cache_->Add(script); |
- // No more to do if not debugging. |
- if (in_debug_scope() || ignore_events()) return; |
+ if (ignore_events()) return; |
+ |
+ if (in_debug_scope()) { |
+ ProcessCompileEventInDebugScope(v8::AfterCompile, script); |
+ return; |
+ } |
HandleScope scope(isolate_); |
DebugScope debug_scope(this); |
@@ -2848,6 +2856,27 @@ void Debug::CallEventCallback(v8::DebugEvent event, |
} |
+void Debug::ProcessCompileEventInDebugScope(v8::DebugEvent event, |
+ Handle<Script> script) { |
+ if (event_listener_.is_null()) return; |
+ |
+ SuppressDebug while_processing(this); |
+ DebugScope debug_scope(this); |
+ if (debug_scope.failed()) return; |
+ |
+ Handle<Object> event_data; |
+ // Bail out and don't call debugger if exception. |
+ if (!MakeCompileEvent(script, event).ToHandle(&event_data)) return; |
+ |
+ // Create the execution state. |
+ Handle<Object> exec_state; |
+ // Bail out and don't call debugger if exception. |
+ if (!MakeExecutionState().ToHandle(&exec_state)) return; |
+ |
+ CallEventCallback(event, exec_state, event_data, NULL); |
+} |
+ |
+ |
Handle<Context> Debug::GetDebugContext() { |
DebugScope debug_scope(this); |
// The global handle may be destroyed soon after. Return it reboxed. |