Re-factor/re-name the scripting getter, on the externalServices-implementations, to a createScripting method

Given that the GENERIC default viewer supports opening more than one document, and that a unique scripting-instance is now used for each document, the changes made in this patch seem appropriate.
This commit is contained in:
Jonas Jenwald 2020-12-07 18:23:34 +01:00
parent a7230eb033
commit 6218b9a512
4 changed files with 8 additions and 8 deletions

View File

@ -168,6 +168,10 @@ class DefaultExternalServices {
throw new Error("Not implemented: createL10n");
}
static createScripting() {
throw new Error("Not implemented: createScripting");
}
static get supportsIntegratedFind() {
return shadow(this, "supportsIntegratedFind", false);
}
@ -186,10 +190,6 @@ class DefaultExternalServices {
static get isInAutomation() {
return shadow(this, "isInAutomation", false);
}
static get scripting() {
throw new Error("Not implemented: scripting");
}
}
const PDFViewerApplication = {
@ -1456,7 +1456,7 @@ const PDFViewerApplication = {
// or the document was closed while the data resolved.
return;
}
const { scripting } = this.externalServices;
const scripting = this.externalServices.createScripting();
// Store a reference to the current scripting-instance, to allow destruction
// of the sandbox and removal of the event listeners at document closing.
this._scriptingInstance = { scripting, events: new Map() };

View File

@ -430,7 +430,7 @@ class ChromeExternalServices extends DefaultExternalServices {
return new GenericL10n(navigator.language);
}
static get scripting() {
static createScripting() {
return new GenericScripting();
}
}

View File

@ -360,7 +360,7 @@ class FirefoxExternalServices extends DefaultExternalServices {
return new MozL10n(mozL10n);
}
static get scripting() {
static createScripting() {
return FirefoxScripting;
}

View File

@ -51,7 +51,7 @@ class GenericExternalServices extends DefaultExternalServices {
return new GenericL10n(locale);
}
static get scripting() {
static createScripting() {
return new GenericScripting();
}
}