Remove the 'oplist' rendering intent when getOperatorList has returned the complete OperatorList, and prevent errors in PDFPageProxy_destroy for the 'oplist' rendering intent

This commit is contained in:
Jonas Jenwald 2016-01-22 13:28:30 +01:00 committed by Tim van der Meij
parent 5bcf4c1895
commit e401804f13

View File

@ -1034,6 +1034,11 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
function operatorListChanged() {
if (intentState.operatorList.lastChunk) {
intentState.opListReadCapability.resolve(intentState.operatorList);
var i = intentState.renderTasks.indexOf(opListTask);
if (i >= 0) {
intentState.renderTasks.splice(i, 1);
}
}
}
@ -1042,9 +1047,10 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
this.intentStates[renderingIntent] = Object.create(null);
}
var intentState = this.intentStates[renderingIntent];
var opListTask;
if (!intentState.opListReadCapability) {
var opListTask = {};
opListTask = {};
opListTask.operatorListChanged = operatorListChanged;
intentState.receivingOperatorList = true;
intentState.opListReadCapability = createPromiseCapability();
@ -1087,6 +1093,10 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
var waitOn = [];
Object.keys(this.intentStates).forEach(function(intent) {
if (intent === 'oplist') {
// Avoid errors below, since the renderTasks are just stubs.
return;
}
var intentState = this.intentStates[intent];
intentState.renderTasks.forEach(function(renderTask) {
var renderCompleted = renderTask.capability.promise.