Bug 145190 - Web Inspector: Improve TypedArray view in console - show non-index properties (buffer)
Summary: Web Inspector: Improve TypedArray view in console - show non-index properties...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-05-19 15:50 PDT by Joseph Pecoraro
Modified: 2016-12-13 15:40 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.