Fix inconsistent spacing and trailing commas in objects in remaining src/ files, so we can enable the comma-dangle and object-curly-spacing ESLint rules later on

http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing

Given that we currently have quite inconsistent object formatting, fixing this in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead.

Please note: This patch was created automatically, using the ESLint `--fix` command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.

```diff
diff --git a/src/display/canvas.js b/src/display/canvas.js
index 5739f6f2..4216b2d2 100644
--- a/src/display/canvas.js
+++ b/src/display/canvas.js
@@ -2071,7 +2071,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
       var map = [];
       for (var i = 0, ii = positions.length; i < ii; i += 2) {
         map.push({ transform: [scaleX, 0, 0, scaleY, positions[i],
-                 positions[i + 1]], x: 0, y: 0, w: width, h: height, });
+                   positions[i + 1]], x: 0, y: 0, w: width, h: height, });
       }
       this.paintInlineImageXObjectGroup(imgData, map);
     },
diff --git a/src/display/svg.js b/src/display/svg.js
index 9eb05dfa..2aa21482 100644
--- a/src/display/svg.js
+++ b/src/display/svg.js
@@ -458,7 +458,11 @@ SVGGraphics = (function SVGGraphicsClosure() {

       for (var x = 0; x < fnArrayLen; x++) {
         var fnId = fnArray[x];
-        opList.push({ 'fnId': fnId, 'fn': REVOPS[fnId], 'args': argsArray[x], });
+        opList.push({
+          'fnId': fnId,
+          'fn': REVOPS[fnId],
+          'args': argsArray[x],
+        });
       }
       return opListToTree(opList);
     },
```
This commit is contained in:
Jonas Jenwald 2017-06-02 11:26:37 +02:00
parent 593dec1bb7
commit f20d2cd2ae
12 changed files with 144 additions and 140 deletions

View File

@ -97,7 +97,7 @@ AnnotationElementFactory.prototype =
default: default:
return new AnnotationElement(parameters); return new AnnotationElement(parameters);
} }
} },
}; };
/** /**
@ -242,7 +242,7 @@ var AnnotationElement = (function AnnotationElementClosure() {
color: data.color, color: data.color,
title: data.title, title: data.title,
contents: data.contents, contents: data.contents,
hideWrapper: true hideWrapper: true,
}); });
var popup = popupElement.render(); var popup = popupElement.render();
@ -260,7 +260,7 @@ var AnnotationElement = (function AnnotationElementClosure() {
*/ */
render: function AnnotationElement_render() { render: function AnnotationElement_render() {
throw new Error('Abstract method AnnotationElement.render called'); throw new Error('Abstract method AnnotationElement.render called');
} },
}; };
return AnnotationElement; return AnnotationElement;
@ -340,7 +340,7 @@ var LinkAnnotationElement = (function LinkAnnotationElementClosure() {
return false; return false;
}; };
link.className = 'internalLink'; link.className = 'internalLink';
} },
}); });
return LinkAnnotationElement; return LinkAnnotationElement;
@ -375,7 +375,7 @@ var TextAnnotationElement = (function TextAnnotationElementClosure() {
this.data.name.toLowerCase() + '.svg'; this.data.name.toLowerCase() + '.svg';
image.alt = '[{{type}} Annotation]'; image.alt = '[{{type}} Annotation]';
image.dataset.l10nId = 'text_annotation_type'; image.dataset.l10nId = 'text_annotation_type';
image.dataset.l10nArgs = JSON.stringify({type: this.data.name}); image.dataset.l10nArgs = JSON.stringify({ type: this.data.name, });
if (!this.data.hasPopup) { if (!this.data.hasPopup) {
this._createPopup(this.container, image, this.data); this._createPopup(this.container, image, this.data);
@ -383,7 +383,7 @@ var TextAnnotationElement = (function TextAnnotationElementClosure() {
this.container.appendChild(image); this.container.appendChild(image);
return this.container; return this.container;
} },
}); });
return TextAnnotationElement; return TextAnnotationElement;
@ -409,7 +409,7 @@ var WidgetAnnotationElement = (function WidgetAnnotationElementClosure() {
render: function WidgetAnnotationElement_render() { render: function WidgetAnnotationElement_render() {
// Show only the container for unsupported field types. // Show only the container for unsupported field types.
return this.container; return this.container;
} },
}); });
return WidgetAnnotationElement; return WidgetAnnotationElement;
@ -516,7 +516,7 @@ var TextWidgetAnnotationElement = (
var fontFamily = font.loadedName ? '"' + font.loadedName + '", ' : ''; var fontFamily = font.loadedName ? '"' + font.loadedName + '", ' : '';
var fallbackName = font.fallbackName || 'Helvetica, sans-serif'; var fallbackName = font.fallbackName || 'Helvetica, sans-serif';
style.fontFamily = fontFamily + fallbackName; style.fontFamily = fontFamily + fallbackName;
} },
}); });
return TextWidgetAnnotationElement; return TextWidgetAnnotationElement;
@ -554,7 +554,7 @@ var CheckboxWidgetAnnotationElement =
this.container.appendChild(element); this.container.appendChild(element);
return this.container; return this.container;
} },
}); });
return CheckboxWidgetAnnotationElement; return CheckboxWidgetAnnotationElement;
@ -593,7 +593,7 @@ var RadioButtonWidgetAnnotationElement =
this.container.appendChild(element); this.container.appendChild(element);
return this.container; return this.container;
} },
}); });
return RadioButtonWidgetAnnotationElement; return RadioButtonWidgetAnnotationElement;
@ -651,7 +651,7 @@ var ChoiceWidgetAnnotationElement = (
this.container.appendChild(selectElement); this.container.appendChild(selectElement);
return this.container; return this.container;
} },
}); });
return ChoiceWidgetAnnotationElement; return ChoiceWidgetAnnotationElement;
@ -697,7 +697,7 @@ var PopupAnnotationElement = (function PopupAnnotationElementClosure() {
trigger: parentElement, trigger: parentElement,
color: this.data.color, color: this.data.color,
title: this.data.title, title: this.data.title,
contents: this.data.contents contents: this.data.contents,
}); });
// Position the popup next to the parent annotation's container. // Position the popup next to the parent annotation's container.
@ -711,7 +711,7 @@ var PopupAnnotationElement = (function PopupAnnotationElementClosure() {
this.container.appendChild(popup.render()); this.container.appendChild(popup.render());
return this.container; return this.container;
} },
}); });
return PopupAnnotationElement; return PopupAnnotationElement;
@ -849,7 +849,7 @@ var PopupElement = (function PopupElementClosure() {
this.hideElement.setAttribute('hidden', true); this.hideElement.setAttribute('hidden', true);
this.container.style.zIndex -= 1; this.container.style.zIndex -= 1;
} }
} },
}; };
return PopupElement; return PopupElement;
@ -912,7 +912,7 @@ var LineAnnotationElement = (function LineAnnotationElementClosure() {
this._createPopup(this.container, line, this.data); this._createPopup(this.container, line, this.data);
return this.container; return this.container;
} },
}); });
return LineAnnotationElement; return LineAnnotationElement;
@ -946,7 +946,7 @@ var HighlightAnnotationElement = (
this._createPopup(this.container, null, this.data); this._createPopup(this.container, null, this.data);
} }
return this.container; return this.container;
} },
}); });
return HighlightAnnotationElement; return HighlightAnnotationElement;
@ -980,7 +980,7 @@ var UnderlineAnnotationElement = (
this._createPopup(this.container, null, this.data); this._createPopup(this.container, null, this.data);
} }
return this.container; return this.container;
} },
}); });
return UnderlineAnnotationElement; return UnderlineAnnotationElement;
@ -1013,7 +1013,7 @@ var SquigglyAnnotationElement = (function SquigglyAnnotationElementClosure() {
this._createPopup(this.container, null, this.data); this._createPopup(this.container, null, this.data);
} }
return this.container; return this.container;
} },
}); });
return SquigglyAnnotationElement; return SquigglyAnnotationElement;
@ -1047,7 +1047,7 @@ var StrikeOutAnnotationElement = (
this._createPopup(this.container, null, this.data); this._createPopup(this.container, null, this.data);
} }
return this.container; return this.container;
} },
}); });
return StrikeOutAnnotationElement; return StrikeOutAnnotationElement;
@ -1110,7 +1110,7 @@ var FileAttachmentAnnotationElement = (
return; return;
} }
this.downloadManager.downloadData(this.content, this.filename, ''); this.downloadManager.downloadData(this.content, this.filename, '');
} },
}); });
return FileAttachmentAnnotationElement; return FileAttachmentAnnotationElement;
@ -1183,7 +1183,7 @@ var AnnotationLayer = (function AnnotationLayerClosure() {
} }
} }
parameters.div.removeAttribute('hidden'); parameters.div.removeAttribute('hidden');
} },
}; };
})(); })();

