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

Blob in ie10 throw error: InvalidStateError #1238

Open
caijf opened this issue Apr 20, 2023 · 1 comment
Open

Blob in ie10 throw error: InvalidStateError #1238

caijf opened this issue Apr 20, 2023 · 1 comment

Comments

@caijf
Copy link

caijf commented Apr 20, 2023

What started as a problem of Uint8Array is Blob. #1014

The following is the test code, please help to answer it:

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Test</title>
</head>
<body>
  <!-- No error is reported if it is not imported -->
  <script src="https://www.unpkg.com/[email protected]/minified.js"></script>

  <script>
    var str = 'hello world';
    var n = str.length;
    var uiArr = new Uint8Array(n);
    for (var i = 0; i < n; i++) {
      uiArr[i] = str.charCodeAt(i);
    }
    console.log(uiArr);
    console.log(new Blob([uiArr])); // in ie10 throw error: InvalidStateError
  </script>
</body>
</html>
@zloirock
Copy link
Owner

zloirock commented Apr 22, 2023

Yes, this is an issue. In IE10 and some early IE11 versions, core-js is forced to completely reimplement typed arrays - and native Blob and some other features do not properly work with polyfilled typed arrays.

I'm not sure what should core-js do in this case since adding workarounds for all possible cases is problematic.

I'll think about what can be done - maybe it makes sense to add a wrapper / workaround for Blob, maybe not.

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

No branches or pull requests

2 participants