Merge pull request #14566 from Snuffleupagus/misc-viewer-cleanup

Miscellaneous small viewer clean-up
This commit is contained in:
Tim van der Meij 2022-02-16 20:33:30 +01:00 committed by GitHub
commit d9a3a24353
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 11 deletions

View File

@ -15,12 +15,16 @@
const compatibilityParams = Object.create(null);
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
const userAgent =
(typeof navigator !== "undefined" && navigator.userAgent) || "";
const platform =
(typeof navigator !== "undefined" && navigator.platform) || "";
const maxTouchPoints =
(typeof navigator !== "undefined" && navigator.maxTouchPoints) || 1;
if (
typeof PDFJSDev !== "undefined" &&
PDFJSDev.test("LIB") &&
typeof navigator === "undefined"
) {
globalThis.navigator = Object.create(null);
}
const userAgent = navigator.userAgent || "";
const platform = navigator.platform || "";
const maxTouchPoints = navigator.maxTouchPoints || 1;
const isAndroid = /Android/.test(userAgent);
const isIOS =
@ -278,7 +282,7 @@ if (
};
defaultOptions.locale = {
/** @type {string} */
value: typeof navigator !== "undefined" ? navigator.language : "en-US",
value: navigator.language || "en-US",
kind: OptionKind.VIEWER,
};
defaultOptions.sandboxBundleSrc = {

View File

@ -81,10 +81,9 @@ class PasswordPrompt {
);
}
close() {
this.overlayManager.close(this.overlayName).then(() => {
this.input.value = "";
});
async close() {
await this.overlayManager.close(this.overlayName);
this.input.value = "";
}
#verify() {