Ver Fonte

PDF.js version 1.4.72 - See mozilla/pdf.js@e9a1a47d2881e59362670d1504bc5f457961cf3c

Pdf Bot há 9 anos atrás
pai
commit
7013cab0d8
5 ficheiros alterados com 36 adições e 154 exclusões
  1. 1 1
      bower.json
  2. 16 75
      build/pdf.combined.js
  3. 2 2
      build/pdf.js
  4. 16 75
      build/pdf.worker.js
  5. 1 1
      package.json

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "pdfjs-dist",
-  "version": "1.4.68",
+  "version": "1.4.72",
   "main": [
     "build/pdf.js",
     "build/pdf.worker.js"

+ 16 - 75
build/pdf.combined.js

@@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfCombined = {}));
   // Use strict in our context only - users might not want it
   'use strict';
 
-var pdfjsVersion = '1.4.68';
-var pdfjsBuild = 'addc4a3';
+var pdfjsVersion = '1.4.72';
+var pdfjsBuild = 'e9a1a47';
 
   var pdfjsFilePath =
     typeof document !== 'undefined' && document.currentScript ?
@@ -16203,24 +16203,6 @@ var Dict = (function DictClosure() {
     return nonSerializable; // creating closure on some variable
   };
 
-  var GETALL_DICTIONARY_TYPES_WHITELIST = {
-    'Background': true,
-    'ExtGState': true,
-    'Halftone': true,
-    'Layout': true,
-    'Mask': true,
-    'Pagination': true,
-    'Printing': true
-  };
-
-  function isRecursionAllowedFor(dict) {
-    if (!isName(dict.Type)) {
-      return true;
-    }
-    var dictType = dict.Type.name;
-    return GETALL_DICTIONARY_TYPES_WHITELIST[dictType] === true;
-  }
-
   // xref is optional
   function Dict(xref) {
     // Map should only be used internally, use functions below to access.
@@ -16298,58 +16280,6 @@ var Dict = (function DictClosure() {
       return this.map[key];
     },
 
-    // creates new map and dereferences all Refs
-    getAll: function Dict_getAll() {
-      var all = Object.create(null);
-      var queue = null;
-      var key, obj;
-      for (key in this.map) {
-        obj = this.get(key);
-        if (obj instanceof Dict) {
-          if (isRecursionAllowedFor(obj)) {
-            (queue || (queue = [])).push({target: all, key: key, obj: obj});
-          } else {
-            all[key] = this.getRaw(key);
-          }
-        } else {
-          all[key] = obj;
-        }
-      }
-      if (!queue) {
-        return all;
-      }
-
-      // trying to take cyclic references into the account
-      var processed = Object.create(null);
-      while (queue.length > 0) {
-        var item = queue.shift();
-        var itemObj = item.obj;
-        var objId = itemObj.objId;
-        if (objId && objId in processed) {
-          item.target[item.key] = processed[objId];
-          continue;
-        }
-        var dereferenced = Object.create(null);
-        for (key in itemObj.map) {
-          obj = itemObj.get(key);
-          if (obj instanceof Dict) {
-            if (isRecursionAllowedFor(obj)) {
-              queue.push({target: dereferenced, key: key, obj: obj});
-            } else {
-              dereferenced[key] = itemObj.getRaw(key);
-            }
-          } else {
-            dereferenced[key] = obj;
-          }
-        }
-        if (objId) {
-          processed[objId] = dereferenced;
-        }
-        item.target[item.key] = dereferenced;
-      }
-      return all;
-    },
-
     getKeys: function Dict_getKeys() {
       return Object.keys(this.map);
     },
@@ -45885,9 +45815,20 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
               // but doing so is meaningless without knowing the semantics.
               continue;
             default:
-              // Note: Let's hope that the ignored operator does not have any
-              // non-serializable arguments, otherwise postMessage will throw
+              // Note: Ignore the operator if it has `Dict` arguments, since
+              // those are non-serializable, otherwise postMessage will throw
               // "An object could not be cloned.".
+              if (args !== null) {
+                for (i = 0, ii = args.length; i < ii; i++) {
+                  if (args[i] instanceof Dict) {
+                    break;
+                  }
+                }
+                if (i < ii) {
+                  warn('getOperatorList - ignoring operator: ' + fn);
+                  continue;
+                }
+              }
           }
           operatorList.addOp(fn, args);
         }
@@ -47435,7 +47376,7 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() {
             if (!args) {
               args = [];
             }
-            args.push((obj instanceof Dict ? obj.getAll() : obj));
+            args.push(obj);
             assert(args.length <= 33, 'Too many arguments');
           }
         }

