.arrayBuffer()'s declaration has an unnecessary dependency on Blob support
sfuqua opened this issue · 0 comments
Certain React Native JavaScript environments natively support ArrayBuffer but not Blob, causing the polyfill's support matrix to have arraybuffer: true
but blob: false
.
Unfortunately with this config, the .arrayBuffer()
response handler is never hooked up, because that function's definition is gated on an if (support.blob)
check.
I'd like to propose decoupling these so that ArrayBuffer responses are optimistically supported by the polyfill as long as the environment supports the proper types without need for a direct Blob dependency.
Repro
In React Native for Windows 0.64, try fetch("https://example.com/").then(resp => resp.arrayBuffer())
- this will fail with "arrayBuffer is not a function".
Testing this same environment with a local patch to decouple the support.arrayBuffer
and support.blob
checks, the fetch succeeds and can be converted into an ArrayBuffer as needed. I can share the patch is desired!