Index: src/debug/debug.cc |
diff --git a/src/debug/debug.cc b/src/debug/debug.cc |
index a7e5ea6cef4d4330328d5872028c0c0b4e240694..61cd3ca782f886eb0e406415e99e69946dfda5d7 100644 |
--- a/src/debug/debug.cc |
+++ b/src/debug/debug.cc |
@@ -1894,6 +1894,37 @@ void Debug::OnAfterCompile(Handle<Script> script) { |
ProcessCompileEvent(v8::AfterCompile, script); |
} |
+void Debug::OnModuleRequested(Handle<Module> referer, Handle<Module> requested, |
+ Handle<String> specifier) { |
+ if (!debug_delegate_) return; |
+ debug_delegate_->ModuleRequested( |
+ ToApiHandle<debug::Script>(handle(referer->script())), |
+ ToApiHandle<debug::Script>(handle(requested->script())), |
+ Utils::ToLocal(specifier)); |
+} |
+ |
+void Debug::ReportRequestedModules() { |
+ if (!debug_delegate_) return; |
+ HandleScope handle_scope(isolate_); |
+ HeapIterator iterator(isolate_->heap()); |
+ HeapObject* obj; |
+ while ((obj = iterator.next())) { |
+ if (!obj->IsModule()) continue; |
+ Handle<Module> module(Module::cast(obj)); |
+ if (!module->evaluated()) continue; |
+ Handle<FixedArray> requested_modules(module->requested_modules(), isolate_); |
+ Handle<FixedArray> module_requests(module->info()->module_requests(), |
+ isolate_); |
+ for (int j = 0, length = requested_modules->length(); j < length; ++j) { |
+ Handle<Module> import(i::Module::cast(requested_modules->get(j)), |
+ isolate_); |
+ Handle<String> request(i::String::cast(module_requests->get(j)), |
+ isolate_); |
+ OnModuleRequested(module, import, request); |
+ } |
+ } |
+} |
+ |
namespace { |
struct CollectedCallbackData { |
Object** location; |