emscripten-core / emscripten-core/emsdk

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

Open
#1,398 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3.7k
Forks
821
Avg merge
1h 25m
Merged PRs (30d)
3

Description

I use pthread support of emcc. Compiler generated *.worker.js as WebWorker routine. In *.worker.js, `createObjectURL` was called with its old usage. However, old usage has been removed from browser engine.
![截屏2024-06-07 23 18 57](https://github.com/emscripten-core/emsdk/assets/71890059/f016f781-2163-4d28-bf03-30bd92171552)
Old usage:
```
URL.createObjectURL(blob);
```
New usage:
```
URL.createObjectURL(new Blob([blob],{type: 'application/zip'})); // value of "type" should be MIME type.
```

Compile command:
```
em++ main.cpp -O3 -s WASM=1 -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=2 -o $(WASM_JS)
```

main.cpp:
```
#include
#include
#include

void* EMSCRIPTEN_KEEPALIVE routine(void* param){
printf("Routine\n");
return NULL;
}

int main(int argc, char **argv)
{
printf("Hello WASM\n");
pthread_t pthread;
pthread_create(&pthread, NULL, routine, NULL);
pthread_join(pthread, NULL);
}
```
Error in chrome console:
![截屏2024-06-07 23 17 37](https://github.com/emscripten-core/emsdk/assets/71890059/6f74e2ef-ccc6-4080-9c3d-894efafeb4f2)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.