View File

@ -191,11 +191,11 @@ function getDocument(src, pdfDataRangeTransport,
var source; var source;
if (typeof src === 'string') { if (typeof src === 'string') {
source = { url: src }; source = { url: src, };
} else if (isArrayBuffer(src)) { } else if (isArrayBuffer(src)) {
source = { data: src }; source = { data: src, };
} else if (src instanceof PDFDataRangeTransport) { } else if (src instanceof PDFDataRangeTransport) {
source = { range: src }; source = { range: src, };
} else { } else {
if (typeof src !== 'object') { if (typeof src !== 'object') {
error('Invalid parameter in getDocument, need either Uint8Array, ' + error('Invalid parameter in getDocument, need either Uint8Array, ' +
@ -415,7 +415,7 @@ var PDFDocumentLoadingTask = (function PDFDocumentLoadingTaskClosure() {
*/ */
then: function PDFDocumentLoadingTask_then(onFulfilled, onRejected) { then: function PDFDocumentLoadingTask_then(onFulfilled, onRejected) {
return this.promise.then.apply(this.promise, arguments); return this.promise.then.apply(this.promise, arguments);
} },
}; };
return PDFDocumentLoadingTask; return PDFDocumentLoadingTask;
@ -491,7 +491,7 @@ var PDFDataRangeTransport = (function pdfDataRangeTransportClosure() {
}, },
abort: function PDFDataRangeTransport_abort() { abort: function PDFDataRangeTransport_abort() {
} },
}; };
return PDFDataRangeTransport; return PDFDataRangeTransport;
})(); })();
@ -639,7 +639,7 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {
*/ */
destroy: function PDFDocumentProxy_destroy() { destroy: function PDFDocumentProxy_destroy() {
return this.loadingTask.destroy(); return this.loadingTask.destroy();
} },
}; };
return PDFDocumentProxy; return PDFDocumentProxy;
})(); })();
@ -843,7 +843,7 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
intentState.operatorList = { intentState.operatorList = {
fnArray: [], fnArray: [],
argsArray: [], argsArray: [],
lastChunk: false lastChunk: false,
}; };
this.stats.time('Page Request'); this.stats.time('Page Request');
@ -939,7 +939,7 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
intentState.operatorList = { intentState.operatorList = {
fnArray: [], fnArray: [],
argsArray: [], argsArray: [],
lastChunk: false lastChunk: false,
}; };
this.transport.messageHandler.send('RenderPageRequest', { this.transport.messageHandler.send('RenderPageRequest', {
@ -1066,7 +1066,7 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
intentState.receivingOperatorList = false; intentState.receivingOperatorList = false;
this._tryCleanup(); this._tryCleanup();
} }
} },
}; };
return PDFPageProxy; return PDFPageProxy;
})(); })();
@ -1125,13 +1125,13 @@ class LoopbackPort {
if (!this._defer) { if (!this._defer) {
this._listeners.forEach(function (listener) { this._listeners.forEach(function (listener) {
listener.call(this, {data: obj}); listener.call(this, { data: obj, });
}, this); }, this);
return; return;
} }
var cloned = new WeakMap(); var cloned = new WeakMap();
var e = {data: cloneValue(obj)}; var e = { data: cloneValue(obj), };
this._deferred.then(() => { this._deferred.then(() => {
this._listeners.forEach(function (listener) { this._listeners.forEach(function (listener) {
listener.call(this, e); listener.call(this, e);
@ -1332,7 +1332,7 @@ var PDFWorker = (function PDFWorkerClosure() {
this._readyCapability.resolve(); this._readyCapability.resolve();
// Send global setting, e.g. verbosity level. // Send global setting, e.g. verbosity level.
messageHandler.send('configure', { messageHandler.send('configure', {
verbosity: getVerbosityLevel() verbosity: getVerbosityLevel(),
}); });
} else { } else {
this._setupFakeWorker(); this._setupFakeWorker();
@ -1441,7 +1441,7 @@ var PDFWorker = (function PDFWorkerClosure() {
this._messageHandler.destroy(); this._messageHandler.destroy();
this._messageHandler = null; this._messageHandler = null;
} }
} },
}; };
return PDFWorker; return PDFWorker;
@ -1658,7 +1658,7 @@ var WorkerTransport = (function WorkerTransportClosure() {
fontRegistry = { fontRegistry = {
registerFont(font, url) { registerFont(font, url) {
globalScope['FontInspector'].fontAdded(font, url); globalScope['FontInspector'].fontAdded(font, url);
} },
}; };
} }
var font = new FontFaceObject(exportedData, { var font = new FontFaceObject(exportedData, {
@ -1724,7 +1724,7 @@ var WorkerTransport = (function WorkerTransportClosure() {
if (loadingTask.onProgress) { if (loadingTask.onProgress) {
loadingTask.onProgress({ loadingTask.onProgress({
loaded: data.loaded, loaded: data.loaded,
total: data.total total: data.total,
}); });
} }
}, this); }, this);
@ -1902,7 +1902,7 @@ var WorkerTransport = (function WorkerTransportClosure() {
then(function transportMetadata(results) { then(function transportMetadata(results) {
return { return {
info: results[0], info: results[0],
metadata: (results[1] ? new Metadata(results[1]) : null) metadata: (results[1] ? new Metadata(results[1]) : null),
}; };
}); });
}, },
@ -1922,7 +1922,7 @@ var WorkerTransport = (function WorkerTransportClosure() {
this.commonObjs.clear(); this.commonObjs.clear();
this.fontLoader.clear(); this.fontLoader.clear();
}); });
} },
}; };
return WorkerTransport; return WorkerTransport;
@ -1953,7 +1953,7 @@ var PDFObjects = (function PDFObjectsClosure() {
var obj = { var obj = {
capability: createPromiseCapability(), capability: createPromiseCapability(),
data: null, data: null,
resolved: false resolved: false,
}; };
this.objs[objId] = obj; this.objs[objId] = obj;
@ -2027,7 +2027,7 @@ var PDFObjects = (function PDFObjectsClosure() {
clear: function PDFObjects_clear() { clear: function PDFObjects_clear() {
this.objs = Object.create(null); this.objs = Object.create(null);
} },
}; };
return PDFObjects; return PDFObjects;
})(); })();
@ -2078,7 +2078,7 @@ var RenderTask = (function RenderTaskClosure() {
*/ */
then: function RenderTask_then(onFulfilled, onRejected) { then: function RenderTask_then(onFulfilled, onRejected) {
return this.promise.then.apply(this.promise, arguments); return this.promise.then.apply(this.promise, arguments);
} },
}; };
return RenderTask; return RenderTask;
@ -2212,7 +2212,7 @@ var InternalRenderTask = (function InternalRenderTaskClosure() {
this.callback(); this.callback();
} }
} }
} },
}; };
@ -2235,7 +2235,7 @@ var _UnsupportedManager = (function UnsupportedManagerClosure() {
for (var i = 0, ii = listeners.length; i < ii; i++) { for (var i = 0, ii = listeners.length; i < ii; i++) {
listeners[i](featureId); listeners[i](featureId);
} }
} },
}; };
})(); })();

