mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #12622 from Snuffleupagus/hasJSActions-cleanup
Some `hasJSActions`, and general annotation-code, related cleanup in the viewer and API
This commit is contained in:
commit
2aefc406b4
8 changed files with 30 additions and 19 deletions
|
@ -905,7 +905,7 @@ class PDFDocumentProxy {
|
|||
|
||||
/**
|
||||
* @returns {Promise<boolean>} A promise that is resolved with `true`
|
||||
* if some /AcroForm fields have JavaScript actions.
|
||||
* if some /AcroForm fields have JavaScript actions.
|
||||
*/
|
||||
hasJSActions() {
|
||||
return this._transport.hasJSActions();
|
||||
|
@ -2128,7 +2128,10 @@ class WorkerTransport {
|
|||
const terminated = this.messageHandler.sendWithPromise("Terminate", null);
|
||||
waitOn.push(terminated);
|
||||
Promise.all(waitOn).then(() => {
|
||||
this.commonObjs.clear();
|
||||
this.fontLoader.clear();
|
||||
this._hasJSActionsPromise = null;
|
||||
|
||||
if (this._networkStream) {
|
||||
this._networkStream.cancelAllRequests(
|
||||
new AbortException("Worker was terminated.")
|
||||
|
@ -2577,7 +2580,10 @@ class WorkerTransport {
|
|||
}
|
||||
|
||||
hasJSActions() {
|
||||
return this.messageHandler.sendWithPromise("HasJSActions", null);
|
||||
return (this._hasJSActionsPromise ||= this.messageHandler.sendWithPromise(
|
||||
"HasJSActions",
|
||||
null
|
||||
));
|
||||
}
|
||||
|
||||
getCalculationOrderIds() {
|
||||
|
@ -2679,6 +2685,7 @@ class WorkerTransport {
|
|||
}
|
||||
this.commonObjs.clear();
|
||||
this.fontLoader.clear();
|
||||
this._hasJSActionsPromise = null;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue