From 4aae6b38e6bed37d3b908f6e99611549840ab395 Mon Sep 17 00:00:00 2001 From: dAxpeDDa Date: Wed, 5 Jul 2023 15:19:17 +0200 Subject: [PATCH] Add `WorkerGlobalScope.performance` --- CHANGELOG.md | 3 +++ crates/web-sys/src/features/gen_Window.rs | 16 ++++++++-------- .../src/features/gen_WorkerGlobalScope.rs | 8 ++++++++ crates/web-sys/webidls/enabled/Window.webidl | 6 +++--- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 118be7c4ef0..cf45dc4883b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,9 @@ * Add bindings for async variants of `Atomics.wait`. [#3504](https://github.com/rustwasm/wasm-bindgen/pull/3504) +* Add bindings for `WorkerGlobalScope.performance`. + [#3506](https://github.com/rustwasm/wasm-bindgen/pull/3506) + ### Changed * Updated the WebGPU WebIDL. diff --git a/crates/web-sys/src/features/gen_Window.rs b/crates/web-sys/src/features/gen_Window.rs index 55a2001448c..fac6c77d4b7 100644 --- a/crates/web-sys/src/features/gen_Window.rs +++ b/crates/web-sys/src/features/gen_Window.rs @@ -355,14 +355,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Window`*"] pub fn device_pixel_ratio(this: &Window) -> f64; - #[cfg(feature = "Performance")] - # [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = performance)] - #[doc = "Getter for the `performance` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/performance)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Performance`, `Window`*"] - pub fn performance(this: &Window) -> Option; # [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = orientation)] #[doc = "Getter for the `orientation` field of this object."] #[doc = ""] @@ -1908,6 +1900,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Storage`, `Window`*"] pub fn local_storage(this: &Window) -> Result, JsValue>; + #[cfg(feature = "Performance")] + # [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = performance)] + #[doc = "Getter for the `performance` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/performance)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Performance`, `Window`*"] + pub fn performance(this: &Window) -> Option; # [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = origin)] #[doc = "Getter for the `origin` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs index 0a8dac06a41..e63bf3be961 100644 --- a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs +++ b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs @@ -85,6 +85,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Crypto`, `WorkerGlobalScope`*"] pub fn crypto(this: &WorkerGlobalScope) -> Result; + #[cfg(feature = "Performance")] + # [wasm_bindgen (structural , method , getter , js_class = "WorkerGlobalScope" , js_name = performance)] + #[doc = "Getter for the `performance` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/performance)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Performance`, `WorkerGlobalScope`*"] + pub fn performance(this: &WorkerGlobalScope) -> Option; # [wasm_bindgen (structural , method , getter , js_class = "WorkerGlobalScope" , js_name = origin)] #[doc = "Getter for the `origin` field of this object."] #[doc = ""] diff --git a/crates/web-sys/webidls/enabled/Window.webidl b/crates/web-sys/webidls/enabled/Window.webidl index fb8735f8b50..e17490e5dda 100644 --- a/crates/web-sys/webidls/enabled/Window.webidl +++ b/crates/web-sys/webidls/enabled/Window.webidl @@ -195,9 +195,9 @@ partial interface Window { [Replaceable] readonly attribute double devicePixelRatio; }; -// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html -partial interface Window { - [Replaceable, Pure, StoreInSlot] readonly attribute Performance? performance; +// https://w3c.github.io/hr-time/#the-performance-attribute +partial interface mixin WindowOrWorkerGlobalScope { + [Replaceable] readonly attribute Performance? performance; }; // https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html