Skip to content

Commit 5ee831f

Browse files
committed
fixup! lib: short-circuit WebIDL BufferSource SAB check
1 parent 1980442 commit 5ee831f

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/internal/webidl.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ const {
2323
SymbolIterator,
2424
TypeError,
2525
TypedArrayPrototypeGetBuffer,
26-
TypedArrayPrototypeGetSymbolToStringTag,
2726
} = primordials;
2827

2928
const {
@@ -36,6 +35,7 @@ const { kEmptyObject } = require('internal/util');
3635
const {
3736
isArrayBuffer,
3837
isSharedArrayBuffer,
38+
isTypedArray,
3939
} = require('internal/util/types');
4040

4141
const converters = { __proto__: null };
@@ -392,12 +392,8 @@ function createInterfaceConverter(name, I) {
392392
}
393393

394394
// Returns the [[ViewedArrayBuffer]] of an ArrayBufferView without leaving JS.
395-
// `TypedArrayPrototypeGetSymbolToStringTag` returns the concrete TypedArray
396-
// name (e.g. 'Uint8Array') for any %TypedArray% instance, and `undefined`
397-
// for a DataView, so it doubles as a branch-free dispatch between the two
398-
// getters.
399395
function getViewedArrayBuffer(V) {
400-
return TypedArrayPrototypeGetSymbolToStringTag(V) !== undefined ?
396+
return isTypedArray(V) ?
401397
TypedArrayPrototypeGetBuffer(V) : DataViewPrototypeGetBuffer(V);
402398
}
403399

0 commit comments

Comments
 (0)