mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Re-factor how the sandboxBundleSrc
option is passed to PDFScriptingManager
Given that this option isn't used in the Firefox PDF Viewer, we can (ever so slightly) reduce the amount of code needed.
This commit is contained in:
parent
988d3a188f
commit
92c15a61f1
6 changed files with 12 additions and 28 deletions
|
@ -21,8 +21,8 @@ import { PromiseCapability, shadow } from "pdfjs-lib";
|
|||
/**
|
||||
* @typedef {Object} PDFScriptingManagerOptions
|
||||
* @property {EventBus} eventBus - The application event bus.
|
||||
* @property {string} sandboxBundleSrc - The path and filename of the scripting
|
||||
* bundle.
|
||||
* @property {string} [sandboxBundleSrc] - The path and filename of the
|
||||
* scripting bundle.
|
||||
* @property {Object} [externalServices] - The factory that is used when
|
||||
* initializing scripting; must contain a `createScripting` method.
|
||||
* PLEASE NOTE: Primarily intended for the default viewer use-case.
|
||||
|
@ -47,8 +47,6 @@ class PDFScriptingManager {
|
|||
|
||||
#ready = false;
|
||||
|
||||
#sandboxBundleSrc = null;
|
||||
|
||||
#scripting = null;
|
||||
|
||||
#willPrintCapability = null;
|
||||
|
@ -56,16 +54,8 @@ class PDFScriptingManager {
|
|||
/**
|
||||
* @param {PDFScriptingManagerOptions} options
|
||||
*/
|
||||
constructor({
|
||||
eventBus,
|
||||
sandboxBundleSrc = null,
|
||||
externalServices = null,
|
||||
docProperties = null,
|
||||
}) {
|
||||
constructor({ eventBus, externalServices = null, docProperties = null }) {
|
||||
this.#eventBus = eventBus;
|
||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC || CHROME")) {
|
||||
this.#sandboxBundleSrc = sandboxBundleSrc;
|
||||
}
|
||||
this.#externalServices = externalServices;
|
||||
this.#docProperties = docProperties;
|
||||
}
|
||||
|
@ -421,9 +411,7 @@ class PDFScriptingManager {
|
|||
if (this.#scripting) {
|
||||
throw new Error("#initScripting: Scripting already exists.");
|
||||
}
|
||||
return this.#externalServices.createScripting({
|
||||
sandboxBundleSrc: this.#sandboxBundleSrc,
|
||||
});
|
||||
return this.#externalServices.createScripting();
|
||||
}
|
||||
|
||||
async #destroyScripting() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue