summaryrefslogtreecommitdiff
path: root/ext/web/10_filereader.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/web/10_filereader.js
parentad8d0c90d1887beb8a5f2c6d30f9dc71cc63e4fe (diff)
chore: Turn back on dlintPreferPrimordials (#17715)
Closes #17709
Diffstat (limited to 'ext/web/10_filereader.js')
-rw-r--r--ext/web/10_filereader.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/ext/web/10_filereader.js b/ext/web/10_filereader.js
index 5dd2d5c3a..524a3fe51 100644
--- a/ext/web/10_filereader.js
+++ b/ext/web/10_filereader.js
@@ -27,14 +27,15 @@ const {
MapPrototypeGet,
MapPrototypeSet,
ObjectDefineProperty,
- ObjectPrototypeIsPrototypeOf,
queueMicrotask,
SafeArrayIterator,
Symbol,
TypedArrayPrototypeSet,
+ TypedArrayPrototypeGetBuffer,
+ TypedArrayPrototypeGetByteLength,
+ TypedArrayPrototypeGetSymbolToStringTag,
TypeError,
Uint8Array,
- Uint8ArrayPrototype,
} = primordials;
const state = Symbol("[[state]]");
@@ -119,7 +120,8 @@ class FileReader extends EventTarget {
// and whose value property is a Uint8Array object, run these steps:
if (
!chunk.done &&
- ObjectPrototypeIsPrototypeOf(Uint8ArrayPrototype, chunk.value)
+ TypedArrayPrototypeGetSymbolToStringTag(chunk.value) ===
+ "Uint8Array"
) {
ArrayPrototypePush(chunks, chunk.value);
@@ -127,7 +129,7 @@ class FileReader extends EventTarget {
{
const size = ArrayPrototypeReduce(
chunks,
- (p, i) => p + i.byteLength,
+ (p, i) => p + TypedArrayPrototypeGetByteLength(i),
0,
);
const ev = new ProgressEvent("progress", {
@@ -151,7 +153,7 @@ class FileReader extends EventTarget {
// 2. Let result be the result of package data given bytes, type, blob's type, and encodingName.
const size = ArrayPrototypeReduce(
chunks,
- (p, i) => p + i.byteLength,
+ (p, i) => p + TypedArrayPrototypeGetByteLength(i),
0,
);
const bytes = new Uint8Array(size);
@@ -159,11 +161,11 @@ class FileReader extends EventTarget {
for (let i = 0; i < chunks.length; ++i) {
const chunk = chunks[i];
TypedArrayPrototypeSet(bytes, chunk, offs);
- offs += chunk.byteLength;
+ offs += TypedArrayPrototypeGetByteLength(chunk);
}
switch (readtype.kind) {
case "ArrayBuffer": {
- this[result] = bytes.buffer;
+ this[result] = TypedArrayPrototypeGetBuffer(bytes);
break;
}
case "BinaryString":