nwjs/nw.js

URL.createObjectURL still fails

CosmoMyzrailGorynych opened this issue · 1 comments

Issue Type

Before opening an issue, please search and see if it has already been raised.
One of the cases was fixed in:

This is a:

  • Bug Report
  • Successfully reproduced against the latest version of NW.js

Current/Missing Behavior

Calling URL.createObjectURL fails in most occurences:

  1. When nw.js is run with a flag --mixed-context
  2. When URL.createObjectURL is called in an nw-enabled webview (allownw attribute).
  3. When URL.createObjectURL is called in a first window after creating a second one.

The error is

Uncaught TypeError: Failed to execute 'createObjectURL' on 'URL': Overload resolution failed.

Minimal code that reproduces that:

URL.createObjectURL(new Blob([]))

Expected/Proposed Behavior

Calling URL.createObjectURL should work

Additional Info

  • Operating System: Confirmed to affect Windows 10 and 11, Linux (SteamOS and others).
  • NW.js Version: 0.87.0

I found a temporary solution:

<!-- Fix Blob Start -->
<script>delete window.Blob;</script>
<script src="https://cdn.jsdelivr.net/npm/blob-polyfill@9.0.20240710/Blob.min.js"></script>
<!-- Fix Blob End -->

<script>
    const objectURL = URL.createObjectURL(new Blob(["test"]));
    console.log(objectURL); // 'data:;base64,dGVzdA=='
</script>

But it is still a problem, I hope it can be solved reasonably.