Merge pull request #17153 from Snuffleupagus/src-navigator-checks
Guard `navigator`-object accesses in `src/`-files (issue 15728)
This commit is contained in:
commit
0329b5e130
@ -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)
|
||||
|
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user