Repository: rustwasm/wasm-bindgen
Pull request #3740 (2023-12-09 23:46:21)

 Add a typescript test (not just a compile test) for enums
Also changed from opt-in to opt-out for running TypeScript tests.

This will make sure that new tests are run by default.

thomasetter: Friendly ping :)

Patch:
diff --git a/.github/actions/setup-geckodriver/action.yml b/.github/actions/setup-geckodriver/action.yml
index 40611a1d..89dd42ca 100644
--- a/.github/actions/setup-geckodriver/action.yml
+++ b/.github/actions/setup-geckodriver/action.yml
@@ -2,5 +2,5 @@ name: 'Setup Geckodriver'
 description: 'Setup Geckodriver'
 
 runs:
-  using: node16
+  using: node20
   main: 'main.js'
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 117e538f..4db634ba 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -24,7 +24,7 @@ jobs:
     name: Rustfmt
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update stable && rustup default stable
     - run: rustup component add rustfmt
     - run: cargo fmt --all -- --check
@@ -34,7 +34,7 @@ jobs:
     name: Check
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update stable && rustup default stable
     - run: cargo check --all
 
@@ -43,7 +43,7 @@ jobs:
     name: Clippy
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update stable && rustup default stable
     - run: rustup target add wasm32-unknown-unknown
     - run: cargo clippy --no-deps --all-features -p wasm-bindgen-backend -- -D warnings
@@ -77,10 +77,10 @@ jobs:
     env:
       WASM_BINDGEN_SPLIT_LINKED_MODULES: 1
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update stable && rustup default stable
     - run: rustup target add wasm32-unknown-unknown
-    - uses: actions/setup-node@v3
+    - uses: actions/setup-node@v4
       with:
         node-version: '20'
     - uses: ./.github/actions/setup-geckodriver
@@ -90,14 +90,7 @@ jobs:
     - run: cargo test --target wasm32-unknown-unknown -p wasm-bindgen-futures
     - run: cargo test --target wasm32-unknown-unknown --test wasm
       env:
-        WASM_BINDGEN_WEAKREF: 1
-    - run: cargo test --target wasm32-unknown-unknown --test wasm
-      env:
-        WASM_BINDGEN_WEAKREF: 1
         WASM_BINDGEN_NO_DEBUG: 1
-    - run: cargo test --target wasm32-unknown-unknown --test wasm --features serde-serialize
-      env:
-        WASM_BINDGEN_WEAKREF: 1
     - run: cargo test --target wasm32-unknown-unknown
       env:
         WASM_BINDGEN_EXTERNREF: 1
@@ -109,8 +102,8 @@ jobs:
     name: "Run wasm-bindgen crate tests with multithreading enabled"
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
-    - run: rustup default nightly-2023-05-08
+    - uses: actions/checkout@v4
+    - run: rustup default nightly-2024-02-06
     - run: rustup target add wasm32-unknown-unknown
     - run: rustup component add rust-src
     # Note: we only run the browser tests here, because wasm-bindgen doesn't support threading in Node yet.
@@ -124,10 +117,10 @@ jobs:
   #   name: "Run wasm-bindgen crate tests (Windows)"
   #   runs-on: windows-latest
   #   steps:
-  #   - uses: actions/checkout@v3
+  #   - uses: actions/checkout@v4
   #   - run: rustup update --no-self-update stable && rustup default stable
   #   - run: rustup target add wasm32-unknown-unknown
-  #   - uses: actions/setup-node@v3
+  #   - uses: actions/setup-node@v4
   #     with:
   #       node-version: '20'
   #   - uses: ./.github/actions/setup-geckodriver
@@ -145,10 +138,10 @@ jobs:
     name: Run native tests
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update stable && rustup default stable
     - run: rustup target add wasm32-unknown-unknown
-    - uses: actions/setup-node@v3
+    - uses: actions/setup-node@v4
       with:
         node-version: '20'
     - run: cargo test
@@ -165,10 +158,10 @@ jobs:
     name: "Run web-sys crate tests"
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update stable && rustup default stable
     - run: rustup target add wasm32-unknown-unknown
-    - uses: actions/setup-node@v3
+    - uses: actions/setup-node@v4
       with:
         node-version: '20'
     - uses: ./.github/actions/setup-geckodriver
@@ -185,7 +178,7 @@ jobs:
     name: "Verify that web-sys is compiled correctly"
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update stable && rustup default stable
     - run: cd crates/web-sys && cargo run --release --package wasm-bindgen-webidl -- webidls src/features ./Cargo.toml
     - run: git diff --exit-code
@@ -194,10 +187,10 @@ jobs:
     name: "Run js-sys crate tests"
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update stable && rustup default stable
     - run: rustup target add wasm32-unknown-unknown
-    - uses: actions/setup-node@v3
+    - uses: actions/setup-node@v4
       with:
         node-version: '20'
     - uses: ./.github/actions/setup-geckodriver
@@ -210,10 +203,10 @@ jobs:
     name: "Run wasm-bindgen-webidl crate tests"
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update stable && rustup default stable
     - run: rustup target add wasm32-unknown-unknown
-    - uses: actions/setup-node@v3
+    - uses: actions/setup-node@v4
       with:
         node-version: '20'
     - run: cargo test -p wasm-bindgen-webidl
@@ -228,10 +221,10 @@ jobs:
     name: "Test TypeScript output of wasm-bindgen"
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update stable && rustup default stable
     - run: rustup target add wasm32-unknown-unknown
-    - uses: actions/setup-node@v3
+    - uses: actions/setup-node@v4
       with:
         node-version: '20'
     - run: cd crates/typescript-tests && ./run.sh
@@ -240,7 +233,7 @@ jobs:
     name: "Build and test the deno example"
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update stable && rustup default stable
     - run: rustup target add wasm32-unknown-unknown
     - uses: denoland/setup-deno@v1
@@ -252,7 +245,7 @@ jobs:
     name: Run UI compile-fail tests
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update 1.69.0 && rustup default 1.69.0
     - run: cargo test -p wasm-bindgen-macro
     - run: cargo test -p wasm-bindgen-test-macro
@@ -260,7 +253,7 @@ jobs:
   build_examples:
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update stable && rustup default stable
     - run: rustup target add wasm32-unknown-unknown
     - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f
@@ -289,8 +282,8 @@ jobs:
   build_nightly:
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
-    - run: rustup default nightly-2023-05-08
+    - uses: actions/checkout@v4
+    - run: rustup default nightly-2024-02-06
     - run: rustup target add wasm32-unknown-unknown
     - run: rustup component add rust-src
     - run: |
@@ -310,7 +303,7 @@ jobs:
     - build_nightly
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - uses: actions/download-artifact@v3
       with:
         name: examples1
@@ -327,7 +320,7 @@ jobs:
   build_benchmarks:
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update stable && rustup default stable
     - run: rustup target add wasm32-unknown-unknown
     - run: cargo build --manifest-path benchmarks/Cargo.toml --release --target wasm32-unknown-unknown
@@ -340,7 +333,7 @@ jobs:
   dist_linux_x86_64_musl:
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update stable && rustup default stable
     - run: rustup target add x86_64-unknown-linux-musl
     - run: sudo apt update -y && sudo apt install musl-tools -y
@@ -357,7 +350,7 @@ jobs:
   dist_linux_aarch64_gnu:
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update stable && rustup default stable
     - run: rustup target add aarch64-unknown-linux-gnu
     - run: sudo apt update -y && sudo apt install gcc-aarch64-linux-gnu -y
@@ -373,7 +366,7 @@ jobs:
   dist_macos_x86_64:
     runs-on: macos-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update stable && rustup default stable
     - run: cargo build --manifest-path crates/cli/Cargo.toml --release
       env:
@@ -386,7 +379,7 @@ jobs:
   dist_macos_aarch64:
     runs-on: macos-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update stable && rustup default stable
     - run: rustup target add aarch64-apple-darwin
     - run: |
@@ -401,7 +394,7 @@ jobs:
   dist_windows:
     runs-on: windows-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update stable && rustup default stable
     - run: cargo build --manifest-path crates/cli/Cargo.toml --release
       env:
@@ -414,7 +407,7 @@ jobs:
   doc_book:
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: |
         curl -L https://github.com/rust-lang/mdBook/releases/download/v0.4.28/mdbook-v0.4.28-x86_64-unknown-linux-gnu.tar.gz | tar xzf -
         echo $PWD >> $GITHUB_PATH
@@ -427,7 +420,7 @@ jobs:
   doc_api:
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: rustup update --no-self-update nightly && rustup default nightly
     - run: cargo doc --no-deps --features 'serde-serialize'
     - run: cargo doc --no-deps --manifest-path crates/js-sys/Cargo.toml
@@ -459,7 +452,7 @@ jobs:
       - build_benchmarks
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
       with:
         fetch-depth: 0
     - uses: actions/download-artifact@v3
@@ -524,4 +517,4 @@ jobs:
     - run: ./publish publish
       if: startsWith(github.ref, 'refs/tags/')
       env:
-        CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
+        CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_PUBLISH_TOKEN }}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6bebf011..1650b86e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,10 +5,24 @@
 
 ### Added
 
