emscripten-core / emscripten-core/emscripten

CSP error is thrown for the binaryFile type Data URI

Open
#20,449 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

**Version of emscripten/emsdk:**
3.1.35

In the file preamble.js for the binary file for the type **data uri**, in the function [instantiateAsync](https://github.com/emscripten-core/emscripten/blob/5b24a09de582f3943d75aa6af9be36ba719c08c0/src/preamble.js#L848C10-L848C26), it calls the function [instantiateArrayBuffer](https://github.com/emscripten-core/emscripten/blob/5b24a09de582f3943d75aa6af9be36ba719c08c0/src/preamble.js#L916C10-L916C32), which in turn calls [getBinaryPromise](https://github.com/emscripten-core/emscripten/blob/5b24a09de582f3943d75aa6af9be36ba719c08c0/src/preamble.js#L805C10-L805C26). This function makes the fetch request [here](https://github.com/emscripten-core/emscripten/blob/5b24a09de582f3943d75aa6af9be36ba719c08c0/src/preamble.js#L672) even though the binaryFile is of type data uri, which defeats the purpose we did [here](https://github.com/emscripten-core/emscripten/blob/5b24a09de582f3943d75aa6af9be36ba719c08c0/src/preamble.js#L852).
This fetch request throws CSP connect-src error in the console and this fetch request is unnecessary for a binary file of type data uri, and hence needs to be addressed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.