2092 Commits

Author SHA1 Message Date
dan
c389f9bde2 init thread pool as soon as wasm is loaded 2024-06-20 10:24:03 +03:00
Lukas Lihotzki
617167fbee Use table.fill in externref-xform (TODO) (#3446) 2024-06-19 20:39:08 +02:00
daxpedda
dd50433063 Update Clippy to Rust v1.79 (#3987) 2024-06-16 11:18:52 +02:00
daxpedda
3f6c7c6e3d Fix triggering clippy::mem_forget lint (#3985) 2024-06-16 09:38:35 +02:00
daxpedda
f1c840fd1c Add bindings for queueMicrotask (#3981) 2024-06-12 10:56:17 +02:00
Daniëlle Huisman
c108c7520a Add bindings for VisualViewport (#3931) 2024-06-02 08:18:21 +10:00
Liam Murphy
88f8917efb Fix Rust values getting GC'd while still borrowed and not getting GC'd if created via. constructor (#3940)
* Add a failing test

* Force tests to run sequentially

At first I tried fixing them so that they didn't need to (giving each of them
their own `dropCount`), but running multiple GCs in parallel seems to be flaky.

* Add objects created via. constructors to the FinalizationRegistry

* Add a failing test

* Fix exported Rust types being GC'd while still borrowed

I also discovered and fixed an extra bug while working on this, which
was that `LongRefFromWasmAbi` wasn't getting used for `self`: this bug
didn't cause any problems before, because the only type that had a
different `LongRefFromWasmAbi` impl than its `RefFromWasmAbi` impl was
`JsValue` which can't be the type of `self`.

It became a problem here because I made the new `LongRefFromWasmAbi`
impl for exported Rust types clone the `Rc`, whereas the
`RefFromWasmAbi` impl doesn't because garbage collection can't occur
during the synchronous call that the value has to live for.

I might actually change it so that both of the impls behave like the
current `LongRefFromWasmAbi` impl, though: cloning an `Rc` isn't
expensive and so having the second different impl just makes things more
complicated for no good reason. I just left it in this commit as
explanation for how I discovered the `LongRefFromWasmAbi` issue.

* Unify RefFromWasmAbi and LongRefFromWasmAbi impls

* Get rid of needless looping

* Get rid of outdated `borrow_mut`

Now that borrowing a Rust value always clones its `Rc`, `Rc::into_inner`
is a sufficient check that the value isn't borrowed.

* Get rid of needless `mut`

For some reason I was getting errors before without it, but that seems
to be fixed now. (It's probably something to do with having removed the
`borrow_mut`, but that only takes `&self`, so I still don't get it.)

* Update reference tests

* Add changelog entry

* Update schema hash

* Use Rc::try_unwrap instead of Rc::into_inner

* Skip GC tests

They seem to be far flakier in CI than locally for some reason, and I
don't see any way to solve it; so just turn them off. :(

I also got rid of the weird GC warmup hack because it doesn't do
anything anymore; I could've sworn it was a reproducible effect before,
but it seems to make no difference now.
2024-06-01 22:18:14 +10:00
Nicklas Warming Jacobsen
5767be9ea0 Fixes #3929 Allow exporting functions named "default". (#3930) 2024-05-28 06:38:45 +10:00
daxpedda
b4da51c4b1 Register target features in custom section when using xforms (#3967) 2024-05-27 09:41:57 +02:00
David Huculak
9b37613bba Improve the performance of 'string enums' (#3915) 2024-05-21 10:04:15 +02:00
Erik Moqvist
fa6d2bc726 Added getCapabilities() to RtcRtpReceiver (#3941) 2024-05-14 20:01:08 +10:00
Pablo Sichert
7ad4c3f931 Add WebIDL definitions for InputDeviceInfo and MediaTrackCapabilities (#3935)
* Add WebIDL definitions for `InputDeviceInfo` and `MediaTrackCapabilities`

* Regenerate WebIDL bindings

* Add changelog entry for `InputDeviceInfo` and `MediaTrackCapabilities`
2024-05-14 18:58:59 +10:00
Kevin Flansburg
73e5a8c482 Fix clippy lint empty_docs (#3946)
* Do not include docstring if empty

Closes #3945

* Move changelog entry to correct section
2024-05-08 13:59:11 +10:00
Liam Murphy
ad251c06a6 Fix CI failures introduced by Rust 1.78 (except clippy::empty_docs) (#3949)
* Fix clippy/cargo warnings introduced by Rust 1.78

* Update reference tests
2024-05-07 20:30:12 +10:00
redismongo
e78db23553 chore: fix some comments (#3913)
Signed-off-by: redismongo <yuanchaowei@outlook.com>
2024-04-18 23:57:16 +02:00
daxpedda
134fdda807 Fix MSRV compilation (#3927) 2024-04-18 23:57:02 +02:00
ZGY
7d0b11c80e Support expr when use typescript_custom_section attribute (#3901)
* feat: support expr when use `typescript_custom_section` attribute

* test: update typescript-tests

* chore: update "APPROVED_SCHEMA_FILE_HASH" of shared lib

* chore: cargo fmt

* Apply suggestions from code review

include fix typo and adding whitespace to ensure consistent code style.

Co-authored-by: Liam Murphy <liampm32@gmail.com>

* chore(backend): fix typo

* chore(typescript-tests): rename custom_section_type to custom_section_type.d.ts

* fix(backend/codegen): change method flat_slices to flat_byte_slices in order to avoid unsafe code

* fix(backend/codegen): use dynamic wasm_bindgen path as import entry

* chore(typescript-tests): ignore *.d.ts file when test

* chore(shared/program): rename CustomSection to LitOrExpr

* doc(shared/lib): add doc for program[typescript_custom_sections], explain why there are different types of LitOrExpr when encoding and decoding

* chore(shared): update "APPROVED_SCHEMA_FILE_HASH" of shared lib

* doc: add docs for method encode_u32_to_fixed_len_bytes

* refactor(backend/encode): rename method shared_typescript_custom_section to shared_lit_or_expr

* refactor(__rt): extract methods from nested mod directly into `__rt`

* chore: cargo fmt

* chore(__rt): remove unnecessary TODO

* chore(changelog): update change log
Support Expressions when using the `typescript_custom_section` attribute[#3901]

* Update CHANGELOG.md
2024-04-10 16:43:15 +10:00
David Huculak
d25a68eaa7 Don't use reflect in webidl dictionary setters (#3898) 2024-04-03 08:33:51 +02:00
Liam Murphy
88efe468e6 Implement Into<JsValue> for Vec (#3630)
* Implement `Into<JsValue>` for `Vec`

This means that `Vec`s can now be returned from `async` functions.

Fixes #3155.

I had to add a new `VectorIntoJsValue` trait, since similarly to
`VectorIntoWasmAbi` the orphan rule won't let us directly implement
`From<Vec<T>>` for `JsValue` outside of `wasm-bindgen`.

* Implement Into<JsValue> for boxed slices of numbers as well

* Add changelog entry

* Fix memory leak

* Add missing if_std!

* Move the changelog entry to the right spot
2024-03-25 11:10:24 +11:00
Thomas Etter
78463a2fd7 Add a crates/cli/tests/reference/enums.rs test to visualize the current (#3874) 2024-03-14 14:52:36 +11:00
ZGY
b3121a6d67 Add methods for Typed Array and Array (#3888) 2024-03-13 16:53:50 +01:00
burrscurr
3e378a7bbf Mark Web Share API as stable (#3882) 2024-03-12 23:30:32 +01:00
daxpedda
1317b34c09 Make catch thread safe (#3879) 2024-03-10 23:49:22 +01:00
daxpedda
3f129ae5be Fix nits in multi-threaded futures implementation (#3880) 2024-03-10 22:32:17 +01:00
battmdpkq
e22f754e06 fix some comments (#3875) 2024-03-08 11:16:05 +01:00
Lynn
ac462d586a Copy port from headless test server when using WASM_BINDGEN_TEST_ADDRESS (#3873) 2024-03-06 22:04:28 +01:00
daxpedda
2a4a493623 Prepare v0.2.92 release (#3869) 2024-03-04 11:25:46 +01:00
daxpedda
8e992dc906 Don't allow invalid Unicode scalar values in char (#3866) 2024-03-04 08:51:38 +01:00
daxpedda
807bdb48e4 Revert "Allow using 'static lifetimes in functions (#3856)" (#3865) 2024-03-02 11:55:19 +01:00
daxpedda
983ec579a3 Add NonNull<T> as parameter (#3857) 2024-03-02 09:11:13 +01:00
Lynn
0095fa73c9 Allow overriding headless test URL (#3861) 2024-03-02 08:58:19 +01:00
daxpedda
b9ccb8f3c5 Allow using 'static lifetimes in functions (#3856)
Co-authored-by: Liam Murphy <43807659+Liamolucko@users.noreply.github.com>
2024-02-27 22:22:50 +01:00
daxpedda
c80bf9a323 Add support for Option<*const T>, Option<*mut T> and NonNull<T> (#3852)
Co-authored-by: Liam Murphy <43807659+Liamolucko@users.noreply.github.com>
2024-02-26 11:49:55 +01:00
Léo Gaspard
557e2e6518 Introduce impl TryFrom for Number that succeeds iff the value is within the safe range (#3847) 2024-02-23 09:06:00 +01:00
Aaron Hill
b5a74c8578 Add sorted_iter_mut for NonstandardWitSection.adapters for determinism (#3851) 2024-02-22 17:06:13 +01:00
daxpedda
00ab174fcc Update Rust version for UI tests (#3850) 2024-02-21 23:17:19 +01:00
daxpedda
6150e210ca Revert "Use single-threaded impl when MT is impossible"
This reverts commit 7ce38b42d3.
2024-02-20 11:02:21 +01:00
daxpedda
7ce38b42d3 Use single-threaded impl when MT is impossible 2024-02-20 10:59:25 +01:00
Nulled
a396d03d9e feat(#3843): Add support for CanvasState.reset (#3844) 2024-02-10 09:00:36 +01:00
Thomas Etter
114a4a198c Add a typescript test (not just a compile test) for enums (#3740) 2024-02-09 08:24:33 +11:00
evdokimovs
e9cb333116 Add RtcPeerConnectionIceErrorEvent WebAPI (#3835) 2024-02-08 14:15:23 +01:00
logist322
b56728f0f4 Add RTCRtpTransceiver.setCodecPreferences() (#3828) 2024-02-06 13:04:56 +01:00
daxpedda
fe8bc949b5 Prepare v0.2.91 release (#3829) 2024-02-06 12:37:22 +01:00
daxpedda
4b6ef26f8a Fixed nighly build of wasm-bindgen-futures (#3827) 2024-02-06 11:20:08 +01:00
daxpedda
3e469b2654 Deprecate --weak-refs in favor of run-time detection (#3822)
* Deprecate `--weak-refs` in favor of run-time detection

* Generate empty functions instead

* Fix integration tests

* Improve `Closure::into_js_value()` docs
2024-02-05 09:01:50 +01:00
daxpedda
1f7942dfdb Fix #[wasm_bindgen(js_name = default)] for module imports (#3823) 2024-02-05 08:53:57 +01:00
G2
1f019db03a Enabled and auto generated forget() method for UsbDevice (#3821) 2024-02-03 00:53:19 +01:00
daxpedda
305cb25cbd Fixed temporary folder detection on MacOS (#3817) 2024-01-31 22:40:37 +01:00
Erich Gubler
b1047882dc chore(webgpu)!: update to latest WebGPU IDL as of 2024-01-30 (#3816) 2024-01-30 12:26:37 +01:00
Liam Murphy
acef364c7e Shrink JS-allocated strings down to the correct size before passing them to Rust (#3808)
* Shrink JS-allocated strings down to the correct size before passing them to Rust

Fixes #3801.

I opted to solve it this way rather than just pass the capacity to Rust
as well because it means the allocation isn't up to 3x bigger than it
needs to be anymore. I also removed a TODO about fixing that.

* Update reference tests

* Add changelog entry
2024-01-25 20:05:55 +11:00