* 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.
* Add WebIDL definitions for `InputDeviceInfo` and `MediaTrackCapabilities`
* Regenerate WebIDL bindings
* Add changelog entry for `InputDeviceInfo` and `MediaTrackCapabilities`
* 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
* 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
* 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