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

Fixed 2 minor bugs in JS glue code #4192

Merged
merged 4 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
* Fixed `#[should_panic]` not working with `#[wasm_bindgen_test(unsupported = ...)]`.
[#4196](https://github.com/rustwasm/wasm-bindgen/pull/4196)

* Fixed potential `null` error when using `JsValue::as_debug_string()`.
[#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)
Expand Down
3 changes: 1 addition & 2 deletions crates/cli-support/src/js/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1958,7 +1958,6 @@ __wbg_set_wasm(wasm);"
if (!(instance instanceof klass)) {
throw new Error(`expected instance of ${klass.name}`);
}
return instance.ptr;
}
",
);
Expand Down Expand Up @@ -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]'
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/reference/web-sys.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]'
Expand Down