Repository navigation
Normative: make DataView.prototype.{byteLength,byteOffset} not throw when backed by detached buffer - #3972
Normative: make DataView.prototype.{byteLength,byteOffset} not throw when backed by detached buffer#3972bakkot wants to merge 1 commit into
Conversation
…when backed by detached buffer
|
The rendered spec preview for this PR is available as a single page at https://tc39.es/ecma262/pr/3972 and as multiple pages at https://tc39.es/ecma262/pr/3972/multipage . |
|
Tests are in tc39/test262#5137. These cover the cases of a detached buffer, and of a resizable buffer that is shrunk such that the view becomes out of bounds. |
linusg
left a comment
There was a problem hiding this comment.
I think this deserves a mention in Annex F.
|
This got consensus at the October plenary. |
Does it? It's only turning an error case into a non-error. |
That's the usual guideline for what committee considers web compatible, it still is an incompatibility with a prior edition of ES. Falls under the same category as these:
|
Fixes #2635. This makes these getters on DataViews behave like the corresponding getters on TypedArrays.
Note that these getters will still throw when
.call'd on incompatible receivers; this is just about what happens when a real DataView's.byteLengthor.byteOffsetis invoked after the buffer backing said view has been detached or become out of bounds.This came up in the context of Web IDL, which has badly needed to rationalize its TypedArray handling for a long time; @MattiasBuelens has been working on that in whatwg/webidl#1529 but encountered this inconsistency, which was surprising and also complicates that side of things (since webIDL normally treats DataViews and TypedArrays very similarly).