Skip to content

Blob in ie10 throw error: InvalidStateError #1238

Open
@caijf

Description

@caijf

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/core-js-bundle@3.30.1/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>

Activity

zloirock

zloirock commented on Apr 22, 2023

@zloirock
Owner

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Blob in ie10 throw error: InvalidStateError · Issue #1238 · zloirock/core-js