+* Add bindings for `RTCPeerConnectionIceErrorEvent`.
+  [#3835](https://github.com/rustwasm/wasm-bindgen/pull/3835)
+
+--------------------------------------------------------------------------------
+
+## [0.2.91](https://github.com/rustwasm/wasm-bindgen/compare/0.2.90...0.2.91)
+
+Released 2024-02-06
+
+### Added
+
+* Added bindings for the `RTCRtpTransceiver.setCodecPreferences()` and unstable bindings for the `RTCRtpEncodingParameters.scalabilityMode`.
+  [#3828](https://github.com/rustwasm/wasm-bindgen/pull/3828)
+
 * Add unstable bindings for the FileSystemAccess API
   [#3810](https://github.com/rustwasm/wasm-bindgen/pull/3810)
 
-* Added support for running tests in shared and service workers with ``wasm_bindgen_test_configure!` `run_in_shared_worker` and `run_in_service_worker`.
+* Added support for running tests in shared and service workers with `wasm_bindgen_test_configure!` `run_in_shared_worker` and `run_in_service_worker`.
   [#3804](https://github.com/rustwasm/wasm-bindgen/pull/3804)
 
 * Accept the `--skip` flag with `wasm-bindgen-test-runner`.
@@ -34,6 +48,9 @@
 * Updated the WebGPU WebIDL to the current draft as of 2024-01-30. Note that this retains the previous update's workaround for `GPUPipelineError`, and holds back an update to the `buffer` argument of the `GPUQueue.{writeBuffer,writeTexture}` methods.
   [#3816](https://github.com/rustwasm/wasm-bindgen/pull/3816)
 
+* Depreate `--weak-refs` and `WASM_BINDGEN_WEAKREF` in favor of automatic run-time detection.
+  [#3822](https://github.com/rustwasm/wasm-bindgen/pull/3822)
+
 ### Fixed
 
 * Fixed UB when freeing strings received from JS if not using the default allocator.
@@ -42,6 +59,14 @@
 * Fixed temporary folder detection by `wasm-bindgen-test-runner` on MacOS.
   [#3817](https://github.com/rustwasm/wasm-bindgen/pull/3817)
 
+* Fixed using `#[wasm_bindgen(js_name = default)]` with `#[wasm_bindgen(module = ...)]`.
+  [#3823](https://github.com/rustwasm/wasm-bindgen/pull/3823)
+
+* Fixed nighly build of `wasm-bindgen-futures`.
+  [#3827](https://github.com/rustwasm/wasm-bindgen/pull/3827)
+
+--------------------------------------------------------------------------------
+
 ## [0.2.90](https://github.com/rustwasm/wasm-bindgen/compare/0.2.89...0.2.90)
 
 Released 2024-01-06
@@ -84,6 +109,8 @@ Released 2024-01-06
   `RtcLifecycleEvent` and `WebrtcGlobalStatisticsReport` features.
   [#3723](https://github.com/rustwasm/wasm-bindgen/pull/3723)
 
+--------------------------------------------------------------------------------
+
 ## [0.2.89](https://github.com/rustwasm/wasm-bindgen/compare/0.2.88...0.2.89)
 
 Released 2023-11-27.
@@ -112,6 +139,8 @@ Released 2023-11-27.
 * Removed Gecko-internal dictionary bindings `Csp`, `CspPolicies`, `CspReport` and `CspReportProperties`.
   [#3721](https://github.com/rustwasm/wasm-bindgen/pull/3721)
 
+--------------------------------------------------------------------------------
+
 ## [0.2.88](https://github.com/rustwasm/wasm-bindgen/compare/0.2.87...0.2.88)
 
 Released 2023-11-01
@@ -276,6 +305,8 @@ Released 2023-11-01
 * Removed `GetNotificationOptions`, `NotificationBehavior` and `Notification.get()` because
   they don't exist anymore.
 
+--------------------------------------------------------------------------------
+
 ## [0.2.87](https://github.com/rustwasm/wasm-bindgen/compare/0.2.86...0.2.87)
 
 Released 2023-06-12.
diff --git a/Cargo.toml b/Cargo.toml
index b1faa4e8..08cd2dfa 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-bindgen"
-version = "0.2.90"
+version = "0.2.91"
 authors = ["The wasm-bindgen Developers"]
 license = "MIT OR Apache-2.0"
 readme = "README.md"
@@ -42,15 +42,15 @@ xxx_debug_only_print_generated_code = [
 ]
 
 [dependencies]
-wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.90" }
+wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.91" }
 serde = { version = "1.0", optional = true }
 serde_json = { version = "1.0", optional = true }
 cfg-if = "1.0.0"
 
 [target.'cfg(target_arch = "wasm32")'.dev-dependencies]
-js-sys = { path = 'crates/js-sys', version = '0.3.67' }
-wasm-bindgen-test = { path = 'crates/test', version = '=0.3.40' }
-wasm-bindgen-futures = { path = 'crates/futures', version = '=0.4.40' }
+js-sys = { path = 'crates/js-sys', version = '0.3.68' }
+wasm-bindgen-test = { path = 'crates/test', version = '=0.3.41' }
+wasm-bindgen-futures = { path = 'crates/futures', version = '=0.4.41' }
 serde_derive = "1.0"
 wasm-bindgen-test-crate-a = { path = 'tests/crates/a', version = '0.1' }
 wasm-bindgen-test-crate-b = { path = 'tests/crates/b', version = '0.1' }
diff --git a/README.md b/README.md
index be034243..9b1728cf 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@
   </p>
 
   <p>
-    <a href="https://dev.azure.com/rustwasm/wasm-bindgen/_build/latest?definitionId=1&branchName=master"><img src="https://img.shields.io/azure-devops/build/rustwasm/wasm-bindgen/1.svg?style=flat-square" alt="Build Status" /></a>
+    <a href="https://github.com/rustwasm/wasm-bindgen/actions/workflows/main.yml?query=branch%3Amain"><img src="https://github.com/rustwasm/wasm-bindgen/actions/workflows/main.yml/badge.svg?branch=main" alt="Build Status" /></a>
     <a href="https://crates.io/crates/wasm-bindgen"><img src="https://img.shields.io/crates/v/wasm-bindgen.svg?style=flat-square" alt="Crates.io version" /></a>
     <a href="https://crates.io/crates/wasm-bindgen"><img src="https://img.shields.io/crates/d/wasm-bindgen.svg?style=flat-square" alt="Download" /></a>
     <a href="https://docs.rs/wasm-bindgen"><img src="https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square" alt="docs.rs docs" /></a>
diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml
index 8be4e953..b2dccbbb 100644
--- a/crates/backend/Cargo.toml
+++ b/crates/backend/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-bindgen-backend"
-version = "0.2.90"
+version = "0.2.91"
 authors = ["The wasm-bindgen Developers"]
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/backend"
@@ -23,4 +23,4 @@ once_cell = "1.12"
 proc-macro2 = "1.0"
 quote = '1.0'
 syn = { version = '2.0', features = ['full'] }
-wasm-bindgen-shared = { path = "../shared", version = "=0.2.90" }
+wasm-bindgen-shared = { path = "../shared", version = "=0.2.91" }
diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml
index 0dae8e03..ec12dc3d 100644
--- a/crates/cli-support/Cargo.toml
+++ b/crates/cli-support/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-bindgen-cli-support"
-version = "0.2.90"
+version = "0.2.91"
 authors = ["The wasm-bindgen Developers"]
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli-support"
@@ -20,10 +20,10 @@ rustc-demangle = "0.1.13"
 serde_json = "1.0"
 tempfile = "3.0"
 walrus = "0.20.2"
-wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.90' }
-wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.90' }
-wasm-bindgen-shared = { path = "../shared", version = '=0.2.90' }
-wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.90' }
-wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.90' }
-wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.90' }
+wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.91' }
+wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.91' }
+wasm-bindgen-shared = { path = "../shared", version = '=0.2.91' }
+wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.91' }
+wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.91' }
+wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.91' }
 unicode-ident = "1.0.5"
diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs
index 5a5ebfee..2e774487 100644
--- a/crates/cli-support/src/js/mod.rs
+++ b/crates/cli-support/src/js/mod.rs
@@ -921,18 +921,12 @@ impl<'a> Context<'a> {
                 "
                 static __wrap(ptr) {{
                     ptr = ptr >>> 0;
-                    const obj = Object.create({}.prototype);
+                    const obj = Object.create({name}.prototype);
                     obj.__wbg_ptr = ptr;
-                    {}
+                    {name}Finalization.register(obj, obj.__wbg_ptr, obj);
                     return obj;
                 }}
-                ",
-                name,
-                if self.config.weak_refs {
-                    format!("{}Finalization.register(obj, obj.__wbg_ptr, obj);", name)
-                } else {
-                    String::new()
-                },
+                "
             ));
         }
 
@@ -950,13 +944,13 @@ impl<'a> Context<'a> {
             ));
         }
 
-        if self.config.weak_refs {
-            self.global(&format!(
-                "const {}Finalization = new FinalizationRegistry(ptr => wasm.{}(ptr >>> 0));",
-                name,
-                wasm_bindgen_shared::free_function(name),
-            ));
-        }
+        self.global(&format!(
+            "
+            const {name}Finalization = (typeof FinalizationRegistry === 'undefined')
+                ? {{ register: () => {{}}, unregister: () => {{}} }}
+                : new FinalizationRegistry(ptr => wasm.{}(ptr >>> 0));",
+            wasm_bindgen_shared::free_function(name),
+        ));
 
         // If the class is inspectable, generate `toJSON` and `toString`
         // to expose all readable properties of the class. Otherwise,
@@ -1021,7 +1015,7 @@ impl<'a> Context<'a> {
             __destroy_into_raw() {{
                 const ptr = this.__wbg_ptr;
                 this.__wbg_ptr = 0;
-                {}
+                {name}Finalization.unregister(this);
                 return ptr;
             }}
 
@@ -1030,11 +1024,6 @@ impl<'a> Context<'a> {
                 wasm.{}(ptr);
             }}
             ",
-            if self.config.weak_refs {
-                format!("{}Finalization.unregister(this);", name)
-            } else {
-                String::new()
-            },
             wasm_bindgen_shared::free_function(name),
         ));
         ts_dst.push_str("  free(): void;\n");
@@ -2121,15 +2110,7 @@ impl<'a> Context<'a> {
 
         let table = self.export_function_table()?;
 
-        let (register, unregister) = if self.config.weak_refs {
-            self.expose_closure_finalization()?;
-            (
-                "CLOSURE_DTORS.register(real, state, state);",
-                "CLOSURE_DTORS.unregister(state)",
-            )
-        } else {
-            ("", "")
-        };
+        self.expose_closure_finalization()?;
 
         // For mutable closures they can't be invoked recursively.
         // To handle that we swap out the `this.a` pointer with zero
@@ -2152,20 +2133,17 @@ impl<'a> Context<'a> {
                     }} finally {{
                         if (--state.cnt === 0) {{
                             wasm.{table}.get(state.dtor)(a, state.b);
-                            {unregister}
+                            CLOSURE_DTORS.unregister(state);
                         }} else {{
                             state.a = a;
                         }}
                     }}
                 }};
                 real.original = state;
