From a265861ba65fb9441328245d94d8559872b8d945 Mon Sep 17 00:00:00 2001 From: Tom De Wolf Date: Sun, 10 Aug 2014 10:26:32 +0200 Subject: [PATCH] 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 6d57b9200..2c7776610 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;