Skip to content

Annotate methods in WebCodecs that throw #3970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
* Use `table.fill` when appropriate.
[#3446](https://github.com/rustwasm/wasm-bindgen/pull/3446)

* Annotated methods in WebCodecs that throw.
[#3970](https://github.com/rustwasm/wasm-bindgen/pull/3970)

### Fixed

* Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`.
Expand Down
19 changes: 11 additions & 8 deletions crates/web-sys/src/features/gen_AudioData.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ extern "C" {
pub fn new(init: &AudioDataInit) -> Result<AudioData, JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "AudioDataCopyToOptions")]
# [wasm_bindgen (method , structural , js_class = "AudioData" , js_name = allocationSize)]
# [wasm_bindgen (catch , method , structural , js_class = "AudioData" , js_name = allocationSize)]
#[doc = "The `allocationSize()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioData/allocationSize)"]
Expand All @@ -106,9 +106,12 @@ extern "C" {
#[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 allocation_size(this: &AudioData, options: &AudioDataCopyToOptions) -> u32;
pub fn allocation_size(
this: &AudioData,
options: &AudioDataCopyToOptions,
) -> Result<u32, JsValue>;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "AudioData" , js_name = clone)]
# [wasm_bindgen (catch , method , structural , js_class = "AudioData" , js_name = clone)]
#[doc = "The `clone()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioData/clone)"]
Expand All @@ -117,7 +120,7 @@ extern "C" {
#[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 clone(this: &AudioData) -> AudioData;
pub fn clone(this: &AudioData) -> Result<AudioData, JsValue>;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "AudioData" , js_name = close)]
#[doc = "The `close()` method."]
Expand All @@ -131,7 +134,7 @@ extern "C" {
pub fn close(this: &AudioData);
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "AudioDataCopyToOptions")]
# [wasm_bindgen (method , structural , js_class = "AudioData" , js_name = copyTo)]
# [wasm_bindgen (catch , method , structural , js_class = "AudioData" , js_name = copyTo)]
#[doc = "The `copyTo()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioData/copyTo)"]
Expand All @@ -144,10 +147,10 @@ extern "C" {
this: &AudioData,
destination: &::js_sys::Object,
options: &AudioDataCopyToOptions,
);
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "AudioDataCopyToOptions")]
# [wasm_bindgen (method , structural , js_class = "AudioData" , js_name = copyTo)]
# [wasm_bindgen (catch , method , structural , js_class = "AudioData" , js_name = copyTo)]
#[doc = "The `copyTo()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioData/copyTo)"]
Expand All @@ -160,5 +163,5 @@ extern "C" {
this: &AudioData,
destination: &mut [u8],
options: &AudioDataCopyToOptions,
);
) -> Result<(), JsValue>;
}
16 changes: 8 additions & 8 deletions crates/web-sys/src/features/gen_AudioDecoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extern "C" {
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn new(init: &AudioDecoderInit) -> Result<AudioDecoder, JsValue>;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "AudioDecoder" , js_name = close)]
# [wasm_bindgen (catch , method , structural , js_class = "AudioDecoder" , js_name = close)]
#[doc = "The `close()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioDecoder/close)"]
Expand All @@ -61,10 +61,10 @@ extern "C" {
#[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 close(this: &AudioDecoder);
pub fn close(this: &AudioDecoder) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "AudioDecoderConfig")]
# [wasm_bindgen (method , structural , js_class = "AudioDecoder" , js_name = configure)]
# [wasm_bindgen (catch , method , structural , js_class = "AudioDecoder" , js_name = configure)]
#[doc = "The `configure()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioDecoder/configure)"]
Expand All @@ -73,10 +73,10 @@ extern "C" {
#[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 configure(this: &AudioDecoder, config: &AudioDecoderConfig);
pub fn configure(this: &AudioDecoder, config: &AudioDecoderConfig) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "EncodedAudioChunk")]
# [wasm_bindgen (method , structural , js_class = "AudioDecoder" , js_name = decode)]
# [wasm_bindgen (catch , method , structural , js_class = "AudioDecoder" , js_name = decode)]
#[doc = "The `decode()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioDecoder/decode)"]
Expand All @@ -85,7 +85,7 @@ extern "C" {
#[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 decode(this: &AudioDecoder, chunk: &EncodedAudioChunk);
pub fn decode(this: &AudioDecoder, chunk: &EncodedAudioChunk) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "AudioDecoder" , js_name = flush)]
#[doc = "The `flush()` method."]
Expand All @@ -110,7 +110,7 @@ extern "C" {
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn is_config_supported(config: &AudioDecoderConfig) -> ::js_sys::Promise;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "AudioDecoder" , js_name = reset)]
# [wasm_bindgen (catch , method , structural , js_class = "AudioDecoder" , js_name = reset)]
#[doc = "The `reset()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioDecoder/reset)"]
Expand All @@ -119,5 +119,5 @@ extern "C" {
#[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 reset(this: &AudioDecoder);
pub fn reset(this: &AudioDecoder) -> Result<(), JsValue>;
}
16 changes: 8 additions & 8 deletions crates/web-sys/src/features/gen_AudioEncoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extern "C" {
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn new(init: &AudioEncoderInit) -> Result<AudioEncoder, JsValue>;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "AudioEncoder" , js_name = close)]
# [wasm_bindgen (catch , method , structural , js_class = "AudioEncoder" , js_name = close)]
#[doc = "The `close()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioEncoder/close)"]
Expand All @@ -61,10 +61,10 @@ extern "C" {
#[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 close(this: &AudioEncoder);
pub fn close(this: &AudioEncoder) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "AudioEncoderConfig")]
# [wasm_bindgen (method , structural , js_class = "AudioEncoder" , js_name = configure)]
# [wasm_bindgen (catch , method , structural , js_class = "AudioEncoder" , js_name = configure)]
#[doc = "The `configure()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioEncoder/configure)"]
Expand All @@ -73,10 +73,10 @@ extern "C" {
#[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 configure(this: &AudioEncoder, config: &AudioEncoderConfig);
pub fn configure(this: &AudioEncoder, config: &AudioEncoderConfig) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "AudioData")]
# [wasm_bindgen (method , structural , js_class = "AudioEncoder" , js_name = encode)]
# [wasm_bindgen (catch , method , structural , js_class = "AudioEncoder" , js_name = encode)]
#[doc = "The `encode()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioEncoder/encode)"]
Expand All @@ -85,7 +85,7 @@ extern "C" {
#[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 encode(this: &AudioEncoder, data: &AudioData);
pub fn encode(this: &AudioEncoder, data: &AudioData) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "AudioEncoder" , js_name = flush)]
#[doc = "The `flush()` method."]
Expand All @@ -110,7 +110,7 @@ extern "C" {
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn is_config_supported(config: &AudioEncoderConfig) -> ::js_sys::Promise;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "AudioEncoder" , js_name = reset)]
# [wasm_bindgen (catch , method , structural , js_class = "AudioEncoder" , js_name = reset)]
#[doc = "The `reset()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioEncoder/reset)"]
Expand All @@ -119,5 +119,5 @@ extern "C" {
#[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 reset(this: &AudioEncoder);
pub fn reset(this: &AudioEncoder) -> Result<(), JsValue>;
}
14 changes: 10 additions & 4 deletions crates/web-sys/src/features/gen_EncodedAudioChunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ extern "C" {
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn new(init: &EncodedAudioChunkInit) -> Result<EncodedAudioChunk, JsValue>;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "EncodedAudioChunk" , js_name = copyTo)]
# [wasm_bindgen (catch , method , structural , js_class = "EncodedAudioChunk" , js_name = copyTo)]
#[doc = "The `copyTo()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EncodedAudioChunk/copyTo)"]
Expand All @@ -83,9 +83,12 @@ extern "C" {
#[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 copy_to_with_buffer_source(this: &EncodedAudioChunk, destination: &::js_sys::Object);
pub fn copy_to_with_buffer_source(
this: &EncodedAudioChunk,
destination: &::js_sys::Object,
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "EncodedAudioChunk" , js_name = copyTo)]
# [wasm_bindgen (catch , method , structural , js_class = "EncodedAudioChunk" , js_name = copyTo)]
#[doc = "The `copyTo()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EncodedAudioChunk/copyTo)"]
Expand All @@ -94,5 +97,8 @@ extern "C" {
#[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 copy_to_with_u8_array(this: &EncodedAudioChunk, destination: &mut [u8]);
pub fn copy_to_with_u8_array(
this: &EncodedAudioChunk,
destination: &mut [u8],
) -> Result<(), JsValue>;
}
14 changes: 10 additions & 4 deletions crates/web-sys/src/features/gen_EncodedVideoChunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ extern "C" {
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn new(init: &EncodedVideoChunkInit) -> Result<EncodedVideoChunk, JsValue>;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "EncodedVideoChunk" , js_name = copyTo)]
# [wasm_bindgen (catch , method , structural , js_class = "EncodedVideoChunk" , js_name = copyTo)]
#[doc = "The `copyTo()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EncodedVideoChunk/copyTo)"]
Expand All @@ -83,9 +83,12 @@ extern "C" {
#[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 copy_to_with_buffer_source(this: &EncodedVideoChunk, destination: &::js_sys::Object);
pub fn copy_to_with_buffer_source(
this: &EncodedVideoChunk,
destination: &::js_sys::Object,
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "EncodedVideoChunk" , js_name = copyTo)]
# [wasm_bindgen (catch , method , structural , js_class = "EncodedVideoChunk" , js_name = copyTo)]
#[doc = "The `copyTo()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EncodedVideoChunk/copyTo)"]
Expand All @@ -94,5 +97,8 @@ extern "C" {
#[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 copy_to_with_u8_array(this: &EncodedVideoChunk, destination: &mut [u8]);
pub fn copy_to_with_u8_array(
this: &EncodedVideoChunk,
destination: &mut [u8],
) -> Result<(), JsValue>;
}
16 changes: 8 additions & 8 deletions crates/web-sys/src/features/gen_VideoDecoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extern "C" {
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn new(init: &VideoDecoderInit) -> Result<VideoDecoder, JsValue>;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "VideoDecoder" , js_name = close)]
# [wasm_bindgen (catch , method , structural , js_class = "VideoDecoder" , js_name = close)]
#[doc = "The `close()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoDecoder/close)"]
Expand All @@ -61,10 +61,10 @@ extern "C" {
#[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 close(this: &VideoDecoder);
pub fn close(this: &VideoDecoder) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "VideoDecoderConfig")]
# [wasm_bindgen (method , structural , js_class = "VideoDecoder" , js_name = configure)]
# [wasm_bindgen (catch , method , structural , js_class = "VideoDecoder" , js_name = configure)]
#[doc = "The `configure()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoDecoder/configure)"]
Expand All @@ -73,10 +73,10 @@ extern "C" {
#[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 configure(this: &VideoDecoder, config: &VideoDecoderConfig);
pub fn configure(this: &VideoDecoder, config: &VideoDecoderConfig) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "EncodedVideoChunk")]
# [wasm_bindgen (method , structural , js_class = "VideoDecoder" , js_name = decode)]
# [wasm_bindgen (catch , method , structural , js_class = "VideoDecoder" , js_name = decode)]
#[doc = "The `decode()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoDecoder/decode)"]
Expand All @@ -85,7 +85,7 @@ extern "C" {
#[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 decode(this: &VideoDecoder, chunk: &EncodedVideoChunk);
pub fn decode(this: &VideoDecoder, chunk: &EncodedVideoChunk) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "VideoDecoder" , js_name = flush)]
#[doc = "The `flush()` method."]
Expand All @@ -110,7 +110,7 @@ extern "C" {
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn is_config_supported(config: &VideoDecoderConfig) -> ::js_sys::Promise;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "VideoDecoder" , js_name = reset)]
# [wasm_bindgen (catch , method , structural , js_class = "VideoDecoder" , js_name = reset)]
#[doc = "The `reset()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoDecoder/reset)"]
Expand All @@ -119,5 +119,5 @@ extern "C" {
#[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 reset(this: &VideoDecoder);
pub fn reset(this: &VideoDecoder) -> Result<(), JsValue>;
}
Loading