Sfoglia il codice sorgente

PDF.js version 1.0.391

Yury Delendik 10 anni fa
parent
commit
1e5a72bfe4
5 ha cambiato i file con 36 aggiunte e 10 eliminazioni
  1. 1 1
      bower.json
  2. 16 3
      build/pdf.combined.js
  3. 2 2
      build/pdf.js
  4. 16 3
      build/pdf.worker.js
  5. 1 1
      package.json

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "pdfjs-dist",
-  "version": "1.0.389",
+  "version": "1.0.391",
   "keywords": [
     "Mozilla",
     "pdf",

+ 16 - 3
build/pdf.combined.js

@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 
-PDFJS.version = '1.0.389';
-PDFJS.build = 'bab40ca';
+PDFJS.version = '1.0.391';
+PDFJS.build = '011eb84';
 
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it
@@ -7204,6 +7204,7 @@ var ChunkedStream = (function ChunkedStreamClosure() {
     this.numChunks = Math.ceil(length / chunkSize);
     this.manager = manager;
     this.initialDataLength = 0;
+    this.lastSuccessfulEnsureByteChunk = -1;  // a single-entry cache
   }
 
   // required methods for a stream. if a particular stream does not
@@ -7263,6 +7264,18 @@ var ChunkedStream = (function ChunkedStreamClosure() {
       }
     },
 
+    ensureByte: function ChunkedStream_ensureRange(pos) {
+      var chunk = Math.floor(pos / this.chunkSize);
+      if (chunk === this.lastSuccessfulEnsureByteChunk) {
+        return;
+      }
+
+      if (!(chunk in this.loadedChunks)) {
+        throw new MissingDataException(pos, pos + 1);
+      }
+      this.lastSuccessfulEnsureByteChunk = chunk;
+    },
+
     ensureRange: function ChunkedStream_ensureRange(begin, end) {
       if (begin >= end) {
         return;
@@ -7315,7 +7328,7 @@ var ChunkedStream = (function ChunkedStreamClosure() {
       if (pos >= this.end) {
         return -1;
       }
-      this.ensureRange(pos, pos + 1);
+      this.ensureByte(pos);
       return this.bytes[this.pos++];
     },
 

+ 2 - 2
build/pdf.js

@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 
-PDFJS.version = '1.0.389';
-PDFJS.build = 'bab40ca';
+PDFJS.version = '1.0.391';
+PDFJS.build = '011eb84';
 
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it

+ 16 - 3
build/pdf.worker.js

@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 
-PDFJS.version = '1.0.389';
-PDFJS.build = 'bab40ca';
+PDFJS.version = '1.0.391';
+PDFJS.build = '011eb84';
 
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it
@@ -2603,6 +2603,7 @@ var ChunkedStream = (function ChunkedStreamClosure() {
     this.numChunks = Math.ceil(length / chunkSize);
     this.manager = manager;
     this.initialDataLength = 0;
+    this.lastSuccessfulEnsureByteChunk = -1;  // a single-entry cache
   }
 
   // required methods for a stream. if a particular stream does not
@@ -2662,6 +2663,18 @@ var ChunkedStream = (function ChunkedStreamClosure() {
       }
     },
 
+    ensureByte: function ChunkedStream_ensureRange(pos) {
+      var chunk = Math.floor(pos / this.chunkSize);
+      if (chunk === this.lastSuccessfulEnsureByteChunk) {
+        return;
+      }
+
+      if (!(chunk in this.loadedChunks)) {
+        throw new MissingDataException(pos, pos + 1);
+      }
+      this.lastSuccessfulEnsureByteChunk = chunk;
+    },
+
     ensureRange: function ChunkedStream_ensureRange(begin, end) {
       if (begin >= end) {
         return;
@@ -2714,7 +2727,7 @@ var ChunkedStream = (function ChunkedStreamClosure() {
       if (pos >= this.end) {
         return -1;
       }
-      this.ensureRange(pos, pos + 1);
+      this.ensureByte(pos);
       return this.bytes[this.pos++];
     },
 

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "pdfjs-dist",
-  "version": "1.0.389",
+  "version": "1.0.391",
   "description": "Generic build of Mozilla's PDF.js library.",
   "keywords": [
     "Mozilla",