Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gloo-worker: Console warning due to deprecated parameter for wasm_bindgen() #494

Open
robofinch opened this issue Nov 13, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@robofinch
Copy link

Describe the Bug

When spawning a web worker with gloo-worker, a warning message is printed to the console:
using deprecated parameters for the initialization function; pass a single object instead

This comes from the use of wasm_bindgen("URL") (which refers to / runs __wbg_init("URL")), a parameter format which was deprecated in wasm-bindgen v0.2.93 in favor of wasm_bindgen({module_or_path: "URL"}).

The places I found that can cause this bug are

array.push(&format!(r#"importScripts("{js_shim_url}");wasm_bindgen("{wasm_url}");"#).into());

and, in an example,

<script>
wasm_bindgen("pkg/clock_bg.wasm");
</script>

Steps to Reproduce

Conveniently, the clock example almost causes the issue, aside from using a pre-0.2.93 version of wasm-bindgen. Modify the clock example's Cargo.toml to depend on wasm-bindgen v0.2.93, and from the clock example's directory, run wasm-pack build --target no-modules --out-name clock, and serve the example's index.html in some way (e.g. python3 -m http.server). Opening the site in a browser and opening the developer console shows the deprecation warning.

Expected Behavior

No warnings should be printed to the console for correct code using gloo-worker.

Actual Behavior

Creating a web worker with gloo-worker causes a deprecation warning to be printed to the console.

Additional Context

I used gloo-worker v0.5.0, and the warning occurred on Safari, Chrome, and Firefox (presumably also on any supported browser). Note that many crates don't seem to have updated to the newer wasm_bindgen() format, so this deprecation warning might still occur in other contexts even if this issue is fixed.

@robofinch robofinch added the bug Something isn't working label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant