Skip to content

Fix JsCast::instanceof() not respecting JS namespaces #4241

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

Merged
merged 1 commit into from
Oct 31, 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 @@ -63,6 +63,9 @@
* Only emit `table.fill` instructions if the bulk-memory proposal is enabled.
[#4237](https://github.com/rustwasm/wasm-bindgen/pull/4237)

* Fixed calls to `JsCast::instanceof()` not respecting JavaScript namespaces.
[#4241](https://github.com/rustwasm/wasm-bindgen/pull/4241)

--------------------------------------------------------------------------------

## [0.2.95](https://github.com/rustwasm/wasm-bindgen/compare/0.2.94...0.2.95)
Expand Down
6 changes: 5 additions & 1 deletion crates/macro-support/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,11 @@ impl ConvertToAst<(&ast::Program, BindgenAttrs)> for syn::ForeignItemType {
.map_or_else(|| self.ident.to_string(), |s| s.to_string());
let typescript_type = attrs.typescript_type().map(|s| s.0.to_string());
let is_type_of = attrs.is_type_of().cloned();
let shim = format!("__wbg_instanceof_{}_{}", self.ident, ShortHash(&self.ident));
let shim = format!(
"__wbg_instanceof_{}_{}",
self.ident,
ShortHash((attrs.js_namespace().map(|(ns, _)| ns), &self.ident))
);
let mut extends = Vec::new();
let mut vendor_prefixes = Vec::new();
let no_deref = attrs.no_deref().is_some();
Expand Down