From b44b461a76effad6016a643e83654748303c9423 Mon Sep 17 00:00:00 2001 From: Sam <16504129+sagudev@users.noreply.github.com> Date: Fri, 29 Aug 2025 17:09:19 +0200 Subject: [PATCH] script: do not update `Document` rendering when waiting on asynchronous canvas image updates (#39022) This is fixup for #37776. We forget to skip documents with waiting_on_canvas_image_updates flag. Testing: Existing WPT tests and manual testing Fixes: #39021 --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --- components/script/dom/document.rs | 4 ++++ components/script/script_thread.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index eac3429cc33..5eecfdb03c0 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -2743,6 +2743,10 @@ impl Document { self.waiting_on_canvas_image_updates.set(false); } + pub(crate) fn waiting_on_canvas_image_updates(&self) -> bool { + self.waiting_on_canvas_image_updates.get() + } + /// From : /// /// > A FontFaceSet is pending on the environment if any of the following are true: diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 2ab84a8d621..6972163bc5e 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -1158,6 +1158,10 @@ impl ScriptThread { continue; } + if document.waiting_on_canvas_image_updates() { + continue; + } + // TODO(#31581): The steps in the "Revealing the document" section need to be implemented // `process_pending_input_events` handles the focusing steps as well as other events // from the compositor.