Skip to content

Commit

Permalink
webidl: implement resizable arraybuffer checks
Browse files Browse the repository at this point in the history
  • Loading branch information
KhafraDev committed Apr 25, 2023
1 parent a3efc98 commit d494ffd
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions lib/fetch/webidl.js
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,12 @@ webidl.converters.ArrayBuffer = function (V, opts = {}) {
// with the [AllowResizable] extended attribute, and
// IsResizableArrayBuffer(V) is true, then throw a
// TypeError.
// Note: resizable ArrayBuffers are currently a proposal.
if (V.resizable || V.growable) {
throw webidl.errors.exception({
header: 'ArrayBuffer',
message: 'Received a resizable ArrayBuffer.'
})
}

// 4. Return the IDL ArrayBuffer value that is a
// reference to the same object as V.
Expand Down Expand Up @@ -574,7 +579,12 @@ webidl.converters.TypedArray = function (V, T, opts = {}) {
// with the [AllowResizable] extended attribute, and
// IsResizableArrayBuffer(V.[[ViewedArrayBuffer]]) is
// true, then throw a TypeError.
// Note: resizable array buffers are currently a proposal
if (V.buffer.resizable || V.buffer.growable) {
throw webidl.errors.exception({
header: 'ArrayBuffer',
message: 'Received a resizable ArrayBuffer.'
})
}

// 5. Return the IDL value of type T that is a reference
// to the same object as V.
Expand Down Expand Up @@ -606,7 +616,12 @@ webidl.converters.DataView = function (V, opts = {}) {
// with the [AllowResizable] extended attribute, and
// IsResizableArrayBuffer(V.[[ViewedArrayBuffer]]) is
// true, then throw a TypeError.
// Note: resizable ArrayBuffers are currently a proposal
if (V.buffer.resizable || V.buffer.growable) {
throw webidl.errors.exception({
header: 'ArrayBuffer',
message: 'Received a resizable ArrayBuffer.'
})
}

// 4. Return the IDL DataView value that is a reference
// to the same object as V.
Expand Down

0 comments on commit d494ffd

Please sign in to comment.