View File

@ -40,7 +40,7 @@ var FULL_CHUNK_HEIGHT = 16;
var IsLittleEndianCached = { var IsLittleEndianCached = {
get value() { get value() {
return shadow(IsLittleEndianCached, 'value', isLittleEndian()); return shadow(IsLittleEndianCached, 'value', isLittleEndian());
} },
}; };
function addContextCurrentTransform(ctx) { function addContextCurrentTransform(ctx) {
@ -60,7 +60,7 @@ function addContextCurrentTransform(ctx) {
Object.defineProperty(ctx, 'mozCurrentTransform', { Object.defineProperty(ctx, 'mozCurrentTransform', {
get: function getCurrentTransform() { get: function getCurrentTransform() {
return this._transformMatrix; return this._transformMatrix;
} },
}); });
Object.defineProperty(ctx, 'mozCurrentTransformInverse', { Object.defineProperty(ctx, 'mozCurrentTransformInverse', {
@ -83,7 +83,7 @@ function addContextCurrentTransform(ctx) {
(d * e - c * f) / bc_ad, (d * e - c * f) / bc_ad,
(b * e - a * f) / ad_bc (b * e - a * f) / ad_bc
]; ];
} },
}); });
ctx.save = function ctxSave() { ctx.save = function ctxSave() {
@ -188,7 +188,7 @@ var CachedCanvases = (function CachedCanvasesClosure() {
this.canvasFactory.destroy(canvasEntry); this.canvasFactory.destroy(canvasEntry);
delete this.cache[id]; delete this.cache[id];
} }
} },
}; };
return CachedCanvases; return CachedCanvases;
})(); })();
@ -394,7 +394,7 @@ var CanvasExtraState = (function CanvasExtraStateClosure() {
setCurrentPoint: function CanvasExtraState_setCurrentPoint(x, y) { setCurrentPoint: function CanvasExtraState_setCurrentPoint(x, y) {
this.x = x; this.x = x;
this.y = y; this.y = y;
} },
}; };
return CanvasExtraState; return CanvasExtraState;
})(); })();
@ -1649,7 +1649,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
createCanvasGraphics: (ctx) => { createCanvasGraphics: (ctx) => {
return new CanvasGraphics(ctx, this.commonObjs, this.objs, return new CanvasGraphics(ctx, this.commonObjs, this.objs,
this.canvasFactory); this.canvasFactory);
} },
}; };
pattern = new TilingPattern(IR, color, this.ctx, canvasGraphicsFactory, pattern = new TilingPattern(IR, color, this.ctx, canvasGraphicsFactory,
baseTransform); baseTransform);
@ -1933,7 +1933,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
left: position[0], left: position[0],
top: position[1], top: position[1],
width: w / currentTransform[0], width: w / currentTransform[0],
height: h / currentTransform[3] height: h / currentTransform[3],
}); });
} }
this.restore(); this.restore();
@ -2070,8 +2070,8 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
var height = imgData.height; var height = imgData.height;
var map = []; var map = [];
for (var i = 0, ii = positions.length; i < ii; i += 2) { for (var i = 0, ii = positions.length; i < ii; i += 2) {
map.push({transform: [scaleX, 0, 0, scaleY, positions[i], map.push({ transform: [scaleX, 0, 0, scaleY, positions[i],
positions[i + 1]], x: 0, y: 0, w: width, h: height}); positions[i + 1]], x: 0, y: 0, w: width, h: height, });
} }
this.paintInlineImageXObjectGroup(imgData, map); this.paintInlineImageXObjectGroup(imgData, map);
}, },
@ -2141,7 +2141,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
left: position[0], left: position[0],
top: position[1], top: position[1],
width: width / currentTransform[0], width: width / currentTransform[0],
height: height / currentTransform[3] height: height / currentTransform[3],
}); });
} }
this.restore(); this.restore();
@ -2171,7 +2171,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
left: position[0], left: position[0],
top: position[1], top: position[1],
width: w, width: w,
height: h height: h,
}); });
} }
ctx.restore(); ctx.restore();
@ -2251,7 +2251,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
transform[0] * x + transform[2] * y + transform[4], transform[0] * x + transform[2] * y + transform[4],
transform[1] * x + transform[3] * y + transform[5] transform[1] * x + transform[3] * y + transform[5]
]; ];
} },
}; };
for (var op in OPS) { for (var op in OPS) {

View File

@ -25,7 +25,7 @@ function FontLoader(docId) {
this.loadTestFontId = 0; this.loadTestFontId = 0;
this.loadingContext = { this.loadingContext = {
requests: [], requests: [],
nextRequestId: 0 nextRequestId: 0,
}; };
} }
} }
@ -55,7 +55,7 @@ FontLoader.prototype = {
}); });
this.nativeFontFaces.length = 0; this.nativeFontFaces.length = 0;
} }
} },
}; };
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL')) { if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL')) {
@ -90,7 +90,7 @@ if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL')) {
get() { get() {
return shadow(this, 'loadTestFont', getLoadTestFont()); return shadow(this, 'loadTestFont', getLoadTestFont());
}, },
configurable: true configurable: true,
}); });
FontLoader.prototype.addNativeFontFace = FontLoader.prototype.addNativeFontFace =
@ -171,7 +171,7 @@ if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL')) {
id: requestId, id: requestId,
complete: LoadLoader_completeRequest, complete: LoadLoader_completeRequest,
callback, callback,
started: Date.now() started: Date.now(),
}; };
context.requests.push(request); context.requests.push(request);
return request; return request;
@ -325,14 +325,14 @@ if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL || CHROME')) {
isSyncFontLoadingSupported()); isSyncFontLoadingSupported());
}, },
enumerable: true, enumerable: true,
configurable: true configurable: true,
}); });
} }
var IsEvalSupportedCached = { var IsEvalSupportedCached = {
get value() { get value() {
return shadow(this, 'value', isEvalSupported()); return shadow(this, 'value', isEvalSupported());
} },
}; };
var FontFaceObject = (function FontFaceObjectClosure() { var FontFaceObject = (function FontFaceObjectClosure() {
@ -430,7 +430,7 @@ var FontFaceObject = (function FontFaceObjectClosure() {
} }
} }
return this.compiledGlyphs[character]; return this.compiledGlyphs[character];
} },
}; };
return FontFaceObject; return FontFaceObject;

