From ec3056265d34b3c611321a7fd9e886a690e3e3a5 Mon Sep 17 00:00:00 2001 From: Ammarpad Date: Tue, 24 Jan 2023 19:06:33 +0100 Subject: [PATCH] Don't show download button if there's no window.print Bug: T309591 Change-Id: I2e9b59cbf0e83942af0023c46052d7f2e784aa11 --- bundlesize.config.json | 2 +- resources/skins.minerva.scripts/downloadPageAction.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bundlesize.config.json b/bundlesize.config.json index 4e9af3deb..f446865b6 100644 --- a/bundlesize.config.json +++ b/bundlesize.config.json @@ -33,6 +33,6 @@ }, { "resourceModule": "skins.minerva.scripts", - "maxSize": "11.9KB" + "maxSize": "12.0KB" } ] diff --git a/resources/skins.minerva.scripts/downloadPageAction.js b/resources/skins.minerva.scripts/downloadPageAction.js index d324aacee..a416cf4b8 100644 --- a/resources/skins.minerva.scripts/downloadPageAction.js +++ b/resources/skins.minerva.scripts/downloadPageAction.js @@ -45,6 +45,11 @@ var androidVersion = getAndroidVersion( userAgent ), chromeVersion = getChromeVersion( userAgent ); + if ( typeof window.print !== 'function' ) { + // T309591: No window.print support + return false; + } + // Download button is restricted to certain namespaces T181152. // Not shown on missing pages // Defaults to 0, in case cached JS has been served.