[debugger] fix function in suspended generator

R=szuend@chromium.org

Fixed: chromium:1075763
Change-Id: I7f67cfb9c643d8f30bec808ccb2a9e1326ad1921
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2170030
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67450}
This commit is contained in:
Yang Guo 2020-04-28 16:24:43 +02:00 committed by Commit Bot
parent 9d1b87efd6
commit ed559eae5e
3 changed files with 43 additions and 1 deletions

View File

@ -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<JSFunction> function = frame_inspector_->GetFunction();
Handle<JSFunction> function = frame_inspector_ == nullptr
? function_
: frame_inspector_->GetFunction();
Handle<String> name = function_var->name();
if (visitor(name, function)) return true;
}

View File

@ -0,0 +1,26 @@
Tests Runtime.evaluate returns object with undefined property.
{
id : <messageId>
result : {
result : {
className : f
description : f
objectId : <objectId>
preview : {
description : f
overflow : false
properties : [
[0] : {
name : [[GeneratorStatus]]
type : string
value : suspended
}
]
subtype : generator
type : object
}
subtype : generator
type : object
}
}
}

View File

@ -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();
})();