Re: [w3c/FileAPI] Why are Blob() and File() constructors at Chromium 81 throwing RangeError? (#147)

An `Array` containing `Uint8Array`s is being passed to the constructor, e.g., 

```
const arr = [];
arr.push(new Uint8Array([1]), new Uint8Array([2]));
const blob =  new Blob([arr]);
const file = new File([arr], 'file');
blob.stream().getReader().read().then(({value, done}) => {
  console.assert(value.length === 3, value);
  console.log(value);
});
file.stream().getReader().read().then(({value, done}) => {
  console.assert(value.length === 3, value);
  console.log(value);
});
```

however, the `length` of the input `Uint8Array`s have `length` substantially greater than `3` total, where the values are derived from `OffscreenCanvas.convertToBlob({type:"image/webp"})`, then `Blob.arrayBuffer()` is used where the result is passed to `Uint8Array()`. Those individual `Uint8Array`s are `push()` into a plain JavaScript ``Array` which is then passed to `Blob()` and `File()` constructors, respectively, in each case including `[result<Array>]` within constructor.  Have not observed  that particular behaviour in the past when using `File` or `Blob` constructors. The result should be consistent with the result of `MediaRecorder.ondataavailable` event being fired multiple times (or any other concatenation of `Array`, `TypedArray`, `Blob` or `File`), each `event.data<Blob>` being `push()`ed to an `Array` and the array being passed to `Blob` constructor.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/FileAPI/issues/147#issuecomment-602285027

Received on Sunday, 22 March 2020 22:16:25 UTC