summaryrefslogtreecommitdiff
path: root/ext/webidl/00_webidl.js
diff options
context:
space:
mode:
authorKenta Moriuchi <moriken@kimamass.com>2023-04-03 02:41:41 +0900
committerGitHub <noreply@github.com>2023-04-02 19:41:41 +0200
commit03edd48edd004cec091541e6b71095cfbc4b4c87 (patch)
tree72aed1dae803334b73479ffebc7ca8c83d10addf /ext/webidl/00_webidl.js
parentad8d0c90d1887beb8a5f2c6d30f9dc71cc63e4fe (diff)
chore: Turn back on dlintPreferPrimordials (#17715)
Closes #17709
Diffstat (limited to 'ext/webidl/00_webidl.js')
-rw-r--r--ext/webidl/00_webidl.js26
1 files changed, 21 insertions, 5 deletions
diff --git a/ext/webidl/00_webidl.js b/ext/webidl/00_webidl.js
index 124c81c73..43c0cb621 100644
--- a/ext/webidl/00_webidl.js
+++ b/ext/webidl/00_webidl.js
@@ -18,6 +18,7 @@ const {
BigInt,
BigIntAsIntN,
BigIntAsUintN,
+ DataViewPrototypeGetBuffer,
Float32Array,
Float64Array,
FunctionPrototypeBind,
@@ -76,6 +77,7 @@ const {
Symbol,
SymbolIterator,
SymbolToStringTag,
+ TypedArrayPrototypeGetBuffer,
TypedArrayPrototypeGetSymbolToStringTag,
TypeError,
Uint16Array,
@@ -476,7 +478,7 @@ converters.DataView = (V, opts = {}) => {
throw makeException(TypeError, "is not a DataView", opts);
}
- if (!opts.allowShared && isSharedArrayBuffer(V.buffer)) {
+ if (!opts.allowShared && isSharedArrayBuffer(DataViewPrototypeGetBuffer(V))) {
throw makeException(
TypeError,
"is backed by a SharedArrayBuffer, which is not allowed",
@@ -512,7 +514,10 @@ ArrayPrototypeForEach(
opts,
);
}
- if (!opts.allowShared && isSharedArrayBuffer(V.buffer)) {
+ if (
+ !opts.allowShared &&
+ isSharedArrayBuffer(TypedArrayPrototypeGetBuffer(V))
+ ) {
throw makeException(
TypeError,
"is a view on a SharedArrayBuffer, which is not allowed",
@@ -535,8 +540,13 @@ converters.ArrayBufferView = (V, opts = {}) => {
opts,
);
}
-
- if (!opts.allowShared && isSharedArrayBuffer(V.buffer)) {
+ let buffer;
+ if (TypedArrayPrototypeGetSymbolToStringTag(V) !== undefined) {
+ buffer = TypedArrayPrototypeGetBuffer(V);
+ } else {
+ buffer = DataViewPrototypeGetBuffer(V);
+ }
+ if (!opts.allowShared && isSharedArrayBuffer(buffer)) {
throw makeException(
TypeError,
"is a view on a SharedArrayBuffer, which is not allowed",
@@ -549,7 +559,13 @@ converters.ArrayBufferView = (V, opts = {}) => {
converters.BufferSource = (V, opts = {}) => {
if (ArrayBufferIsView(V)) {
- if (!opts.allowShared && isSharedArrayBuffer(V.buffer)) {
+ let buffer;
+ if (TypedArrayPrototypeGetSymbolToStringTag(V) !== undefined) {
+ buffer = TypedArrayPrototypeGetBuffer(V);
+ } else {
+ buffer = DataViewPrototypeGetBuffer(V);
+ }
+ if (!opts.allowShared && isSharedArrayBuffer(buffer)) {
throw makeException(
TypeError,
"is a view on a SharedArrayBuffer, which is not allowed",