Bug 1416009 - Update pdf.js to version 2.0.106. r=bdahl, r=Mossop on a CLOSED TREE

--HG--
extra : rebase_source : 97a8c26eb80e45f0a9134a773b8f12e277fe6336
This commit is contained in:
Ryan VanderMeulen 2017-11-09 17:05:52 -05:00
Родитель 8c31f6f143
Коммит 792089fde4
4 изменённых файлов: 37 добавлений и 27 удалений

Просмотреть файл

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.0.104
Current extension version is: 2.0.106
Taken from upstream commit: 012d0756
Taken from upstream commit: 0052dc2b

Просмотреть файл

@ -149,7 +149,7 @@ function getLocalizedString(strings, id, property) {
// PDF data storage
function PdfDataListener(length) {
this.length = length; // less than 0, if length is unknown
this.buffer = null;
this.buffers = [];
this.loaded = 0;
}
@ -157,15 +157,7 @@ PdfDataListener.prototype = {
append: function PdfDataListener_append(chunk) {
// In most of the cases we will pass data as we receive it, but at the
// beginning of the loading we may accumulate some data.
if (!this.buffer) {
this.buffer = new Uint8Array(chunk);
} else {
var buffer = this.buffer;
var newBuffer = new Uint8Array(buffer.length + chunk.length);
newBuffer.set(buffer);
newBuffer.set(chunk, buffer.length);
this.buffer = newBuffer;
}
this.buffers.push(chunk);
this.loaded += chunk.length;
if (this.length >= 0 && this.length < this.loaded) {
this.length = -1; // reset the length, server is giving incorrect one
@ -173,9 +165,26 @@ PdfDataListener.prototype = {
this.onprogress(this.loaded, this.length >= 0 ? this.length : void 0);
},
readData: function PdfDataListener_readData() {
var result = this.buffer;
this.buffer = null;
return result;
if (this.buffers.length === 0) {
return null;
}
if (this.buffers.length === 1) {
return this.buffers.pop();
}
// There are multiple buffers that need to be combined into a single
// buffer.
let combinedLength = 0;
for (let buffer of this.buffers) {
combinedLength += buffer.length;
}
let combinedArray = new Uint8Array(combinedLength);
let writeOffset = 0;
while (this.buffers.length) {
let buffer = this.buffers.shift();
combinedArray.set(buffer, writeOffset);
writeOffset += buffer.length;
}
return combinedArray;
},
finish: function PdfDataListener_finish() {
this.isDataReady = true;
@ -878,8 +887,9 @@ PdfStreamConverter.prototype = {
var binaryStream = this.binaryStream;
binaryStream.setInputStream(aInputStream);
var chunk = binaryStream.readByteArray(aCount);
this.dataListener.append(chunk);
let chunk = new ArrayBuffer(aCount);
binaryStream.readArrayBuffer(aCount, chunk);
this.dataListener.append(new Uint8Array(chunk));
},
// nsIRequestObserver::onStartRequest

Просмотреть файл

@ -1961,7 +1961,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
if (worker.destroyed) {
return Promise.reject(new Error('Worker was destroyed'));
}
let apiVersion = '2.0.104';
let apiVersion = '2.0.106';
source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch');
source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream');
source.chunkedViewerLoading = !!pdfDataRangeTransport;
@ -3258,8 +3258,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}();
var version, build;
{
exports.version = version = '2.0.104';
exports.build = build = '012d0756';
exports.version = version = '2.0.106';
exports.build = build = '0052dc2b';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -4993,8 +4993,8 @@ exports.SVGGraphics = SVGGraphics;
"use strict";
var pdfjsVersion = '2.0.104';
var pdfjsBuild = '012d0756';
var pdfjsVersion = '2.0.106';
var pdfjsBuild = '0052dc2b';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(13);
var pdfjsDisplayAPI = __w_pdfjs_require__(3);
@ -8118,8 +8118,8 @@ if (!_global_scope2.default.PDFJS) {
}
var PDFJS = _global_scope2.default.PDFJS;
{
PDFJS.version = '2.0.104';
PDFJS.build = '012d0756';
PDFJS.version = '2.0.106';
PDFJS.build = '0052dc2b';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {

Просмотреть файл

@ -23284,8 +23284,8 @@ exports.PostScriptCompiler = PostScriptCompiler;
"use strict";
var pdfjsVersion = '2.0.104';
var pdfjsBuild = '012d0756';
var pdfjsVersion = '2.0.106';
var pdfjsBuild = '0052dc2b';
var pdfjsCoreWorker = __w_pdfjs_require__(18);
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
@ -23480,7 +23480,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
let apiVersion = docParams.apiVersion;
let workerVersion = '2.0.104';
let workerVersion = '2.0.106';
if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
}