-                {register}
+                CLOSURE_DTORS.register(real, state, state);
                 return real;
             }}
             ",
-            table = table,
-            register = register,
-            unregister = unregister,
         ));
 
         Ok(())
@@ -2178,15 +2156,7 @@ impl<'a> Context<'a> {
 
         let table = self.export_function_table()?;
 
-        let (register, unregister) = if self.config.weak_refs {
-            self.expose_closure_finalization()?;
-            (
-                "CLOSURE_DTORS.register(real, state, state);",
-                "CLOSURE_DTORS.unregister(state)",
-            )
-        } else {
-            ("", "")
-        };
+        self.expose_closure_finalization()?;
 
         // For shared closures they can be invoked recursively so we
         // just immediately pass through `this.a`. If we end up
@@ -2208,18 +2178,15 @@ impl<'a> Context<'a> {
                         if (--state.cnt === 0) {{
                             wasm.{table}.get(state.dtor)(state.a, state.b);
                             state.a = 0;
-                            {unregister}
+                            CLOSURE_DTORS.unregister(state);
                         }}
                     }}
                 }};
                 real.original = state;
-                {register}
+                CLOSURE_DTORS.register(real, state, state);
                 return real;
             }}
             ",
-            table = table,
-            register = register,
-            unregister = unregister,
         ));
 
         Ok(())
