Skip to content

Commit

Permalink
Re-factor/re-name the scripting getter, on the externalServices-i…
Browse files Browse the repository at this point in the history
…mplementations, 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.
  • Loading branch information
Snuffleupagus committed Dec 7, 2020
1 parent ec5746d commit bc92642
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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 = {
Expand Down Expand Up @@ -1454,7 +1454,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() };
Expand Down
2 changes: 1 addition & 1 deletion web/chromecom.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ class ChromeExternalServices extends DefaultExternalServices {
return new GenericL10n(navigator.language);
}

static get scripting() {
static createScripting() {
return new GenericScripting();
}
}
Expand Down
2 changes: 1 addition & 1 deletion web/firefoxcom.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ class FirefoxExternalServices extends DefaultExternalServices {
return new MozL10n(mozL10n);
}

static get scripting() {
static createScripting() {
return FirefoxScripting;
}

Expand Down
2 changes: 1 addition & 1 deletion web/genericcom.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class GenericExternalServices extends DefaultExternalServices {
return new GenericL10n(locale);
}

static get scripting() {
static createScripting() {
return new GenericScripting();
}
}
Expand Down

0 comments on commit bc92642

Please sign in to comment.