Merge pull request #7890 from Snuffleupagus/pre-eslint-fixes
Fix a number of code style issues found by various ESLint rules, to make it easier to switch from JSHint to ESLint
This commit is contained in:
commit
7d8fa1385d
@ -338,4 +338,3 @@ var PdfjsChromeUtils = {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
1
external/crlfchecker/crlfchecker.js
vendored
1
external/crlfchecker/crlfchecker.js
vendored
@ -24,4 +24,3 @@ function checkIfCrlfIsPresent(files) {
|
||||
}
|
||||
|
||||
exports.checkIfCrlfIsPresent = checkIfCrlfIsPresent;
|
||||
|
||||
|
2
make.js
2
make.js
@ -883,7 +883,7 @@ target.chromium = function() {
|
||||
'extensions/chromium/*.html',
|
||||
'extensions/chromium/*.js',
|
||||
'extensions/chromium/*.css',
|
||||
'extensions/chromium/icon*.png',],
|
||||
'extensions/chromium/icon*.png'],
|
||||
CHROME_BUILD_DIR],
|
||||
['extensions/chromium/pageAction/*.*', CHROME_BUILD_DIR + '/pageAction'],
|
||||
['extensions/chromium/options/*.*', CHROME_BUILD_DIR + '/options'],
|
||||
|
@ -1729,13 +1729,13 @@ var PDF20 = (function PDF20Closure() {
|
||||
|
||||
var CipherTransform = (function CipherTransformClosure() {
|
||||
function CipherTransform(stringCipherConstructor, streamCipherConstructor) {
|
||||
this.stringCipherConstructor = stringCipherConstructor;
|
||||
this.streamCipherConstructor = streamCipherConstructor;
|
||||
this.StringCipherConstructor = stringCipherConstructor;
|
||||
this.StreamCipherConstructor = streamCipherConstructor;
|
||||
}
|
||||
|
||||
CipherTransform.prototype = {
|
||||
createStream: function CipherTransform_createStream(stream, length) {
|
||||
var cipher = new this.streamCipherConstructor();
|
||||
var cipher = new this.StreamCipherConstructor();
|
||||
return new DecryptStream(stream, length,
|
||||
function cipherTransformDecryptStream(data, finalize) {
|
||||
return cipher.decryptBlock(data, finalize);
|
||||
@ -1743,7 +1743,7 @@ var CipherTransform = (function CipherTransformClosure() {
|
||||
);
|
||||
},
|
||||
decryptString: function CipherTransform_decryptString(s) {
|
||||
var cipher = new this.stringCipherConstructor();
|
||||
var cipher = new this.StringCipherConstructor();
|
||||
var data = stringToBytes(s);
|
||||
data = cipher.decryptBlock(data, true);
|
||||
return bytesToString(data);
|
||||
@ -2057,17 +2057,17 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() {
|
||||
return new NullCipher();
|
||||
};
|
||||
}
|
||||
if ('V2' === cfm.name) {
|
||||
if (cfm.name === 'V2') {
|
||||
return function cipherTransformFactoryBuildCipherConstructorV2() {
|
||||
return new ARCFourCipher(buildObjectKey(num, gen, key, false));
|
||||
};
|
||||
}
|
||||
if ('AESV2' === cfm.name) {
|
||||
if (cfm.name === 'AESV2') {
|
||||
return function cipherTransformFactoryBuildCipherConstructorAESV2() {
|
||||
return new AES128Cipher(buildObjectKey(num, gen, key, true));
|
||||
};
|
||||
}
|
||||
if ('AESV3' === cfm.name) {
|
||||
if (cfm.name === 'AESV3') {
|
||||
return function cipherTransformFactoryBuildCipherConstructorAESV3() {
|
||||
return new AES256Cipher(key);
|
||||
};
|
||||
|
@ -2943,6 +2943,7 @@ var ErrorFont = (function ErrorFontClosure() {
|
||||
function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
|
||||
var charCodeToGlyphId = Object.create(null);
|
||||
var glyphId, charCode, baseEncoding;
|
||||
var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
|
||||
|
||||
if (properties.baseEncodingName) {
|
||||
// If a valid base encoding name was used, the mapping is initialized with
|
||||
@ -2956,9 +2957,8 @@ function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
|
||||
charCodeToGlyphId[charCode] = 0; // notdef
|
||||
}
|
||||
}
|
||||
} else if (!!(properties.flags & FontFlags.Symbolic)) {
|
||||
// For a symbolic font the encoding should be the fonts built-in
|
||||
// encoding.
|
||||
} else if (isSymbolicFont) {
|
||||
// For a symbolic font the encoding should be the fonts built-in encoding.
|
||||
for (charCode in builtInEncoding) {
|
||||
charCodeToGlyphId[charCode] = builtInEncoding[charCode];
|
||||
}
|
||||
|
@ -1780,13 +1780,13 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
||||
this.save();
|
||||
this.baseTransformStack.push(this.baseTransform);
|
||||
|
||||
if (isArray(matrix) && 6 === matrix.length) {
|
||||
if (isArray(matrix) && matrix.length === 6) {
|
||||
this.transform.apply(this, matrix);
|
||||
}
|
||||
|
||||
this.baseTransform = this.ctx.mozCurrentTransform;
|
||||
|
||||
if (isArray(bbox) && 4 === bbox.length) {
|
||||
if (isArray(bbox) && bbox.length === 4) {
|
||||
var width = bbox[2] - bbox[0];
|
||||
var height = bbox[3] - bbox[1];
|
||||
this.ctx.rect(bbox[0], bbox[1], width, height);
|
||||
@ -1947,7 +1947,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
||||
matrix) {
|
||||
this.save();
|
||||
|
||||
if (isArray(rect) && 4 === rect.length) {
|
||||
if (isArray(rect) && rect.length === 4) {
|
||||
var width = rect[2] - rect[0];
|
||||
var height = rect[3] - rect[1];
|
||||
this.ctx.rect(rect[0], rect[1], width, height);
|
||||
|
@ -2166,7 +2166,7 @@ if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL')) {
|
||||
err('\\ not allowed in relative path.');
|
||||
}
|
||||
var tmp;
|
||||
if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
|
||||
if ((tmp = relativePathDotMapping[buffer.toLowerCase()])) {
|
||||
buffer = tmp;
|
||||
}
|
||||
if ('..' === buffer) {
|
||||
|
@ -81,7 +81,7 @@ function parseOptions() {
|
||||
'test_manifest.json'))
|
||||
.check(describeCheck(function (argv) {
|
||||
return !argv.browser || !argv.browserManifestFile;
|
||||
}, '--browser and --browserManifestFile must not be specified at the ' +'' +
|
||||
}, '--browser and --browserManifestFile must not be specified at the ' +
|
||||
'same time.'));
|
||||
var result = yargs.argv;
|
||||
if (result.help) {
|
||||
|
@ -505,7 +505,7 @@ describe('api', function() {
|
||||
|
||||
// PageLabels with bad "Prefix" entries.
|
||||
var url3 = new URL('../pdfs/bad-PageLabels.pdf', window.location).href;
|
||||
var loadingTask3 = new PDFJS.getDocument(url3);
|
||||
var loadingTask3 = PDFJS.getDocument(url3);
|
||||
var promise3 = loadingTask3.promise.then(function (pdfDoc) {
|
||||
return pdfDoc.getPageLabels();
|
||||
});
|
||||
|
@ -203,4 +203,3 @@ function initializePDFJS(callback) {
|
||||
return destination;
|
||||
}
|
||||
}());
|
||||
|
||||
|
@ -73,7 +73,7 @@ describe('Type1Parser', function() {
|
||||
'dup 0 1 RD x noaccess put\n' +
|
||||
'end\n' +
|
||||
'/CharStrings 46 dict dup begin\n' +
|
||||
'/.notdef 1 RD x ND' + '\n' +
|
||||
'/.notdef 1 RD x ND\n' +
|
||||
'end');
|
||||
var parser = new Type1Parser(stream, false, SEAC_ANALYSIS_ENABLED);
|
||||
var program = parser.extractFontProgram();
|
||||
|
@ -117,4 +117,3 @@ describe('ui_utils', function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -270,7 +270,7 @@ if (typeof PDFJS === 'undefined') {
|
||||
// initialize result and counters
|
||||
var bc = 0, bs, buffer, idx = 0, output = '';
|
||||
// get next character
|
||||
buffer = input.charAt(idx++);
|
||||
(buffer = input.charAt(idx++));
|
||||
// character found in table?
|
||||
// initialize bit storage and add its ascii value
|
||||
~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
|
||||
|
@ -173,7 +173,7 @@ Preferences._readFromStorage = function (prefObj) {
|
||||
highlightAll: !!evt.detail.highlightAll,
|
||||
findPrevious: !!evt.detail.findPrevious
|
||||
});
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
for (var i = 0, len = events.length; i < len; i++) {
|
||||
window.addEventListener(events[i], handleEvent);
|
||||
|
@ -188,7 +188,7 @@ var SecondaryToolbar = (function SecondaryToolbarClosure() {
|
||||
toggleHandToolButton.firstElementChild.textContent =
|
||||
mozL10n.get('hand_tool_enable_label', null, 'Enable hand tool');
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
open: function SecondaryToolbar_open() {
|
||||
|
Loading…
Reference in New Issue
Block a user