Repository navigation
Collection of prep work for custom WIT interface support - #42
Merged
Merged
Conversation
`core_runtime::event_loop` gains `without_event_loop`, which runs a closure with no active loop and a reason for that, and `throw_no_event_loop` and `reject_without_event_loop`, which fail work that needs a loop with a `TypeError` giving the reason. Timers, reading a host body and `ExtendableEvent.waitUntil` use them instead of panicking or throwing a generic error. An event loop also gains pending sends (`PendingSend`, `finish_pending_sends`), which keep its driver running until a write the loop's work feeds is done. Async-promise futures are polled with their loop active, since a poll can run JS, and a poll that left jobs queued drains them. `js::Promise::spawn_polled` polls a future once before spawning it, so the work of its first poll starts right away.
`js::bigint` gains `fits_i64` and `fits_u64`, `js::typedarray` the 64-bit typed-array kinds and each view kind's name, and `js::exception` `is_error_object`. `web-streams` exposes `ReadableStream::new_native_bytes` and `ReadableStream::from_iterable`, and makes the byte stream controller's and the BYOB request's methods callable from Rust. `fetch` converts its input itself, after giving the adapter `web_fetch::request::register_request_input_adapter` registers a chance to convert it to a `Request`. A failed conversion rejects the returned promise, as does calling `fetch` where no event loop is active. `core_runtime::module::entry_namespace` returns the namespace of the entry module. An entry evaluated under a synthetic filename is recorded as the entry too, without being registered for imports by path.
The `starlingmonkey` crate's `libc-alloc` feature routes Rust's allocations through wasi-libc's `malloc`, which SpiderMonkey's allocations also end in, so the wasm build allocates from one heap. Alignments above `max_align_t` go through `posix_memalign`.
`just clippy` lints tests and examples too, and CI runs it and the format check in a lint job. The tests and examples it newly covers are fixed: approximate constants, a constructor named after its type, a redundant closure, and `to_*` methods on `Copy` receivers. CI installs wasmtime 49.0.0 and builds wasm32-wasip3 with `nightly-2026-09-24`, which `STARLING_NIGHTLY` names for the justfile and `test-wizer.sh`, instead of whatever is newest. `test-wizer.sh` fails when wasmtime is missing instead of passing without running anything.
A promise that a host future settles, such as the one `fetch` returns, is settled outside a task, so the rejections its settlement leaves unhandled are now reported once the reactions have run, as after a task. A `fetch` event's dispatch performs its microtask checkpoints with `run_microtasks` instead of draining the jobs alone, so a rejection a listener leaves unhandled is reported too, as HTML's microtask checkpoint does. `fetch` no longer attaches a reaction to its promise to detach the abort algorithm, since any reaction marks the promise handled and suppressed the report. The algorithm is detached where the promise settles instead: when a response is delivered with nothing left to abort, and on each path that rejects the promise.
A top-level `await` that rejects after the script registered its `fetch` listener, such as one waiting on a timer, used to leave the server serving from a script that never finished. The rejection is now a startup failure. The native server exits with status 1 once it happens, and with `--serve-isolated` the request whose evaluation rejected gets a 500. A wasm instance logs the failure once and answers every request with a 500, and the work the script left behind is cancelled. A wasm instance whose script fails to evaluate now also logs that failure once rather than on every request.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a relatively loose collection of changes to existing code which are all directly motivated by the upcoming support for custom componentization. See the individual commit messages for details.