Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.arrayBuffer()'s declaration has an unnecessary dependency on Blob support #992

Closed
sfuqua opened this issue Jul 13, 2021 · 1 comment · Fixed by #1359
Closed

.arrayBuffer()'s declaration has an unnecessary dependency on Blob support #992

sfuqua opened this issue Jul 13, 2021 · 1 comment · Fixed by #1359

Comments

@sfuqua
Copy link

sfuqua commented Jul 13, 2021

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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@sfuqua and others