Skip to content

Commit 8f4c4d8

Browse files
authored
BREAKING(web-sys): Remove support for CanvasRenderingContext2D and BufferSource from createImageBitmap (#3231)
Resolves #3227 Both APIs are broken, to some extent, which is why I think it makes sense to remove them despite the potential breakage. Calling `createImageBitmap` with a `BufferSource` will instantly throw an error, and calling it with a `CanvasRenderingContext2D` will also fail except in Firefox, where it gives a deprecation warning. `BufferSource` was there as part of the abandoned video capture worker API (https://w3c.github.io/mediacapture-worker). It looks like we inherited it from Firefox, which supported it behind a flag at the time we copied our WebIDL from it but later removed it. I also removed the rest of that API while I was at it. `CanvasRenderingContext2D` is there because, for whatever reason, Firefox non-standardly accepts it in `createImageBitmap`, and we took our WebIDL from them. It's deprecated, and https://bugzilla.mozilla.org/show_bug.cgi?id=1500782 talks about removing it, but it hasn't been done yet.
1 parent 3c1f5a9 commit 8f4c4d8

8 files changed

+66
-779
lines changed

crates/web-sys/src/features/gen_ChannelPixelLayout.rs

-122
This file was deleted.

crates/web-sys/src/features/gen_ChannelPixelLayoutDataType.rs

-17
This file was deleted.

crates/web-sys/src/features/gen_ImageBitmap.rs

-56
Original file line numberDiff line numberDiff line change
@@ -32,60 +32,4 @@ extern "C" {
3232
#[doc = ""]
3333
#[doc = "*This API requires the following crate features to be activated: `ImageBitmap`*"]
3434
pub fn close(this: &ImageBitmap);
35-
#[cfg(feature = "ImageBitmapFormat")]
36-
# [wasm_bindgen (catch , method , structural , js_class = "ImageBitmap" , js_name = findOptimalFormat)]
37-
#[doc = "The `findOptimalFormat()` method."]
38-
#[doc = ""]
39-
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap/findOptimalFormat)"]
40-
#[doc = ""]
41-
#[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `ImageBitmapFormat`*"]
42-
pub fn find_optimal_format(this: &ImageBitmap) -> Result<ImageBitmapFormat, JsValue>;
43-
#[cfg(feature = "ImageBitmapFormat")]
44-
# [wasm_bindgen (catch , method , structural , js_class = "ImageBitmap" , js_name = findOptimalFormat)]
45-
#[doc = "The `findOptimalFormat()` method."]
46-
#[doc = ""]
47-
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap/findOptimalFormat)"]
48-
#[doc = ""]
49-
#[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `ImageBitmapFormat`*"]
50-
pub fn find_optimal_format_with_a_possible_formats(
51-
this: &ImageBitmap,
52-
a_possible_formats: &::wasm_bindgen::JsValue,
53-
) -> Result<ImageBitmapFormat, JsValue>;
54-
#[cfg(feature = "ImageBitmapFormat")]
55-
# [wasm_bindgen (catch , method , structural , js_class = "ImageBitmap" , js_name = mapDataInto)]
56-
#[doc = "The `mapDataInto()` method."]
57-
#[doc = ""]
58-
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap/mapDataInto)"]
59-
#[doc = ""]
60-
#[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `ImageBitmapFormat`*"]
61-
pub fn map_data_into_with_buffer_source(
62-
this: &ImageBitmap,
63-
a_format: ImageBitmapFormat,
64-
a_buffer: &::js_sys::Object,
65-
a_offset: i32,
66-
) -> Result<::js_sys::Promise, JsValue>;
67-
#[cfg(feature = "ImageBitmapFormat")]
68-
# [wasm_bindgen (catch , method , structural , js_class = "ImageBitmap" , js_name = mapDataInto)]
69-
#[doc = "The `mapDataInto()` method."]
70-
#[doc = ""]
71-
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap/mapDataInto)"]
72-
#[doc = ""]
73-
#[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `ImageBitmapFormat`*"]
74-
pub fn map_data_into_with_u8_array(
75-
this: &ImageBitmap,
76-
a_format: ImageBitmapFormat,
77-
a_buffer: &mut [u8],
78-
a_offset: i32,
79-
) -> Result<::js_sys::Promise, JsValue>;
80-
#[cfg(feature = "ImageBitmapFormat")]
81-
# [wasm_bindgen (catch , method , structural , js_class = "ImageBitmap" , js_name = mappedDataLength)]
82-
#[doc = "The `mappedDataLength()` method."]
83-
#[doc = ""]
84-
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap/mappedDataLength)"]
85-
#[doc = ""]
86-
#[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `ImageBitmapFormat`*"]
87-
pub fn mapped_data_length(
88-
this: &ImageBitmap,
89-
a_format: ImageBitmapFormat,
90-
) -> Result<i32, JsValue>;
9135
}

crates/web-sys/src/features/gen_ImageBitmapFormat.rs

-22
This file was deleted.

0 commit comments

Comments
 (0)