View File

@ -63,7 +63,7 @@ Object.defineProperty(PDFJS, 'verbosity', {
setVerbosityLevel(level); setVerbosityLevel(level);
}, },
enumerable: true, enumerable: true,
configurable: true configurable: true,
}); });
PDFJS.VERBOSITY_LEVELS = VERBOSITY_LEVELS; PDFJS.VERBOSITY_LEVELS = VERBOSITY_LEVELS;
@ -79,7 +79,7 @@ Object.defineProperty(PDFJS, 'isLittleEndian', {
configurable: true, configurable: true,
get: function PDFJS_isLittleEndian() { get: function PDFJS_isLittleEndian() {
return shadow(PDFJS, 'isLittleEndian', isLittleEndian()); return shadow(PDFJS, 'isLittleEndian', isLittleEndian());
} },
}); });
PDFJS.removeNullCharacters = removeNullCharacters; PDFJS.removeNullCharacters = removeNullCharacters;
PDFJS.PasswordResponses = PasswordResponses; PDFJS.PasswordResponses = PasswordResponses;
@ -266,7 +266,7 @@ if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL')) {
PDFJS.externalLinkTarget = value ? LinkTarget.BLANK : LinkTarget.NONE; PDFJS.externalLinkTarget = value ? LinkTarget.BLANK : LinkTarget.NONE;
}, },
enumerable: true, enumerable: true,
configurable: true configurable: true,
}); });
if (savedOpenExternalLinksInNewWindow) { if (savedOpenExternalLinksInNewWindow) {
/** /**

View File

@ -88,7 +88,7 @@ Metadata.prototype = {
has: function Metadata_has(name) { has: function Metadata_has(name) {
return typeof this.metadata[name] !== 'undefined'; return typeof this.metadata[name] !== 'undefined';
} },
}; };
export { export {

View File

@ -41,9 +41,9 @@ ShadingIRs.RadialAxial = {
grad.addColorStop(c[0], c[1]); grad.addColorStop(c[0], c[1]);
} }
return grad; return grad;
} },
}; };
} },
}; };
var createMeshCanvas = (function createMeshCanvasClosure() { var createMeshCanvas = (function createMeshCanvasClosure() {
@ -174,7 +174,7 @@ var createMeshCanvas = (function createMeshCanvasClosure() {
offsetX: -offsetX, offsetX: -offsetX,
offsetY: -offsetY, offsetY: -offsetY,
scaleX: 1 / scaleX, scaleX: 1 / scaleX,
scaleY: 1 / scaleY scaleY: 1 / scaleY,
}; };
var paddedWidth = width + BORDER_SIZE * 2; var paddedWidth = width + BORDER_SIZE * 2;
@ -269,9 +269,9 @@ ShadingIRs.Mesh = {
temporaryPatternCanvas.scaleY); temporaryPatternCanvas.scaleY);
return ctx.createPattern(temporaryPatternCanvas.canvas, 'no-repeat'); return ctx.createPattern(temporaryPatternCanvas.canvas, 'no-repeat');
} },
}; };
} },
}; };
ShadingIRs.Dummy = { ShadingIRs.Dummy = {
@ -280,9 +280,9 @@ ShadingIRs.Dummy = {
type: 'Pattern', type: 'Pattern',
getPattern: function Dummy_fromIR_getPattern() { getPattern: function Dummy_fromIR_getPattern() {
return 'hotpink'; return 'hotpink';
} },
}; };
} },
}; };
function getShadingPatternFromIR(raw) { function getShadingPatternFromIR(raw) {
@ -296,7 +296,7 @@ function getShadingPatternFromIR(raw) {
var TilingPattern = (function TilingPatternClosure() { var TilingPattern = (function TilingPatternClosure() {
var PaintType = { var PaintType = {
COLORED: 1, COLORED: 1,
UNCOLORED: 2 UNCOLORED: 2,
}; };
var MAX_PATTERN_SIZE = 3000; // 10in @ 300dpi shall be enough var MAX_PATTERN_SIZE = 3000; // 10in @ 300dpi shall be enough
@ -428,7 +428,7 @@ var TilingPattern = (function TilingPatternClosure() {
this.scaleToContext(); this.scaleToContext();
return ctx.createPattern(temporaryPatternCanvas, 'repeat'); return ctx.createPattern(temporaryPatternCanvas, 'repeat');
} },
}; };
return TilingPattern; return TilingPattern;

View File

@ -28,7 +28,7 @@ if (typeof PDFJSDev === 'undefined' ||
var SVG_DEFAULTS = { var SVG_DEFAULTS = {
fontStyle: 'normal', fontStyle: 'normal',
fontWeight: 'normal', fontWeight: 'normal',
fillColor: '#000000' fillColor: '#000000',
}; };
var convertImgDataToPng = (function convertImgDataToPngClosure() { var convertImgDataToPng = (function convertImgDataToPngClosure() {
@ -277,7 +277,7 @@ var SVGExtraState = (function SVGExtraStateClosure() {
setCurrentPoint: function SVGExtraState_setCurrentPoint(x, y) { setCurrentPoint: function SVGExtraState_setCurrentPoint(x, y) {
this.x = x; this.x = x;
this.y = y; this.y = y;
} },
}; };
return SVGExtraState; return SVGExtraState;
})(); })();
@ -290,7 +290,7 @@ SVGGraphics = (function SVGGraphicsClosure() {
for (var x = 0; x < opListLen; x++) { for (var x = 0; x < opListLen; x++) {
if (opList[x].fn === 'save') { if (opList[x].fn === 'save') {
opTree.push({'fnId': 92, 'fn': 'group', 'items': []}); opTree.push({ 'fnId': 92, 'fn': 'group', 'items': [], });
tmp.push(opTree); tmp.push(opTree);
opTree = opTree[opTree.length - 1].items; opTree = opTree[opTree.length - 1].items;
continue; continue;
@ -458,7 +458,11 @@ SVGGraphics = (function SVGGraphicsClosure() {
for (var x = 0; x < fnArrayLen; x++) { for (var x = 0; x < fnArrayLen; x++) {
var fnId = fnArray[x]; var fnId = fnArray[x];
opList.push({'fnId': fnId, 'fn': REVOPS[fnId], 'args': argsArray[x]}); opList.push({
'fnId': fnId,
'fn': REVOPS[fnId],
'args': argsArray[x],
});
} }
return opListToTree(opList); return opListToTree(opList);
}, },
@ -1187,7 +1191,7 @@ SVGGraphics = (function SVGGraphicsClosure() {
} }
} }
return this.tgrp; return this.tgrp;
} },
}; };
return SVGGraphics; return SVGGraphics;
})(); })();

View File

@ -176,7 +176,7 @@ var renderTextLayer = (function renderTextLayerClosure() {
PDFJSDev.test('FIREFOX || MOZCENTRAL || GENERIC')) { PDFJSDev.test('FIREFOX || MOZCENTRAL || GENERIC')) {
canvas.mozOpaque = true; canvas.mozOpaque = true;
} }
var ctx = canvas.getContext('2d', {alpha: false}); var ctx = canvas.getContext('2d', { alpha: false, });
var lastFontSize; var lastFontSize;
var lastFontFamily; var lastFontFamily;
@ -293,7 +293,7 @@ var renderTextLayer = (function renderTextLayerClosure() {
y2: box.bottom, y2: box.bottom,
index: i, index: i,
x1New: undefined, x1New: undefined,
x2New: undefined x2New: undefined,
}; };
}); });
expandBoundsLTR(width, bounds); expandBoundsLTR(width, bounds);
@ -304,7 +304,7 @@ var renderTextLayer = (function renderTextLayerClosure() {
left: b.x1New, left: b.x1New,
top: 0, top: 0,
right: b.x2New, right: b.x2New,
bottom: 0 bottom: 0,
}; };
}); });
@ -344,12 +344,12 @@ var renderTextLayer = (function renderTextLayerClosure() {
y2: Infinity, y2: Infinity,
index: -1, index: -1,
x1New: 0, x1New: 0,
x2New: 0 x2New: 0,
}; };
var horizon = [{ var horizon = [{
start: -Infinity, start: -Infinity,
end: Infinity, end: Infinity,
boundary: fakeBoundary boundary: fakeBoundary,
}]; }];
bounds.forEach(function (boundary) { bounds.forEach(function (boundary) {
@ -428,7 +428,7 @@ var renderTextLayer = (function renderTextLayerClosure() {
changedHorizon.push({ changedHorizon.push({
start: horizonPart.start, start: horizonPart.start,
end: horizonPart.end, end: horizonPart.end,
boundary: useBoundary boundary: useBoundary,
}); });
lastBoundary = useBoundary; lastBoundary = useBoundary;
} }
@ -438,7 +438,7 @@ var renderTextLayer = (function renderTextLayerClosure() {
changedHorizon.unshift({ changedHorizon.unshift({
start: horizon[i].start, start: horizon[i].start,
end: boundary.y1, end: boundary.y1,
boundary: horizon[i].boundary boundary: horizon[i].boundary,
}); });
} }
if (boundary.y2 < horizon[j].end) { if (boundary.y2 < horizon[j].end) {
@ -446,7 +446,7 @@ var renderTextLayer = (function renderTextLayerClosure() {
changedHorizon.push({ changedHorizon.push({
start: boundary.y2, start: boundary.y2,
end: horizon[j].end, end: horizon[j].end,
boundary: horizon[j].boundary boundary: horizon[j].boundary,
}); });
} }

View File

@ -73,7 +73,7 @@ var WebGLUtils = (function WebGLUtilsClosure() {
// The temporary canvas is used in the WebGL context. // The temporary canvas is used in the WebGL context.
currentCanvas = document.createElement('canvas'); currentCanvas = document.createElement('canvas');
currentGL = currentCanvas.getContext('webgl', currentGL = currentCanvas.getContext('webgl',
{ premultipliedalpha: false }); { premultipliedalpha: false, });
} }
var smaskVertexShaderCode = '\ var smaskVertexShaderCode = '\
@ -432,7 +432,7 @@ var WebGLUtils = (function WebGLUtilsClosure() {
}, },
composeSMask, composeSMask,
drawFigures, drawFigures,
clear: cleanup clear: cleanup,
}; };
})(); })();

View File

@ -104,7 +104,7 @@ PDFJS.compatibilityChecked = true;
buffer[offset + 1] = (value >> 8) & 255; buffer[offset + 1] = (value >> 8) & 255;
buffer[offset + 2] = (value >> 16) & 255; buffer[offset + 2] = (value >> 16) & 255;
buffer[offset + 3] = (value >>> 24) & 255; buffer[offset + 3] = (value >>> 24) & 255;
} },
}; };
} }
@ -182,14 +182,14 @@ PDFJS.compatibilityChecked = true;
return this; return this;
}, },
enumerable: false, enumerable: false,
configurable: true configurable: true,
}); });
Object.defineProperty(cpaProto, 'byteLength', { Object.defineProperty(cpaProto, 'byteLength', {
get() { get() {
return this.length; return this.length;
}, },
enumerable: false, enumerable: false,
configurable: true configurable: true,
}); });
})(); })();
@ -210,13 +210,13 @@ PDFJS.compatibilityChecked = true;
if (hasDOM) { if (hasDOM) {
// some browsers (e.g. safari) cannot use defineProperty() on DOM // some browsers (e.g. safari) cannot use defineProperty() on DOM
// objects and thus the native version is not sufficient // objects and thus the native version is not sufficient
Object.defineProperty(new Image(), 'id', { value: 'test' }); Object.defineProperty(new Image(), 'id', { value: 'test', });
} }
// ... another test for android gb browser for non-DOM objects // ... another test for android gb browser for non-DOM objects
var Test = function Test() {}; var Test = function Test() {};
Test.prototype = { get id() { } }; Test.prototype = { get id() { }, };
Object.defineProperty(new Test(), 'id', Object.defineProperty(new Test(), 'id',
{ value: '', configurable: true, enumerable: true, writable: false }); { value: '', configurable: true, enumerable: true, writable: false, });
} catch (e) { } catch (e) {
definePropertyPossible = false; definePropertyPossible = false;
} }
@ -258,7 +258,7 @@ PDFJS.compatibilityChecked = true;
// IE10 might have response, but not overrideMimeType // IE10 might have response, but not overrideMimeType
// Support: IE10 // Support: IE10
Object.defineProperty(xhrPrototype, 'overrideMimeType', { Object.defineProperty(xhrPrototype, 'overrideMimeType', {
value: function xmlHttpRequestOverrideMimeType(mimeType) {} value: function xmlHttpRequestOverrideMimeType(mimeType) {},
}); });
} }
if ('responseType' in xhr) { if ('responseType' in xhr) {
@ -277,7 +277,7 @@ PDFJS.compatibilityChecked = true;
this.overrideMimeType('text/plain; charset=x-user-defined'); this.overrideMimeType('text/plain; charset=x-user-defined');
} }
} }
} },
}); });
// Support: IE9 // Support: IE9
@ -288,7 +288,7 @@ PDFJS.compatibilityChecked = true;
return new Uint8Array(new VBArray(this.responseBody).toArray()); return new Uint8Array(new VBArray(this.responseBody).toArray());
} }
return this.responseText; return this.responseText;
} },
}); });
return; return;
} }
@ -305,7 +305,7 @@ PDFJS.compatibilityChecked = true;
result[i] = text.charCodeAt(i) & 0xFF; result[i] = text.charCodeAt(i) & 0xFF;
} }
return result.buffer; return result.buffer;
} },
}); });
})(); })();
@ -420,11 +420,11 @@ PDFJS.compatibilityChecked = true;
Object.defineProperty(this, '_dataset', { Object.defineProperty(this, '_dataset', {
value: dataset, value: dataset,
writable: false, writable: false,
enumerable: false enumerable: false,
}); });
return dataset; return dataset;
}, },
enumerable: true enumerable: true,
}); });
})(); })();
@ -469,7 +469,7 @@ PDFJS.compatibilityChecked = true;
}, },
toggle(name) { toggle(name) {
changeList(this.element, name, true, true); changeList(this.element, name, true, true);
} },
}; };
Object.defineProperty(HTMLElement.prototype, 'classList', { Object.defineProperty(HTMLElement.prototype, 'classList', {
@ -482,17 +482,17 @@ PDFJS.compatibilityChecked = true;
element: { element: {
value: this, value: this,
writable: false, writable: false,
enumerable: true enumerable: true,
} },
}); });
Object.defineProperty(this, '_classList', { Object.defineProperty(this, '_classList', {
value: classList, value: classList,
writable: false, writable: false,
enumerable: false enumerable: false,
}); });
return classList; return classList;
}, },
enumerable: true enumerable: true,
}); });
})(); })();
@ -511,7 +511,7 @@ PDFJS.compatibilityChecked = true;
globalScope.postMessage({ globalScope.postMessage({
targetName: 'main', targetName: 'main',
action: 'console_log', action: 'console_log',
data: args data: args,
}); });
}, },
@ -520,7 +520,7 @@ PDFJS.compatibilityChecked = true;
globalScope.postMessage({ globalScope.postMessage({
targetName: 'main', targetName: 'main',
action: 'console_error', action: 'console_error',
data: args data: args,
}); });
}, },
@ -534,7 +534,7 @@ PDFJS.compatibilityChecked = true;
throw new Error('Unknown timer name ' + name); throw new Error('Unknown timer name ' + name);
} }
this.log('Timer:', name, Date.now() - time); this.log('Timer:', name, Date.now() - time);
} },
}; };
globalScope.console = workerConsole; globalScope.console = workerConsole;
@ -552,7 +552,7 @@ PDFJS.compatibilityChecked = true;
window.console = { window.console = {
log() {}, log() {},
error() {}, error() {},
warn() {} warn() {},
}; };
return; return;
} }
@ -765,7 +765,7 @@ PDFJS.compatibilityChecked = true;
return scripts[scripts.length - 1]; return scripts[scripts.length - 1];
}, },
enumerable: true, enumerable: true,
configurable: true configurable: true,
}); });
})(); })();
@ -789,7 +789,7 @@ PDFJS.compatibilityChecked = true;
typeProperty.set.call(this, value === 'number' ? 'text' : value); typeProperty.set.call(this, value === 'number' ? 'text' : value);
}, },
enumerable: true, enumerable: true,
configurable: true configurable: true,
}); });
} }
})(); })();
@ -815,7 +815,7 @@ PDFJS.compatibilityChecked = true;
readyStateProto.set.call(this, value); readyStateProto.set.call(this, value);
}, },
enumerable: true, enumerable: true,
configurable: true configurable: true,
}); });
})(); })();
@ -968,7 +968,7 @@ PDFJS.compatibilityChecked = true;
addUnhandledRejection: function addUnhandledRejection(promise) { addUnhandledRejection: function addUnhandledRejection(promise) {
this.unhandledRejections.push({ this.unhandledRejections.push({
promise, promise,
time: Date.now() time: Date.now(),
}); });
this.scheduleRejectionCheck(); this.scheduleRejectionCheck();
}, },
@ -1012,7 +1012,7 @@ PDFJS.compatibilityChecked = true;
this.scheduleRejectionCheck(); this.scheduleRejectionCheck();
} }
}, REJECTION_TIMEOUT); }, REJECTION_TIMEOUT);
} },
}; };
var Promise = function Promise(resolver) { var Promise = function Promise(resolver) {
@ -1158,7 +1158,7 @@ PDFJS.compatibilityChecked = true;
catch: function Promise_catch(onReject) { catch: function Promise_catch(onReject) {
return this.then(undefined, onReject); return this.then(undefined, onReject);
} },
}; };
globalScope.Promise = Promise; globalScope.Promise = Promise;
@ -1184,12 +1184,12 @@ PDFJS.compatibilityChecked = true;
Object.defineProperty(obj, this.id, { Object.defineProperty(obj, this.id, {
value, value,
enumerable: false, enumerable: false,
configurable: true configurable: true,
}); });
}, },
delete(obj) { delete(obj) {
delete obj[this.id]; delete obj[this.id];
} },
}; };
globalScope.WeakMap = WeakMap; globalScope.WeakMap = WeakMap;
@ -1818,7 +1818,7 @@ PDFJS.compatibilityChecked = true;
return ''; return '';
} }
return this._scheme + '://' + host; return this._scheme + '://' + host;
} },
}; };
// Copy over the static methods // Copy over the static methods

View File

@ -26,7 +26,7 @@ var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
const NativeImageDecoding = { const NativeImageDecoding = {
NONE: 'none', NONE: 'none',
DECODE: 'decode', DECODE: 'decode',
DISPLAY: 'display' DISPLAY: 'display',
}; };
var TextRenderingMode = { var TextRenderingMode = {
@ -39,13 +39,13 @@ var TextRenderingMode = {
FILL_STROKE_ADD_TO_PATH: 6, FILL_STROKE_ADD_TO_PATH: 6,
ADD_TO_PATH: 7, ADD_TO_PATH: 7,
FILL_STROKE_MASK: 3, FILL_STROKE_MASK: 3,
ADD_TO_PATH_FLAG: 4 ADD_TO_PATH_FLAG: 4,
}; };
var ImageKind = { var ImageKind = {
GRAYSCALE_1BPP: 1, GRAYSCALE_1BPP: 1,
RGB_24BPP: 2, RGB_24BPP: 2,
RGBA_32BPP: 3 RGBA_32BPP: 3,
}; };
var AnnotationType = { var AnnotationType = {
@ -74,7 +74,7 @@ var AnnotationType = {
TRAPNET: 23, TRAPNET: 23,
WATERMARK: 24, WATERMARK: 24,
THREED: 25, THREED: 25,
REDACT: 26 REDACT: 26,
}; };
var AnnotationFlag = { var AnnotationFlag = {
@ -87,7 +87,7 @@ var AnnotationFlag = {
READONLY: 0x40, READONLY: 0x40,
LOCKED: 0x80, LOCKED: 0x80,
TOGGLENOVIEW: 0x100, TOGGLENOVIEW: 0x100,
LOCKEDCONTENTS: 0x200 LOCKEDCONTENTS: 0x200,
}; };
var AnnotationFieldFlag = { var AnnotationFieldFlag = {
@ -117,7 +117,7 @@ var AnnotationBorderStyleType = {
DASHED: 2, DASHED: 2,
BEVELED: 3, BEVELED: 3,
INSET: 4, INSET: 4,
UNDERLINE: 5 UNDERLINE: 5,
}; };
var StreamType = { var StreamType = {
@ -130,7 +130,7 @@ var StreamType = {
A85: 6, A85: 6,
AHX: 7, AHX: 7,
CCF: 8, CCF: 8,
RL: 9 RL: 9,
}; };
var FontType = { var FontType = {
@ -144,13 +144,13 @@ var FontType = {
TYPE3: 7, TYPE3: 7,
OPENTYPE: 8, OPENTYPE: 8,
TYPE0: 9, TYPE0: 9,
MMTYPE1: 10 MMTYPE1: 10,
}; };
var VERBOSITY_LEVELS = { var VERBOSITY_LEVELS = {
errors: 0, errors: 0,
warnings: 1, warnings: 1,
infos: 5 infos: 5,
}; };
var CMapCompressionType = { var CMapCompressionType = {
@ -253,7 +253,7 @@ var OPS = {
paintImageXObjectRepeat: 88, paintImageXObjectRepeat: 88,
paintImageMaskXObjectRepeat: 89, paintImageMaskXObjectRepeat: 89,
paintSolidColorImageMask: 90, paintSolidColorImageMask: 90,
constructPath: 91 constructPath: 91,
}; };
var verbosity = VERBOSITY_LEVELS.warnings; var verbosity = VERBOSITY_LEVELS.warnings;
@ -317,7 +317,7 @@ var UNSUPPORTED_FEATURES = {
javaScript: 'javaScript', javaScript: 'javaScript',
smask: 'smask', smask: 'smask',
shadingPattern: 'shadingPattern', shadingPattern: 'shadingPattern',
font: 'font' font: 'font',
}; };
// Checks if URLs have the same origin. For non-HTTP based URLs, returns false. // Checks if URLs have the same origin. For non-HTTP based URLs, returns false.
@ -375,7 +375,7 @@ function shadow(obj, prop, value) {
Object.defineProperty(obj, prop, { value, Object.defineProperty(obj, prop, { value,
enumerable: true, enumerable: true,
configurable: true, configurable: true,
writable: false }); writable: false, });
return value; return value;
} }
@ -393,7 +393,7 @@ function getLookupTableFactory(initializer) {
var PasswordResponses = { var PasswordResponses = {
NEED_PASSWORD: 1, NEED_PASSWORD: 1,
INCORRECT_PASSWORD: 2 INCORRECT_PASSWORD: 2,
}; };
var PasswordException = (function PasswordExceptionClosure() { var PasswordException = (function PasswordExceptionClosure() {
@ -1011,7 +1011,7 @@ var PageViewport = (function PageViewportClosure() {
*/ */
convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) { convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) {
return Util.applyInverseTransform([x, y], this.transform); return Util.applyInverseTransform([x, y], this.transform);
} },
}; };
return PageViewport; return PageViewport;
})(); })();
@ -1154,7 +1154,7 @@ var StatTimer = (function StatTimerClosure() {
this.times.push({ this.times.push({
'name': name, 'name': name,
'start': this.started[name], 'start': this.started[name],
'end': Date.now() 'end': Date.now(),
}); });
// Remove timer from started so it can be called again. // Remove timer from started so it can be called again.
delete this.started[name]; delete this.started[name];
@ -1177,14 +1177,14 @@ var StatTimer = (function StatTimerClosure() {
out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n'; out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n';
} }
return out; return out;
} },
}; };
return StatTimer; return StatTimer;
})(); })();
var createBlob = function createBlob(data, contentType) { var createBlob = function createBlob(data, contentType) {
if (typeof Blob !== 'undefined') { if (typeof Blob !== 'undefined') {
return new Blob([data], { type: contentType }); return new Blob([data], { type: contentType, });
} }
throw new Error('The "Blob" constructor is not supported.'); throw new Error('The "Blob" constructor is not supported.');
}; };
@ -1254,7 +1254,7 @@ function MessageHandler(sourceName, targetName, comObj) {
targetName, targetName,
isReply: true, isReply: true,
callbackId: data.callbackId, callbackId: data.callbackId,
data: result data: result,
}); });
}, function (reason) { }, function (reason) {
if (reason instanceof Error) { if (reason instanceof Error) {
@ -1266,7 +1266,7 @@ function MessageHandler(sourceName, targetName, comObj) {
targetName, targetName,
isReply: true, isReply: true,
callbackId: data.callbackId, callbackId: data.callbackId,
error: reason error: reason,
}); });
}); });
} else { } else {
@ -1344,7 +1344,7 @@ MessageHandler.prototype = {
destroy() { destroy() {
this.comObj.removeEventListener('message', this._onComObjOnMessage); this.comObj.removeEventListener('message', this._onComObjOnMessage);
} },
}; };
function loadJpegStream(id, imageUrl, objs) { function loadJpegStream(id, imageUrl, objs) {