| Index: src/api.cc
|
| diff --git a/src/api.cc b/src/api.cc
|
| index ad41d819b7f094ddda7834f5ca57377ae8184f03..ccc6266a98313b41501d7728c9c70328acf2c0f2 100644
|
| --- a/src/api.cc
|
| +++ b/src/api.cc
|
| @@ -8946,13 +8946,21 @@ void DebugInterface::GetLoadedScripts(
|
| PersistentValueVector<DebugInterface::Script>& scripts) {
|
| i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
| ENTER_V8(isolate);
|
| - i::HandleScope handle_scope(isolate);
|
| - i::Handle<i::FixedArray> instances = isolate->debug()->GetLoadedScripts();
|
| - for (int i = 0; i < instances->length(); i++) {
|
| - i::Handle<i::Script> script =
|
| - i::Handle<i::Script>(i::Script::cast(instances->get(i)));
|
| - if (script->type() != i::Script::TYPE_NORMAL) continue;
|
| - scripts.Append(ToApiHandle<Script>(script));
|
| + // TODO(kozyatinskiy): remove this GC once tests are dealt with.
|
| + isolate->heap()->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask,
|
| + i::GarbageCollectionReason::kDebugger);
|
| + {
|
| + i::DisallowHeapAllocation no_gc;
|
| + i::Script::Iterator iterator(isolate);
|
| + i::Script* script;
|
| + while ((script = iterator.Next())) {
|
| + if (script->type() != i::Script::TYPE_NORMAL) continue;
|
| + if (script->HasValidSource()) {
|
| + i::HandleScope handle_scope(isolate);
|
| + i::Handle<i::Script> script_handle(script, isolate);
|
| + scripts.Append(ToApiHandle<Script>(script_handle));
|
| + }
|
| + }
|
| }
|
| }
|
|
|
|
|