mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Adjust the brace-style
ESLint rule to disallow single lines (and also enable no-iterator
)
See http://eslint.org/docs/rules/brace-style. Having the opening/closing braces on the same line can often make the code slightly more difficult to read, in particular for `if`/`else if` statements, compared to using new lines. This patch also, for consistency with `mozilla-central`, enables the [`no-iterator`](http://eslint.org/docs/rules/no-iterator) rule. Note that this rule didn't require a single code change.
This commit is contained in:
parent
92e5fb099e
commit
bc736fdc7d
18 changed files with 129 additions and 46 deletions
|
@ -430,7 +430,9 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
|
|||
}
|
||||
}
|
||||
|
||||
chunksToRequest.sort(function(a, b) { return a - b; });
|
||||
chunksToRequest.sort(function(a, b) {
|
||||
return a - b;
|
||||
});
|
||||
return this._requestChunks(chunksToRequest);
|
||||
},
|
||||
|
||||
|
|
|
@ -1010,7 +1010,9 @@ var Font = (function FontClosure() {
|
|||
|
||||
var i, ii, j, jj;
|
||||
for (i = ranges.length - 1; i >= 0; --i) {
|
||||
if (ranges[i][0] <= 0xFFFF) { break; }
|
||||
if (ranges[i][0] <= 0xFFFF) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
var bmpLength = i + 1;
|
||||
|
||||
|
|
|
@ -94,7 +94,9 @@ IPDFStream.prototype = {
|
|||
* Gets a reader for the entire PDF data.
|
||||
* @returns {IPDFStreamReader}
|
||||
*/
|
||||
getFullReader: function () { return null; },
|
||||
getFullReader: function () {
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets a reader for the range of the PDF data.
|
||||
|
@ -102,7 +104,9 @@ IPDFStream.prototype = {
|
|||
* @param {number} end - the end offset of the data.
|
||||
* @returns {IPDFStreamRangeReader}
|
||||
*/
|
||||
getRangeReader: function (begin, end) { return null; },
|
||||
getRangeReader: function (begin, end) {
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Cancels all opened reader and closes all their opened requests.
|
||||
|
@ -123,14 +127,18 @@ IPDFStreamReader.prototype = {
|
|||
* the PDF data stream are available.
|
||||
* @returns {Promise}
|
||||
*/
|
||||
get headersReady() { return null; },
|
||||
get headersReady() {
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets PDF binary data length. It is defined after the headersReady promise
|
||||
* is resolved.
|
||||
* @returns {number} The data length (or 0 if unknown).
|
||||
*/
|
||||
get contentLength() { return 0; },
|
||||
get contentLength() {
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets ability of the stream to handle range requests. It is defined after
|
||||
|
@ -138,14 +146,18 @@ IPDFStreamReader.prototype = {
|
|||
* or an error occurs.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
get isRangeSupported() { return false; },
|
||||
get isRangeSupported() {
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets ability of the stream to progressively load binary data. It is defined
|
||||
* after the headersReady promise is resolved.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
get isStreamingSupported() { return false; },
|
||||
get isStreamingSupported() {
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Requests a chunk of the binary data. The method returns the promise, which
|
||||
|
@ -183,7 +195,9 @@ IPDFStreamRangeReader.prototype = {
|
|||
* Gets ability of the stream to progressively load binary data.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
get isStreamingSupported() { return false; },
|
||||
get isStreamingSupported() {
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Requests a chunk of the binary data. The method returns the promise, which
|
||||
|
|
|
@ -98,7 +98,9 @@ if (typeof PDFJSDev === 'undefined' ||
|
|||
return (typeof imageData.data.buffer !== 'undefined');
|
||||
};
|
||||
} else {
|
||||
hasCanvasTypedArrays = function () { return true; };
|
||||
hasCanvasTypedArrays = function () {
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
var LinkTarget = {
|
||||
|
|
|
@ -68,8 +68,12 @@
|
|||
}
|
||||
delete PDFJS.verbosity;
|
||||
Object.defineProperty(PDFJS, 'verbosity', {
|
||||
get: function () { return sharedUtil.getVerbosityLevel(); },
|
||||
set: function (level) { sharedUtil.setVerbosityLevel(level); },
|
||||
get: function () {
|
||||
return sharedUtil.getVerbosityLevel();
|
||||
},
|
||||
set: function (level) {
|
||||
sharedUtil.setVerbosityLevel(level);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
|
|
@ -347,7 +347,9 @@ var renderTextLayer = (function renderTextLayerClosure() {
|
|||
|
||||
function expandBoundsLTR(width, bounds) {
|
||||
// Sorting by x1 coordinate and walk by the bounds in the same order.
|
||||
bounds.sort(function (a, b) { return a.x1 - b.x1 || a.index - b.index; });
|
||||
bounds.sort(function (a, b) {
|
||||
return a.x1 - b.x1 || a.index - b.index;
|
||||
});
|
||||
|
||||
// First we see on the horizon is a fake boundary.
|
||||
var fakeBoundary = {
|
||||
|
|
|
@ -1193,7 +1193,9 @@ function createPromiseCapability() {
|
|||
}
|
||||
if (typeof globalScope.Promise.resolve !== 'function') {
|
||||
globalScope.Promise.resolve = function (value) {
|
||||
return new globalScope.Promise(function (resolve) { resolve(value); });
|
||||
return new globalScope.Promise(function (resolve) {
|
||||
resolve(value);
|
||||
});
|
||||
};
|
||||
}
|
||||
if (typeof globalScope.Promise.reject !== 'function') {
|
||||
|
@ -1401,7 +1403,9 @@ if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL')) {
|
|||
* @returns {Promise}
|
||||
*/
|
||||
Promise.resolve = function Promise_resolve(value) {
|
||||
return new Promise(function (resolve) { resolve(value); });
|
||||
return new Promise(function (resolve) {
|
||||
resolve(value);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1410,7 +1414,9 @@ if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL')) {
|
|||
* @returns {Promise}
|
||||
*/
|
||||
Promise.reject = function Promise_reject(reason) {
|
||||
return new Promise(function (resolve, reject) { reject(reason); });
|
||||
return new Promise(function (resolve, reject) {
|
||||
reject(reason);
|
||||
});
|
||||
};
|
||||
|
||||
Promise.prototype = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue