Commit 76784275 authored by Yang Guo's avatar Yang Guo Committed by Commit Bot

Fix inspector preview for detached JSTypedArray

R=petermarshall@chromium.org

Bug: chromium:952455
Change-Id: Ib08a20e1d1fac7ef943f15ff524ee4e7c1c15507
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1662290
Commit-Queue: Yang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62261}
parent 83da1c2d
......@@ -148,9 +148,13 @@ void DebugPropertyIterator::FillKeysForCurrentPrototypeAndStage() {
bool has_exotic_indices = receiver->IsJSTypedArray();
if (stage_ == kExoticIndices) {
if (!has_exotic_indices) return;
// TODO(bmeurer, v8:4153): Change this to size_t later.
exotic_length_ =
static_cast<uint32_t>(Handle<JSTypedArray>::cast(receiver)->length());
Handle<JSTypedArray> typed_array = Handle<JSTypedArray>::cast(receiver);
if (typed_array->WasDetached()) {
exotic_length_ = 0;
} else {
// TODO(bmeurer, v8:4153): Change this to size_t later.
exotic_length_ = static_cast<uint32_t>(typed_array->length());
}
return;
}
bool skip_indices = has_exotic_indices;
......
......@@ -103,6 +103,16 @@ Running test: testArrayBuffer
1 own number 16843009
__proto__ own object undefined
Running test: testDetachedArrayBuffer
[[Int8Array]]
__proto__ own object undefined
[[Uint8Array]]
__proto__ own object undefined
[[Int16Array]]
__proto__ own object undefined
[[Int32Array]]
__proto__ own object undefined
Running test: testArrayBufferWithBrokenUintCtor
[[Int8Array]] own object undefined
[[Uint8Array]] own object undefined
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Flags: --harmony-private-fields
// Flags: --harmony-private-fields --allow-natives-syntax
let {session, contextGroup, Protocol} = InspectorTest.start('Checks Runtime.getProperties method');
......@@ -52,6 +52,21 @@ InspectorTest.runAsyncTestSuite([
}
},
async function testDetachedArrayBuffer() {
await Protocol.Runtime.evaluate({ expression: 'var a = new ArrayBuffer(16)' });
await Protocol.Runtime.evaluate({ expression: 'var b = new Uint32Array(a)' });
let objectId = await evaluateToObjectId('a');
await Protocol.Runtime.evaluate({ expression: '%ArrayBufferDetach(a)' });
await Protocol.Runtime.evaluate({ expression: 'b', generatePreview: true })
let props = await Protocol.Runtime.getProperties({ objectId, ownProperties: true });
for (let prop of props.result.result) {
if (prop.name === '__proto__')
continue;
InspectorTest.log(prop.name);
await logGetPropertiesResult(prop.value.objectId);
}
},
async function testArrayBufferWithBrokenUintCtor() {
await evaluateToObjectId(`(function() {
this.uint8array_old = this.Uint8Array;
......
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