Enable the no-unused-vars
ESLint rule
Please see http://eslint.org/docs/rules/no-unused-vars; note that this patch purposely uses the same rule options as in `mozilla-central`, such that it fixes part of issue 7957. It wasn't, in my opinion, entirely straightforward to enable this rule compared to the already existing rules. In many cases a `var descriptiveName = ...` format was used (more or less) to document the code, and I choose to place the old variable name in a trailing comment to not lose that information. I welcome feedback on these changes, since it wasn't always entirely easy to know what changes made the most sense in every situation.
This commit is contained in:
parent
8d684b5b3f
commit
52e0f51917
@ -84,6 +84,10 @@
|
||||
"no-shadow-restricted-names": "error",
|
||||
"no-undef-init": "error",
|
||||
"no-undef": ["error", { "typeof": true, }],
|
||||
"no-unused-vars": ["error", {
|
||||
"vars": "local",
|
||||
"args": "none",
|
||||
}],
|
||||
|
||||
// Stylistic Issues
|
||||
"array-bracket-spacing": ["error", "never"],
|
||||
|
3
external/importL10n/locales.js
vendored
3
external/importL10n/locales.js
vendored
@ -62,7 +62,8 @@ function downloadLanguageFiles(root, langCode, callback) {
|
||||
files.forEach(function(fileName) {
|
||||
var outputPath = path.join(outputDir, fileName);
|
||||
var url = MOZ_AURORA_ROOT + langCode + MOZ_AURORA_PDFJS_DIR + fileName;
|
||||
var request = https.get(url, function(response) {
|
||||
|
||||
https.get(url, function(response) {
|
||||
var content = '';
|
||||
response.setEncoding('utf8');
|
||||
response.on('data', function(chunk) {
|
||||
|
@ -38,7 +38,6 @@ var AnnotationFlag = sharedUtil.AnnotationFlag;
|
||||
var AnnotationType = sharedUtil.AnnotationType;
|
||||
var OPS = sharedUtil.OPS;
|
||||
var Util = sharedUtil.Util;
|
||||
var isString = sharedUtil.isString;
|
||||
var isArray = sharedUtil.isArray;
|
||||
var isInt = sharedUtil.isInt;
|
||||
var stringToBytes = sharedUtil.stringToBytes;
|
||||
|
@ -785,7 +785,6 @@ var CFFParser = (function CFFParserClosure() {
|
||||
var encoding = Object.create(null);
|
||||
var bytes = this.bytes;
|
||||
var predefined = false;
|
||||
var hasSupplement = false;
|
||||
var format, i, ii;
|
||||
var raw = null;
|
||||
|
||||
@ -836,7 +835,7 @@ var CFFParser = (function CFFParserClosure() {
|
||||
break;
|
||||
}
|
||||
var dataEnd = pos;
|
||||
if (format & 0x80) {
|
||||
if (format & 0x80) { // hasSupplement
|
||||
// The font sanitizer does not support CFF encoding with a
|
||||
// supplement, since the encoding is not really used to map
|
||||
// between gid to glyph, let's overwrite what is declared in
|
||||
@ -844,7 +843,6 @@ var CFFParser = (function CFFParserClosure() {
|
||||
// StandardEncoding, that's a lie but that's ok.
|
||||
bytes[dataStart] &= 0x7f;
|
||||
readSupplement();
|
||||
hasSupplement = true;
|
||||
}
|
||||
raw = bytes.subarray(dataStart, dataEnd);
|
||||
}
|
||||
|
@ -1084,30 +1084,6 @@ var AES128Cipher = (function AES128CipherClosure() {
|
||||
})();
|
||||
|
||||
var AES256Cipher = (function AES256CipherClosure() {
|
||||
var rcon = new Uint8Array([
|
||||
0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c,
|
||||
0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a,
|
||||
0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd,
|
||||
0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a,
|
||||
0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
|
||||
0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6,
|
||||
0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72,
|
||||
0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc,
|
||||
0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10,
|
||||
0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e,
|
||||
0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5,
|
||||
0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94,
|
||||
0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02,
|
||||
0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d,
|
||||
0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d,
|
||||
0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f,
|
||||
0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb,
|
||||
0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c,
|
||||
0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a,
|
||||
0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd,
|
||||
0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a,
|
||||
0x74, 0xe8, 0xcb, 0x8d]);
|
||||
|
||||
var s = new Uint8Array([
|
||||
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b,
|
||||
0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0,
|
||||
|
@ -1296,22 +1296,11 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
var width = 0;
|
||||
var height = 0;
|
||||
var glyphs = font.charsToGlyphs(chars);
|
||||
var defaultVMetrics = font.defaultVMetrics;
|
||||
for (var i = 0; i < glyphs.length; i++) {
|
||||
var glyph = glyphs[i];
|
||||
var vMetricX = null;
|
||||
var vMetricY = null;
|
||||
var glyphWidth = null;
|
||||
if (font.vertical) {
|
||||
if (glyph.vmetric) {
|
||||
glyphWidth = glyph.vmetric[0];
|
||||
vMetricX = glyph.vmetric[1];
|
||||
vMetricY = glyph.vmetric[2];
|
||||
} else {
|
||||
glyphWidth = glyph.width;
|
||||
vMetricX = glyph.width * 0.5;
|
||||
vMetricY = defaultVMetrics[2];
|
||||
}
|
||||
if (font.vertical && glyph.vmetric) {
|
||||
glyphWidth = glyph.vmetric[0];
|
||||
} else {
|
||||
glyphWidth = glyph.width;
|
||||
}
|
||||
@ -1323,18 +1312,6 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
}
|
||||
glyphUnicode = reverseIfRtl(glyphUnicode);
|
||||
|
||||
// The following will calculate the x and y of the individual glyphs.
|
||||
// if (font.vertical) {
|
||||
// tsm[4] -= vMetricX * Math.abs(textState.fontSize) *
|
||||
// textState.fontMatrix[0];
|
||||
// tsm[5] -= vMetricY * textState.fontSize *
|
||||
// textState.fontMatrix[0];
|
||||
// }
|
||||
// var trm = Util.transform(textState.textMatrix, tsm);
|
||||
// var pt = Util.applyTransform([trm[4], trm[5]], textState.ctm);
|
||||
// var x = pt[0];
|
||||
// var y = pt[1];
|
||||
|
||||
var charSpacing = textState.charSpacing;
|
||||
if (glyph.isSpace) {
|
||||
var wordSpacing = textState.wordSpacing;
|
||||
|
@ -53,9 +53,9 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
|
||||
var offset = (getUshort(data, start + 2) === 1 ?
|
||||
getLong(data, start + 8) : getLong(data, start + 16));
|
||||
var format = getUshort(data, start + offset);
|
||||
var length, ranges, p, i;
|
||||
var ranges, p, i;
|
||||
if (format === 4) {
|
||||
length = getUshort(data, start + offset + 2);
|
||||
getUshort(data, start + offset + 2); // length
|
||||
var segCount = getUshort(data, start + offset + 6) >> 1;
|
||||
p = start + offset + 14;
|
||||
ranges = [];
|
||||
@ -82,7 +82,7 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
|
||||
}
|
||||
return ranges;
|
||||
} else if (format === 12) {
|
||||
length = getLong(data, start + offset + 4);
|
||||
getLong(data, start + offset + 4); // length
|
||||
var groups = getLong(data, start + offset + 12);
|
||||
p = start + offset + 16;
|
||||
ranges = [];
|
||||
|
@ -594,9 +594,6 @@ var Font = (function FontClosure() {
|
||||
|
||||
this.glyphCache = Object.create(null);
|
||||
|
||||
var names = name.split('+');
|
||||
names = names.length > 1 ? names[1] : names[0];
|
||||
names = names.split(/[-,_]/g)[0];
|
||||
this.isSerifFont = !!(properties.flags & FontFlags.Serif);
|
||||
this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
|
||||
this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
|
||||
@ -1409,7 +1406,7 @@ var Font = (function FontClosure() {
|
||||
var start = (font.start ? font.start : 0) + cmap.offset;
|
||||
font.pos = start;
|
||||
|
||||
var version = font.getUint16();
|
||||
font.getUint16(); // version
|
||||
var numTables = font.getUint16();
|
||||
|
||||
var potentialTable;
|
||||
@ -1471,8 +1468,8 @@ var Font = (function FontClosure() {
|
||||
}
|
||||
|
||||
var format = font.getUint16();
|
||||
var length = font.getUint16();
|
||||
var language = font.getUint16();
|
||||
font.getUint16(); // length
|
||||
font.getUint16(); // language
|
||||
|
||||
var hasShortCmap = false;
|
||||
var mappings = [];
|
||||
|
@ -432,14 +432,12 @@ var Jbig2Image = (function Jbig2ImageClosure() {
|
||||
var deltaHeight = decodeInteger(contextCache, 'IADH', decoder); // 6.5.6
|
||||
currentHeight += deltaHeight;
|
||||
var currentWidth = 0;
|
||||
var totalWidth = 0;
|
||||
while (true) {
|
||||
var deltaWidth = decodeInteger(contextCache, 'IADW', decoder); // 6.5.7
|
||||
if (deltaWidth === null) {
|
||||
break; // OOB
|
||||
}
|
||||
currentWidth += deltaWidth;
|
||||
totalWidth += currentWidth;
|
||||
var bitmap;
|
||||
if (refinement) {
|
||||
// 6.5.8.2 Refinement/aggregate-coded symbol bitmap
|
||||
@ -889,7 +887,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
|
||||
delete pageInfo.height;
|
||||
}
|
||||
var pageSegmentFlags = data[position + 16];
|
||||
var pageStripingInformation = readUint16(data, position + 17);
|
||||
readUint16(data, position + 17); // pageStripingInformation
|
||||
pageInfo.lossless = !!(pageSegmentFlags & 1);
|
||||
pageInfo.refinement = !!(pageSegmentFlags & 2);
|
||||
pageInfo.defaultPixelValue = (pageSegmentFlags >> 2) & 1;
|
||||
@ -923,7 +921,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
|
||||
}
|
||||
}
|
||||
|
||||
function parseJbig2(data, start, end) {
|
||||
function parseJbig2(data, start, end) { // eslint-disable-line no-unused-vars
|
||||
var position = start;
|
||||
if (data[position] !== 0x97 || data[position + 1] !== 0x4A ||
|
||||
data[position + 2] !== 0x42 || data[position + 3] !== 0x32 ||
|
||||
@ -939,7 +937,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
|
||||
header.numberOfPages = readUint32(data, position);
|
||||
position += 4;
|
||||
}
|
||||
var segments = readSegments(header, data, position, end);
|
||||
readSegments(header, data, position, end); // segments
|
||||
error('Not implemented');
|
||||
// processSegments(segments, new SimpleSegmentVisitor());
|
||||
}
|
||||
|
@ -790,7 +790,7 @@ var JpegImage = (function JpegImageClosure() {
|
||||
break;
|
||||
|
||||
case 0xFFDA: // SOS (Start of Scan)
|
||||
var scanLength = readUint16();
|
||||
readUint16(); // scanLength
|
||||
var selectorsCount = data[offset++];
|
||||
var components = [], component;
|
||||
for (i = 0; i < selectorsCount; i++) {
|
||||
|
@ -38,7 +38,6 @@ var isInt = sharedUtil.isInt;
|
||||
var isArray = sharedUtil.isArray;
|
||||
var createObjectURL = sharedUtil.createObjectURL;
|
||||
var shadow = sharedUtil.shadow;
|
||||
var warn = sharedUtil.warn;
|
||||
var isSpace = sharedUtil.isSpace;
|
||||
var Dict = corePrimitives.Dict;
|
||||
var isDict = corePrimitives.isDict;
|
||||
|
@ -251,7 +251,7 @@ var Type1CharString = (function Type1CharStringClosure() {
|
||||
// first part of the charstring and then use rmoveto with
|
||||
// (dx, dy). The height argument will not be used for vmtx and
|
||||
// vhea tables reconstruction -- ignoring it.
|
||||
var wy = this.stack.pop();
|
||||
this.stack.pop(); // wy
|
||||
wx = this.stack.pop();
|
||||
var sby = this.stack.pop();
|
||||
sbx = this.stack.pop();
|
||||
@ -579,7 +579,7 @@ var Type1Parser = (function Type1ParserClosure() {
|
||||
}
|
||||
break;
|
||||
case 'Subrs':
|
||||
var num = this.readInt();
|
||||
this.readInt(); // num
|
||||
this.getToken(); // read in 'array'
|
||||
while ((token = this.getToken()) === 'dup') {
|
||||
var index = this.readInt();
|
||||
|
@ -36,7 +36,6 @@ var MessageHandler = sharedUtil.MessageHandler;
|
||||
var MissingPDFException = sharedUtil.MissingPDFException;
|
||||
var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
|
||||
var PasswordException = sharedUtil.PasswordException;
|
||||
var PasswordResponses = sharedUtil.PasswordResponses;
|
||||
var UnknownErrorException = sharedUtil.UnknownErrorException;
|
||||
var XRefParseException = sharedUtil.XRefParseException;
|
||||
var arrayByteLength = sharedUtil.arrayByteLength;
|
||||
@ -448,7 +447,7 @@ var WorkerMessageHandler = {
|
||||
var responseExists = 'response' in xhr;
|
||||
// check if the property is actually implemented
|
||||
try {
|
||||
var dummy = xhr.responseType;
|
||||
xhr.responseType; // eslint-disable-line no-unused-expressions
|
||||
} catch (e) {
|
||||
responseExists = false;
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ var InvalidPDFException = sharedUtil.InvalidPDFException;
|
||||
var MessageHandler = sharedUtil.MessageHandler;
|
||||
var MissingPDFException = sharedUtil.MissingPDFException;
|
||||
var PageViewport = sharedUtil.PageViewport;
|
||||
var PasswordResponses = sharedUtil.PasswordResponses;
|
||||
var PasswordException = sharedUtil.PasswordException;
|
||||
var StatTimer = sharedUtil.StatTimer;
|
||||
var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
|
||||
|
@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* eslint strict: ["error", "function"] */
|
||||
/* eslint-disable no-unused-vars */
|
||||
/* umdutils ignore */
|
||||
|
||||
(function (root, factory) {
|
||||
|
@ -673,3 +673,5 @@ var Driver = (function DriverClosure() {
|
||||
|
||||
return Driver;
|
||||
})();
|
||||
|
||||
exports.Driver = Driver;
|
||||
|
@ -88,3 +88,7 @@ function verifyTtxOutput(output) {
|
||||
throw m[1];
|
||||
}
|
||||
}
|
||||
|
||||
exports.decodeFontData = decodeFontData;
|
||||
exports.ttx = ttx;
|
||||
exports.verifyTtxOutput = verifyTtxOutput;
|
||||
|
@ -189,7 +189,7 @@ describe('CFFParser', function() {
|
||||
it('parses a CharString endchar with 4 args w/seac enabled', function() {
|
||||
var parser = new CFFParser(fontData, {},
|
||||
/* seacAnalysisEnabled = */ true);
|
||||
var cff = parser.parse();
|
||||
parser.parse(); // cff
|
||||
|
||||
var bytes = new Uint8Array([0, 1, // count
|
||||
1, // offsetSize
|
||||
@ -211,7 +211,7 @@ describe('CFFParser', function() {
|
||||
it('parses a CharString endchar with 4 args w/seac disabled', function() {
|
||||
var parser = new CFFParser(fontData, {},
|
||||
/* seacAnalysisEnabled = */ false);
|
||||
var cff = parser.parse();
|
||||
parser.parse(); // cff
|
||||
|
||||
var bytes = new Uint8Array([0, 1, // count
|
||||
1, // offsetSize
|
||||
|
@ -40,8 +40,6 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
var pdfjsLibs;
|
||||
|
||||
function initializePDFJS(callback) {
|
||||
require.config({paths: {'pdfjs': '../../src', 'pdfjs-web': '../../web',
|
||||
'pdfjs-test': '..'}});
|
||||
|
@ -63,7 +63,7 @@ describe('network', function() {
|
||||
});
|
||||
};
|
||||
|
||||
var readPromise = read();
|
||||
var readPromise = Promise.all([read(), promise]);
|
||||
|
||||
readPromise.then(function (page) {
|
||||
expect(len).toEqual(pdf1Length);
|
||||
@ -117,12 +117,13 @@ describe('network', function() {
|
||||
});
|
||||
};
|
||||
|
||||
var readPromise = read();
|
||||
var readPromise = Promise.all([read(), promise]);
|
||||
|
||||
readPromise.then(function () {
|
||||
expect(len).toEqual(pdf2Length);
|
||||
expect(count).toBeGreaterThan(1);
|
||||
expect(isStreamingSupported).toEqual(true);
|
||||
expect(isRangeSupported).toEqual(true);
|
||||
done();
|
||||
}).catch(function (reason) {
|
||||
done.fail(reason);
|
||||
@ -179,6 +180,7 @@ describe('network', function() {
|
||||
readPromises.then(function () {
|
||||
expect(result1.value).toEqual(rangeSize);
|
||||
expect(result2.value).toEqual(tailSize);
|
||||
expect(isStreamingSupported).toEqual(false);
|
||||
expect(isRangeSupported).toEqual(true);
|
||||
expect(fullReaderCancelled).toEqual(true);
|
||||
done();
|
||||
|
@ -74,3 +74,5 @@ var TestReporter = function(browser, appPath) {
|
||||
setTimeout(sendQuitRequest, 500);
|
||||
};
|
||||
};
|
||||
|
||||
exports.TestReporter = TestReporter;
|
||||
|
@ -360,7 +360,6 @@ var PDFPageView = (function PDFPageViewClosure() {
|
||||
|
||||
var self = this;
|
||||
var pdfPage = this.pdfPage;
|
||||
var viewport = this.viewport;
|
||||
var div = this.div;
|
||||
// Wrap the canvas so if it has a css transform for highdpi the overflow
|
||||
// will be hidden in FF.
|
||||
@ -519,8 +518,6 @@ var PDFPageView = (function PDFPageViewClosure() {
|
||||
}
|
||||
};
|
||||
|
||||
var self = this;
|
||||
var pdfPage = this.pdfPage;
|
||||
var viewport = this.viewport;
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.id = 'page' + this.id;
|
||||
|
@ -85,7 +85,6 @@
|
||||
layout: function () {
|
||||
this.throwIfInactive();
|
||||
|
||||
var pdfDocument = this.pdfDocument;
|
||||
var body = document.querySelector('body');
|
||||
body.setAttribute('data-pdfjsprinting', true);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user