Skip to content

Commit

Permalink
fix: allow to retain fetchEvent on all wasi 0.2.x versions (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
karthik2804 authored Jan 16, 2025
1 parent d8dd995 commit 54bbab4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
run: |
rustup toolchain install 1.77.1
rustup target add wasm32-wasi --toolchain 1.77.1
rustup target add wasm32-wasi
rustup target add wasm32-wasip1
- uses: actions/setup-node@v4
with:
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
run: |
rustup toolchain install 1.77.1
rustup target add wasm32-wasi --toolchain 1.77.1
rustup target add wasm32-wasi
rustup target add wasm32-wasip1
- name: Restore Embedding Splicer from cache
uses: actions/cache/restore@v4
Expand Down Expand Up @@ -165,7 +165,7 @@ jobs:
run: |
rustup toolchain install 1.77.1
rustup target add wasm32-wasi --toolchain 1.77.1
rustup target add wasm32-wasi
rustup target add wasm32-wasip1
- name: Restore Embedding Splicer from cache
uses: actions/cache/restore@v4
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ debug: lib/starlingmonkey_embedding.debug.wasm lib/spidermonkey-embedding-splice
release: lib/starlingmonkey_embedding.wasm lib/spidermonkey-embedding-splicer.js
release-weval: lib/starlingmonkey_ics.wevalcache lib/spidermonkey-embedding-splicer.js

lib/spidermonkey-embedding-splicer.js: target/wasm32-wasi/release/spidermonkey_embedding_splicer.wasm crates/spidermonkey-embedding-splicer/wit/spidermonkey-embedding-splicer.wit | obj lib
@$(JCO) new target/wasm32-wasi/release/spidermonkey_embedding_splicer.wasm -o obj/spidermonkey-embedding-splicer.wasm --wasi-reactor
lib/spidermonkey-embedding-splicer.js: target/wasm32-wasip1/release/spidermonkey_embedding_splicer.wasm crates/spidermonkey-embedding-splicer/wit/spidermonkey-embedding-splicer.wit | obj lib
@$(JCO) new target/wasm32-wasip1/release/spidermonkey_embedding_splicer.wasm -o obj/spidermonkey-embedding-splicer.wasm --wasi-reactor
@$(JCO) transpile -q --name spidermonkey-embedding-splicer obj/spidermonkey-embedding-splicer.wasm -o lib -- -O1

target/wasm32-wasi/release/spidermonkey_embedding_splicer.wasm: Cargo.toml crates/spidermonkey-embedding-splicer/Cargo.toml crates/spidermonkey-embedding-splicer/src/*.rs
cargo build --release --target wasm32-wasi
target/wasm32-wasip1/release/spidermonkey_embedding_splicer.wasm: Cargo.toml crates/spidermonkey-embedding-splicer/Cargo.toml crates/spidermonkey-embedding-splicer/src/*.rs
cargo build --release --target wasm32-wasip1

lib/starlingmonkey_embedding.wasm: StarlingMonkey/cmake/* embedding/* StarlingMonkey/runtime/* StarlingMonkey/builtins/* StarlingMonkey/builtins/*/* StarlingMonkey/builtins/*/*/* StarlingMonkey/include/* | lib
cmake -B build-release -DCMAKE_BUILD_TYPE=Release
Expand Down
2 changes: 1 addition & 1 deletion crates/spidermonkey-embedding-splicer/src/bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ impl JsBindgen<'_> {
// can be used when an explicit export is not
// defined by the guest content.
if iface_name == "incoming-handler"
|| name == "wasi:http/[email protected].0"
|| name.starts_with("wasi:http/[email protected].")
{
if !features.contains(&Features::Http) {
bail!(
Expand Down
2 changes: 1 addition & 1 deletion crates/spidermonkey-embedding-splicer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ impl Guest for SpidermonkeyEmbeddingSplicerComponent {
.find(|(key, _)| {
engine_resolve
.name_world_key(key)
.starts_with("wasi:http/[email protected]")
.starts_with("wasi:http/[email protected].")
})
.map(|(key, _)| key.clone());

Expand Down
4 changes: 2 additions & 2 deletions test/builtins/performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ export const source = `
};
`;

export async function test (run) {
export async function test(run) {
const { stdout, stderr } = await run();
strictEqual(stdout, 'Calculated fib 1000: 4.346655768693743e+208\n');

ok(stderr.includes(' ms'));
const time = Number(stderr.split(' ms')[0]);
// TODO: fix back to half a millisecond when Weval fix is added
if (time > 3) {
if (time > 4) {
throw new Error('took more than half a millisecond - ' + time + ' ms');
}
}

0 comments on commit 54bbab4

Please sign in to comment.