Enable the spaced-comment
ESLint rule
Please see http://eslint.org/docs/rules/spaced-comment. Note that the exceptions added for `line` comments are intended to still allow use of the old preprocessor without linting errors. Also, I took the opportunity to improve the grammar slightly (w.r.t. capitalization and punctuation) for comments touched in the patch.
This commit is contained in:
parent
a917443ae6
commit
4626fc8342
@ -105,5 +105,14 @@
|
|||||||
"space-in-parens": ["error", "never"],
|
"space-in-parens": ["error", "never"],
|
||||||
"space-infix-ops": ["error", { "int32Hint": false }],
|
"space-infix-ops": ["error", { "int32Hint": false }],
|
||||||
"space-unary-ops": ["error", { "words": true, "nonwords": false, }],
|
"space-unary-ops": ["error", { "words": true, "nonwords": false, }],
|
||||||
|
"spaced-comment": ["error", "always", {
|
||||||
|
"line": {
|
||||||
|
"exceptions": ["//", "#else", "#endif"],
|
||||||
|
"markers": ["#if", "#elif", "#include", "#expand", "#error"],
|
||||||
|
},
|
||||||
|
"block": {
|
||||||
|
"balanced": true,
|
||||||
|
}
|
||||||
|
}],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1482,8 +1482,7 @@ var AES256Cipher = (function AES256CipherClosure() {
|
|||||||
i < sourceLength; ++i, ++bufferLength) {
|
i < sourceLength; ++i, ++bufferLength) {
|
||||||
buffer[bufferLength] = data[i];
|
buffer[bufferLength] = data[i];
|
||||||
}
|
}
|
||||||
if (bufferLength < 16) {
|
if (bufferLength < 16) { // Need more data.
|
||||||
//need more data
|
|
||||||
this.bufferLength = bufferLength;
|
this.bufferLength = bufferLength;
|
||||||
return new Uint8Array([]);
|
return new Uint8Array([]);
|
||||||
}
|
}
|
||||||
@ -1596,7 +1595,7 @@ var PDF17 = (function PDF17Closure() {
|
|||||||
var hashData = new Uint8Array(password.length + 8);
|
var hashData = new Uint8Array(password.length + 8);
|
||||||
hashData.set(password, 0);
|
hashData.set(password, 0);
|
||||||
hashData.set(userKeySalt, password.length);
|
hashData.set(userKeySalt, password.length);
|
||||||
//key is the decryption key for the UE string
|
// `key` is the decryption key for the UE string.
|
||||||
var key = calculateSHA256(hashData, 0, hashData.length);
|
var key = calculateSHA256(hashData, 0, hashData.length);
|
||||||
var cipher = new AES256Cipher(key);
|
var cipher = new AES256Cipher(key);
|
||||||
return cipher.decryptBlock(userEncryption,
|
return cipher.decryptBlock(userEncryption,
|
||||||
@ -1617,7 +1616,7 @@ var PDF20 = (function PDF20Closure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function calculatePDF20Hash(password, input, userBytes) {
|
function calculatePDF20Hash(password, input, userBytes) {
|
||||||
//This refers to Algorithm 2.B as defined in ISO 32000-2
|
// This refers to Algorithm 2.B as defined in ISO 32000-2.
|
||||||
var k = calculateSHA256(input, 0, input.length).subarray(0, 32);
|
var k = calculateSHA256(input, 0, input.length).subarray(0, 32);
|
||||||
var e = [0];
|
var e = [0];
|
||||||
var i = 0;
|
var i = 0;
|
||||||
@ -1630,16 +1629,14 @@ var PDF20 = (function PDF20Closure() {
|
|||||||
for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) {
|
for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) {
|
||||||
k1.set(array, pos);
|
k1.set(array, pos);
|
||||||
}
|
}
|
||||||
//AES128 CBC NO PADDING with
|
// AES128 CBC NO PADDING with first 16 bytes of k as the key
|
||||||
//first 16 bytes of k as the key and the second 16 as the iv.
|
// and the second 16 as the iv.
|
||||||
var cipher = new AES128Cipher(k.subarray(0, 16));
|
var cipher = new AES128Cipher(k.subarray(0, 16));
|
||||||
e = cipher.encrypt(k1, k.subarray(16, 32));
|
e = cipher.encrypt(k1, k.subarray(16, 32));
|
||||||
//Now we have to take the first 16 bytes of an unsigned
|
// Now we have to take the first 16 bytes of an unsigned big endian
|
||||||
//big endian integer... and compute the remainder
|
// integer and compute the remainder modulo 3. That is a fairly large
|
||||||
//modulo 3.... That is a fairly large number and
|
// number and JavaScript isn't going to handle that well, so we're using
|
||||||
//JavaScript isn't going to handle that well...
|
// a trick that allows us to perform modulo math byte by byte.
|
||||||
//So we're using a trick that allows us to perform
|
|
||||||
//modulo math byte by byte
|
|
||||||
var remainder = 0;
|
var remainder = 0;
|
||||||
for (var z = 0; z < 16; z++) {
|
for (var z = 0; z < 16; z++) {
|
||||||
remainder *= (256 % 3);
|
remainder *= (256 % 3);
|
||||||
@ -1716,7 +1713,7 @@ var PDF20 = (function PDF20Closure() {
|
|||||||
var hashData = new Uint8Array(password.length + 8);
|
var hashData = new Uint8Array(password.length + 8);
|
||||||
hashData.set(password, 0);
|
hashData.set(password, 0);
|
||||||
hashData.set(userKeySalt, password.length);
|
hashData.set(userKeySalt, password.length);
|
||||||
//key is the decryption key for the UE string
|
// `key` is the decryption key for the UE string.
|
||||||
var key = calculatePDF20Hash(password, hashData, []);
|
var key = calculatePDF20Hash(password, hashData, []);
|
||||||
var cipher = new AES256Cipher(key);
|
var cipher = new AES256Cipher(key);
|
||||||
return cipher.decryptBlock(userEncryption,
|
return cipher.decryptBlock(userEncryption,
|
||||||
|
@ -1369,7 +1369,7 @@ var Font = (function FontClosure() {
|
|||||||
if (tag === 'head') {
|
if (tag === 'head') {
|
||||||
// clearing checksum adjustment
|
// clearing checksum adjustment
|
||||||
data[8] = data[9] = data[10] = data[11] = 0;
|
data[8] = data[9] = data[10] = data[11] = 0;
|
||||||
data[17] |= 0x20; //Set font optimized for cleartype flag
|
data[17] |= 0x20; // Set font optimized for cleartype flag.
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -709,7 +709,7 @@ var JpegImage = (function JpegImageClosure() {
|
|||||||
z = dctZigZag[j];
|
z = dctZigZag[j];
|
||||||
tableData[z] = data[offset++];
|
tableData[z] = data[offset++];
|
||||||
}
|
}
|
||||||
} else if ((quantizationTableSpec >> 4) === 1) { //16 bit
|
} else if ((quantizationTableSpec >> 4) === 1) { // 16 bit values
|
||||||
for (j = 0; j < 64; j++) {
|
for (j = 0; j < 64; j++) {
|
||||||
z = dctZigZag[j];
|
z = dctZigZag[j];
|
||||||
tableData[z] = readUint16();
|
tableData[z] = readUint16();
|
||||||
|
@ -1627,7 +1627,7 @@
|
|||||||
|
|
||||||
function reverseIfRtl(chars) {
|
function reverseIfRtl(chars) {
|
||||||
var charsLength = chars.length;
|
var charsLength = chars.length;
|
||||||
//reverse an arabic ligature
|
// Reverse an arabic ligature.
|
||||||
if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
|
if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
|
||||||
return chars;
|
return chars;
|
||||||
}
|
}
|
||||||
|
@ -1710,10 +1710,10 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||||||
}
|
}
|
||||||
return pattern;
|
return pattern;
|
||||||
},
|
},
|
||||||
setStrokeColorN: function CanvasGraphics_setStrokeColorN(/*...*/) {
|
setStrokeColorN: function CanvasGraphics_setStrokeColorN() {
|
||||||
this.current.strokeColor = this.getColorN_Pattern(arguments);
|
this.current.strokeColor = this.getColorN_Pattern(arguments);
|
||||||
},
|
},
|
||||||
setFillColorN: function CanvasGraphics_setFillColorN(/*...*/) {
|
setFillColorN: function CanvasGraphics_setFillColorN() {
|
||||||
this.current.fillColor = this.getColorN_Pattern(arguments);
|
this.current.fillColor = this.getColorN_Pattern(arguments);
|
||||||
this.current.patternFill = true;
|
this.current.patternFill = true;
|
||||||
},
|
},
|
||||||
|
@ -71,7 +71,7 @@ var CustomStyle = (function CustomStyleClosure() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if all fails then set to undefined
|
// If all fails then set to undefined.
|
||||||
return (_cache[propName] = 'undefined');
|
return (_cache[propName] = 'undefined');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ PDFViewerApplication.externalServices = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
//// l10n.js for Firefox extension expects services to be set.
|
// l10n.js for Firefox extension expects services to be set.
|
||||||
document.mozL10n.setExternalLocalizerServices({
|
document.mozL10n.setExternalLocalizerServices({
|
||||||
getLocale: function () {
|
getLocale: function () {
|
||||||
return FirefoxCom.requestSync('getLocale', null);
|
return FirefoxCom.requestSync('getLocale', null);
|
||||||
|
@ -285,7 +285,7 @@
|
|||||||
window.addEventListener('keydown', function(event) {
|
window.addEventListener('keydown', function(event) {
|
||||||
// Intercept Cmd/Ctrl + P in all browsers.
|
// Intercept Cmd/Ctrl + P in all browsers.
|
||||||
// Also intercept Cmd/Ctrl + Shift + P in Chrome and Opera
|
// Also intercept Cmd/Ctrl + Shift + P in Chrome and Opera
|
||||||
if (event.keyCode === 80/*P*/ && (event.ctrlKey || event.metaKey) &&
|
if (event.keyCode === /* P= */ 80 && (event.ctrlKey || event.metaKey) &&
|
||||||
!event.altKey && (!event.shiftKey || window.chrome || window.opera)) {
|
!event.altKey && (!event.shiftKey || window.chrome || window.opera)) {
|
||||||
window.print();
|
window.print();
|
||||||
if (hasAttachEvent) {
|
if (hasAttachEvent) {
|
||||||
@ -305,7 +305,7 @@
|
|||||||
if (hasAttachEvent) {
|
if (hasAttachEvent) {
|
||||||
document.attachEvent('onkeydown', function(event) {
|
document.attachEvent('onkeydown', function(event) {
|
||||||
event = event || window.event;
|
event = event || window.event;
|
||||||
if (event.keyCode === 80/*P*/ && event.ctrlKey) {
|
if (event.keyCode === /* P= */ 80 && event.ctrlKey) {
|
||||||
event.keyCode = 0;
|
event.keyCode = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user