new Response(new Uint8Array([8])).arrayBuffer();
returns a Promise, which resolves to a Uint8Array.
It should resolve to an ArrayBuffer instead.
Steps to reproduce:
Load this polyfill and paste above code into the developer console.
My hacky workaround:
After loading the polyfill add the following:
const ori = window.Response.prototype.arrayBuffer;
window.Response.prototype.arrayBuffer = function (...props) {
return (ori.apply(this, props) as Promise<
ArrayBuffer | ArrayBufferView
>).then((value) => {
if (ArrayBuffer.isView(value)) {
return value.buffer.slice(
value.byteOffset,
value.byteOffset + value.byteLength
);
} else {
return value;
}
});
};
returns a Promise, which resolves to a
Uint8Array.It should resolve to an
ArrayBufferinstead.Steps to reproduce:
Load this polyfill and paste above code into the developer console.
My hacky workaround:
After loading the polyfill add the following: