[Pkg-javascript-commits] [pdf.js] 158/246: only convert in IE9 if the requested responseType is actually an arraybuffer, otherwise just return the responseText. That way the compatibility.js does not break other frameworks like angular that not always want an array from xhr requests.

David Prévot taffit at moszumanska.debian.org
Sun Sep 7 15:36:36 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 a265861ba65fb9441328245d94d8559872b8d945
Author: Tom De Wolf <t.dewolf at aca-it.be>
Date:   Sun Aug 10 10:26:32 2014 +0200

    only convert in IE9 if the requested responseType is actually an arraybuffer, otherwise just return the responseText. That way the compatibility.js does not break other frameworks like angular that not always want an array from xhr requests.
---
 web/compatibility.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/web/compatibility.js b/web/compatibility.js
index 6d57b92..2c77766 100644
--- a/web/compatibility.js
+++ b/web/compatibility.js
@@ -171,7 +171,11 @@ if (typeof PDFJS === 'undefined') {
   if (typeof VBArray !== 'undefined') {
     Object.defineProperty(xhrPrototype, 'response', {
       get: function xmlHttpRequestResponseGet() {
-        return new Uint8Array(new VBArray(this.responseBody).toArray());
+        if (this.responseType === 'arraybuffer') {
+          return new Uint8Array(new VBArray(this.responseBody).toArray());
+        } else {
+          return this.responseText;
+        }
       }
     });
     return;

-- 
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