Index: src/debug.cc |
diff --git a/src/debug.cc b/src/debug.cc |
index d8844cc414e3f03c64f803dac22fdfaa8c5a003f..ce77219639d5f3aca9c9b36804d1474b5c39b0ad 100644 |
--- a/src/debug.cc |
+++ b/src/debug.cc |
@@ -2481,9 +2481,8 @@ void Debug::RecordEvalCaller(Handle<Script> script) { |
MaybeHandle<Object> Debug::MakeJSObject(const char* constructor_name, |
int argc, |
Handle<Object> argv[]) { |
- AssertDebugContext(); |
// Create the execution state object. |
- Handle<GlobalObject> global(isolate_->global_object()); |
+ Handle<GlobalObject> global = in_debug_scope() ? Handle<GlobalObject>(debug_context()->global_object()) : Handle<GlobalObject>(isolate_->global_object()); |
yurys
2014/12/08 07:19:28
This way we will create debugger objects in the us
kozy
2014/12/08 14:19:30
Done.
|
Handle<Object> constructor = Object::GetProperty( |
isolate_, global, constructor_name).ToHandleChecked(); |
DCHECK(constructor->IsJSFunction()); |
@@ -2630,8 +2629,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 +2695,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 +2855,23 @@ void Debug::CallEventCallback(v8::DebugEvent event, |
} |
+void Debug::ProcessCompileEventInDebugScope(v8::DebugEvent event, |
+ Handle<Script> script) { |
+ if (event_listener_.is_null()) return; |
yurys
2014/12/08 10:55:51
I believe you can reenter debug context here if it
kozy
2014/12/08 14:19:30
Done.
|
+ |
+ 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. |