Avoid reading the "disablePreferences"/"locale" options, when initializing the viewer, in extension builds
These two `AppOptions` are only defined in GENERIC builds, hence it's completely unnecessary to check them in the extension builds (e.g. MOZCENTRAL and CHROME). Also, simply let the "printResolution" option be defined in all builds since it's being accessed in `web/firefox_print_service.js` as well.
This commit is contained in:
parent
49f59eb627
commit
256aae02d2
14
web/app.js
14
web/app.js
@ -229,7 +229,11 @@ const PDFViewerApplication = {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
async _readPreferences() {
|
async _readPreferences() {
|
||||||
if (AppOptions.get("disablePreferences") === true) {
|
if (
|
||||||
|
(typeof PDFJSDev === "undefined" ||
|
||||||
|
PDFJSDev.test("!PRODUCTION || GENERIC")) &&
|
||||||
|
AppOptions.get("disablePreferences")
|
||||||
|
) {
|
||||||
// Give custom implementations of the default viewer a simpler way to
|
// Give custom implementations of the default viewer a simpler way to
|
||||||
// opt-out of having the `Preferences` override existing `AppOptions`.
|
// opt-out of having the `Preferences` override existing `AppOptions`.
|
||||||
return;
|
return;
|
||||||
@ -328,9 +332,11 @@ const PDFViewerApplication = {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
async _initializeL10n() {
|
async _initializeL10n() {
|
||||||
this.l10n = this.externalServices.createL10n({
|
this.l10n = this.externalServices.createL10n(
|
||||||
locale: AppOptions.get("locale"),
|
typeof PDFJSDev === "undefined" || PDFJSDev.test("!PRODUCTION || GENERIC")
|
||||||
});
|
? { locale: AppOptions.get("locale") }
|
||||||
|
: null
|
||||||
|
);
|
||||||
const dir = await this.l10n.getDirection();
|
const dir = await this.l10n.getDirection();
|
||||||
document.getElementsByTagName("html")[0].dir = dir;
|
document.getElementsByTagName("html")[0].dir = dir;
|
||||||
},
|
},
|
||||||
|
@ -53,14 +53,14 @@ const defaultOptions = {
|
|||||||
value: false,
|
value: false,
|
||||||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE,
|
kind: OptionKind.VIEWER + OptionKind.PREFERENCE,
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* The `disablePreferences` is, conditionally, defined below.
|
||||||
|
*/
|
||||||
enablePermissions: {
|
enablePermissions: {
|
||||||
/** @type {boolean} */
|
/** @type {boolean} */
|
||||||
value: false,
|
value: false,
|
||||||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE,
|
kind: OptionKind.VIEWER + OptionKind.PREFERENCE,
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* The `disablePreferences` is, conditionally, defined below.
|
|
||||||
*/
|
|
||||||
enablePrintAutoRotate: {
|
enablePrintAutoRotate: {
|
||||||
/** @type {boolean} */
|
/** @type {boolean} */
|
||||||
value: false,
|
value: false,
|
||||||
@ -110,9 +110,11 @@ const defaultOptions = {
|
|||||||
value: false,
|
value: false,
|
||||||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE,
|
kind: OptionKind.VIEWER + OptionKind.PREFERENCE,
|
||||||
},
|
},
|
||||||
/**
|
printResolution: {
|
||||||
* The `printResolution` is, conditionally, defined below.
|
/** @type {number} */
|
||||||
*/
|
value: 150,
|
||||||
|
kind: OptionKind.VIEWER,
|
||||||
|
},
|
||||||
renderer: {
|
renderer: {
|
||||||
/** @type {string} */
|
/** @type {string} */
|
||||||
value: "canvas",
|
value: "canvas",
|
||||||
@ -252,11 +254,6 @@ if (
|
|||||||
value: typeof navigator !== "undefined" ? navigator.language : "en-US",
|
value: typeof navigator !== "undefined" ? navigator.language : "en-US",
|
||||||
kind: OptionKind.VIEWER,
|
kind: OptionKind.VIEWER,
|
||||||
};
|
};
|
||||||
defaultOptions.printResolution = {
|
|
||||||
/** @type {number} */
|
|
||||||
value: 150,
|
|
||||||
kind: OptionKind.VIEWER,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const userOptions = Object.create(null);
|
const userOptions = Object.create(null);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user