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:
Tim van der Meij 2016-12-14 01:16:24 +01:00 committed by GitHub
commit 7d8fa1385d
41 changed files with 99 additions and 103 deletions

View File

@ -54,7 +54,7 @@ function isPdfDownloadable(details) {
* @return {undefined|{name: string, value: string}} The header, if found. * @return {undefined|{name: string, value: string}} The header, if found.
*/ */
function getHeaderFromHeaders(headers, headerName) { function getHeaderFromHeaders(headers, headerName) {
for (var i=0; i<headers.length; ++i) { for (var i = 0; i < headers.length; ++i) {
var header = headers[i]; var header = headers[i];
if (header.name.toLowerCase() === headerName) { if (header.name.toLowerCase() === headerName) {
return header; return header;
@ -72,7 +72,7 @@ function getHeaderFromHeaders(headers, headerName) {
function isPdfFile(details) { function isPdfFile(details) {
var header = getHeaderFromHeaders(details.responseHeaders, 'content-type'); var header = getHeaderFromHeaders(details.responseHeaders, 'content-type');
if (header) { if (header) {
var headerValue = header.value.toLowerCase().split(';',1)[0].trim(); var headerValue = header.value.toLowerCase().split(';', 1)[0].trim();
if (headerValue === 'application/pdf') { if (headerValue === 'application/pdf') {
return true; return true;
} }
@ -153,7 +153,7 @@ chrome.webRequest.onHeadersReceived.addListener(
], ],
types: ['main_frame', 'sub_frame'] types: ['main_frame', 'sub_frame']
}, },
['blocking','responseHeaders']); ['blocking', 'responseHeaders']);
chrome.webRequest.onBeforeRequest.addListener( chrome.webRequest.onBeforeRequest.addListener(
function onBeforeRequestForFTP(details) { function onBeforeRequestForFTP(details) {

View File

@ -338,4 +338,3 @@ var PdfjsChromeUtils = {
}); });
} }
}; };

View File

@ -68,7 +68,7 @@ function handlePreprocessorAction(ctx, actionName, args, loc) {
jsonPath.substring(ROOT_PREFIX.length)); jsonPath.substring(ROOT_PREFIX.length));
} }
var jsonContent = fs.readFileSync(jsonPath).toString(); var jsonContent = fs.readFileSync(jsonPath).toString();
var parsedJSON = esprima.parse('(' +jsonContent + ')'); var parsedJSON = esprima.parse('(' + jsonContent + ')');
parsedJSON.body[0].expression.loc = loc; parsedJSON.body[0].expression.loc = loc;
return parsedJSON.body[0].expression; return parsedJSON.body[0].expression;
} }

View File

@ -24,4 +24,3 @@ function checkIfCrlfIsPresent(files) {
} }
exports.checkIfCrlfIsPresent = checkIfCrlfIsPresent; exports.checkIfCrlfIsPresent = checkIfCrlfIsPresent;

View File

@ -210,7 +210,7 @@ function readDependencies(rootPaths) {
} }
}); });
if (discovered.length === 0) { if (discovered.length === 0) {
throw new Error ('Some circular references exist: somewhere at ' + throw new Error('Some circular references exist: somewhere at ' +
left.join(',')); left.join(','));
} }
discovered.sort(); discovered.sort();

View File

@ -197,7 +197,7 @@ function createBundle(defines) {
case 'mainfile': case 'mainfile':
// 'buildnumber' shall create BUILD_DIR for us // 'buildnumber' shall create BUILD_DIR for us
tmpFile = BUILD_DIR + '~' + mainOutputName + '.tmp'; tmpFile = BUILD_DIR + '~' + mainOutputName + '.tmp';
bundle('src/pdf.js', tmpFile, 'src/', mainFiles, mainAMDName, bundle('src/pdf.js', tmpFile, 'src/', mainFiles, mainAMDName,
defines, true, versionJSON); defines, true, versionJSON);
this.push(new gutil.File({ this.push(new gutil.File({
cwd: '', cwd: '',

View File

@ -883,7 +883,7 @@ target.chromium = function() {
'extensions/chromium/*.html', 'extensions/chromium/*.html',
'extensions/chromium/*.js', 'extensions/chromium/*.js',
'extensions/chromium/*.css', 'extensions/chromium/*.css',
'extensions/chromium/icon*.png',], 'extensions/chromium/icon*.png'],
CHROME_BUILD_DIR], CHROME_BUILD_DIR],
['extensions/chromium/pageAction/*.*', CHROME_BUILD_DIR + '/pageAction'], ['extensions/chromium/pageAction/*.*', CHROME_BUILD_DIR + '/pageAction'],
['extensions/chromium/options/*.*', CHROME_BUILD_DIR + '/options'], ['extensions/chromium/options/*.*', CHROME_BUILD_DIR + '/options'],

View File

@ -435,7 +435,7 @@ var Annotation = (function AnnotationClosure() {
// Properties // Properties
]); ]);
var bbox = appearanceDict.getArray('BBox') || [0, 0, 1, 1]; var bbox = appearanceDict.getArray('BBox') || [0, 0, 1, 1];
var matrix = appearanceDict.getArray('Matrix') || [1, 0, 0, 1, 0 ,0]; var matrix = appearanceDict.getArray('Matrix') || [1, 0, 0, 1, 0, 0];
var transform = getTransformMatrix(data.rect, bbox, matrix); var transform = getTransformMatrix(data.rect, bbox, matrix);
var self = this; var self = this;

View File

@ -568,7 +568,7 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
if (this.pdfNetworkStream) { if (this.pdfNetworkStream) {
this.pdfNetworkStream.cancelAllRequests('abort'); this.pdfNetworkStream.cancelAllRequests('abort');
} }
for(var requestId in this.promisesByRequest) { for (var requestId in this.promisesByRequest) {
var capability = this.promisesByRequest[requestId]; var capability = this.promisesByRequest[requestId];
capability.reject(new Error('Request was aborted')); capability.reject(new Error('Request was aborted'));
} }

View File

@ -609,22 +609,22 @@ var calculateSHA512 = (function calculateSHA512Closure() {
var result; var result;
if (!mode384) { if (!mode384) {
result = new Uint8Array(64); result = new Uint8Array(64);
h0.copyTo(result,0); h0.copyTo(result, 0);
h1.copyTo(result,8); h1.copyTo(result, 8);
h2.copyTo(result,16); h2.copyTo(result, 16);
h3.copyTo(result,24); h3.copyTo(result, 24);
h4.copyTo(result,32); h4.copyTo(result, 32);
h5.copyTo(result,40); h5.copyTo(result, 40);
h6.copyTo(result,48); h6.copyTo(result, 48);
h7.copyTo(result,56); h7.copyTo(result, 56);
} else { } else {
result = new Uint8Array(48); result = new Uint8Array(48);
h0.copyTo(result,0); h0.copyTo(result, 0);
h1.copyTo(result,8); h1.copyTo(result, 8);
h2.copyTo(result,16); h2.copyTo(result, 16);
h3.copyTo(result,24); h3.copyTo(result, 24);
h4.copyTo(result,32); h4.copyTo(result, 32);
h5.copyTo(result,40); h5.copyTo(result, 40);
} }
return result; return result;
} }
@ -1729,13 +1729,13 @@ var PDF20 = (function PDF20Closure() {
var CipherTransform = (function CipherTransformClosure() { var CipherTransform = (function CipherTransformClosure() {
function CipherTransform(stringCipherConstructor, streamCipherConstructor) { function CipherTransform(stringCipherConstructor, streamCipherConstructor) {
this.stringCipherConstructor = stringCipherConstructor; this.StringCipherConstructor = stringCipherConstructor;
this.streamCipherConstructor = streamCipherConstructor; this.StreamCipherConstructor = streamCipherConstructor;
} }
CipherTransform.prototype = { CipherTransform.prototype = {
createStream: function CipherTransform_createStream(stream, length) { createStream: function CipherTransform_createStream(stream, length) {
var cipher = new this.streamCipherConstructor(); var cipher = new this.StreamCipherConstructor();
return new DecryptStream(stream, length, return new DecryptStream(stream, length,
function cipherTransformDecryptStream(data, finalize) { function cipherTransformDecryptStream(data, finalize) {
return cipher.decryptBlock(data, finalize); return cipher.decryptBlock(data, finalize);
@ -1743,7 +1743,7 @@ var CipherTransform = (function CipherTransformClosure() {
); );
}, },
decryptString: function CipherTransform_decryptString(s) { decryptString: function CipherTransform_decryptString(s) {
var cipher = new this.stringCipherConstructor(); var cipher = new this.StringCipherConstructor();
var data = stringToBytes(s); var data = stringToBytes(s);
data = cipher.decryptBlock(data, true); data = cipher.decryptBlock(data, true);
return bytesToString(data); return bytesToString(data);
@ -2057,17 +2057,17 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() {
return new NullCipher(); return new NullCipher();
}; };
} }
if ('V2' === cfm.name) { if (cfm.name === 'V2') {
return function cipherTransformFactoryBuildCipherConstructorV2() { return function cipherTransformFactoryBuildCipherConstructorV2() {
return new ARCFourCipher(buildObjectKey(num, gen, key, false)); return new ARCFourCipher(buildObjectKey(num, gen, key, false));
}; };
} }
if ('AESV2' === cfm.name) { if (cfm.name === 'AESV2') {
return function cipherTransformFactoryBuildCipherConstructorAESV2() { return function cipherTransformFactoryBuildCipherConstructorAESV2() {
return new AES128Cipher(buildObjectKey(num, gen, key, true)); return new AES128Cipher(buildObjectKey(num, gen, key, true));
}; };
} }
if ('AESV3' === cfm.name) { if (cfm.name === 'AESV3') {
return function cipherTransformFactoryBuildCipherConstructorAESV3() { return function cipherTransformFactoryBuildCipherConstructorAESV3() {
return new AES256Cipher(key); return new AES256Cipher(key);
}; };

View File

@ -437,7 +437,7 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
x = xb; y = yb; x = xb; y = yb;
if (Math.abs(x - x0) > Math.abs(y - y0)) { if (Math.abs(x - x0) > Math.abs(y - y0)) {
x += stack.shift(); x += stack.shift();
} else { } else {
y += stack.shift(); y += stack.shift();
} }
bezierCurveTo(xa, ya, xb, yb, x, y); bezierCurveTo(xa, ya, xb, yb, x, y);

View File

@ -2943,6 +2943,7 @@ var ErrorFont = (function ErrorFontClosure() {
function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) { function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
var charCodeToGlyphId = Object.create(null); var charCodeToGlyphId = Object.create(null);
var glyphId, charCode, baseEncoding; var glyphId, charCode, baseEncoding;
var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
if (properties.baseEncodingName) { if (properties.baseEncodingName) {
// If a valid base encoding name was used, the mapping is initialized with // 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 charCodeToGlyphId[charCode] = 0; // notdef
} }
} }
} else if (!!(properties.flags & FontFlags.Symbolic)) { } else if (isSymbolicFont) {
// For a symbolic font the encoding should be the fonts built-in // For a symbolic font the encoding should be the fonts built-in encoding.
// encoding.
for (charCode in builtInEncoding) { for (charCode in builtInEncoding) {
charCodeToGlyphId[charCode] = builtInEncoding[charCode]; charCodeToGlyphId[charCode] = builtInEncoding[charCode];
} }

View File

@ -977,7 +977,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
var combinationOperator = pageInfo.combinationOperatorOverride ? var combinationOperator = pageInfo.combinationOperatorOverride ?
regionInfo.combinationOperator : pageInfo.combinationOperator; regionInfo.combinationOperator : pageInfo.combinationOperator;
var buffer = this.buffer; var buffer = this.buffer;
var mask0 = 128 >> (regionInfo.x & 7); var mask0 = 128 >> (regionInfo.x & 7);
var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3); var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
var i, j, mask, offset; var i, j, mask, offset;
switch (combinationOperator) { switch (combinationOperator) {

View File

@ -616,7 +616,7 @@ var JpegImage = (function JpegImageClosure() {
component = frame.components[i]; component = frame.components[i];
var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) *
component.h / frame.maxH); component.h / frame.maxH);
var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) *
component.v / frame.maxV); component.v / frame.maxV);
var blocksPerLineForMcu = mcusPerLine * component.h; var blocksPerLineForMcu = mcusPerLine * component.h;
var blocksPerColumnForMcu = mcusPerColumn * component.v; var blocksPerColumnForMcu = mcusPerColumn * component.v;

View File

@ -1484,7 +1484,7 @@ var JpxImage = (function JpxImageClosure() {
var qcdOrQcc = (context.currentTile.QCC[c] !== undefined ? var qcdOrQcc = (context.currentTile.QCC[c] !== undefined ?
context.currentTile.QCC[c] : context.currentTile.QCD); context.currentTile.QCC[c] : context.currentTile.QCD);
component.quantizationParameters = qcdOrQcc; component.quantizationParameters = qcdOrQcc;
var codOrCoc = (context.currentTile.COC[c] !== undefined ? var codOrCoc = (context.currentTile.COC[c] !== undefined ?
context.currentTile.COC[c] : context.currentTile.COD); context.currentTile.COC[c] : context.currentTile.COD);
component.codingStyleParameters = codOrCoc; component.codingStyleParameters = codOrCoc;
} }
@ -1552,7 +1552,7 @@ var JpxImage = (function JpxImageClosure() {
})(); })();
var InclusionTree = (function InclusionTreeClosure() { var InclusionTree = (function InclusionTreeClosure() {
function InclusionTree(width, height, defaultValue) { function InclusionTree(width, height, defaultValue) {
var levelsLength = log2(Math.max(width, height)) + 1; var levelsLength = log2(Math.max(width, height)) + 1;
this.levels = []; this.levels = [];
for (var i = 0; i < levelsLength; i++) { for (var i = 0; i < levelsLength; i++) {

View File

@ -32,12 +32,12 @@
var Uint32ArrayView = sharedUtil.Uint32ArrayView; var Uint32ArrayView = sharedUtil.Uint32ArrayView;
var MurmurHash3_64 = (function MurmurHash3_64Closure (seed) { var MurmurHash3_64 = (function MurmurHash3_64Closure(seed) {
// Workaround for missing math precision in JS. // Workaround for missing math precision in JS.
var MASK_HIGH = 0xffff0000; var MASK_HIGH = 0xffff0000;
var MASK_LOW = 0xffff; var MASK_LOW = 0xffff;
function MurmurHash3_64 (seed) { function MurmurHash3_64(seed) {
var SEED = 0xc3d2e1f0; var SEED = 0xc3d2e1f0;
this.h1 = seed ? seed & 0xffffffff : SEED; this.h1 = seed ? seed & 0xffffffff : SEED;
this.h2 = seed ? seed & 0xffffffff : SEED; this.h2 = seed ? seed & 0xffffffff : SEED;
@ -145,7 +145,7 @@ var MurmurHash3_64 = (function MurmurHash3_64Closure (seed) {
return this; return this;
}, },
hexdigest: function MurmurHash3_64_hexdigest () { hexdigest: function MurmurHash3_64_hexdigest() {
var h1 = this.h1; var h1 = this.h1;
var h2 = this.h2; var h2 = this.h2;

View File

@ -895,7 +895,7 @@ var Lexer = (function LexerClosure() {
var x2 = toHexDigit(ch); var x2 = toHexDigit(ch);
if (x2 === -1) { if (x2 === -1) {
warn('Lexer_getName: Illegal digit (' + warn('Lexer_getName: Illegal digit (' +
String.fromCharCode(ch) +') in hexadecimal number.'); String.fromCharCode(ch) + ') in hexadecimal number.');
strBuf.push('#', String.fromCharCode(previousCh)); strBuf.push('#', String.fromCharCode(previousCh));
if (specialChars[ch]) { if (specialChars[ch]) {
break; break;

View File

@ -210,7 +210,7 @@ var NetworkPdfManager = (function NetworkPdfManagerClosure() {
result = value; result = value;
} }
resolve(result); resolve(result);
} catch(e) { } catch (e) {
if (!(e instanceof MissingDataException)) { if (!(e instanceof MissingDataException)) {
reject(e); reject(e);
return; return;

View File

@ -86,7 +86,7 @@ var Type1CharString = (function Type1CharStringClosure() {
'rrcurveto': [8], 'rrcurveto': [8],
'callsubr': [10], 'callsubr': [10],
'flex': [12, 35], 'flex': [12, 35],
'drop' : [12, 18], 'drop': [12, 18],
'endchar': [14], 'endchar': [14],
'rmoveto': [21], 'rmoveto': [21],
'hmoveto': [22], 'hmoveto': [22],
@ -483,7 +483,7 @@ var Type1Parser = (function Type1ParserClosure() {
return token === 'true' ? 1 : 0; return token === 'true' ? 1 : 0;
}, },
nextChar : function Type1_nextChar() { nextChar: function Type1_nextChar() {
return (this.currentChar = this.stream.getByte()); return (this.currentChar = this.stream.getByte());
}, },
@ -550,7 +550,7 @@ var Type1Parser = (function Type1ParserClosure() {
this.getToken(); // read in 'dict' this.getToken(); // read in 'dict'
this.getToken(); // read in 'dup' this.getToken(); // read in 'dup'
this.getToken(); // read in 'begin' this.getToken(); // read in 'begin'
while(true) { while (true) {
token = this.getToken(); token = this.getToken();
if (token === null || token === 'end') { if (token === null || token === 'end') {
break; break;

View File

@ -1314,7 +1314,7 @@ var PDFWorker = (function PDFWorkerClosure() {
} }
try { try {
sendTest(); sendTest();
} catch (e) { } catch (e) {
// We need fallback to a faked worker. // We need fallback to a faked worker.
this._setupFakeWorker(); this._setupFakeWorker();
} }

View File

@ -654,7 +654,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
} }
if (sourceCtx.setLineDash !== undefined) { if (sourceCtx.setLineDash !== undefined) {
destCtx.setLineDash(sourceCtx.getLineDash()); destCtx.setLineDash(sourceCtx.getLineDash());
destCtx.lineDashOffset = sourceCtx.lineDashOffset; destCtx.lineDashOffset = sourceCtx.lineDashOffset;
} }
} }
@ -1780,13 +1780,13 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
this.save(); this.save();
this.baseTransformStack.push(this.baseTransform); this.baseTransformStack.push(this.baseTransform);
if (isArray(matrix) && 6 === matrix.length) { if (isArray(matrix) && matrix.length === 6) {
this.transform.apply(this, matrix); this.transform.apply(this, matrix);
} }
this.baseTransform = this.ctx.mozCurrentTransform; this.baseTransform = this.ctx.mozCurrentTransform;
if (isArray(bbox) && 4 === bbox.length) { if (isArray(bbox) && bbox.length === 4) {
var width = bbox[2] - bbox[0]; var width = bbox[2] - bbox[0];
var height = bbox[3] - bbox[1]; var height = bbox[3] - bbox[1];
this.ctx.rect(bbox[0], bbox[1], width, height); this.ctx.rect(bbox[0], bbox[1], width, height);
@ -1862,7 +1862,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
var cacheId = 'groupAt' + this.groupLevel; var cacheId = 'groupAt' + this.groupLevel;
if (group.smask) { if (group.smask) {
// Using two cache entries is case if masks are used one after another. // Using two cache entries is case if masks are used one after another.
cacheId += '_smask_' + ((this.smaskCounter++) % 2); cacheId += '_smask_' + ((this.smaskCounter++) % 2);
} }
var scratchCanvas = this.cachedCanvases.getCanvas( var scratchCanvas = this.cachedCanvases.getCanvas(
cacheId, drawnWidth, drawnHeight, true); cacheId, drawnWidth, drawnHeight, true);
@ -1947,7 +1947,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
matrix) { matrix) {
this.save(); this.save();
if (isArray(rect) && 4 === rect.length) { if (isArray(rect) && rect.length === 4) {
var width = rect[2] - rect[0]; var width = rect[2] - rect[0];
var height = rect[3] - rect[1]; var height = rect[3] - rect[1];
this.ctx.rect(rect[0], rect[1], width, height); this.ctx.rect(rect[0], rect[1], width, height);

View File

@ -841,7 +841,7 @@ var SVGGraphics = (function SVGGraphicsClosure() {
var height = args[j++]; var height = args[j++];
var xw = x + width; var xw = x + width;
var yh = y + height; var yh = y + height;
d.push('M', pf(x), pf(y), 'L', pf(xw) , pf(y), 'L', pf(xw), pf(yh), d.push('M', pf(x), pf(y), 'L', pf(xw), pf(y), 'L', pf(xw), pf(yh),
'L', pf(x), pf(yh), 'Z'); 'L', pf(x), pf(yh), 'Z');
break; break;
case OPS.moveTo: case OPS.moveTo:
@ -852,7 +852,7 @@ var SVGGraphics = (function SVGGraphicsClosure() {
case OPS.lineTo: case OPS.lineTo:
x = args[j++]; x = args[j++];
y = args[j++]; y = args[j++];
d.push('L', pf(x) , pf(y)); d.push('L', pf(x), pf(y));
break; break;
case OPS.curveTo: case OPS.curveTo:
x = args[j + 4]; x = args[j + 4];

View File

@ -374,7 +374,7 @@ var renderTextLayer = (function renderTextLayerClosure() {
i++; i++;
} }
var j = horizon.length - 1; var j = horizon.length - 1;
while(j >= 0 && horizon[j].start >= boundary.y2) { while (j >= 0 && horizon[j].start >= boundary.y2) {
j--; j--;
} }

View File

@ -165,12 +165,12 @@ var WebGLUtils = (function WebGLUtilsClosure() {
var texCoordBuffer = gl.createBuffer(); var texCoordBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer); gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
0.0, 0.0, 0.0, 0.0,
1.0, 0.0, 1.0, 0.0,
0.0, 1.0, 0.0, 1.0,
0.0, 1.0, 0.0, 1.0,
1.0, 0.0, 1.0, 0.0,
1.0, 1.0]), gl.STATIC_DRAW); 1.0, 1.0]), gl.STATIC_DRAW);
gl.enableVertexAttribArray(texCoordLocation); gl.enableVertexAttribArray(texCoordLocation);
gl.vertexAttribPointer(texCoordLocation, 2, gl.FLOAT, false, 0, 0); gl.vertexAttribPointer(texCoordLocation, 2, gl.FLOAT, false, 0, 0);
@ -186,7 +186,7 @@ var WebGLUtils = (function WebGLUtilsClosure() {
if (!smaskCache) { if (!smaskCache) {
initSmaskGL(); initSmaskGL();
} }
var cache = smaskCache,canvas = cache.canvas, gl = cache.gl; var cache = smaskCache, canvas = cache.canvas, gl = cache.gl;
canvas.width = width; canvas.width = width;
canvas.height = height; canvas.height = height;
gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);

View File

@ -148,7 +148,7 @@ var CFFDictDataMap = {
}, },
'7': { '7': {
name: 'FontMatrix', name: 'FontMatrix',
operand: [0.001, 0, 0, 0.001, 0 , 0] operand: [0.001, 0, 0, 0.001, 0, 0]
}, },
'8': { '8': {
name: 'StrokeWidth', name: 'StrokeWidth',

View File

@ -557,7 +557,7 @@ function arraysToBytes(arr) {
} }
var resultLength = 0; var resultLength = 0;
var i, ii = arr.length; var i, ii = arr.length;
var item, itemLength ; var item, itemLength;
for (i = 0; i < ii; i++) { for (i = 0; i < ii; i++) {
item = arr[i]; item = arr[i];
itemLength = arrayByteLength(item); itemLength = arrayByteLength(item);
@ -1766,7 +1766,7 @@ if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL')) {
u.pathname = 'c%20d'; u.pathname = 'c%20d';
hasWorkingUrl = u.href === 'http://a/c%20d'; hasWorkingUrl = u.href === 'http://a/c%20d';
} }
} catch(e) { } } catch (e) { }
if (hasWorkingUrl) { if (hasWorkingUrl) {
return; return;
@ -1925,7 +1925,7 @@ if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL')) {
break; break;
case 'relative or authority': case 'relative or authority':
if ('/' === c && '/' === input[cursor+1]) { if ('/' === c && '/' === input[cursor + 1]) {
state = 'authority ignore slashes'; state = 'authority ignore slashes';
} else { } else {
err('Expected /, got: ' + c); err('Expected /, got: ' + c);
@ -1970,8 +1970,8 @@ if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL')) {
this._password = base._password; this._password = base._password;
state = 'fragment'; state = 'fragment';
} else { } else {
var nextC = input[cursor+1]; var nextC = input[cursor + 1];
var nextNextC = input[cursor+2]; var nextNextC = input[cursor + 2];
if ('file' !== this._scheme || !ALPHA.test(c) || if ('file' !== this._scheme || !ALPHA.test(c) ||
(nextC !== ':' && nextC !== '|') || (nextC !== ':' && nextC !== '|') ||
(EOF !== nextNextC && '/' !== nextNextC && '\\' !== nextNextC && (EOF !== nextNextC && '/' !== nextNextC && '\\' !== nextNextC &&
@ -2166,7 +2166,7 @@ if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL')) {
err('\\ not allowed in relative path.'); err('\\ not allowed in relative path.');
} }
var tmp; var tmp;
if (tmp = relativePathDotMapping[buffer.toLowerCase()]) { if ((tmp = relativePathDotMapping[buffer.toLowerCase()])) {
buffer = tmp; buffer = tmp;
} }
if ('..' === buffer) { if ('..' === buffer) {

View File

@ -288,7 +288,7 @@ var Driver = (function DriverClosure() {
var self = this; var self = this;
window.onerror = function(message, source, line, column, error) { window.onerror = function(message, source, line, column, error) {
self._info('Error: ' + message + ' Script: ' + source + ' Line: ' + self._info('Error: ' + message + ' Script: ' + source + ' Line: ' +
line + ' Column: ' + column + ' StackTrace: ' + error); line + ' Column: ' + column + ' StackTrace: ' + error);
}; };
this._info('User agent: ' + navigator.userAgent); this._info('User agent: ' + navigator.userAgent);
this._log('Harness thinks this browser is "' + this.browser + this._log('Harness thinks this browser is "' + this.browser +

View File

@ -159,7 +159,7 @@ function stat(baseline, current) {
} }
// add horizontal line // add horizontal line
var hline = width.map(function(w) { return new Array(w+1).join('-'); }); var hline = width.map(function(w) { return new Array(w + 1).join('-'); });
rows.splice(1, 0, hline); rows.splice(1, 0, hline);
// print output // print output
@ -179,14 +179,14 @@ function main() {
try { try {
var baselineFile = fs.readFileSync(options.baseline).toString(); var baselineFile = fs.readFileSync(options.baseline).toString();
baseline = flatten(JSON.parse(baselineFile)); baseline = flatten(JSON.parse(baselineFile));
} catch(e) { } catch (e) {
console.log('Error reading file "' + options.baseline + '": ' + e); console.log('Error reading file "' + options.baseline + '": ' + e);
process.exit(0); process.exit(0);
} }
try { try {
var currentFile = fs.readFileSync(options.current).toString(); var currentFile = fs.readFileSync(options.current).toString();
current = flatten(JSON.parse(currentFile)); current = flatten(JSON.parse(currentFile));
} catch(e) { } catch (e) {
console.log('Error reading file "' + options.current + '": ' + e); console.log('Error reading file "' + options.current + '": ' + e);
process.exit(0); process.exit(0);
} }

View File

@ -81,7 +81,7 @@ function parseOptions() {
'test_manifest.json')) 'test_manifest.json'))
.check(describeCheck(function (argv) { .check(describeCheck(function (argv) {
return !argv.browser || !argv.browserManifestFile; 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.')); 'same time.'));
var result = yargs.argv; var result = yargs.argv;
if (result.help) { if (result.help) {

View File

@ -505,7 +505,7 @@ describe('api', function() {
// PageLabels with bad "Prefix" entries. // PageLabels with bad "Prefix" entries.
var url3 = new URL('../pdfs/bad-PageLabels.pdf', window.location).href; 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) { var promise3 = loadingTask3.promise.then(function (pdfDoc) {
return pdfDoc.getPageLabels(); return pdfDoc.getPageLabels();
}); });

View File

@ -250,7 +250,7 @@ describe('crypto', function() {
key = hex2binary('000102030405060708090a0b0c0d0e0f'); key = hex2binary('000102030405060708090a0b0c0d0e0f');
iv = hex2binary('00000000000000000000000000000000'); iv = hex2binary('00000000000000000000000000000000');
cipher = new AES128Cipher(key); cipher = new AES128Cipher(key);
result = cipher.encrypt(input,iv); result = cipher.encrypt(input, iv);
expected = hex2binary('69c4e0d86a7b0430d8cdb78070b4c55a'); expected = hex2binary('69c4e0d86a7b0430d8cdb78070b4c55a');
expect(result).toEqual(expected); expect(result).toEqual(expected);
}); });
@ -279,7 +279,7 @@ describe('crypto', function() {
'191a1b1c1d1e1f'); '191a1b1c1d1e1f');
iv = hex2binary('00000000000000000000000000000000'); iv = hex2binary('00000000000000000000000000000000');
cipher = new AES256Cipher(key); cipher = new AES256Cipher(key);
result = cipher.encrypt(input,iv); result = cipher.encrypt(input, iv);
expected = hex2binary('8ea2b7ca516745bfeafc49904b496089'); expected = hex2binary('8ea2b7ca516745bfeafc49904b496089');
expect(result).toEqual(expected); expect(result).toEqual(expected);
}); });
@ -293,7 +293,7 @@ describe('crypto', function() {
'191a1b1c1d1e1f'); '191a1b1c1d1e1f');
iv = hex2binary('00000000000000000000000000000000'); iv = hex2binary('00000000000000000000000000000000');
cipher = new AES256Cipher(key); cipher = new AES256Cipher(key);
result = cipher.decryptBlock(input,false,iv); result = cipher.decryptBlock(input, false, iv);
expected = hex2binary('00112233445566778899aabbccddeeff'); expected = hex2binary('00112233445566778899aabbccddeeff');
expect(result).toEqual(expected); expect(result).toEqual(expected);
}); });
@ -304,7 +304,7 @@ describe('crypto', function() {
key = hex2binary('000102030405060708090a0b0c0d0e0f101112131415161718' + key = hex2binary('000102030405060708090a0b0c0d0e0f101112131415161718' +
'191a1b1c1d1e1f'); '191a1b1c1d1e1f');
cipher = new AES256Cipher(key); cipher = new AES256Cipher(key);
result = cipher.decryptBlock(input,false); result = cipher.decryptBlock(input, false);
expected = hex2binary('00112233445566778899aabbccddeeff'); expected = hex2binary('00112233445566778899aabbccddeeff');
expect(result).toEqual(expected); expect(result).toEqual(expected);
}); });

View File

@ -203,4 +203,3 @@ function initializePDFJS(callback) {
return destination; return destination;
} }
}()); }());

View File

@ -346,12 +346,12 @@ describe('primitives', function() {
}); });
describe('isRef', function () { describe('isRef', function () {
it ('handles non-refs', function () { it('handles non-refs', function () {
var nonRef = {}; var nonRef = {};
expect(isRef(nonRef)).toEqual(false); expect(isRef(nonRef)).toEqual(false);
}); });
it ('handles refs', function () { it('handles refs', function () {
var ref = new Ref(1, 0); var ref = new Ref(1, 0);
expect(isRef(ref)).toEqual(true); expect(isRef(ref)).toEqual(true);
}); });

View File

@ -70,10 +70,10 @@ describe('Type1Parser', function() {
var stream = new StringStream( var stream = new StringStream(
'/ExpansionFactor 99\n' + '/ExpansionFactor 99\n' +
'/Subrs 1 array\n' + '/Subrs 1 array\n' +
'dup 0 1 RD x noaccess put\n'+ 'dup 0 1 RD x noaccess put\n' +
'end\n' + 'end\n' +
'/CharStrings 46 dict dup begin\n' + '/CharStrings 46 dict dup begin\n' +
'/.notdef 1 RD x ND' + '\n' + '/.notdef 1 RD x ND\n' +
'end'); 'end');
var parser = new Type1Parser(stream, false, SEAC_ANALYSIS_ENABLED); var parser = new Type1Parser(stream, false, SEAC_ANALYSIS_ENABLED);
var program = parser.extractFontProgram(); var program = parser.extractFontProgram();

View File

@ -117,4 +117,3 @@ describe('ui_utils', function() {
}); });
}); });
}); });

View File

@ -270,7 +270,7 @@ if (typeof PDFJS === 'undefined') {
// initialize result and counters // initialize result and counters
var bc = 0, bs, buffer, idx = 0, output = ''; var bc = 0, bs, buffer, idx = 0, output = '';
// get next character // get next character
buffer = input.charAt(idx++); (buffer = input.charAt(idx++));
// character found in table? // character found in table?
// initialize bit storage and add its ascii value // initialize bit storage and add its ascii value
~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,

View File

@ -173,7 +173,7 @@ Preferences._readFromStorage = function (prefObj) {
highlightAll: !!evt.detail.highlightAll, highlightAll: !!evt.detail.highlightAll,
findPrevious: !!evt.detail.findPrevious findPrevious: !!evt.detail.findPrevious
}); });
}.bind(this); };
for (var i = 0, len = events.length; i < len; i++) { for (var i = 0, len = events.length; i < len; i++) {
window.addEventListener(events[i], handleEvent); window.addEventListener(events[i], handleEvent);

View File

@ -200,22 +200,22 @@ var PDFDocumentProperties = (function PDFDocumentPropertiesClosure() {
} }
// Remove the D: prefix if it is available. // Remove the D: prefix if it is available.
if (dateToParse.substring(0,2) === 'D:') { if (dateToParse.substring(0, 2) === 'D:') {
dateToParse = dateToParse.substring(2); dateToParse = dateToParse.substring(2);
} }
// Get all elements from the PDF date string. // Get all elements from the PDF date string.
// JavaScript's Date object expects the month to be between // JavaScript's Date object expects the month to be between
// 0 and 11 instead of 1 and 12, so we're correcting for this. // 0 and 11 instead of 1 and 12, so we're correcting for this.
var year = parseInt(dateToParse.substring(0,4), 10); var year = parseInt(dateToParse.substring(0, 4), 10);
var month = parseInt(dateToParse.substring(4,6), 10) - 1; var month = parseInt(dateToParse.substring(4, 6), 10) - 1;
var day = parseInt(dateToParse.substring(6,8), 10); var day = parseInt(dateToParse.substring(6, 8), 10);
var hours = parseInt(dateToParse.substring(8,10), 10); var hours = parseInt(dateToParse.substring(8, 10), 10);
var minutes = parseInt(dateToParse.substring(10,12), 10); var minutes = parseInt(dateToParse.substring(10, 12), 10);
var seconds = parseInt(dateToParse.substring(12,14), 10); var seconds = parseInt(dateToParse.substring(12, 14), 10);
var utRel = dateToParse.substring(14,15); var utRel = dateToParse.substring(14, 15);
var offsetHours = parseInt(dateToParse.substring(15,17), 10); var offsetHours = parseInt(dateToParse.substring(15, 17), 10);
var offsetMinutes = parseInt(dateToParse.substring(18,20), 10); var offsetMinutes = parseInt(dateToParse.substring(18, 20), 10);
// As per spec, utRel = 'Z' means equal to universal time. // As per spec, utRel = 'Z' means equal to universal time.
// The other cases ('-' and '+') have to be handled here. // The other cases ('-' and '+') have to be handled here.

View File

@ -188,7 +188,7 @@ var SecondaryToolbar = (function SecondaryToolbarClosure() {
toggleHandToolButton.firstElementChild.textContent = toggleHandToolButton.firstElementChild.textContent =
mozL10n.get('hand_tool_enable_label', null, 'Enable hand tool'); mozL10n.get('hand_tool_enable_label', null, 'Enable hand tool');
} }
}.bind(this)); });
}, },
open: function SecondaryToolbar_open() { open: function SecondaryToolbar_open() {

View File

@ -260,7 +260,7 @@ function approximateFraction(x) {
var limit = 8; var limit = 8;
if (xinv > limit) { if (xinv > limit) {
return [1, limit]; return [1, limit];
} else if (Math.floor(xinv) === xinv) { } else if (Math.floor(xinv) === xinv) {
return [1, xinv]; return [1, xinv];
} }
@ -384,7 +384,7 @@ function getPDFFileNameFromURL(url) {
try { try {
suggestedFilename = suggestedFilename =
reFilename.exec(decodeURIComponent(suggestedFilename))[0]; reFilename.exec(decodeURIComponent(suggestedFilename))[0];
} catch(e) { // Possible (extremely rare) errors: } catch (e) { // Possible (extremely rare) errors:
// URIError "Malformed URI", e.g. for "%AA.pdf" // URIError "Malformed URI", e.g. for "%AA.pdf"
// TypeError "null has no properties", e.g. for "%2F.pdf" // TypeError "null has no properties", e.g. for "%2F.pdf"
} }

View File

@ -54,7 +54,7 @@ function getViewerConfiguration() {
return { return {
appContainer: document.body, appContainer: document.body,
mainContainer: document.getElementById('viewerContainer'), mainContainer: document.getElementById('viewerContainer'),
viewerContainer: document.getElementById('viewer'), viewerContainer: document.getElementById('viewer'),
eventBus: null, // using global event bus with DOM events eventBus: null, // using global event bus with DOM events
toolbar: { toolbar: {
container: document.getElementById('toolbarViewer'), container: document.getElementById('toolbarViewer'),