diff --git a/CHANGELOG.md b/CHANGELOG.md index b6c36b45dde..4094197a859 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- +## Unreleased + +### Fixed + +* Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. + [#3873](https://github.com/rustwasm/wasm-bindgen/pull/3873) + ## [0.2.92](https://github.com/rustwasm/wasm-bindgen/compare/0.2.91...0.2.92) Released 2024-03-04 @@ -249,7 +256,7 @@ Released 2023-11-01 It was also automatically changed for `IdbFileHandle`, which is deprecated. [#3537](https://github.com/rustwasm/wasm-bindgen/pull/3537) -* Changed behavior when compiling to `wasm32-wasi` to match `wasm32-emscripten` and +* Changed behavior when compiling to `wasm32-wasi` to match `wasm32-emscripten` and non-WASM targets, generating a stub that panics when called rather than a wasm- bindgen placeholder. [#3233](https://github.com/rustwasm/wasm-bindgen/pull/3233) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 35bba115fdc..738035e69f8 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1768,25 +1768,6 @@ impl<'a> Context<'a> { self.memview("Float64", memory) } - fn memview_function(&mut self, t: VectorKind, memory: MemoryId) -> MemView { - match t { - VectorKind::String => self.expose_uint8_memory(memory), - VectorKind::I8 => self.expose_int8_memory(memory), - VectorKind::U8 => self.expose_uint8_memory(memory), - VectorKind::ClampedU8 => self.expose_clamped_uint8_memory(memory), - VectorKind::I16 => self.expose_int16_memory(memory), - VectorKind::U16 => self.expose_uint16_memory(memory), - VectorKind::I32 => self.expose_int32_memory(memory), - VectorKind::U32 => self.expose_uint32_memory(memory), - VectorKind::I64 => self.expose_int64_memory(memory), - VectorKind::U64 => self.expose_uint64_memory(memory), - VectorKind::F32 => self.expose_f32_memory(memory), - VectorKind::F64 => self.expose_f64_memory(memory), - VectorKind::Externref => self.expose_uint32_memory(memory), - VectorKind::NamedExternref(_) => self.expose_uint32_memory(memory), - } - } - fn memview(&mut self, kind: &'static str, memory: walrus::MemoryId) -> MemView { let view = self.memview_memory(kind, memory); if !self.should_write_global(view.name.clone()) { diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs index 08d9b7fc85c..c001344c602 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs @@ -121,8 +121,20 @@ pub fn run(server: &SocketAddr, shell: &Shell, timeout: u64) -> Result<(), Error // Visit our local server to open up the page that runs tests, and then get // some handles to objects on the page which we'll be scraping output from. - let url = - std::env::var("WASM_BINDGEN_TEST_ADDRESS").unwrap_or_else(|_| format!("http://{}", server)); + // + // If WASM_BINDGEN_TEST_ADDRESS is set, use it as the local server URL, + // trying to inherit the port from the server if it isn't specified. + let url = match std::env::var("WASM_BINDGEN_TEST_ADDRESS") { + Ok(u) => { + let mut url = Url::parse(&u)?; + if url.port().is_none() { + url.set_port(Some(server.port())).unwrap(); + } + url.to_string() + } + Err(_) => format!("http://{}", server), + }; + shell.status(&format!("Visiting {}...", url)); client.goto(&id, &url)?; shell.status("Loading page elements..."); diff --git a/crates/cli/src/bin/wasm-bindgen.rs b/crates/cli/src/bin/wasm-bindgen.rs index 78d9e1bd6be..b62449392c9 100644 --- a/crates/cli/src/bin/wasm-bindgen.rs +++ b/crates/cli/src/bin/wasm-bindgen.rs @@ -63,6 +63,7 @@ struct Args { flag_no_modules_global: Option, flag_remove_name_section: bool, flag_remove_producers_section: bool, + #[allow(dead_code)] flag_weak_refs: Option, flag_reference_types: Option, flag_keep_lld_exports: bool,