Skip to content

Commit

Permalink
Revise workaroundCors setting for Emscripten 3.1.58
Browse files Browse the repository at this point in the history
  • Loading branch information
kleisauke committed Apr 27, 2024
1 parent c8a8623 commit 95310d5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 19 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
"ignore": [
"src/closure-externs/wasm-vips.js",
"src/fixed-threadpool-web.js",
"src/locatefile-cors-pre.js",
"src/modules-pre.js"
"src/modules-pre.js",
"src/workaround-cors-pre.js"
],
"env": [
"browser",
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ endif()

if ("web" IN_LIST ENVIRONMENT)
set(WEB_CORS_WORKAROUND
--pre-js=${CMAKE_CURRENT_SOURCE_DIR}/locatefile-cors-pre.js
--pre-js=${CMAKE_CURRENT_SOURCE_DIR}/workaround-cors-pre.js
)
set(WEB_FIXED_THREADPOOL
--js-library=${CMAKE_CURRENT_SOURCE_DIR}/fixed-threadpool-web.js
Expand Down
16 changes: 0 additions & 16 deletions src/locatefile-cors-pre.js

This file was deleted.

7 changes: 7 additions & 0 deletions src/workaround-cors-pre.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// https://stackoverflow.com/q/25458104
if (Module['workaroundCors']) {
Module['mainScriptUrlOrBlob'] = Module['mainScriptUrlOrBlob'] ||
URL.createObjectURL(new Blob(
[`importScripts('${_scriptName}');`],
{'type': 'application/javascript'}));
}

0 comments on commit 95310d5

Please sign in to comment.