Jelajahi Sumber

PDF.js version 1.0.284

Yury Delendik 10 tahun lalu
induk
melakukan
05f138a71d
6 mengubah file dengan 18 tambahan dan 44 penghapusan
  1. 1 1
      bower.json
  2. 4 19
      build/pdf.combined.js
  3. 2 2
      build/pdf.js
  4. 4 19
      build/pdf.worker.js
  5. 1 1
      package.json
  6. 6 2
      web/compatibility.js

+ 1 - 1
bower.json

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

+ 4 - 19
build/pdf.combined.js

@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 
-PDFJS.version = '1.0.281';
-PDFJS.build = 'c7c1639';
+PDFJS.version = '1.0.284';
+PDFJS.build = '5ded0ea';
 
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it
@@ -6893,8 +6893,7 @@ var NetworkManager = (function NetworkManagerClosure() {
   }
 
   function getArrayBuffer(xhr) {
-    var data = (xhr.mozResponseArrayBuffer || xhr.mozResponse ||
-                xhr.responseArrayBuffer || xhr.response);
+    var data = xhr.response;
     if (typeof data !== 'string') {
       return data;
     }
@@ -6946,7 +6945,7 @@ var NetworkManager = (function NetworkManagerClosure() {
         pendingRequest.expectedStatus = 200;
       }
 
-      xhr.mozResponseType = xhr.responseType = 'arraybuffer';
+      xhr.responseType = 'arraybuffer';
 
       if (args.onProgress) {
         xhr.onprogress = args.onProgress;
@@ -43785,20 +43784,6 @@ var JpxImage = (function JpxImageClosure() {
     this.failOnCorruptedImage = false;
   }
   JpxImage.prototype = {
-    load: function JpxImage_load(url) {
-      var xhr = new XMLHttpRequest();
-      xhr.open('GET', url, true);
-      xhr.responseType = 'arraybuffer';
-      xhr.onload = (function() {
-        // TODO catch parse error
-        var data = new Uint8Array(xhr.response || xhr.mozResponseArrayBuffer);
-        this.parse(data);
-        if (this.onload) {
-          this.onload();
-        }
-      }).bind(this);
-      xhr.send(null);
-    },
     parse: function JpxImage_parse(data) {
 
       var head = readUint16(data, 0);

+ 2 - 2
build/pdf.js

@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 
-PDFJS.version = '1.0.281';
-PDFJS.build = 'c7c1639';
+PDFJS.version = '1.0.284';
+PDFJS.build = '5ded0ea';
 
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it

+ 4 - 19
build/pdf.worker.js

@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 
-PDFJS.version = '1.0.281';
-PDFJS.build = 'c7c1639';
+PDFJS.version = '1.0.284';
+PDFJS.build = '5ded0ea';
 
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it
@@ -2386,8 +2386,7 @@ var NetworkManager = (function NetworkManagerClosure() {
   }
 
   function getArrayBuffer(xhr) {
-    var data = (xhr.mozResponseArrayBuffer || xhr.mozResponse ||
-                xhr.responseArrayBuffer || xhr.response);
+    var data = xhr.response;
     if (typeof data !== 'string') {
       return data;
     }
@@ -2439,7 +2438,7 @@ var NetworkManager = (function NetworkManagerClosure() {
         pendingRequest.expectedStatus = 200;
       }
 
-      xhr.mozResponseType = xhr.responseType = 'arraybuffer';
+      xhr.responseType = 'arraybuffer';
 
       if (args.onProgress) {
         xhr.onprogress = args.onProgress;
@@ -39278,20 +39277,6 @@ var JpxImage = (function JpxImageClosure() {
     this.failOnCorruptedImage = false;
   }
   JpxImage.prototype = {
-    load: function JpxImage_load(url) {
-      var xhr = new XMLHttpRequest();
-      xhr.open('GET', url, true);
-      xhr.responseType = 'arraybuffer';
-      xhr.onload = (function() {
-        // TODO catch parse error
-        var data = new Uint8Array(xhr.response || xhr.mozResponseArrayBuffer);
-        this.parse(data);
-        if (this.onload) {
-          this.onload();
-        }
-      }).bind(this);
-      xhr.send(null);
-    },
     parse: function JpxImage_parse(data) {
 
       var head = readUint16(data, 0);

+ 1 - 1
package.json

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

+ 6 - 2
web/compatibility.js

@@ -160,9 +160,13 @@ if (typeof PDFJS === 'undefined') {
       value: function xmlHttpRequestOverrideMimeType(mimeType) {}
     });
   }
-  if ('response' in xhr || 'responseArrayBuffer' in xhr) {
+  if ('responseType' in xhr) {
     return;
   }
+
+  // The worker will be using XHR, so we can save time and disable worker.
+  PDFJS.disableWorker = true;
+
   // Support: IE9
   if (typeof VBArray !== 'undefined') {
     Object.defineProperty(xhrPrototype, 'response', {
@@ -189,7 +193,7 @@ if (typeof PDFJS === 'undefined') {
     for (i = 0; i < n; ++i) {
       result[i] = text.charCodeAt(i) & 0xFF;
     }
-    return result;
+    return result.buffer;
   }
   Object.defineProperty(xhrPrototype, 'response', { get: responseGetter });
 })();