Bug 1842773 - Part 11: Make DataView byteOffset and byteLength accessors aware of...
commitf727e627a233051e7e10ac2607bdd4f880c37207
authorAndré Bargull <andre.bargull@gmail.com>
Fri, 26 Jan 2024 08:17:37 +0000 (26 08:17 +0000)
committerAndré Bargull <andre.bargull@gmail.com>
Fri, 26 Jan 2024 08:17:37 +0000 (26 08:17 +0000)
tree1dbd4e91a4a583418c4e79d045911ef85b57e834
parent87e0442bc9a768ee2b3b91836b2cc69361dc4a98
Bug 1842773 - Part 11: Make DataView byteOffset and byteLength accessors aware of resizable buffers. r=sfink

DataViews which are baked by a resizable ArrayBuffer can get out-of-bounds when
the ArrayBuffer is shrunk. It can later get again in-bounds when the ArrayBuffer
is grown. That means it's no longer possible to directly read the byte-length
and byte-offset from the reserved slots. Instead all accesses need to validate
the ArrayBufferView is still in-bounds. `mozilla::Maybe` is used to to represent
in-bound and out-of-bounds results.

Differential Revision: https://phabricator.services.mozilla.com/D183327
js/public/friend/ErrorNumbers.msg
js/src/builtin/DataViewObject.cpp
js/src/builtin/DataViewObject.h
js/src/vm/ArrayBufferViewObject.cpp
js/src/vm/ArrayBufferViewObject.h
js/src/vm/SelfHosting.cpp
js/src/vm/StructuredClone.cpp
js/src/vm/TypedArrayObject.cpp
js/src/vm/TypedArrayObject.h