+ 2 - 2
build/pdf.js

@@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdf = {}));
   // Use strict in our context only - users might not want it
   'use strict';
 
-var pdfjsVersion = '1.4.68';
-var pdfjsBuild = 'addc4a3';
+var pdfjsVersion = '1.4.72';
+var pdfjsBuild = 'e9a1a47';
 
   var pdfjsFilePath =
     typeof document !== 'undefined' && document.currentScript ?

+ 16 - 75
build/pdf.worker.js

@@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfWorker = {}));
   // Use strict in our context only - users might not want it
   'use strict';
 
-var pdfjsVersion = '1.4.68';
-var pdfjsBuild = 'addc4a3';
+var pdfjsVersion = '1.4.72';
+var pdfjsBuild = 'e9a1a47';
 
   var pdfjsFilePath =
     typeof document !== 'undefined' && document.currentScript ?
@@ -16135,24 +16135,6 @@ var Dict = (function DictClosure() {
     return nonSerializable; // creating closure on some variable
   };
 
-  var GETALL_DICTIONARY_TYPES_WHITELIST = {
-    'Background': true,
-    'ExtGState': true,
-    'Halftone': true,
-    'Layout': true,
-    'Mask': true,
-    'Pagination': true,
-    'Printing': true
-  };
-
-  function isRecursionAllowedFor(dict) {
-    if (!isName(dict.Type)) {
-      return true;
-    }
-    var dictType = dict.Type.name;
-    return GETALL_DICTIONARY_TYPES_WHITELIST[dictType] === true;
-  }
-
   // xref is optional
   function Dict(xref) {
     // Map should only be used internally, use functions below to access.
@@ -16230,58 +16212,6 @@ var Dict = (function DictClosure() {
       return this.map[key];
     },
 
-    // creates new map and dereferences all Refs
-    getAll: function Dict_getAll() {
-      var all = Object.create(null);
-      var queue = null;
-      var key, obj;
-      for (key in this.map) {
-        obj = this.get(key);
-        if (obj instanceof Dict) {
-          if (isRecursionAllowedFor(obj)) {
-            (queue || (queue = [])).push({target: all, key: key, obj: obj});
-          } else {
-            all[key] = this.getRaw(key);
-          }
-        } else {
-          all[key] = obj;
-        }
-      }
-      if (!queue) {
-        return all;
-      }
-
-      // trying to take cyclic references into the account
-      var processed = Object.create(null);
-      while (queue.length > 0) {
-        var item = queue.shift();
-        var itemObj = item.obj;
-        var objId = itemObj.objId;
-        if (objId && objId in processed) {
-          item.target[item.key] = processed[objId];
-          continue;
-        }
-        var dereferenced = Object.create(null);
-        for (key in itemObj.map) {
-          obj = itemObj.get(key);
-          if (obj instanceof Dict) {
-            if (isRecursionAllowedFor(obj)) {
-              queue.push({target: dereferenced, key: key, obj: obj});
-            } else {
-              dereferenced[key] = itemObj.getRaw(key);
-            }
-          } else {
-            dereferenced[key] = obj;
-          }
-        }
-        if (objId) {
-          processed[objId] = dereferenced;
-        }
-        item.target[item.key] = dereferenced;
-      }
-      return all;
-    },
-
     getKeys: function Dict_getKeys() {
       return Object.keys(this.map);
     },
@@ -38024,9 +37954,20 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
               // but doing so is meaningless without knowing the semantics.
               continue;
             default:
-              // Note: Let's hope that the ignored operator does not have any
-              // non-serializable arguments, otherwise postMessage will throw
+              // Note: Ignore the operator if it has `Dict` arguments, since
+              // those are non-serializable, otherwise postMessage will throw
               // "An object could not be cloned.".
+              if (args !== null) {
+                for (i = 0, ii = args.length; i < ii; i++) {
+                  if (args[i] instanceof Dict) {
+                    break;
+                  }
+                }
+                if (i < ii) {
+                  warn('getOperatorList - ignoring operator: ' + fn);
+                  continue;
+                }
+              }
           }
           operatorList.addOp(fn, args);
         }
@@ -39574,7 +39515,7 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() {
             if (!args) {
               args = [];
             }
-            args.push((obj instanceof Dict ? obj.getAll() : obj));
+            args.push(obj);
             assert(args.length <= 33, 'Too many arguments');
           }
         }

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "pdfjs-dist",
-  "version": "1.4.68",
+  "version": "1.4.72",
   "main": "build/pdf.js",
   "description": "Generic build of Mozilla's PDF.js library.",
   "keywords": [