diff --git a/src/display/font_loader.js b/src/display/font_loader.js index 23f4a6a1c..7ca4ebbf5 100644 --- a/src/display/font_loader.js +++ b/src/display/font_loader.js @@ -184,6 +184,7 @@ class FontLoader { supported = true; } else if ( typeof navigator !== "undefined" && + typeof navigator?.userAgent === "string" && // User agent string sniffing is bad, but there is no reliable way to // tell if the font is fully loaded and ready to be used with canvas. /Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent) diff --git a/src/shared/util.js b/src/shared/util.js index ed1ec6886..5a4874ffe 100644 --- a/src/shared/util.js +++ b/src/shared/util.js @@ -616,14 +616,15 @@ class FeatureTest { static get platform() { if ( - (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) && - typeof navigator === "undefined" + (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) || + (typeof navigator !== "undefined" && + typeof navigator?.platform === "string") ) { - return shadow(this, "platform", { isMac: false }); + return shadow(this, "platform", { + isMac: navigator.platform.includes("Mac"), + }); } - return shadow(this, "platform", { - isMac: navigator.platform.includes("Mac"), - }); + return shadow(this, "platform", { isMac: false }); } static get isCSSRoundSupported() {