diff --git a/crates/web-sys/src/features/gen_WorkerOptions.rs b/crates/web-sys/src/features/gen_WorkerOptions.rs index b2974634544..b4e6791454f 100644 --- a/crates/web-sys/src/features/gen_WorkerOptions.rs +++ b/crates/web-sys/src/features/gen_WorkerOptions.rs @@ -19,6 +19,24 @@ impl WorkerOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } + #[cfg(feature = "RequestCredentials")] + #[doc = "Change the `credentials` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestCredentials`, `WorkerOptions`*"] + pub fn credentials(&mut self, val: RequestCredentials) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("credentials"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`*"] @@ -32,6 +50,20 @@ impl WorkerOptions { let _ = r; self } + #[cfg(feature = "WorkerType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`, `WorkerType`*"] + pub fn type_(&mut self, val: WorkerType) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } } impl Default for WorkerOptions { fn default() -> Self { diff --git a/crates/web-sys/src/features/gen_WorkerType.rs b/crates/web-sys/src/features/gen_WorkerType.rs new file mode 100644 index 00000000000..3ae50015616 --- /dev/null +++ b/crates/web-sys/src/features/gen_WorkerType.rs @@ -0,0 +1,11 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +#[doc = "The `WorkerType` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `WorkerType`*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum WorkerType { + Classic = "classic", + Module = "module", +} diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 10f658fe99f..54cacbade5b 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -8140,6 +8140,12 @@ mod gen_WorkerOptions; #[cfg(feature = "WorkerOptions")] pub use gen_WorkerOptions::*; +#[cfg(feature = "WorkerType")] +#[allow(non_snake_case)] +mod gen_WorkerType; +#[cfg(feature = "WorkerType")] +pub use gen_WorkerType::*; + #[cfg(feature = "Worklet")] #[allow(non_snake_case)] mod gen_Worklet; diff --git a/crates/web-sys/webidls/enabled/Worker.webidl b/crates/web-sys/webidls/enabled/Worker.webidl index 94094ee89d7..dc86f157586 100644 --- a/crates/web-sys/webidls/enabled/Worker.webidl +++ b/crates/web-sys/webidls/enabled/Worker.webidl @@ -27,11 +27,13 @@ interface Worker : EventTarget { Worker includes AbstractWorker; dictionary WorkerOptions { - // WorkerType type = "classic"; TODO: Bug 1247687 - // RequestCredentials credentials = "omit"; // credentials is only used if type is "module" TODO: Bug 1247687 + WorkerType type = "classic"; + RequestCredentials credentials = "omit"; // credentials is only used if type is "module" DOMString name = ""; }; +enum WorkerType { "classic", "module" }; + [Constructor(USVString scriptURL), Func="mozilla::dom::ChromeWorker::WorkerAvailable", Exposed=(Window,DedicatedWorker,SharedWorker,System)]