Closed thatsmydoing closed 1 year ago
Reproduction case:
<html> <body> <script src="https://cdn.jsdelivr.net/npm/core-js-bundle@3.32.1/index.js"></script> <script> img = new Image(); img.onload = () => { createImageBitmap(img).then(bmp => structuredClone(bmp)); }; img.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8zwQAAgYBAyKDV6YAAAAASUVORK5CYII="; </script> </body> </html>
Throws DOMException: Cloning of ImageBitmap cannot be properly polyfilled in this engine but doesn't on 3.32.0. I've tested on FF 117 and Safari 16.6.
DOMException: Cloning of ImageBitmap cannot be properly polyfilled in this engine
It seems that changing != 7 to !== 7 in https://github.com/zloirock/core-js/blob/26c6592dc28c70a5067ad87dca080fabdcd8268a/packages/core-js/modules/web.structured-clone.js#L65 causes the bug since structuredClone(Object(7)) == 7 but not ===. This disables the fallback to native structuredClone and prevents it from working when it should.
!= 7
!== 7
structuredClone(Object(7)) == 7
===
structuredClone
Oops, thanks.
Reproduction case:
Throws
DOMException: Cloning of ImageBitmap cannot be properly polyfilled in this engine
but doesn't on 3.32.0. I've tested on FF 117 and Safari 16.6.It seems that changing
!= 7
to!== 7
in https://github.com/zloirock/core-js/blob/26c6592dc28c70a5067ad87dca080fabdcd8268a/packages/core-js/modules/web.structured-clone.js#L65 causes the bug sincestructuredClone(Object(7)) == 7
but not===
. This disables the fallback to nativestructuredClone
and prevents it from working when it should.