Merge pull request #4866 from yurydelendik/issue4673

Removes mozResponseArrayBuffer
This commit is contained in:
Yury Delendik 2014-06-02 12:51:29 -05:00
commit 5ded0ea163
4 changed files with 10 additions and 22 deletions

View File

@ -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);

View File

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

View File

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

View File

@ -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 });
})();