Merge pull request #11872 from Snuffleupagus/issue-11871
Gracefully handle annotation parsing errors in `Page.getOperatorList` (issue 11871)
This commit is contained in:
		
						commit
						491904d30a
					
				@ -302,11 +302,15 @@ class Page {
 | 
				
			|||||||
        for (const annotation of annotations) {
 | 
					        for (const annotation of annotations) {
 | 
				
			||||||
          if (isAnnotationRenderable(annotation, intent)) {
 | 
					          if (isAnnotationRenderable(annotation, intent)) {
 | 
				
			||||||
            opListPromises.push(
 | 
					            opListPromises.push(
 | 
				
			||||||
              annotation.getOperatorList(
 | 
					              annotation
 | 
				
			||||||
                partialEvaluator,
 | 
					                .getOperatorList(partialEvaluator, task, renderInteractiveForms)
 | 
				
			||||||
                task,
 | 
					                .catch(function (reason) {
 | 
				
			||||||
                renderInteractiveForms
 | 
					                  warn(
 | 
				
			||||||
              )
 | 
					                    "getOperatorList - ignoring annotation data during " +
 | 
				
			||||||
 | 
					                      `"${task.name}" task: "${reason}".`
 | 
				
			||||||
 | 
					                  );
 | 
				
			||||||
 | 
					                  return null;
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -13,7 +13,7 @@
 | 
				
			|||||||
 * limitations under the License.
 | 
					 * limitations under the License.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { assert, ImageKind, OPS } from "../shared/util.js";
 | 
					import { assert, ImageKind, OPS, warn } from "../shared/util.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var QueueOptimizer = (function QueueOptimizerClosure() {
 | 
					var QueueOptimizer = (function QueueOptimizerClosure() {
 | 
				
			||||||
  function addState(parentState, pattern, checkFn, iterateFn, processFn) {
 | 
					  function addState(parentState, pattern, checkFn, iterateFn, processFn) {
 | 
				
			||||||
@ -674,6 +674,10 @@ var OperatorList = (function OperatorListClosure() {
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    addOpList(opList) {
 | 
					    addOpList(opList) {
 | 
				
			||||||
 | 
					      if (!(opList instanceof OperatorList)) {
 | 
				
			||||||
 | 
					        warn('addOpList - ignoring invalid "opList" parameter.');
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      Object.assign(this.dependencies, opList.dependencies);
 | 
					      Object.assign(this.dependencies, opList.dependencies);
 | 
				
			||||||
      for (var i = 0, ii = opList.length; i < ii; i++) {
 | 
					      for (var i = 0, ii = opList.length; i < ii; i++) {
 | 
				
			||||||
        this.addOp(opList.fnArray[i], opList.argsArray[i]);
 | 
					        this.addOp(opList.fnArray[i], opList.argsArray[i]);
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								test/pdfs/issue11871.pdf.link
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								test/pdfs/issue11871.pdf.link
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					https://github.com/mozilla/pdf.js/files/4575091/bugdoc.pdf
 | 
				
			||||||
@ -1134,6 +1134,15 @@
 | 
				
			|||||||
       "link": true,
 | 
					       "link": true,
 | 
				
			||||||
       "type": "eq"
 | 
					       "type": "eq"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    {  "id": "issue11871",
 | 
				
			||||||
 | 
					       "file": "pdfs/issue11871.pdf",
 | 
				
			||||||
 | 
					       "md5": "9c533eacd0ca892df4191360848668a2",
 | 
				
			||||||
 | 
					       "rounds": 1,
 | 
				
			||||||
 | 
					       "link": true,
 | 
				
			||||||
 | 
					       "firstPage": 2,
 | 
				
			||||||
 | 
					       "lastPage": 2,
 | 
				
			||||||
 | 
					       "type": "eq"
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    {  "id": "bug1252420",
 | 
					    {  "id": "bug1252420",
 | 
				
			||||||
       "file": "pdfs/bug1252420.pdf",
 | 
					       "file": "pdfs/bug1252420.pdf",
 | 
				
			||||||
       "md5": "f21c911b9b655972b06ef782a1fa6a17",
 | 
					       "md5": "f21c911b9b655972b06ef782a1fa6a17",
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user