From 472bbf45922b7509541e25589cbfcfa8c4a92b12 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 18 Dec 2021 19:04:38 +0100 Subject: [PATCH] Unblock the "load" event in inactive windows/tabs (bug 1746213, PR 11646 follow-up) Given that `requestAnimationFrame` is being used, see the `src/diplay/api.js` file, an inactive window/tab means that rendering will not run and we'll thus not fetch all pages. The latter is a requirement for the "load" event to be unblocked, in the MOZCENTRAL-version of, the default viewer. This patch is a *partial* solution, since it only addresses the following situations: - A *background* tab (containing the viewer) is reloaded, e.g. via the tab-bar context menu. - The viewer is loaded in a active tab, but the user switches away from it (or switches to another program window) *before* rendering has started. --- web/base_viewer.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/base_viewer.js b/web/base_viewer.js index 993c869c7..1f26fe2fd 100644 --- a/web/base_viewer.js +++ b/web/base_viewer.js @@ -533,11 +533,14 @@ class BaseViewer { // `this._onePageRenderedCapability` thus won't be resolved. // To ensure that automatic printing, on document load, still works even in // those cases we force-allow fetching of all pages when: + // - The current window/tab is inactive, which will prevent rendering since + // `requestAnimationFrame` is being used; fixes bug 1746213. // - The viewer is hidden in the DOM, e.g. in a `display: none`