[inspector] An Error with no stack description should not be empty

Make the description return the class name as it used to be.

BUG=chromium:919292

Change-Id: Idbc07643f15014a39a08a545a5003be891d95bd3
Reviewed-on: https://chromium-review.googlesource.com/c/1416318
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Commit-Queue: Alexei Filippov <alph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58867}
This commit is contained in:
Alexei Filippov 2019-01-16 14:46:52 -08:00 committed by Commit Bot
parent ba363c755b
commit defbef78d2
3 changed files with 18 additions and 1 deletions

View File

@ -205,7 +205,7 @@ String16 descriptionForError(v8::Local<v8::Context> context,
if (!object->Get(context, toV8String(isolate, "stack"))
.ToLocal(&stackValue) ||
!stackValue->IsString()) {
return String16();
return className;
}
String16 stack = toProtocolString(isolate, stackValue.As<v8::String>());
String16 description = stack;

View File

@ -1424,6 +1424,18 @@ Running test: testError
}
}
Running test: testCustomError
'class CustomError extends Error {}; a = new CustomError(); delete a.stack; a', returnByValue: false, generatePreview: false
{
result : {
className : CustomError
description : CustomError
objectId : <objectId>
subtype : error
type : object
}
}
Running test: testProxy
'new Proxy({}, {})', returnByValue: false, generatePreview: false
{

View File

@ -414,6 +414,11 @@ InspectorTest.runAsyncTestSuite([
returnByValue: true
})).result);
},
async function testCustomError() {
InspectorTest.logMessage((await evaluate({
expression: `class CustomError extends Error {}; a = new CustomError(); delete a.stack; a`
})).result);
},
async function testProxy() {
InspectorTest.logMessage((await evaluate({
expression: 'new Proxy({}, {})'