emscripten icon indicating copy to clipboard operation
emscripten copied to clipboard

-s MIN_SAFARI_VERSION=101000 and --closure 1 suddenly produces warnings

Open CodingMarkus opened this issue 9 months ago • 3 comments

When I specify the lowest Safari version allowed

-s MIN_SAFARI_VERSION=101000

and I add --closure 1, I get warnings like

WARNING - [JSC_TYPE_MISMATCH] actual parameter 2 of XMLHttpRequest.prototype.open does not match formal parameter
found   : (Request|URL|string)
required: (URL|string)
  69|       request.open(options.method || "get", url, true);
                                                  ^^^

or

/var/folders/mh/vg4fw0d57pgf9n3qwzwqts0c0000gn/T/emscripten_temp_ywbuzjuq/eqcrypt.jso1.js:81:19: WARNING - [JSC_TYPE_MISMATCH] actual parameter 1 of XMLHttpRequest.prototype.send does not match formal parameter
found   : (ArrayBuffer|ArrayBufferView|Blob|FormData|ReadableStream|URLSearchParams|null|string)
required: (ArrayBuffer|ArrayBufferView|Blob|Document|FormData|null|string|undefined)
  81|       request.send(options.body || null);
                         ^^^^^^^^^^^^^^^^^^^^

This only happens with lowest Safari version. Lowest Firefox or lowest Chrome version will not cause any such warnings to appear.

Version of emscripten/emsdk:

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.71 (4171ae200b77a6c266b0e1ebb507d61d1ade3501)
clang version 20.0.0git (https:/github.com/llvm/llvm-project d6344c1cd0d099f8d99ee320f33fc9254dbe8288)
Target: wasm32-unknown-emscripten
eThread model: posix
InstalledDir: /Library/Automount/Internal/Applications/DevTools/emsdk/upstream/bin
ee

CodingMarkus avatar Mar 30 '25 03:03 CodingMarkus

Do you know where the request.open and request.send methods are coming from?

I don't see them appearing like that anywhere in the emscripten code.

Can you share the full link command you used?

sbc100 avatar Mar 31 '25 20:03 sbc100

Oh wait, I think I see the problem. It looks like you are using an older version of emscripten prior to #23118 which included a fetch polyfill in some cases.

Can you try upgrading to 3.1.74 or above which have the polyfill removed?

sbc100 avatar Mar 31 '25 20:03 sbc100

The polyfill here is not actually needed since fetch support was added in safari 10.1: https://caniuse.com/fetch

sbc100 avatar Mar 31 '25 20:03 sbc100