Skip to content

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

@sfuqua

Description

@sfuqua

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions