Skip to content

Commit e880baf

Browse files
Pauanalexcrichton
authored andcommitted
Working around bug in Safari (#1829)
1 parent c1b4f67 commit e880baf

File tree

1 file changed

+6
-0
lines changed
  • crates/cli-support/src/js

1 file changed

+6
-0
lines changed

crates/cli-support/src/js/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1071,9 +1071,15 @@ impl<'a> Context<'a> {
10711071
if !self.should_write_global("text_decoder") {
10721072
return Ok(());
10731073
}
1074+
10741075
// `ignoreBOM` is needed so that the BOM will be preserved when sending a string from Rust to JS
10751076
// `fatal` is needed to catch any weird encoding bugs when sending a string from Rust to JS
10761077
self.expose_text_processor("TextDecoder", "('utf-8', { ignoreBOM: true, fatal: true })")?;
1078+
1079+
// This is needed to workaround a bug in Safari
1080+
// See: https://github.com/rustwasm/wasm-bindgen/issues/1825
1081+
self.global("cachedTextDecoder.decode();");
1082+
10771083
Ok(())
10781084
}
10791085

0 commit comments

Comments
 (0)