From fecb11bada81b93efea2c83702b4eb52dfa94929 Mon Sep 17 00:00:00 2001 From: Kelsey Gilbert Date: Mon, 3 Apr 2023 23:50:26 +0000 Subject: [PATCH] Bug 1695986 - Also wait for 10x requestAnimationFrame to ensure warning is displayed to screen. r=Gijs Differential Revision: https://phabricator.services.mozilla.com/D153794 --- toolkit/content/aboutNetError.mjs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/toolkit/content/aboutNetError.mjs b/toolkit/content/aboutNetError.mjs index ec9b3da31cb1..aabe799d8c82 100644 --- a/toolkit/content/aboutNetError.mjs +++ b/toolkit/content/aboutNetError.mjs @@ -200,6 +200,18 @@ async function revealAdvancedPanelSlowlyAsync() { wasReset = true; }; + // Wait for 10 frames to ensure that the warning text is rendered + // and gets all the way to the screen for the user to read it. + // This is only ~0.160s at 60Hz, so it's not too much extra time that we're + // taking to ensure that we're caught up with rendering, on top of the + // (by default) whole second(s) we're going to wait based on the + // security.dialog_enable_delay pref. + // The catching-up to rendering is the important part, not the + // N-frame-delay here. + for (let i = 0; i < 10; i++) { + await new Promise(requestAnimationFrame); + } + // Wait another Nms (default: 1000) for the user to be very sure. (Sorry speed readers!) const securityDelayMs = RPMGetIntPref("security.dialog_enable_delay", 1000); await new Promise(go => setTimeout(go, securityDelayMs)); -- 2.11.4.GIT