[Pkg-javascript-commits] [pdf.js] 04/207: Removes mozResponseArrayBuffer

David Prévot taffit at moszumanska.debian.org
Mon Jul 28 15:36:23 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 9c87fa24f739927fb9f2e57c04794b843db1b075
Author: Yury Delendik <ydelendik at mozilla.com>
Date:   Thu May 29 12:26:16 2014 -0500

    Removes mozResponseArrayBuffer
---
 src/core/jpx.js           | 14 --------------
 src/core/network.js       |  5 ++---
 src/shared/fonts_utils.js |  5 ++---
 web/compatibility.js      |  4 ++--
 4 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/src/core/jpx.js b/src/core/jpx.js
index 114c93a..a533d9b 100644
--- a/src/core/jpx.js
+++ b/src/core/jpx.js
@@ -31,20 +31,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);
diff --git a/src/core/network.js b/src/core/network.js
index 9286df0..d0812bc 100644
--- a/src/core/network.js
+++ b/src/core/network.js
@@ -63,8 +63,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;
     }
@@ -116,7 +115,7 @@ var NetworkManager = (function NetworkManagerClosure() {
         pendingRequest.expectedStatus = 200;
       }
 
-      xhr.mozResponseType = xhr.responseType = 'arraybuffer';
+      xhr.responseType = 'arraybuffer';
 
       if (args.onProgress) {
         xhr.onprogress = args.onProgress;
diff --git a/src/shared/fonts_utils.js b/src/shared/fonts_utils.js
index 57b8e19..3cccc10 100644
--- a/src/shared/fonts_utils.js
+++ b/src/shared/fonts_utils.js
@@ -255,11 +255,10 @@ var Type2Parser = function type2Parser(aFilePath) {
 
   var xhr = new XMLHttpRequest();
   xhr.open('GET', aFilePath, false);
-  xhr.mozResponseType = xhr.responseType = 'arraybuffer';
+  xhr.responseType = 'arraybuffer';
   xhr.expected = (document.URL.indexOf('file:') === 0) ? 0 : 200;
   xhr.send(null);
-  this.data = new Stream(xhr.mozResponseArrayBuffer || xhr.mozResponse ||
-                         xhr.responseArrayBuffer || xhr.response);
+  this.data = new Stream(xhr.response);
 
   // Turn on this flag for additional debugging logs
   var debug = false;
diff --git a/web/compatibility.js b/web/compatibility.js
index fd9f215..8b687b6 100644
--- a/web/compatibility.js
+++ b/web/compatibility.js
@@ -160,7 +160,7 @@ if (typeof PDFJS === 'undefined') {
       value: function xmlHttpRequestOverrideMimeType(mimeType) {}
     });
   }
-  if ('response' in xhr || 'responseArrayBuffer' in xhr) {
+  if ('responseType' in xhr) {
     return;
   }
   // Support: IE9
@@ -189,7 +189,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 });
 })();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list