@@ -2229,15 +2196,15 @@ impl<'a> Context<'a> {
         if !self.should_write_global("closure_finalization") {
             return Ok(());
         }
-        assert!(self.config.weak_refs);
         let table = self.export_function_table()?;
         self.global(&format!(
             "
-            const CLOSURE_DTORS = new FinalizationRegistry(state => {{
-                wasm.{}.get(state.dtor)(state.a, state.b)
-            }});
-            ",
-            table
+            const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
+                ? {{ register: () => {{}}, unregister: () => {{}} }}
+                : new FinalizationRegistry(state => {{
+                    wasm.{table}.get(state.dtor)(state.a, state.b)
+                }});
+            "
         ));
 
         Ok(())
diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs
index ee07fe86..c3e24bd2 100755
--- a/crates/cli-support/src/lib.rs
+++ b/crates/cli-support/src/lib.rs
@@ -35,9 +35,6 @@ pub struct Bindgen {
     remove_producers_section: bool,
     omit_default_module_path: bool,
     emit_start: bool,
-    // Experimental support for weakrefs, an upcoming ECMAScript feature.
-    // Currently only enable-able through an env var.
-    weak_refs: bool,
     // Support for the wasm threads proposal, transforms the wasm module to be
     // "ready to be instantiated on any thread"
     threads: wasm_bindgen_threads_xform::Config,
@@ -106,7 +103,6 @@ impl Bindgen {
             remove_name_section: false,
             remove_producers_section: false,
             emit_start: true,
-            weak_refs: env::var("WASM_BINDGEN_WEAKREF").is_ok(),
             threads: threads_config(),
             externref,
             multi_value,
@@ -126,11 +122,6 @@ impl Bindgen {
         self
     }
 
-    pub fn weak_refs(&mut self, enable: bool) -> &mut Bindgen {
-        self.weak_refs = enable;
-        self
-    }
-
     pub fn reference_types(&mut self, enable: bool) -> &mut Bindgen {
         self.externref = enable;
         self
diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml
index e7d09100..81f27693 100644
--- a/crates/cli/Cargo.toml
+++ b/crates/cli/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-bindgen-cli"
-version = "0.2.90"
+version = "0.2.91"
 authors = ["The wasm-bindgen Developers"]
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli"
@@ -34,8 +34,8 @@ ureq = { version = "2.7", default-features = false, features = [
     "gzip",
 ] }
 walrus = { version = "0.20.2", features = ['parallel'] }
-wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.90" }
-wasm-bindgen-shared = { path = "../shared", version = "=0.2.90" }
+wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.91" }
+wasm-bindgen-shared = { path = "../shared", version = "=0.2.91" }
 
 [dev-dependencies]
 assert_cmd = "1.0"
diff --git a/crates/cli/src/bin/wasm-bindgen.rs b/crates/cli/src/bin/wasm-bindgen.rs
index 74d29a16..78d9e1bd 100644
--- a/crates/cli/src/bin/wasm-bindgen.rs
+++ b/crates/cli/src/bin/wasm-bindgen.rs
@@ -39,7 +39,7 @@ Options:
     --nodejs                     Deprecated, use `--target nodejs`
     --web                        Deprecated, use `--target web`
     --no-modules                 Deprecated, use `--target no-modules`
-    --weak-refs                  Enable usage of the JS weak references proposal
+    --weak-refs                  Deprecated, is runtime-detected
     --reference-types            Enable usage of WebAssembly reference types
     -V --version                 Print the version number of wasm-bindgen
 
@@ -126,9 +126,6 @@ fn rmain(args: &Args) -> Result<(), Error> {
         .omit_imports(args.flag_omit_imports)
         .omit_default_module_path(args.flag_omit_default_module_path)
         .split_linked_modules(args.flag_split_linked_modules);
-    if let Some(true) = args.flag_weak_refs {
-        b.weak_refs(true);
-    }
     if let Some(true) = args.flag_reference_types {
         b.reference_types(true);
     }
diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml
index d1082290..0b5f80f3 100644
--- a/crates/externref-xform/Cargo.toml
+++ b/crates/externref-xform/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-bindgen-externref-xform"
-version = "0.2.90"
+version = "0.2.91"
 authors = ["The wasm-bindgen Developers"]
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/externref-xform"
diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml
index f5462b2a..860e6d74 100644
--- a/crates/futures/Cargo.toml
+++ b/crates/futures/Cargo.toml
@@ -7,14 +7,14 @@ license = "MIT OR Apache-2.0"
 name = "wasm-bindgen-futures"
 repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures"
 readme = "./README.md"
-version = "0.4.40"
+version = "0.4.41"
 edition = "2018"
 rust-version = "1.57"
 
 [dependencies]
 cfg-if = "1.0.0"
-js-sys = { path = "../js-sys", version = '0.3.67' }
-wasm-bindgen = { path = "../..", version = '0.2.90' }
+js-sys = { path = "../js-sys", version = '0.3.68' }
+wasm-bindgen = { path = "../..", version = '0.2.91' }
 futures-core =  { version = '0.3.8', default-features = false, optional = true }
 
 [features]
@@ -29,6 +29,6 @@ features = [
 ]
 
 [target.'cfg(target_arch = "wasm32")'.dev-dependencies]
-wasm-bindgen-test = { path = '../test', version = '0.3.40' }
+wasm-bindgen-test = { path = '../test', version = '0.3.41' }
 futures-channel-preview = { version = "0.3.0-alpha.18" }
 futures-lite = { version = "1.11.3", default-features = false }
diff --git a/crates/futures/src/lib.rs b/crates/futures/src/lib.rs
index 8a02a51b..a44ec7c6 100644
--- a/crates/futures/src/lib.rs
+++ b/crates/futures/src/lib.rs
@@ -30,7 +30,7 @@
 //! systems and make sure that Rust/JavaScript can work together with
 //! asynchronous and I/O work.
 
-#![cfg_attr(target_feature = "atomics", feature(stdsimd))]
+#![cfg_attr(target_feature = "atomics", feature(stdarch_wasm_atomic_wait))]
 #![deny(missing_docs)]
 
 use js_sys::Promise;
diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml
index 80a940af..ca5f849f 100644
--- a/crates/js-sys/Cargo.toml
+++ b/crates/js-sys/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "js-sys"
-version = "0.3.67"
+version = "0.3.68"
 authors = ["The wasm-bindgen Developers"]
 readme = "./README.md"
 categories = ["wasm"]
@@ -20,9 +20,9 @@ test = false
 doctest = false
 
 [dependencies]
-wasm-bindgen = { path = "../..", version = "0.2.90" }
+wasm-bindgen = { path = "../..", version = "0.2.91" }
 
 [target.'cfg(target_arch = "wasm32")'.dev-dependencies]
-wasm-bindgen-test = { path = '../test', version = '=0.3.40' }
-wasm-bindgen-futures = { path = '../futures', version = '0.4.40' }
-web-sys = { path = "../web-sys", version = "0.3.67", features = ["Headers", "Response", "ResponseInit"] }
+wasm-bindgen-test = { path = '../test', version = '=0.3.41' }
+wasm-bindgen-futures = { path = '../futures', version = '0.4.41' }
+web-sys = { path = "../web-sys", version = "0.3.68", features = ["Headers", "Response", "ResponseInit"] }
diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml
index 1ba1c871..6a13463b 100644
--- a/crates/macro-support/Cargo.toml
+++ b/crates/macro-support/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-bindgen-macro-support"
-version = "0.2.90"
+version = "0.2.91"
 authors = ["The wasm-bindgen Developers"]
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro-support"
@@ -21,5 +21,5 @@ strict-macro = []
 syn = { version = '2.0', features = ['visit', 'full'] }
 quote = '1.0'
 proc-macro2 = "1.0"
-wasm-bindgen-backend = { path = "../backend", version = "=0.2.90" }
-wasm-bindgen-shared = { path = "../shared", version = "=0.2.90" }
+wasm-bindgen-backend = { path = "../backend", version = "=0.2.91" }
+wasm-bindgen-shared = { path = "../shared", version = "=0.2.91" }
diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs
index 39ab459f..eee4f66e 100644
--- a/crates/macro-support/src/parser.rs
+++ b/crates/macro-support/src/parser.rs
@@ -505,6 +505,7 @@ impl<'a> ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option<ast::ImportModule
             false,
             None,
             false,
+            Some(&["default"]),
         )?
         .0;
         let catch = opts.catch().is_some();
@@ -793,14 +794,18 @@ impl ConvertToAst<BindgenAttrs> for syn::ItemFn {
             false,
             None,
             false,
+            None,
         )?;
         attrs.check_used();
         Ok(ret.0)
     }
 }
 
-pub(crate) fn is_js_keyword(keyword: &str) -> bool {
-    JS_KEYWORDS.contains(&keyword)
+pub(crate) fn is_js_keyword(keyword: &str, skip: Option<&[&str]>) -> bool {
+    JS_KEYWORDS
+        .iter()
+        .filter(|keyword| skip.filter(|skip| skip.contains(keyword)).is_none())
+        .any(|this| *this == keyword)
 }
 
 /// Construct a function (and gets the self type if appropriate) for our AST from a syn function.
@@ -814,6 +819,7 @@ fn function_from_decl(
     allow_self: bool,
     self_ty: Option<&Ident>,
     is_from_impl: bool,
+    skip_keywords: Option<&[&str]>,
 ) -> Result<(ast::Function, Option<ast::MethodSelf>), Diagnostic> {
     if sig.variadic.is_some() {
         bail_span!(sig.variadic, "can't #[wasm_bindgen] variadic functions");
@@ -852,7 +858,7 @@ fn function_from_decl(
     let replace_colliding_arg = |i: &mut syn::PatType| {
         if let syn::Pat::Ident(ref mut i) = *i.pat {
             let ident = i.ident.to_string();
-            if is_js_keyword(ident.as_str()) {
+            if is_js_keyword(ident.as_str(), skip_keywords) {
                 i.ident = Ident::new(format!("_{}", ident).as_str(), i.ident.span());
             }
         }
@@ -889,29 +895,33 @@ fn function_from_decl(
         syn::ReturnType::Type(_, ty) => Some(replace_self(*ty)),
     };
 
-    let (name, name_span, renamed_via_js_name) = if let Some((js_name, js_name_span)) =
-        opts.js_name()
-    {
-        let kind = operation_kind(opts);
-        let prefix = match kind {
-            OperationKind::Setter(_) => "set_",
-            _ => "",
-        };
-        let name = if prefix.is_empty() && opts.method().is_none() && is_js_keyword(js_name) {
-            format!("_{}", js_name)
+    let (name, name_span, renamed_via_js_name) =
+        if let Some((js_name, js_name_span)) = opts.js_name() {
+            let kind = operation_kind(opts);
+            let prefix = match kind {
+                OperationKind::Setter(_) => "set_",
+                _ => "",
+            };
+            let name = if prefix.is_empty()
+                && opts.method().is_none()
+                && is_js_keyword(js_name, skip_keywords)
+            {
+                format!("_{}", js_name)
+            } else {
+                format!("{}{}", prefix, js_name)
+            };
+            (name, js_name_span, true)
         } else {
-            format!("{}{}", prefix, js_name)
-        };
-        (name, js_name_span, true)
-    } else {
-        let name =
-            if !is_from_impl && opts.method().is_none() && is_js_keyword(&decl_name.to_string()) {
+            let name = if !is_from_impl
+                && opts.method().is_none()
+                && is_js_keyword(&decl_name.to_string(), skip_keywords)
+            {
                 format!("_{}", decl_name)
             } else {
                 decl_name.to_string()
             };
-        (name, decl_name.span(), false)
-    };
+            (name, decl_name.span(), false)
+        };
     Ok((
         ast::Function {
             arguments,
@@ -1188,6 +1198,7 @@ impl<'a> MacroParse<&ClassMarker> for &'a mut syn::ImplItemFn {
             true,
             Some(class),
             true,
+            None,
         )?;
         let method_kind = if opts.constructor().is_some() {
             ast::MethodKind::Constructor
diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml
index ae7a3044..46ceac29 100644
--- a/crates/macro/Cargo.toml
+++ b/crates/macro/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-bindgen-macro"
-version = "0.2.90"
+version = "0.2.91"
 authors = ["The wasm-bindgen Developers"]
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro"
@@ -21,11 +21,11 @@ xxx_debug_only_print_generated_code = []
 strict-macro = ["wasm-bindgen-macro-support/strict-macro"]
 
 [dependencies]
-wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.90" }
+wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.91" }
 quote = "1.0"
 
 [dev-dependencies]
 trybuild = "1.0"
-wasm-bindgen = { path = "../..", version = "0.2.90" }
-wasm-bindgen-futures = { path = "../futures", version = "0.4.40" }
-web-sys = { path = "../web-sys", version = "0.3.67", features = ["Worker"] }
+wasm-bindgen = { path = "../..", version = "0.2.91" }
+wasm-bindgen-futures = { path = "../futures", version = "0.4.41" }
+web-sys = { path = "../web-sys", version = "0.3.68", features = ["Worker"] }
diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml
index a03bf6f5..dd6a7a0e 100644
--- a/crates/multi-value-xform/Cargo.toml
+++ b/crates/multi-value-xform/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-bindgen-multi-value-xform"
-version = "0.2.90"
+version = "0.2.91"
 authors = ["The wasm-bindgen Developers"]
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/multi-value-xform"
diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml
index eb2ab22c..a5d90fcd 100644
--- a/crates/shared/Cargo.toml
+++ b/crates/shared/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-bindgen-shared"
-version = "0.2.90"
+version = "0.2.91"
 authors = ["The wasm-bindgen Developers"]
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/shared"
diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml
index 220e8022..e55df83b 100644
--- a/crates/threads-xform/Cargo.toml
+++ b/crates/threads-xform/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-bindgen-threads-xform"
-version = "0.2.90"
+version = "0.2.91"
 authors = ["The wasm-bindgen Developers"]
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/threads-xform"
@@ -15,7 +15,7 @@ rust-version = "1.57"
 [dependencies]
 anyhow = "1.0"
 walrus = "0.20.2"
-wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.90" }
+wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.91" }
 
 [dev-dependencies]
 rayon = "1.0"
diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml
index 234d499f..aee55476 100644
--- a/crates/wasm-conventions/Cargo.toml
+++ b/crates/wasm-conventions/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-bindgen-wasm-conventions"
-version = "0.2.90"
+version = "0.2.91"
 authors = ["The wasm-bindgen developers"]
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-conventions"
diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml
index 94d33d3b..5f53464d 100644
--- a/crates/wasm-interpreter/Cargo.toml
+++ b/crates/wasm-interpreter/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-bindgen-wasm-interpreter"
-version = "0.2.90"
+version = "0.2.91"
 authors = ["The wasm-bindgen Developers"]
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/rustwasm/wasm-bindgen/tree/main/crates/wasm-interpreter"
@@ -16,7 +16,7 @@ rust-version = "1.57"
 anyhow = "1.0"
 log = "0.4"
 walrus = "0.20.2"
-wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.90" }
+wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.91" }
 
 [dev-dependencies]
 tempfile = "3"
diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml
index 55dfc9fc..66ce7b01 100644
--- a/crates/web-sys/Cargo.toml
+++ b/crates/web-sys/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "web-sys"
-version = "0.3.67"
+version = "0.3.68"
 authors = ["The wasm-bindgen Developers"]
 readme = "./README.md"
 homepage = "https://rustwasm.github.io/wasm-bindgen/web-sys/index.html"
@@ -22,12 +22,12 @@ doctest = false
 test = false
 
 [dependencies]
-wasm-bindgen = { path = "../..", version = "0.2.90" }
-js-sys = { path = '../js-sys', version = '0.3.67' }
+wasm-bindgen = { path = "../..", version = "0.2.91" }
+js-sys = { path = '../js-sys', version = '0.3.68' }
 
 [target.'cfg(target_arch = "wasm32")'.dev-dependencies]
-wasm-bindgen-test = { path = '../test', version = '0.3.40' }
-wasm-bindgen-futures = { path = '../futures', version = '0.4.40' }
+wasm-bindgen-test = { path = '../test', version = '0.3.41' }
+wasm-bindgen-futures = { path = '../futures', version = '0.4.41' }
 
 # This list is auto-generated by the wasm-bindgen-webidl program
 [features]
@@ -1102,6 +1102,7 @@ RtcOfferAnswerOptions = []
 RtcOfferOptions = []
 RtcOutboundRtpStreamStats = []
 RtcPeerConnection = ["EventTarget"]
+RtcPeerConnectionIceErrorEvent = ["Event"]
 RtcPeerConnectionIceEvent = ["Event"]
 RtcPeerConnectionIceEventInit = []
 RtcPeerConnectionState = []
diff --git a/crates/web-sys/src/features/gen_RtcPeerConnectionIceErrorEvent.rs b/crates/web-sys/src/features/gen_RtcPeerConnectionIceErrorEvent.rs
new file mode 100644
index 00000000..fd0fc4a2
--- /dev/null
+++ b/crates/web-sys/src/features/gen_RtcPeerConnectionIceErrorEvent.rs
@@ -0,0 +1,50 @@
+#![allow(unused_imports)]
+#![allow(clippy::all)]
+use super::*;
+use wasm_bindgen::prelude::*;
+#[wasm_bindgen]
+extern "C" {
+    # [wasm_bindgen (extends = Event , extends = :: js_sys :: Object , js_name = RTCPeerConnectionIceErrorEvent , typescript_type = "RTCPeerConnectionIceErrorEvent")]
+    #[derive(Debug, Clone, PartialEq, Eq)]
+    #[doc = "The `RtcPeerConnectionIceErrorEvent` class."]
+    #[doc = ""]
+    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnectionIceErrorEvent)"]
+    #[doc = ""]
+    #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceErrorEvent`*"]
+    pub type RtcPeerConnectionIceErrorEvent;
+    # [wasm_bindgen (structural , method , getter , js_class = "RTCPeerConnectionIceErrorEvent" , js_name = address)]
+    #[doc = "Getter for the `address` field of this object."]
+    #[doc = ""]
+    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnectionIceErrorEvent/address)"]
+    #[doc = ""]
+    #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceErrorEvent`*"]
+    pub fn address(this: &RtcPeerConnectionIceErrorEvent) -> Option<String>;
+    # [wasm_bindgen (structural , method , getter , js_class = "RTCPeerConnectionIceErrorEvent" , js_name = port)]
+    #[doc = "Getter for the `port` field of this object."]
+    #[doc = ""]
+    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnectionIceErrorEvent/port)"]
+    #[doc = ""]
+    #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceErrorEvent`*"]
+    pub fn port(this: &RtcPeerConnectionIceErrorEvent) -> Option<u16>;
+    # [wasm_bindgen (structural , method , getter , js_class = "RTCPeerConnectionIceErrorEvent" , js_name = url)]
+    #[doc = "Getter for the `url` field of this object."]
+    #[doc = ""]
+    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnectionIceErrorEvent/url)"]
+    #[doc = ""]
+    #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceErrorEvent`*"]
+    pub fn url(this: &RtcPeerConnectionIceErrorEvent) -> String;
+    # [wasm_bindgen (structural , method , getter , js_class = "RTCPeerConnectionIceErrorEvent" , js_name = errorCode)]
+    #[doc = "Getter for the `errorCode` field of this object."]
+    #[doc = ""]
+    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnectionIceErrorEvent/errorCode)"]
+    #[doc = ""]
+    #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceErrorEvent`*"]
+    pub fn error_code(this: &RtcPeerConnectionIceErrorEvent) -> u16;
+    # [wasm_bindgen (structural , method , getter , js_class = "RTCPeerConnectionIceErrorEvent" , js_name = errorText)]
+    #[doc = "Getter for the `errorText` field of this object."]
+    #[doc = ""]
+    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnectionIceErrorEvent/errorText)"]
+    #[doc = ""]
+    #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceErrorEvent`*"]
+    pub fn error_text(this: &RtcPeerConnectionIceErrorEvent) -> String;
+}
diff --git a/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs b/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs
index a872f8a3..4bafe390 100644
--- a/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs
+++ b/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs
@@ -128,6 +128,27 @@ impl RtcRtpEncodingParameters {
         let _ = r;
         self
     }
+    #[cfg(web_sys_unstable_apis)]
+    #[doc = "Change the `scalabilityMode` field of this object."]
+    #[doc = ""]
+    #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"]
+    #[doc = ""]
+    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
+    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
+    pub fn scalability_mode(&mut self, val: &str) -> &mut Self {
+        use wasm_bindgen::JsValue;
+        let r = ::js_sys::Reflect::set(
+            self.as_ref(),
+            &JsValue::from("scalabilityMode"),
+            &JsValue::from(val),
+        );
+        debug_assert!(
+            r.is_ok(),
+            "setting properties should never fail on our dictionary objects"
+        );
+        let _ = r;
+        self
+    }
     #[doc = "Change the `scaleResolutionDownBy` field of this object."]
     #[doc = ""]
     #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"]
diff --git a/crates/web-sys/src/features/gen_RtcRtpTransceiver.rs b/crates/web-sys/src/features/gen_RtcRtpTransceiver.rs
index 98be3953..8b8fca69 100644
--- a/crates/web-sys/src/features/gen_RtcRtpTransceiver.rs
+++ b/crates/web-sys/src/features/gen_RtcRtpTransceiver.rs
@@ -73,6 +73,13 @@ extern "C" {
     #[doc = ""]
     #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiver`*"]
     pub fn get_remote_track_id(this: &RtcRtpTransceiver) -> String;
+    # [wasm_bindgen (method , structural , js_class = "RTCRtpTransceiver" , js_name = setCodecPreferences)]
+    #[doc = "The `setCodecPreferences()` method."]
+    #[doc = ""]
+    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpTransceiver/setCodecPreferences)"]
+    #[doc = ""]
+    #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiver`*"]
+    pub fn set_codec_preferences(this: &RtcRtpTransceiver, codecs: &::wasm_bindgen::JsValue);
     # [wasm_bindgen (method , structural , js_class = "RTCRtpTransceiver" , js_name = stop)]
     #[doc = "The `stop()` method."]
     #[doc = ""]
diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs
index c3bb7d92..9e5d5156 100644
--- a/crates/web-sys/src/features/mod.rs
+++ b/crates/web-sys/src/features/mod.rs
@@ -7495,6 +7495,13 @@ mod gen_RtcPeerConnection;
 #[allow(unused_imports)]
 pub use gen_RtcPeerConnection::*;
 
+#[cfg(feature = "RtcPeerConnectionIceErrorEvent")]
+#[allow(non_snake_case)]
+mod gen_RtcPeerConnectionIceErrorEvent;
+#[cfg(feature = "RtcPeerConnectionIceErrorEvent")]
+#[allow(unused_imports)]
+pub use gen_RtcPeerConnectionIceErrorEvent::*;
+
 #[cfg(feature = "RtcPeerConnectionIceEvent")]
 #[allow(non_snake_case)]
 mod gen_RtcPeerConnectionIceEvent;
diff --git a/crates/web-sys/webidls/enabled/RTCPeerConnectionIceErrorEvent.webidl b/crates/web-sys/webidls/enabled/RTCPeerConnectionIceErrorEvent.webidl
new file mode 100644
index 00000000..91e148ca
--- /dev/null
+++ b/crates/web-sys/webidls/enabled/RTCPeerConnectionIceErrorEvent.webidl
@@ -0,0 +1,18 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * The origin of this IDL file is
+ * https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnectioniceerrorevent
+ */
+
+[Exposed=Window]
+interface RTCPeerConnectionIceErrorEvent : Event {
+  constructor(DOMString type, RTCPeerConnectionIceErrorEventInit eventInitDict);
+  readonly attribute DOMString? address;
+  readonly attribute unsigned short? port;
+  readonly attribute DOMString url;
+  readonly attribute unsigned short errorCode;
+  readonly attribute USVString errorText;
+};
diff --git a/crates/web-sys/webidls/enabled/RTCRtpTransceiver.webidl b/crates/web-sys/webidls/enabled/RTCRtpTransceiver.webidl
index fb8d594d..4c89a032 100644
--- a/crates/web-sys/webidls/enabled/RTCRtpTransceiver.webidl
+++ b/crates/web-sys/webidls/enabled/RTCRtpTransceiver.webidl
@@ -33,8 +33,7 @@ interface RTCRtpTransceiver {
     readonly attribute RTCRtpTransceiverDirection? currentDirection;
 
     undefined stop();
-    // TODO: bug 1396922
-    // undefined setCodecPreferences(sequence<RTCRtpCodecCapability> codecs);
+    undefined setCodecPreferences(sequence<RTCRtpCodecCapability> codecs);
 
     [ChromeOnly]
     undefined setRemoteTrackId(DOMString trackId);
diff --git a/crates/web-sys/webidls/unstable/RTCRtpSender.webidl b/crates/web-sys/webidls/unstable/RTCRtpSender.webidl
new file mode 100644
index 00000000..b1b5eb39
--- /dev/null
+++ b/crates/web-sys/webidls/unstable/RTCRtpSender.webidl
@@ -0,0 +1,3 @@
+partial dictionary RTCRtpEncodingParameters {
+    DOMString scalabilityMode;
+};
diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml
index b5183178..d004298a 100644
--- a/crates/webidl/Cargo.toml
+++ b/crates/webidl/Cargo.toml
@@ -21,7 +21,7 @@ log = "0.4.1"
 proc-macro2 = "1.0"
 quote = '1.0'
 syn = { version = '2.0', features = ['full'] }
-wasm-bindgen-backend = { version = "=0.2.90", path = "../backend" }
+wasm-bindgen-backend = { version = "=0.2.91", path = "../backend" }
 weedle = { git = "https://github.com/rustwasm/weedle.git" }
 once_cell = "1.12"
 sourcefile = "0.1"
diff --git a/examples/add/Cargo.toml b/examples/add/Cargo.toml
index 41b63590..cdeabc31 100644
--- a/examples/add/Cargo.toml
+++ b/examples/add/Cargo.toml
@@ -9,4 +9,4 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
+wasm-bindgen = "0.2.91"
diff --git a/examples/canvas/Cargo.toml b/examples/canvas/Cargo.toml
index e1afecc8..d0088cc3 100644
--- a/examples/canvas/Cargo.toml
+++ b/examples/canvas/Cargo.toml
@@ -9,8 +9,8 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-js-sys = "0.3.67"
-wasm-bindgen = "0.2.90"
+js-sys = "0.3.68"
+wasm-bindgen = "0.2.91"
 
 [dependencies.web-sys]
 version = "0.3.4"
diff --git a/examples/char/Cargo.toml b/examples/char/Cargo.toml
index 6f61f63f..c8489529 100644
--- a/examples/char/Cargo.toml
+++ b/examples/char/Cargo.toml
@@ -9,4 +9,4 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
+wasm-bindgen = "0.2.91"
diff --git a/examples/closures/Cargo.toml b/examples/closures/Cargo.toml
index 6e37abd8..1021f1a3 100644
--- a/examples/closures/Cargo.toml
+++ b/examples/closures/Cargo.toml
@@ -9,8 +9,8 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
-js-sys = "0.3.67"
+wasm-bindgen = "0.2.91"
+js-sys = "0.3.68"
 
 [dependencies.web-sys]
 version = "0.3.4"
diff --git a/examples/console_log/Cargo.toml b/examples/console_log/Cargo.toml
index c1ee13c3..64f59399 100644
--- a/examples/console_log/Cargo.toml
+++ b/examples/console_log/Cargo.toml
@@ -9,5 +9,5 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
-web-sys = { version = "0.3.67", features = ['console'] }
+wasm-bindgen = "0.2.91"
+web-sys = { version = "0.3.68", features = ['console'] }
diff --git a/examples/deno/Cargo.toml b/examples/deno/Cargo.toml
index 37c91692..d2a17d0d 100644
--- a/examples/deno/Cargo.toml
+++ b/examples/deno/Cargo.toml
@@ -9,4 +9,4 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
+wasm-bindgen = "0.2.91"
diff --git a/examples/dom/Cargo.toml b/examples/dom/Cargo.toml
index f559e374..4556a2c7 100644
--- a/examples/dom/Cargo.toml
+++ b/examples/dom/Cargo.toml
@@ -9,7 +9,7 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
+wasm-bindgen = "0.2.91"
 
 [dependencies.web-sys]
 version = "0.3.4"
diff --git a/examples/duck-typed-interfaces/Cargo.toml b/examples/duck-typed-interfaces/Cargo.toml
index 9d58b57d..c5f6b1d6 100644
--- a/examples/duck-typed-interfaces/Cargo.toml
+++ b/examples/duck-typed-interfaces/Cargo.toml
@@ -9,4 +9,4 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
+wasm-bindgen = "0.2.91"
diff --git a/examples/fetch/Cargo.toml b/examples/fetch/Cargo.toml
index f7ff31cf..0f6e7468 100644
--- a/examples/fetch/Cargo.toml
+++ b/examples/fetch/Cargo.toml
@@ -9,9 +9,9 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
-js-sys = "0.3.67"
-wasm-bindgen-futures = "0.4.40"
+wasm-bindgen = "0.2.91"
+js-sys = "0.3.68"
+wasm-bindgen-futures = "0.4.41"
 
 [dependencies.web-sys]
 version = "0.3.4"
diff --git a/examples/guide-supported-types-examples/Cargo.toml b/examples/guide-supported-types-examples/Cargo.toml
index 1a065849..c6126275 100644
--- a/examples/guide-supported-types-examples/Cargo.toml
+++ b/examples/guide-supported-types-examples/Cargo.toml
@@ -9,5 +9,5 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
-js-sys = "0.3.67"
+wasm-bindgen = "0.2.91"
+js-sys = "0.3.68"
diff --git a/examples/hello_world/Cargo.toml b/examples/hello_world/Cargo.toml
index 64d83ba5..5ea4ba06 100644
--- a/examples/hello_world/Cargo.toml
+++ b/examples/hello_world/Cargo.toml
@@ -9,4 +9,4 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
+wasm-bindgen = "0.2.91"
diff --git a/examples/import_js/crate/Cargo.toml b/examples/import_js/crate/Cargo.toml
index 599ac181..cd87a9b8 100644
--- a/examples/import_js/crate/Cargo.toml
+++ b/examples/import_js/crate/Cargo.toml
@@ -8,4 +8,4 @@ edition = "2018"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
+wasm-bindgen = "0.2.91"
diff --git a/examples/julia_set/Cargo.toml b/examples/julia_set/Cargo.toml
index 9a54e10e..e16590c3 100644
--- a/examples/julia_set/Cargo.toml
+++ b/examples/julia_set/Cargo.toml
@@ -9,7 +9,7 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
+wasm-bindgen = "0.2.91"
 
 [dependencies.web-sys]
 version = "0.3.4"
diff --git a/examples/paint/Cargo.toml b/examples/paint/Cargo.toml
index 1786bdaf..e4a108d5 100644
--- a/examples/paint/Cargo.toml
+++ b/examples/paint/Cargo.toml
@@ -9,8 +9,8 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-js-sys = "0.3.67"
-wasm-bindgen = "0.2.90"
+js-sys = "0.3.68"
+wasm-bindgen = "0.2.91"
 
 [dependencies.web-sys]
 version = "0.3.4"
diff --git a/examples/performance/Cargo.toml b/examples/performance/Cargo.toml
index 38c62cd0..46aa55a1 100644
--- a/examples/performance/Cargo.toml
+++ b/examples/performance/Cargo.toml
@@ -9,7 +9,7 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
+wasm-bindgen = "0.2.91"
 humantime = "2"
 
 [dependencies.web-sys]
diff --git a/examples/raytrace-parallel/Cargo.toml b/examples/raytrace-parallel/Cargo.toml
index 2b8ff0b8..ebdf77b6 100644
--- a/examples/raytrace-parallel/Cargo.toml
+++ b/examples/raytrace-parallel/Cargo.toml
@@ -10,14 +10,14 @@ crate-type = ["cdylib"]
 
 [dependencies]
 console_error_panic_hook = "0.1"
-js-sys = "0.3.67"
+js-sys = "0.3.68"
 rayon = "1.1.0"
 rayon-core = "1.5.0"
 raytracer = { git = 'https://github.com/alexcrichton/raytracer', branch = 'update-deps' }
 serde-wasm-bindgen = "0.4.3"
 futures-channel-preview = "0.3.0-alpha.18"
-wasm-bindgen = "0.2.90"
-wasm-bindgen-futures = "0.4.40"
+wasm-bindgen = "0.2.91"
+wasm-bindgen-futures = "0.4.41"
 
 [dependencies.web-sys]
 version = "0.3.23"
diff --git a/examples/request-animation-frame/Cargo.toml b/examples/request-animation-frame/Cargo.toml
index f0455d24..69a7ace5 100644
--- a/examples/request-animation-frame/Cargo.toml
+++ b/examples/request-animation-frame/Cargo.toml
@@ -9,7 +9,7 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
+wasm-bindgen = "0.2.91"
 
 [dependencies.web-sys]
 version = "0.3.4"
diff --git a/examples/synchronous-instantiation/Cargo.toml b/examples/synchronous-instantiation/Cargo.toml
index db5a4a73..bdf4115e 100644
--- a/examples/synchronous-instantiation/Cargo.toml
+++ b/examples/synchronous-instantiation/Cargo.toml
@@ -9,4 +9,4 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
+wasm-bindgen = "0.2.91"
diff --git a/examples/todomvc/Cargo.toml b/examples/todomvc/Cargo.toml
index ce7a6bd3..e8966679 100644
--- a/examples/todomvc/Cargo.toml
+++ b/examples/todomvc/Cargo.toml
@@ -12,8 +12,8 @@ crate-type = ["cdylib"]
 askama = "0.10.0"
 
 [dependencies]
-js-sys = "0.3.67"
-wasm-bindgen = "0.2.90"
+js-sys = "0.3.68"
+wasm-bindgen = "0.2.91"
 askama = "0.10.0"
 console_error_panic_hook = "0.1.5"
 
diff --git a/examples/wasm-audio-worklet/Cargo.toml b/examples/wasm-audio-worklet/Cargo.toml
index d9575a9d..1bcbe841 100644
--- a/examples/wasm-audio-worklet/Cargo.toml
+++ b/examples/wasm-audio-worklet/Cargo.toml
@@ -9,9 +9,9 @@ crate-type = ["cdylib"]
 
 [dependencies]
 console_log = "0.2.0"
-js-sys = "0.3.67"
-wasm-bindgen = "0.2.90"
-wasm-bindgen-futures = "0.4.40"
+js-sys = "0.3.68"
+wasm-bindgen = "0.2.91"
+wasm-bindgen-futures = "0.4.41"
 
 [dependencies.web-sys]
 version = "0.3.59"
diff --git a/examples/wasm-in-wasm-imports/Cargo.toml b/examples/wasm-in-wasm-imports/Cargo.toml
index efdab879..5431abe2 100644
--- a/examples/wasm-in-wasm-imports/Cargo.toml
+++ b/examples/wasm-in-wasm-imports/Cargo.toml
@@ -9,6 +9,6 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
-js-sys = "0.3.67"
-wasm-bindgen-futures = "0.4.40"
+wasm-bindgen = "0.2.91"
+js-sys = "0.3.68"
+wasm-bindgen-futures = "0.4.41"
diff --git a/examples/wasm-in-wasm/Cargo.toml b/examples/wasm-in-wasm/Cargo.toml
index 13a307d5..b2a8e483 100644
--- a/examples/wasm-in-wasm/Cargo.toml
+++ b/examples/wasm-in-wasm/Cargo.toml
@@ -9,6 +9,6 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
-js-sys = "0.3.67"
-wasm-bindgen-futures = "0.4.40"
+wasm-bindgen = "0.2.91"
+js-sys = "0.3.68"
+wasm-bindgen-futures = "0.4.41"
diff --git a/examples/wasm-in-web-worker/Cargo.toml b/examples/wasm-in-web-worker/Cargo.toml
index 25769363..8314c662 100644
--- a/examples/wasm-in-web-worker/Cargo.toml
+++ b/examples/wasm-in-web-worker/Cargo.toml
@@ -9,7 +9,7 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
+wasm-bindgen = "0.2.91"
 console_error_panic_hook = { version = "0.1.6", optional = true }
 
 [dependencies.web-sys]
diff --git a/examples/wasm2js/Cargo.toml b/examples/wasm2js/Cargo.toml
index 29e8eef3..d36f812d 100644
--- a/examples/wasm2js/Cargo.toml
+++ b/examples/wasm2js/Cargo.toml
@@ -9,4 +9,4 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
+wasm-bindgen = "0.2.91"
diff --git a/examples/weather_report/Cargo.toml b/examples/weather_report/Cargo.toml
index 1e76e800..628c24be 100644
--- a/examples/weather_report/Cargo.toml
+++ b/examples/weather_report/Cargo.toml
@@ -16,7 +16,7 @@ chrono = "0.4.11"
 reqwest = "0.10.6"
 wasm-bindgen-futures = "0.4.1"
 json= "*"
-wasm-bindgen = "0.2.90"
+wasm-bindgen = "0.2.91"
 gloo = "0.2.1"
 
 [dependencies.web-sys]
diff --git a/examples/webaudio/Cargo.toml b/examples/webaudio/Cargo.toml
index 03b440dc..a4968185 100644
--- a/examples/webaudio/Cargo.toml
+++ b/examples/webaudio/Cargo.toml
@@ -9,7 +9,7 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
+wasm-bindgen = "0.2.91"
 
 [dependencies.web-sys]
 version = "0.3.4"
diff --git a/examples/webgl/Cargo.toml b/examples/webgl/Cargo.toml
index bab7b4cf..c1452b37 100644
--- a/examples/webgl/Cargo.toml
+++ b/examples/webgl/Cargo.toml
@@ -9,8 +9,8 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-js-sys = "0.3.67"
-wasm-bindgen = "0.2.90"
+js-sys = "0.3.68"
+wasm-bindgen = "0.2.91"
 
 [dependencies.web-sys]
 version = "0.3.4"
diff --git a/examples/webrtc_datachannel/Cargo.toml b/examples/webrtc_datachannel/Cargo.toml
index 7f7fbca4..32fcd5dd 100644
--- a/examples/webrtc_datachannel/Cargo.toml
+++ b/examples/webrtc_datachannel/Cargo.toml
@@ -9,9 +9,9 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
+wasm-bindgen = "0.2.91"
 js-sys = "0.3"
-wasm-bindgen-futures = "0.4.40"
+wasm-bindgen-futures = "0.4.41"
 
 [dependencies.web-sys]
 version = "0.3.22"
diff --git a/examples/websockets/Cargo.toml b/examples/websockets/Cargo.toml
index 0cfd4214..97f537d4 100644
--- a/examples/websockets/Cargo.toml
+++ b/examples/websockets/Cargo.toml
@@ -9,7 +9,7 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
+wasm-bindgen = "0.2.91"
 js-sys = "0.3"
 
 [dependencies.web-sys]
diff --git a/examples/webxr/Cargo.toml b/examples/webxr/Cargo.toml
index c934e4c8..1ed18c40 100644
--- a/examples/webxr/Cargo.toml
+++ b/examples/webxr/Cargo.toml
@@ -10,9 +10,9 @@ crate-type = ["cdylib"]
 
 [dependencies]
 futures = "0.3.4"
-js-sys = "0.3.67"
-wasm-bindgen = "0.2.90"
-wasm-bindgen-futures = "0.4.40"
+js-sys = "0.3.68"
+wasm-bindgen = "0.2.91"
+wasm-bindgen-futures = "0.4.41"
 
 [dependencies.web-sys]
 version = "0.3.37"
diff --git a/examples/without-a-bundler/Cargo.toml b/examples/without-a-bundler/Cargo.toml
index 3d7a30ba..b55ed461 100644
--- a/examples/without-a-bundler/Cargo.toml
+++ b/examples/without-a-bundler/Cargo.toml
@@ -9,7 +9,7 @@ rust-version = "1.57"
 crate-type = ["cdylib"]
 
 [dependencies]
-wasm-bindgen = "0.2.90"
+wasm-bindgen = "0.2.91"
 
 [dependencies.web-sys]
 version = "0.3.4"
diff --git a/guide/src/reference/cli.md b/guide/src/reference/cli.md
index 0d66d5cd..f7377ae7 100644
--- a/guide/src/reference/cli.md
+++ b/guide/src/reference/cli.md
@@ -84,15 +84,6 @@ When generating bundler-compatible code (see the section on [deployment]) this
 indicates that the bundled code is always intended to go into a browser so a few
 checks for Node.js can be elided.
 
-### `--weak-refs`
-
-Enables usage of the [TC39 Weak References
-proposal](https://github.com/tc39/proposal-weakrefs), ensuring that all Rust
-memory is eventually deallocated regardless of whether you're calling `free` or
-not. This is off-by-default while we're waiting for support to percolate into
-all major browsers. For more information see the [documentation about weak
-references](./weak-references.md).
-
 ### `--reference-types`
 
 Enables usage of the [WebAssembly References Types
diff --git a/guide/src/reference/weak-references.md b/guide/src/reference/weak-references.md
index 00e7fc32..5e3cfa92 100644
--- a/guide/src/reference/weak-references.md
+++ b/guide/src/reference/weak-references.md
@@ -1,9 +1,8 @@
 # Support for Weak References
 
-By default wasm-bindgen does not use the [TC39 weak references
-proposal](https://github.com/tc39/proposal-weakrefs). This proposal just
-advanced to stage 4 at the time of this writing, but it will still stake some
-time for support to percolate into all the major browsers.
+By default wasm-bindgen does use the [TC39 weak references
+proposal](https://github.com/tc39/proposal-weakrefs) if support is detected.
+At the time of this writing all major browsers do support it.
 
 Without weak references your JS integration may be susceptible to memory leaks
 in Rust, for example:
@@ -15,9 +14,8 @@ in Rust, for example:
 * Rust closures have `Closure::{into_js_value,forget}` methods which explicitly
   do not free the underlying memory.
 
-These issues are all solved with the weak references proposal in JS. The
-`--weak-refs` flag to the `wasm-bindgen` CLI will enable usage of
-`FinalizationRegistry` to ensure that all memory is cleaned up, regardless of
+These issues are all solved with the weak references proposal in JS.
+`FinalizationRegistry` will ensure that all memory is cleaned up, regardless of
 whether it's explicitly deallocated or not. Note that explicit deallocation
 is always a possibility and supported, but if it's not called then memory will
-still be automatically deallocated with the `--weak-refs` flag.
+still be automatically deallocated if `FinalizationRegistry` support is detected.
diff --git a/src/closure.rs b/src/closure.rs
index 319f4c63..430cee5d 100644
--- a/src/closure.rs
+++ b/src/closure.rs
@@ -356,16 +356,12 @@ where
     /// lifetime dynamically managed by the JS GC. This function can be used
     /// to drop this `Closure` while keeping the associated JS function still
     /// valid.
-    ///
-    /// By default this function will leak memory. This can be dangerous if this
-    /// function is called many times in an application because the memory leak
-    /// will overwhelm the page quickly and crash the wasm.
-    ///
-    /// If the browser, however, supports weak references, then this function
-    /// will not leak memory. Instead the Rust memory will be reclaimed when the
-    /// JS closure is GC'd. Weak references are not enabled by default since
-    /// they're still a proposal for the JS standard. They can be enabled with
-    /// `WASM_BINDGEN_WEAKREF=1` when running `wasm-bindgen`, however.
+    /// 
+    /// If the platform supports weak references, the Rust memory will be
+    /// reclaimed when the JS closure is GC'd. If weak references is not
+    /// supported, this can be dangerous if this function is called many times
+    /// in an application because the memory leak will overwhelm the page
+    /// quickly and crash the wasm.
     pub fn into_js_value(self) -> JsValue {
         let idx = self.js.idx;
         mem::forget(self);


Test patch:
diff --git a/crates/cli/tests/reference/builder.js b/crates/cli/tests/reference/builder.js
index 3402667d..6db7eb3f 100644
--- a/crates/cli/tests/reference/builder.js
+++ b/crates/cli/tests/reference/builder.js
@@ -23,6 +23,10 @@ function getStringFromWasm0(ptr, len) {
     ptr = ptr >>> 0;
     return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
 }
+
+const ClassBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
+    ? { register: () => {}, unregister: () => {} }
+    : new FinalizationRegistry(ptr => wasm.__wbg_classbuilder_free(ptr >>> 0));
 /**
 */
 export class ClassBuilder {
@@ -31,14 +35,14 @@ export class ClassBuilder {
         ptr = ptr >>> 0;
         const obj = Object.create(ClassBuilder.prototype);
         obj.__wbg_ptr = ptr;
-
+        ClassBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
         return obj;
     }
 
     __destroy_into_raw() {
         const ptr = this.__wbg_ptr;
         this.__wbg_ptr = 0;
-
+        ClassBuilderFinalization.unregister(this);
         return ptr;
     }
 
diff --git a/crates/cli/tests/reference/constructor.js b/crates/cli/tests/reference/constructor.js
index 1973256e..a485efbe 100644
--- a/crates/cli/tests/reference/constructor.js
+++ b/crates/cli/tests/reference/constructor.js
@@ -23,6 +23,10 @@ function getStringFromWasm0(ptr, len) {
     ptr = ptr >>> 0;
     return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
 }
+
+const ClassConstructorFinalization = (typeof FinalizationRegistry === 'undefined')
+    ? { register: () => {}, unregister: () => {} }
+    : new FinalizationRegistry(ptr => wasm.__wbg_classconstructor_free(ptr >>> 0));
 /**
 */
 export class ClassConstructor {
@@ -30,7 +34,7 @@ export class ClassConstructor {
     __destroy_into_raw() {
         const ptr = this.__wbg_ptr;
         this.__wbg_ptr = 0;
-
+        ClassConstructorFinalization.unregister(this);
         return ptr;
     }
 
diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml
index 0acca18e..4dccf097 100644
--- a/crates/test-macro/Cargo.toml
+++ b/crates/test-macro/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-bindgen-test-macro"
-version = "0.3.40"
+version = "0.3.41"
 authors = ["The wasm-bindgen Developers"]
 description = "Internal testing macro for wasm-bindgen"
 license = "MIT OR Apache-2.0"
diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml
index 51c1a59c..d7f5dc07 100644
--- a/crates/test/Cargo.toml
+++ b/crates/test/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-bindgen-test"
-version = "0.3.40"
+version = "0.3.41"
 authors = ["The wasm-bindgen Developers"]
 description = "Internal testing crate for wasm-bindgen"
 license = "MIT OR Apache-2.0"
@@ -10,11 +10,11 @@ rust-version = "1.57"
 
 [dependencies]
 console_error_panic_hook = '0.1'
-js-sys = { path = '../js-sys', version = '0.3.67' }
+js-sys = { path = '../js-sys', version = '0.3.68' }
 scoped-tls = "1.0"
-wasm-bindgen = { path = '../..', version = '0.2.90' }
-wasm-bindgen-futures = { path = '../futures', version = '0.4.40' }
-wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.40' }
+wasm-bindgen = { path = '../..', version = '0.2.91' }
+wasm-bindgen-futures = { path = '../futures', version = '0.4.41' }
+wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.41' }
 gg-alloc = { version = "1.0", optional = true }
 
 [lib]
diff --git a/crates/typescript-tests/jest.config.cjs b/crates/typescript-tests/jest.config.cjs
index c63e1456..2db7cd71 100644
--- a/crates/typescript-tests/jest.config.cjs
+++ b/crates/typescript-tests/jest.config.cjs
@@ -4,8 +4,21 @@ module.exports = {
   testEnvironment: 'node',
   extensionsToTreatAsEsm: [".ts"],
   verbose: true,
-  // TODO: match all test files
-  testMatch: ['**/src/simple_struct.ts', '**/src/typescript_type.ts'],
+  testMatch: ['**/src/*.ts'],
+  // TODO: migrate all test files and remove this
+  testPathIgnorePatterns: [
+    ".*/src/custom_section.ts$",
+    ".*/src/getters_setters.ts$",
+    ".*/src/inspectable.ts$",
+    ".*/src/memory.ts$",
+    ".*/src/omit_definition.ts$",
+    ".*/src/optional_fields.ts$",
+    ".*/src/opt_args_and_ret.ts$",
+    ".*/src/simple_async_fn.ts$",
+    ".*/src/simple_fn.ts$",
+    ".*/src/web_sys.ts$",
+    ".*/src/usize.ts$"
+  ],
   injectGlobals: false,
   globals: {
     'ts-jest':
diff --git a/crates/typescript-tests/src/enums.ts b/crates/typescript-tests/src/enums.ts
index ea246fc8..595586be 100644
--- a/crates/typescript-tests/src/enums.ts
+++ b/crates/typescript-tests/src/enums.ts
@@ -1,13 +1,28 @@
-import * as wbg from '../pkg/typescript_tests';
-
-const a1: wbg.Foo = wbg.Foo.A;
-const a2: wbg.Foo.A = wbg.Foo.A;
-const a3: wbg.Foo.A = 1;
-const b1: wbg.Foo = wbg.Foo.B;
-const b2: wbg.Foo.B = wbg.Foo.B;
-const b3: wbg.Foo.B = 3;
-
-const fn_expects_enum: (_: wbg.Foo) => void = wbg.fn_expects_enum;
-const fn_returns_enum: () => wbg.Foo = wbg.fn_returns_enum;
-const fn_expects_option_enum: (_?: wbg.Foo) => void = wbg.fn_expects_option_enum;
-const fn_returns_option_enum: () => wbg.Foo | undefined = wbg.fn_returns_option_enum;
+import * as wbg from "../pkg/typescript_tests";
+import { expect, jest, test } from "@jest/globals";
+
+test("construction", () => {
+  const a1: wbg.Foo = wbg.Foo.A;
+  const a2: wbg.Foo.A = wbg.Foo.A;
+  expect(a1).toStrictEqual(a2);
+  const a3: wbg.Foo.A = 1;
+  expect(a1).toStrictEqual(a3);
+
+  const b1: wbg.Foo = wbg.Foo.B;
+  const b2: wbg.Foo.B = wbg.Foo.B;
+  expect(b1).toStrictEqual(b2);
+  const b3: wbg.Foo.B = 3;
+  expect(b1).toStrictEqual(b3);
+  expect(a1).not.toStrictEqual(b1);
+});
+
+test("function calls", () => {
+  const fn_expects_enum: (_: wbg.Foo) => void = wbg.fn_expects_enum;
+  const fn_returns_enum: () => wbg.Foo = wbg.fn_returns_enum;
+  const fn_expects_option_enum: (_?: wbg.Foo) => void = wbg.fn_expects_option_enum;
+  const fn_returns_option_enum: () => wbg.Foo | undefined = wbg.fn_returns_option_enum;
+
+  fn_expects_enum(wbg.Foo.B);
+  expect(fn_returns_enum()).toStrictEqual(wbg.Foo.A);
+  expect(fn_returns_option_enum()).toStrictEqual(wbg.Foo.A);
+});