Update Prettier to version 2.0

Please note that these changes were done automatically, using `gulp lint --fix`.

Given that the major version number was increased, there's a fair number of (primarily whitespace) changes; please see https://prettier.io/blog/2020/03/21/2.0.0.html
In order to reduce the size of these changes somewhat, this patch maintains the old "arrowParens" style for now (once mozilla-central updates Prettier we can simply choose the same formatting, assuming it will differ here).
This commit is contained in:
Jonas Jenwald 2020-04-14 12:28:14 +02:00
parent a4dd081d7b
commit 426945b480
145 changed files with 2005 additions and 2009 deletions

View file

@ -309,12 +309,12 @@ function getDocument(src) {
}
const docId = task.docId;
worker.promise
.then(function() {
.then(function () {
if (task.destroyed) {
throw new Error("Loading aborted");
}
return _fetchDocument(worker, params, rangeTransport, docId).then(
function(workerId) {
function (workerId) {
if (task.destroyed) {
throw new Error("Loading aborted");
}
@ -411,7 +411,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
isEvalSupported: source.isEvalSupported,
fontExtraProperties: source.fontExtraProperties,
})
.then(function(workerId) {
.then(function (workerId) {
if (worker.destroyed) {
throw new Error("Worker was destroyed");
}
@ -679,7 +679,7 @@ class PDFDocumentProxy {
getOpenActionDestination() {
deprecated("getOpenActionDestination, use getOpenAction instead.");
return this.getOpenAction().then(function(openAction) {
return this.getOpenAction().then(function (openAction) {
return openAction && openAction.dest ? openAction.dest : null;
});
}
@ -1214,9 +1214,9 @@ class PDFPageProxy {
getTextContent(params = {}) {
const readableStream = this.streamTextContent(params);
return new Promise(function(resolve, reject) {
return new Promise(function (resolve, reject) {
function pump() {
reader.read().then(function({ value, done }) {
reader.read().then(function ({ value, done }) {
if (done) {
resolve(textContent);
return;
@ -1257,9 +1257,9 @@ class PDFPageProxy {
// Avoid errors below, since the renderTasks are just stubs.
return;
}
intentState.renderTasks.forEach(function(renderTask) {
intentState.renderTasks.forEach(function (renderTask) {
const renderCompleted = renderTask.capability.promise.catch(
function() {}
function () {}
); // ignoring failures
waitOn.push(renderCompleted);
renderTask.cancel();
@ -1629,7 +1629,7 @@ const PDFWorker = (function PDFWorkerClosure() {
}
fakeWorkerCapability = createPromiseCapability();
const loader = async function() {
const loader = async function () {
const mainWorkerMessageHandler = getMainThreadWorkerMessageHandler();
if (mainWorkerMessageHandler) {
@ -1734,7 +1734,7 @@ const PDFWorker = (function PDFWorkerClosure() {
_initializeFromPort(port) {
this._port = port;
this._messageHandler = new MessageHandler("main", "worker", port);
this._messageHandler.on("ready", function() {
this._messageHandler.on("ready", function () {
// Ignoring 'ready' event -- MessageHandler shall be already initialized
// and ready to accept the messages.
});
@ -1991,7 +1991,7 @@ class WorkerTransport {
const waitOn = [];
// We need to wait for all renderings to be completed, e.g.
// timeout/rAF can take a long time.
this.pageCache.forEach(function(page) {
this.pageCache.forEach(function (page) {
if (page) {
waitOn.push(page._destroy());
}
@ -2033,7 +2033,7 @@ class WorkerTransport {
sink.onPull = () => {
this._fullReader
.read()
.then(function({ value, done }) {
.then(function ({ value, done }) {
if (done) {
sink.close();
return;
@ -2108,7 +2108,7 @@ class WorkerTransport {
sink.onPull = () => {
rangeReader
.read()
.then(function({ value, done }) {
.then(function ({ value, done }) {
if (done) {
sink.close();
return;
@ -2131,7 +2131,7 @@ class WorkerTransport {
loadingTask._capability.resolve(new PDFDocumentProxy(pdfInfo, this));
});
messageHandler.on("DocException", function(ex) {
messageHandler.on("DocException", function (ex) {
let reason;
switch (ex.name) {
case "PasswordException":
@ -2283,10 +2283,10 @@ class WorkerTransport {
case "JpegStream":
return new Promise((resolve, reject) => {
const img = new Image();
img.onload = function() {
img.onload = function () {
resolve(img);
};
img.onerror = function() {
img.onerror = function () {
// Note that when the browser image loading/decoding fails,
// we'll fallback to the built-in PDF.js JPEG decoder; see
// `PartialEvaluator.buildPaintImageXObject` in the
@ -2354,9 +2354,9 @@ class WorkerTransport {
);
}
return new Promise(function(resolve, reject) {
return new Promise(function (resolve, reject) {
const img = new Image();
img.onload = function() {
img.onload = function () {
const { width, height } = img;
const size = width * height;
const rgbaLength = size * 4;
@ -2390,7 +2390,7 @@ class WorkerTransport {
tmpCanvas = null;
tmpCtx = null;
};
img.onerror = function() {
img.onerror = function () {
reject(new Error("JpegDecode failed to load image"));
// Always remember to release the image data if errors occurred.
@ -2415,10 +2415,10 @@ class WorkerTransport {
fetched = true;
this.CMapReaderFactory.fetch(data)
.then(function(builtInCMap) {
.then(function (builtInCMap) {
sink.enqueue(builtInCMap, 1, [builtInCMap.cMapData.buffer]);
})
.catch(function(reason) {
.catch(function (reason) {
sink.error(reason);
});
};
@ -2477,7 +2477,7 @@ class WorkerTransport {
.sendWithPromise("GetPageIndex", {
ref,
})
.catch(function(reason) {
.catch(function (reason) {
return Promise.reject(new Error(reason));
});
}
@ -2856,9 +2856,7 @@ const InternalRenderTask = (function InternalRenderTaskClosure() {
this._nextBound().catch(this.cancel.bind(this));
});
} else {
Promise.resolve()
.then(this._nextBound)
.catch(this.cancel.bind(this));
Promise.resolve().then(this._nextBound).catch(this.cancel.bind(this));
}
}