[Firefox] Fetch browser preferences/options together with the viewer preferences (bug 1862192)

Currently we *synchronously* fetch a number of browser preferences/options, from the platform code, during the viewer respectively PDF document initialization paths.
This seems unnecessary, and we can re-factor the code to instead include the relevant data when fetching the regular viewer preferences.
This commit is contained in:
Jonas Jenwald 2023-10-31 11:39:04 +01:00
parent 50c0fccda6
commit eebc230cf1
7 changed files with 109 additions and 81 deletions

View file

@ -14,7 +14,7 @@
*/
import { DefaultExternalServices, PDFViewerApplication } from "./app.js";
import { isPdfFile, PDFDataRangeTransport, shadow } from "pdfjs-lib";
import { isPdfFile, PDFDataRangeTransport } from "pdfjs-lib";
import { BasePreferences } from "./preferences.js";
import { DEFAULT_SCALE_VALUE } from "./ui_utils.js";
import { L10n } from "./l10n.js";
@ -434,40 +434,6 @@ class FirefoxExternalServices extends DefaultExternalServices {
return FirefoxScripting;
}
static get supportsPinchToZoom() {
const support = FirefoxCom.requestSync("supportsPinchToZoom");
return shadow(this, "supportsPinchToZoom", support);
}
static get supportsIntegratedFind() {
const support = FirefoxCom.requestSync("supportsIntegratedFind");
return shadow(this, "supportsIntegratedFind", support);
}
static get supportsDocumentFonts() {
const support = FirefoxCom.requestSync("supportsDocumentFonts");
return shadow(this, "supportsDocumentFonts", support);
}
static get supportedMouseWheelZoomModifierKeys() {
const support = FirefoxCom.requestSync(
"supportedMouseWheelZoomModifierKeys"
);
return shadow(this, "supportedMouseWheelZoomModifierKeys", support);
}
static get isInAutomation() {
// Returns the value of `Cu.isInAutomation`, which is only `true` when e.g.
// various test-suites are running in mozilla-central.
const isInAutomation = FirefoxCom.requestSync("isInAutomation");
return shadow(this, "isInAutomation", isInAutomation);
}
static get canvasMaxAreaInBytes() {
const maxArea = FirefoxCom.requestSync("getCanvasMaxArea");
return shadow(this, "canvasMaxAreaInBytes", maxArea);
}
static async getNimbusExperimentData() {
const nimbusData = await FirefoxCom.requestAsync(
"getNimbusExperimentData",