Commit 0d5f6a49 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[inspector] Skip special __proto__ property if already present.

The inspector has some magic to add a special __proto__ property to
object value mirrors as long as the object itself has a [[Prototype]].
However it doesn't check whether the object already has a regular
property named __proto__ and thus confuses the front-end by sending two
properties with the same name.

Fixed: chromium:1193250
Change-Id: I75a1cd78ba94aeda4afedcc0f1e69b8dadb6673f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2810784
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73836}
parent e09acfda
...@@ -1321,6 +1321,7 @@ bool ValueMirror::getProperties(v8::Local<v8::Context> context, ...@@ -1321,6 +1321,7 @@ bool ValueMirror::getProperties(v8::Local<v8::Context> context,
} }
} }
if (accessorPropertiesOnly && !isAccessorProperty) continue; if (accessorPropertiesOnly && !isAccessorProperty) continue;
if (name == "__proto__") shouldSkipProto = true;
auto mirror = PropertyMirror{name, auto mirror = PropertyMirror{name,
writable, writable,
configurable, configurable,
......
...@@ -125,3 +125,6 @@ Internal properties ...@@ -125,3 +125,6 @@ Internal properties
[[ArrayBufferData]] string 0x... [[ArrayBufferData]] string 0x...
[[Int8Array]] object undefined [[Int8Array]] object undefined
[[Uint8Array]] object undefined [[Uint8Array]] object undefined
Running test: testObjectWithProtoProperty
__proto__ own object undefined
...@@ -104,6 +104,10 @@ InspectorTest.runAsyncTestSuite([ ...@@ -104,6 +104,10 @@ InspectorTest.runAsyncTestSuite([
this.Uint8Array = this.uint8array_old; this.Uint8Array = this.uint8array_old;
delete this.uint8array_old; delete this.uint8array_old;
})()`); })()`);
},
async function testObjectWithProtoProperty() {
await logExpressionProperties('Object.defineProperty({}, "__proto__", {enumerable: true, value: {b:"aaa"}})');
} }
]); ]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment