Bug 145190

Summary: Web Inspector: Improve TypedArray view in console - show non-index properties (buffer)
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: graouts, inspector-bugzilla-changes, jonowells, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   

Description Joseph Pecoraro 2015-05-19 15:50:23 PDT
* SUMMARY
Improve TypedArray view in console - show non-index properties (buffer, byteLength, byteOffset).

* TEST
var buffer = new ArrayBuffer(12);
var dataView = new DataView(buffer);
var int8View = new Int8Array(buffer);
console.log(buffer);
console.log(dataView);
console.log(int8View); // <---

We treat the TypedArrays, like Int8Array here, as arrays.

In previews we may ignore non-index properties. But even when expanding (console.dir(int8View)) we only show the indices and don't show the buffer/byteLength/byteOffset value properties which may be useful.


* NOTES
- InjectedScriptSource.js possible changes to mark as non-lossy.

    // For arrays, only allow indexes. Mark as lossy if there are non-obvious value properties.
    if (this.subtype === "array" && !isUInt32(name)) {
        if (name !== "length" && name !== "constructor" && descriptor.isOwn && !descriptor.symbol && "value" in descriptor && typeof descriptor.value !== "function")
            preview.lossless = false;
        continue;
    }

- Would still require frontend changes for an ObjectTree for "array" subtype to also show non-index properties. Perhaps in a new section beneath the #s, but before the Prototype.
Comment 1 Radar WebKit Bug Importer 2015-05-19 15:51:19 PDT
<rdar://problem/21028103>
Comment 2 Joseph Pecoraro 2015-05-19 15:55:53 PDT
Another more basic example:

    var arr = [1, 2, 3];
    arr.myProperty = "test";
    console.dir(arr); // resulting object tree never shows the "myProperty"

Technically this is a regression. The old object trees would show this property.