46d815e737
This CL adds support for ArrayBuffer and SharedArrayBuffer subtypes for injected script source. It also adds the byteLength/size to the description of these objects and for the upcoming "blob" subtype when appropriate. This is dependent on a DevTools frontend patch to accept these new subtypes: https://chromium-review.googlesource.com/c/582427/ Bug: chromium:653620 Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel Change-Id: If8f612b54e82e6fd2f056545bd521868ba7349fd Reviewed-on: https://chromium-review.googlesource.com/582233 Commit-Queue: Erik Luo <luoe@chromium.org> Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org> Cr-Commit-Position: refs/heads/master@{#46851}
37 lines
1.5 KiB
JavaScript
37 lines
1.5 KiB
JavaScript
// Copyright 2016 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.
|
|
|
|
// Flags: --harmony-sharedarraybuffer
|
|
|
|
let {session, contextGroup, Protocol} = InspectorTest.start("Test that descriptions for arrays, maps, and sets include the correct length or size.");
|
|
|
|
contextGroup.setupInjectedScriptEnvironment();
|
|
|
|
Promise.all([
|
|
testExpression("new Set()"),
|
|
testExpression("new Set([1,2])"),
|
|
testExpression("new Map()"),
|
|
testExpression("new Map([[1,2],[3,4]])"),
|
|
testExpression("new Array()"),
|
|
testExpression("new Array(2)"),
|
|
testExpression("new Uint8Array()"),
|
|
testExpression("new Uint8Array(2)"),
|
|
testExpression("new ArrayBuffer()"),
|
|
testExpression("new ArrayBuffer(2)"),
|
|
testExpression("new SharedArrayBuffer()"),
|
|
testExpression("new SharedArrayBuffer(2)"),
|
|
testExpression("new DataView(new ArrayBuffer())"),
|
|
testExpression("new DataView(new ArrayBuffer(5))"),
|
|
// WeakMap and WeakSet should not have size in description.
|
|
testExpression("new WeakMap([[{}, 42]])"),
|
|
testExpression("new WeakSet([{}])")
|
|
]).then(() => InspectorTest.completeTest());
|
|
|
|
function testExpression(expression) {
|
|
return Protocol.Runtime.evaluate({ expression: expression })
|
|
.then(result => InspectorTest.logMessage(result.result.result.description))
|
|
.then(() => Protocol.Runtime.evaluate({ expression: "[" + expression + "]", generatePreview: true }))
|
|
.then(result => InspectorTest.logMessage(result.result.result.preview.properties[0].value))
|
|
}
|