Update the PageError handler, in the API, to always mark the operatorList as done and finalize any pending renderTasks

Note that, in the old code, there was a code-path which could prevent this from happening thus affecting future cleanup.
Furthermore, ensure that we'll always attempt to cleanup when handling the 'PageError' message, similar to the code in e.g. the `PDFPageProxy._renderPageChunk` method.
This commit is contained in:
Jonas Jenwald 2019-07-10 13:41:16 +02:00
parent c6fcdf474b
commit ef48a9a713

View File

@ -2089,19 +2089,21 @@ class WorkerTransport {
const page = this.pageCache[data.pageIndex];
const intentState = page.intentStates[data.intent];
if (intentState.operatorList) {
// Mark operator list as complete.
intentState.operatorList.lastChunk = true;
for (let i = 0; i < intentState.renderTasks.length; i++) {
intentState.renderTasks[i].operatorListChanged();
}
page._tryCleanup();
}
if (intentState.displayReadyCapability) {
intentState.displayReadyCapability.reject(new Error(data.error));
} else {
throw new Error(data.error);
}
if (intentState.operatorList) {
// Mark operator list as complete.
intentState.operatorList.lastChunk = true;
for (let i = 0; i < intentState.renderTasks.length; i++) {
intentState.renderTasks[i].operatorListChanged();
}
}
}, this);
messageHandler.on('UnsupportedFeature', this._onUnsupportedFeature, this);