Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index d6336f2846be74c571a5b694d35529236c76af7c..baa83960ec16c10987683751772fb839a2987c96 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -8124,6 +8124,14 @@ Local<Context> Debug::GetDebugContext() { |
return GetDebugContext(reinterpret_cast<Isolate*>(i::Isolate::Current())); |
} |
+MaybeLocal<Context> Debug::GetDebuggedContext(Isolate* isolate) { |
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
+ ENTER_V8(i_isolate); |
+ if (!i_isolate->debug()->in_debug_scope()) return MaybeLocal<Context>(); |
+ i::Handle<i::Object> calling = i_isolate->GetCallingNativeContext(); |
+ if (calling.is_null()) return MaybeLocal<Context>(); |
+ return Utils::ToLocal(i::Handle<i::Context>::cast(calling)); |
+} |
void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) { |
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |