diff --git a/src/debug/debug-scopes.cc b/src/debug/debug-scopes.cc index 5817f170b8..6b6ccd93fc 100644 --- a/src/debug/debug-scopes.cc +++ b/src/debug/debug-scopes.cc @@ -773,7 +773,9 @@ bool ScopeIterator::VisitLocals(const Visitor& visitor, Mode mode) const { Variable* function_var = current_scope_->AsDeclarationScope()->function_var(); if (function_var != nullptr) { - Handle function = frame_inspector_->GetFunction(); + Handle function = frame_inspector_ == nullptr + ? function_ + : frame_inspector_->GetFunction(); Handle name = function_var->name(); if (visitor(name, function)) return true; } diff --git a/test/inspector/runtime/regress-1075763-expected.txt b/test/inspector/runtime/regress-1075763-expected.txt new file mode 100644 index 0000000000..30d5a1bbef --- /dev/null +++ b/test/inspector/runtime/regress-1075763-expected.txt @@ -0,0 +1,26 @@ +Tests Runtime.evaluate returns object with undefined property. +{ + id : + result : { + result : { + className : f + description : f + objectId : + preview : { + description : f + overflow : false + properties : [ + [0] : { + name : [[GeneratorStatus]] + type : string + value : suspended + } + ] + subtype : generator + type : object + } + subtype : generator + type : object + } + } +} diff --git a/test/inspector/runtime/regress-1075763.js b/test/inspector/runtime/regress-1075763.js new file mode 100644 index 0000000000..5137ed730c --- /dev/null +++ b/test/inspector/runtime/regress-1075763.js @@ -0,0 +1,14 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let {session, contextGroup, Protocol} = InspectorTest.start( + 'Tests Runtime.evaluate returns object with undefined property.'); + +(async function test() { + InspectorTest.logMessage(await Protocol.Runtime.evaluate({ + expression: "(function* f() { yield f;})()", + generatePreview: true + })); + InspectorTest.completeTest(); +})();