Skip to content

Commit 7e235d0

Browse files
chore(deps): update to componentize-js 1.19.0-rc.6
1 parent 869900d commit 7e235d0

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ wit-parser = { version = "0.245.1", features = ["decoding", "serde"] }
3333
wit-bindgen = { version = "0.54.0", features = ["macros", "async", "realloc"] }
3434
wit-bindgen-core = { version = "0.54.0", default-features = false }
3535

36-
js-component-bindgen = { version = "1.19.0-rc.5" }
36+
js-component-bindgen = { version = "1.19.0-rc.6" }

crates/spidermonkey-embedding-splicer/src/bindgen.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,9 @@ impl JsBindgen<'_> {
712712
FunctionKind::AsyncStatic(_id) => todo!(),
713713
};
714714

715+
// All imports are sync
716+
let requires_async_porcelain = false;
717+
715718
// imports are canonicalized as exports because
716719
// the function bindgen as currently written still makes this assumption
717720
self.bindgen(
@@ -728,6 +731,7 @@ impl JsBindgen<'_> {
728731
func,
729732
AbiVariant::GuestExport,
730733
&iface_name,
734+
requires_async_porcelain,
731735
);
732736
self.src.push_str("\n");
733737

@@ -861,6 +865,7 @@ impl JsBindgen<'_> {
861865
func: &Function,
862866
abi: AbiVariant,
863867
iface_name: &Option<String>,
868+
requires_async_porcelain: bool,
864869
) {
865870
self.src.push_str("(");
866871
let mut params = Vec::new();
@@ -920,7 +925,7 @@ impl JsBindgen<'_> {
920925
.resolve(self.resolve)
921926
.callee_resource_dynamic(false)
922927
.asmjs(false)
923-
.requires_async_porcelain(false)
928+
.requires_async_porcelain(requires_async_porcelain)
924929
.tracing_enabled(false)
925930
.maybe_iface_name(iface_name.as_deref())
926931
.build();
@@ -987,13 +992,23 @@ impl JsBindgen<'_> {
987992
// the function bindgen as currently written still makes this assumption
988993
let sig = self.resolve.wasm_signature(AbiVariant::GuestImport, func);
989994

995+
// We treat all functions as requiring async porcelain to
996+
// allow for use of `fetch()`
997+
//
998+
// Requiring async porcelain is distinct from a "real"
999+
// P3 async export, in that the callee is *not* expected to follow
1000+
// the async ABI, but instead essentially be treated like an async
1001+
// JS function.
1002+
let requires_async_porcelain = true;
1003+
9901004
self.bindgen(
9911005
sig.params.len(),
992-
&format!("await {callee}"),
1006+
&callee,
9931007
string_encoding,
9941008
func,
9951009
AbiVariant::GuestImport,
9961010
&iface_name,
1011+
requires_async_porcelain,
9971012
);
9981013
self.src.push_str("\n");
9991014

0 commit comments

Comments
 (0)