Ensure that PDFScriptingManager.setDocument handles failure when initializing the scripting-factory

This way, we'll immediately clean-up in exactly the same way as the other failure code-paths in the `PDFScriptingManager.setDocument` method.
This commit is contained in:
Jonas Jenwald 2021-06-17 18:42:15 +02:00
parent 6dc5dd194f
commit 5db7a3cc88

View File

@ -96,7 +96,14 @@ class PDFScriptingManager {
if (pdfDocument !== this._pdfDocument) {
return; // The document was closed while the data resolved.
}
this._scripting = this._createScripting();
try {
this._scripting = this._createScripting();
} catch (error) {
console.error(`PDFScriptingManager.setDocument: "${error?.message}".`);
await this._destroyScripting();
return;
}
this._internalEvents.set("updatefromsandbox", event => {
if (event?.source !== window) {