From 2469903567510a939211df3e5953e5d2fe2102e4 Mon Sep 17 00:00:00 2001 From: RunDevelopment Date: Sun, 13 Oct 2024 12:22:37 +0200 Subject: [PATCH 1/4] Fixed 2 minor bugs in JS glue code --- crates/cli-support/src/js/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 1055cf43905..f32c698f71b 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1958,7 +1958,6 @@ __wbg_set_wasm(wasm);" if (!(instance instanceof klass)) { throw new Error(`expected instance of ${klass.name}`); } - return instance.ptr; } ", ); @@ -3997,7 +3996,7 @@ __wbg_set_wasm(wasm);" // Test for built-in const builtInMatches = /\\[object ([^\\]]+)\\]/.exec(toString.call(val)); let className; - if (builtInMatches.length > 1) { + if (builtInMatches && builtInMatches.length > 1) { className = builtInMatches[1]; } else { // Failed to match the standard '[object ClassName]' From a0b268030d93a18f13549b13ff60d69322eda271 Mon Sep 17 00:00:00 2001 From: RunDevelopment Date: Sun, 13 Oct 2024 13:17:10 +0200 Subject: [PATCH 2/4] Update ref --- crates/cli/tests/reference/web-sys.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cli/tests/reference/web-sys.js b/crates/cli/tests/reference/web-sys.js index 12bc6777d2e..b513b8cd6a1 100644 --- a/crates/cli/tests/reference/web-sys.js +++ b/crates/cli/tests/reference/web-sys.js @@ -51,7 +51,7 @@ function debugString(val) { // Test for built-in const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); let className; - if (builtInMatches.length > 1) { + if (builtInMatches && builtInMatches.length > 1) { className = builtInMatches[1]; } else { // Failed to match the standard '[object ClassName]' From d278595eae25268603fe6a334ed8fadadee5d069 Mon Sep 17 00:00:00 2001 From: RunDevelopment Date: Sun, 13 Oct 2024 22:48:11 +0200 Subject: [PATCH 3/4] Updated changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d066a6eddde..d70241ea208 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,9 @@ * Fixed `#[should_panic]` not working with `#[wasm_bindgen_test(unsupported = ...)]`. [#4196](https://github.com/rustwasm/wasm-bindgen/pull/4196) +* Fixed a minor bug with regexes when printing debug information. + [#4192](https://github.com/rustwasm/wasm-bindgen/pull/4192) + -------------------------------------------------------------------------------- ## [0.2.95](https://github.com/rustwasm/wasm-bindgen/compare/0.2.94...0.2.95) From 823afddffe26a2dabe7b4a8d8d60c3c68fca3558 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 14 Oct 2024 09:43:30 +0200 Subject: [PATCH 4/4] Adjust changelog entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d70241ea208..2593781fb3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,7 @@ * Fixed `#[should_panic]` not working with `#[wasm_bindgen_test(unsupported = ...)]`. [#4196](https://github.com/rustwasm/wasm-bindgen/pull/4196) -* Fixed a minor bug with regexes when printing debug information. +* Fixed potential `null` error when using `JsValue::as_debug_string()`. [#4192](https://github.com/rustwasm/wasm-bindgen/pull/4192) --------------------------------------------------------------------------------