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;
|
supported = true;
|
||||||
} else if (
|
} else if (
|
||||||
typeof navigator !== "undefined" &&
|
typeof navigator !== "undefined" &&
|
||||||
|
typeof navigator?.userAgent === "string" &&
|
||||||
// User agent string sniffing is bad, but there is no reliable way to
|
// 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.
|
// tell if the font is fully loaded and ready to be used with canvas.
|
||||||
/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent)
|
/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent)
|
||||||
|
@ -616,14 +616,15 @@ class FeatureTest {
|
|||||||
|
|
||||||
static get platform() {
|
static get platform() {
|
||||||
if (
|
if (
|
||||||
(typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) &&
|
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
|
||||||
typeof navigator === "undefined"
|
(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", {
|
return shadow(this, "platform", { isMac: false });
|
||||||
isMac: navigator.platform.includes("Mac"),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static get isCSSRoundSupported() {
|
static get isCSSRoundSupported() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user