diff --git a/crates/web-sys/src/features/gen_BluetoothRemoteGattCharacteristic.rs b/crates/web-sys/src/features/gen_BluetoothRemoteGattCharacteristic.rs index 39c9991a252..f185f07bc63 100644 --- a/crates/web-sys/src/features/gen_BluetoothRemoteGattCharacteristic.rs +++ b/crates/web-sys/src/features/gen_BluetoothRemoteGattCharacteristic.rs @@ -206,7 +206,7 @@ extern "C" { value: &::js_sys::Object, ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValue)] + # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValue)] #[doc = "The `writeValue()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTCharacteristic/writeValue)"] @@ -218,7 +218,7 @@ extern "C" { pub fn write_value_with_u8_slice( this: &BluetoothRemoteGattCharacteristic, value: &mut [u8], - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValue)] #[doc = "The `writeValue()` method."] @@ -248,7 +248,7 @@ extern "C" { value: &::js_sys::Object, ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValueWithResponse)] + # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValueWithResponse)] #[doc = "The `writeValueWithResponse()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTCharacteristic/writeValueWithResponse)"] @@ -260,7 +260,7 @@ extern "C" { pub fn write_value_with_response_with_u8_slice( this: &BluetoothRemoteGattCharacteristic, value: &mut [u8], - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValueWithResponse)] #[doc = "The `writeValueWithResponse()` method."] @@ -290,7 +290,7 @@ extern "C" { value: &::js_sys::Object, ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValueWithoutResponse)] + # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValueWithoutResponse)] #[doc = "The `writeValueWithoutResponse()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTCharacteristic/writeValueWithoutResponse)"] @@ -302,7 +302,7 @@ extern "C" { pub fn write_value_without_response_with_u8_slice( this: &BluetoothRemoteGattCharacteristic, value: &mut [u8], - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValueWithoutResponse)] #[doc = "The `writeValueWithoutResponse()` method."] diff --git a/crates/web-sys/src/features/gen_BluetoothRemoteGattDescriptor.rs b/crates/web-sys/src/features/gen_BluetoothRemoteGattDescriptor.rs index 8c2da626172..76e5709586e 100644 --- a/crates/web-sys/src/features/gen_BluetoothRemoteGattDescriptor.rs +++ b/crates/web-sys/src/features/gen_BluetoothRemoteGattDescriptor.rs @@ -78,7 +78,7 @@ extern "C" { value: &::js_sys::Object, ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "BluetoothRemoteGATTDescriptor" , js_name = writeValue)] + # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTDescriptor" , js_name = writeValue)] #[doc = "The `writeValue()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTDescriptor/writeValue)"] @@ -90,7 +90,7 @@ extern "C" { pub fn write_value_with_u8_slice( this: &BluetoothRemoteGattDescriptor, value: &mut [u8], - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTDescriptor" , js_name = writeValue)] #[doc = "The `writeValue()` method."] diff --git a/crates/web-sys/src/features/gen_HidDevice.rs b/crates/web-sys/src/features/gen_HidDevice.rs index 6f4ca225106..51bc70e5f2f 100644 --- a/crates/web-sys/src/features/gen_HidDevice.rs +++ b/crates/web-sys/src/features/gen_HidDevice.rs @@ -142,7 +142,7 @@ extern "C" { data: &::js_sys::Object, ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "HIDDevice" , js_name = sendFeatureReport)] + # [wasm_bindgen (catch , method , structural , js_class = "HIDDevice" , js_name = sendFeatureReport)] #[doc = "The `sendFeatureReport()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HIDDevice/sendFeatureReport)"] @@ -155,7 +155,7 @@ extern "C" { this: &HidDevice, report_id: u8, data: &mut [u8], - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (catch , method , structural , js_class = "HIDDevice" , js_name = sendFeatureReport)] #[doc = "The `sendFeatureReport()` method."] @@ -187,7 +187,7 @@ extern "C" { data: &::js_sys::Object, ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "HIDDevice" , js_name = sendReport)] + # [wasm_bindgen (catch , method , structural , js_class = "HIDDevice" , js_name = sendReport)] #[doc = "The `sendReport()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HIDDevice/sendReport)"] @@ -200,7 +200,7 @@ extern "C" { this: &HidDevice, report_id: u8, data: &mut [u8], - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (catch , method , structural , js_class = "HIDDevice" , js_name = sendReport)] #[doc = "The `sendReport()` method."] diff --git a/crates/web-sys/src/features/gen_UsbDevice.rs b/crates/web-sys/src/features/gen_UsbDevice.rs index c8c0dbe17dc..8ac1f4737b6 100644 --- a/crates/web-sys/src/features/gen_UsbDevice.rs +++ b/crates/web-sys/src/features/gen_UsbDevice.rs @@ -291,7 +291,7 @@ extern "C" { ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "UsbControlTransferParameters")] - # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = controlTransferOut)] + # [wasm_bindgen (catch , method , structural , js_class = "USBDevice" , js_name = controlTransferOut)] #[doc = "The `controlTransferOut()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/controlTransferOut)"] @@ -304,7 +304,7 @@ extern "C" { this: &UsbDevice, setup: &UsbControlTransferParameters, data: &mut [u8], - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "UsbControlTransferParameters")] # [wasm_bindgen (catch , method , structural , js_class = "USBDevice" , js_name = controlTransferOut)] @@ -364,7 +364,7 @@ extern "C" { packet_lengths: &::wasm_bindgen::JsValue, ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = isochronousTransferOut)] + # [wasm_bindgen (catch , method , structural , js_class = "USBDevice" , js_name = isochronousTransferOut)] #[doc = "The `isochronousTransferOut()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/isochronousTransferOut)"] @@ -378,7 +378,7 @@ extern "C" { endpoint_number: u8, data: &mut [u8], packet_lengths: &::wasm_bindgen::JsValue, - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (catch , method , structural , js_class = "USBDevice" , js_name = isochronousTransferOut)] #[doc = "The `isochronousTransferOut()` method."] @@ -481,7 +481,7 @@ extern "C" { data: &::js_sys::Object, ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = transferOut)] + # [wasm_bindgen (catch , method , structural , js_class = "USBDevice" , js_name = transferOut)] #[doc = "The `transferOut()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/transferOut)"] @@ -494,7 +494,7 @@ extern "C" { this: &UsbDevice, endpoint_number: u8, data: &mut [u8], - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (catch , method , structural , js_class = "USBDevice" , js_name = transferOut)] #[doc = "The `transferOut()` method."] diff --git a/crates/web-sys/src/features/gen_XrFrame.rs b/crates/web-sys/src/features/gen_XrFrame.rs index e0c46a2a4a1..1122bae9f22 100644 --- a/crates/web-sys/src/features/gen_XrFrame.rs +++ b/crates/web-sys/src/features/gen_XrFrame.rs @@ -40,7 +40,7 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn predicted_display_time(this: &XrFrame) -> f64; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "XRFrame" , js_name = fillJointRadii)] + # [wasm_bindgen (catch , method , structural , js_class = "XRFrame" , js_name = fillJointRadii)] #[doc = "The `fillJointRadii()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/fillJointRadii)"] @@ -53,7 +53,7 @@ extern "C" { this: &XrFrame, joint_spaces: &::wasm_bindgen::JsValue, radii: &mut [f32], - ) -> bool; + ) -> Result; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (catch , method , structural , js_class = "XRFrame" , js_name = fillJointRadii)] #[doc = "The `fillJointRadii()` method."] @@ -71,7 +71,7 @@ extern "C" { ) -> Result; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrSpace")] - # [wasm_bindgen (method , structural , js_class = "XRFrame" , js_name = fillPoses)] + # [wasm_bindgen (catch , method , structural , js_class = "XRFrame" , js_name = fillPoses)] #[doc = "The `fillPoses()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/fillPoses)"] @@ -85,7 +85,7 @@ extern "C" { spaces: &::wasm_bindgen::JsValue, base_space: &XrSpace, transforms: &mut [f32], - ) -> bool; + ) -> Result; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrSpace")] # [wasm_bindgen (catch , method , structural , js_class = "XRFrame" , js_name = fillPoses)] diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index 1a1282d3687..df7808fb3a8 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -732,7 +732,20 @@ fn arg_throws(ty: &IdlType<'_>) -> bool { | IdlType::Float32Array { allow_shared, .. } | IdlType::Float64Array { allow_shared, .. } | IdlType::ArrayBufferView { allow_shared, .. } - | IdlType::BufferSource { allow_shared, .. } => !allow_shared, + | IdlType::BufferSource { allow_shared, .. } + | IdlType::Identifier { + ty: + IdentifierType::Int8Slice { allow_shared, .. } + | IdentifierType::Uint8Slice { allow_shared, .. } + | IdentifierType::Uint8ClampedSlice { allow_shared, .. } + | IdentifierType::Int16Slice { allow_shared, .. } + | IdentifierType::Uint16Slice { allow_shared, .. } + | IdentifierType::Int32Slice { allow_shared, .. } + | IdentifierType::Uint32Slice { allow_shared, .. } + | IdentifierType::Float32Slice { allow_shared, .. } + | IdentifierType::Float64Slice { allow_shared, .. }, + .. + } => !allow_shared, IdlType::Nullable(item) => arg_throws(item), IdlType::Union(list) => list.iter().any(arg_throws), // catch-all for everything else like Object