Reland "[inspector] Consistently format all native accessors as own properties."

This is a reland of ce8cef36aa

Original change's description:
> [inspector] Consistently format all native accessors as own properties.
>
> Previously the V8 inspector would only turn embedder accessors on the
> prototype chain into data properties, but would not do the same for
> ECMAScript builtins, which is kind of inconsistent and weird behavior.
>
> This leaves in the hack that the inspector reports native accessor
> properties as (own) data properties, but now at least the very least
> does so consistently. In the absence of a better solution, we'll go
> with this for now.
>
> Bug: chromium:1076820, chromium:1199247
> Change-Id: I593f909a46cb714dbec629a2944eeb892881ba6f
> Before: https://imgur.com/kPuSldj.png
> After: https://imgur.com/eFau45m.png
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3067319
> Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
> Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#76059}

Bug: chromium:1076820, chromium:1199247
Change-Id: I11987194b0d0b8b250eda4f8ce0ae5fc743eb27c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3070701
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76084}
This commit is contained in:
Benedikt Meurer 2021-08-03 09:57:44 +02:00 committed by V8 LUCI CQ
parent d2fd132bcb
commit fb86158a3b
4 changed files with 145 additions and 4 deletions

View File

@ -1201,8 +1201,6 @@ bool ValueMirror::getProperties(v8::Local<v8::Context> context,
}
}
bool formatAccessorsAsProperties =
clientFor(context)->formatAccessorsAsProperties(object);
auto iterator = v8::debug::PropertyIterator::Create(context, object);
if (!iterator) {
CHECK(tryCatch.HasCaught());
@ -1282,8 +1280,7 @@ bool ValueMirror::getProperties(v8::Local<v8::Context> context,
setterMirror = ValueMirror::create(context, descriptor.set);
}
isAccessorProperty = getterMirror || setterMirror;
if (formatAccessorsAsProperties && name != "__proto__" &&
!getterFunction.IsEmpty() &&
if (name != "__proto__" && !getterFunction.IsEmpty() &&
getterFunction->ScriptId() == v8::UnboundScript::kNoScriptId) {
v8::TryCatch tryCatch(isolate);
v8::Local<v8::Value> value;

View File

@ -74,6 +74,11 @@ expression: (function* foo() { yield 1 })()
Running test: entriesInMapAndSet
expression: new Map([[1,2]])
{
name : size
type : number
value : 1
}
[[Entries]]:
[
[0] : {
@ -95,6 +100,11 @@ expression: new Map([[1,2]])
]
expression: new Set([1])
{
name : size
type : number
value : 1
}
[[Entries]]:
[
[0] : {

View File

@ -121,6 +121,27 @@ Running test: testShortTypedArrayPropertiesPreview
type : number
value : 0
}
[3] : {
name : buffer
subtype : arraybuffer
type : object
value : ArrayBuffer(3)
}
[4] : {
name : byteLength
type : number
value : 3
}
[5] : {
name : byteOffset
type : number
value : 0
}
[6] : {
name : length
type : number
value : 3
}
]
subtype : typedarray
type : object
@ -670,6 +691,11 @@ Running test: testSetPropertiesPreview
]
overflow : false
properties : [
[0] : {
name : size
type : number
value : 3
}
]
subtype : set
type : object
@ -727,6 +753,11 @@ Running test: testBigSetPropertiesPreview
]
overflow : true
properties : [
[0] : {
name : size
type : number
value : 10
}
]
subtype : set
type : object

View File

@ -623,6 +623,11 @@ Running test: testMap
description : Map(0)
overflow : false
properties : [
[0] : {
name : size
type : number
value : 0
}
]
subtype : map
type : object
@ -659,6 +664,11 @@ Running test: testMap
]
overflow : false
properties : [
[0] : {
name : size
type : number
value : 1
}
]
subtype : map
type : object
@ -681,6 +691,11 @@ Running test: testMap
description : Map(1)
overflow : true
properties : [
[0] : {
name : size
type : number
value : 1
}
]
subtype : map
type : object
@ -689,6 +704,11 @@ Running test: testMap
description : Map(1)
overflow : true
properties : [
[0] : {
name : size
type : number
value : 1
}
]
subtype : map
type : object
@ -697,6 +717,11 @@ Running test: testMap
]
overflow : false
properties : [
[0] : {
name : size
type : number
value : 1
}
]
subtype : map
type : object
@ -777,6 +802,11 @@ Running test: testMap
type : number
value : 42
}
[1] : {
name : size
type : number
value : 1
}
]
subtype : map
type : object
@ -966,6 +996,11 @@ Running test: testSet
]
overflow : false
properties : [
[0] : {
name : size
type : number
value : 1
}
]
subtype : set
type : object
@ -1039,6 +1074,11 @@ Running test: testSet
]
overflow : true
properties : [
[0] : {
name : size
type : number
value : 7
}
]
subtype : set
type : object
@ -1728,6 +1768,27 @@ Running test: testTypedArray
type : number
value : 2
}
[3] : {
name : buffer
subtype : arraybuffer
type : object
value : ArrayBuffer(2)
}
[4] : {
name : byteLength
type : number
value : 2
}
[5] : {
name : byteOffset
type : number
value : 0
}
[6] : {
name : length
type : number
value : 2
}
]
subtype : typedarray
type : object
@ -2266,6 +2327,11 @@ Running test: testArrayBuffer
description : ArrayBuffer(0)
overflow : false
properties : [
[0] : {
name : byteLength
type : number
value : 0
}
]
subtype : arraybuffer
type : object
@ -2284,6 +2350,11 @@ Running test: testArrayBuffer
description : ArrayBuffer(400)
overflow : false
properties : [
[0] : {
name : byteLength
type : number
value : 400
}
]
subtype : arraybuffer
type : object
@ -2304,6 +2375,22 @@ Running test: testDataView
description : DataView(16)
overflow : false
properties : [
[0] : {
name : buffer
subtype : arraybuffer
type : object
value : ArrayBuffer(16)
}
[1] : {
name : byteLength
type : number
value : 16
}
[2] : {
name : byteOffset
type : number
value : 0
}
]
subtype : dataview
type : object
@ -2322,6 +2409,22 @@ Running test: testDataView
description : DataView(4)
overflow : false
properties : [
[0] : {
name : buffer
subtype : arraybuffer
type : object
value : ArrayBuffer(16)
}
[1] : {
name : byteLength
type : number
value : 4
}
[2] : {
name : byteOffset
type : number
value : 12
}
]
subtype : dataview
type : object