Enable ESLint rules that no longer need to be disabled on a directory/file-basis
Given that browsers/environments without native support for both arrow functions and object shorthand properties are no longer supported in PDF.js, please refer to the compatibility information below, we can now enable a fair number of ESLint rules and also simplify/remove some `.eslintrc` files. With the exception of the `no-alert` cases, all code changes were made automatically by using `gulp lint --fix`. - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions#browser_compatibility - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#browser_compatibility
This commit is contained in:
parent
2cba290361
commit
4db7330677
@ -3,23 +3,9 @@
|
|||||||
"../.eslintrc"
|
"../.eslintrc"
|
||||||
],
|
],
|
||||||
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 6,
|
|
||||||
},
|
|
||||||
|
|
||||||
"env": {
|
|
||||||
"es6": false,
|
|
||||||
},
|
|
||||||
|
|
||||||
"globals": {
|
"globals": {
|
||||||
"pdfjsImageDecoders": false,
|
"pdfjsImageDecoders": false,
|
||||||
"pdfjsLib": false,
|
"pdfjsLib": false,
|
||||||
"pdfjsViewer": false,
|
"pdfjsViewer": false,
|
||||||
"Uint8Array": false,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"rules": {
|
|
||||||
"no-alert": "off",
|
|
||||||
"object-shorthand": ["error", "never"]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -37,11 +37,11 @@ loadingTask.promise.then(function (doc) {
|
|||||||
return doc.getPage(pageNum).then(function (pdfPage) {
|
return doc.getPage(pageNum).then(function (pdfPage) {
|
||||||
// Create the page view.
|
// Create the page view.
|
||||||
var pdfPageView = new pdfjsViewer.PDFPageView({
|
var pdfPageView = new pdfjsViewer.PDFPageView({
|
||||||
container: container,
|
container,
|
||||||
id: pageNum,
|
id: pageNum,
|
||||||
scale: DEFAULT_SCALE,
|
scale: DEFAULT_SCALE,
|
||||||
defaultViewport: pdfPage.getViewport({ scale: DEFAULT_SCALE }),
|
defaultViewport: pdfPage.getViewport({ scale: DEFAULT_SCALE }),
|
||||||
eventBus: eventBus,
|
eventBus,
|
||||||
annotationLayerFactory: new pdfjsViewer.DefaultAnnotationLayerFactory(),
|
annotationLayerFactory: new pdfjsViewer.DefaultAnnotationLayerFactory(),
|
||||||
renderInteractiveForms: true,
|
renderInteractiveForms: true,
|
||||||
});
|
});
|
||||||
|
@ -25,7 +25,7 @@ loadingTask.promise
|
|||||||
var ctx = canvas.getContext("2d");
|
var ctx = canvas.getContext("2d");
|
||||||
var renderTask = pdfPage.render({
|
var renderTask = pdfPage.render({
|
||||||
canvasContext: ctx,
|
canvasContext: ctx,
|
||||||
viewport: viewport,
|
viewport,
|
||||||
});
|
});
|
||||||
return renderTask.promise;
|
return renderTask.promise;
|
||||||
});
|
});
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
if (!pdfjsLib.getDocument || !pdfjsViewer.PDFPageView) {
|
if (!pdfjsLib.getDocument || !pdfjsViewer.PDFPageView) {
|
||||||
|
// eslint-disable-next-line no-alert
|
||||||
alert("Please build the pdfjs-dist library using\n `gulp dist-install`");
|
alert("Please build the pdfjs-dist library using\n `gulp dist-install`");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,11 +49,11 @@ loadingTask.promise.then(function (pdfDocument) {
|
|||||||
return pdfDocument.getPage(PAGE_TO_VIEW).then(function (pdfPage) {
|
return pdfDocument.getPage(PAGE_TO_VIEW).then(function (pdfPage) {
|
||||||
// Creating the page view with default parameters.
|
// Creating the page view with default parameters.
|
||||||
var pdfPageView = new pdfjsViewer.PDFPageView({
|
var pdfPageView = new pdfjsViewer.PDFPageView({
|
||||||
container: container,
|
container,
|
||||||
id: PAGE_TO_VIEW,
|
id: PAGE_TO_VIEW,
|
||||||
scale: SCALE,
|
scale: SCALE,
|
||||||
defaultViewport: pdfPage.getViewport({ scale: SCALE }),
|
defaultViewport: pdfPage.getViewport({ scale: SCALE }),
|
||||||
eventBus: eventBus,
|
eventBus,
|
||||||
// We can enable text/annotations layers, if needed
|
// We can enable text/annotations layers, if needed
|
||||||
textLayerFactory: new pdfjsViewer.DefaultTextLayerFactory(),
|
textLayerFactory: new pdfjsViewer.DefaultTextLayerFactory(),
|
||||||
annotationLayerFactory: new pdfjsViewer.DefaultAnnotationLayerFactory(),
|
annotationLayerFactory: new pdfjsViewer.DefaultAnnotationLayerFactory(),
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
if (!pdfjsLib.getDocument || !pdfjsViewer.PDFViewer) {
|
if (!pdfjsLib.getDocument || !pdfjsViewer.PDFViewer) {
|
||||||
|
// eslint-disable-next-line no-alert
|
||||||
alert("Please build the pdfjs-dist library using\n `gulp dist-install`");
|
alert("Please build the pdfjs-dist library using\n `gulp dist-install`");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,18 +39,18 @@ var eventBus = new pdfjsViewer.EventBus();
|
|||||||
|
|
||||||
// (Optionally) enable hyperlinks within PDF files.
|
// (Optionally) enable hyperlinks within PDF files.
|
||||||
var pdfLinkService = new pdfjsViewer.PDFLinkService({
|
var pdfLinkService = new pdfjsViewer.PDFLinkService({
|
||||||
eventBus: eventBus,
|
eventBus,
|
||||||
});
|
});
|
||||||
|
|
||||||
// (Optionally) enable find controller.
|
// (Optionally) enable find controller.
|
||||||
var pdfFindController = new pdfjsViewer.PDFFindController({
|
var pdfFindController = new pdfjsViewer.PDFFindController({
|
||||||
eventBus: eventBus,
|
eventBus,
|
||||||
linkService: pdfLinkService,
|
linkService: pdfLinkService,
|
||||||
});
|
});
|
||||||
|
|
||||||
var pdfViewer = new pdfjsViewer.PDFViewer({
|
var pdfViewer = new pdfjsViewer.PDFViewer({
|
||||||
container: container,
|
container,
|
||||||
eventBus: eventBus,
|
eventBus,
|
||||||
linkService: pdfLinkService,
|
linkService: pdfLinkService,
|
||||||
findController: pdfFindController,
|
findController: pdfFindController,
|
||||||
});
|
});
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
if (!pdfjsLib.getDocument || !pdfjsViewer.PDFSinglePageViewer) {
|
if (!pdfjsLib.getDocument || !pdfjsViewer.PDFSinglePageViewer) {
|
||||||
|
// eslint-disable-next-line no-alert
|
||||||
alert("Please build the pdfjs-dist library using\n `gulp dist-install`");
|
alert("Please build the pdfjs-dist library using\n `gulp dist-install`");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,18 +39,18 @@ var eventBus = new pdfjsViewer.EventBus();
|
|||||||
|
|
||||||
// (Optionally) enable hyperlinks within PDF files.
|
// (Optionally) enable hyperlinks within PDF files.
|
||||||
var pdfLinkService = new pdfjsViewer.PDFLinkService({
|
var pdfLinkService = new pdfjsViewer.PDFLinkService({
|
||||||
eventBus: eventBus,
|
eventBus,
|
||||||
});
|
});
|
||||||
|
|
||||||
// (Optionally) enable find controller.
|
// (Optionally) enable find controller.
|
||||||
var pdfFindController = new pdfjsViewer.PDFFindController({
|
var pdfFindController = new pdfjsViewer.PDFFindController({
|
||||||
eventBus: eventBus,
|
eventBus,
|
||||||
linkService: pdfLinkService,
|
linkService: pdfLinkService,
|
||||||
});
|
});
|
||||||
|
|
||||||
var pdfSinglePageViewer = new pdfjsViewer.PDFSinglePageViewer({
|
var pdfSinglePageViewer = new pdfjsViewer.PDFSinglePageViewer({
|
||||||
container: container,
|
container,
|
||||||
eventBus: eventBus,
|
eventBus,
|
||||||
linkService: pdfLinkService,
|
linkService: pdfLinkService,
|
||||||
findController: pdfFindController,
|
findController: pdfFindController,
|
||||||
});
|
});
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
if (!pdfjsImageDecoders.JpegImage) {
|
if (!pdfjsImageDecoders.JpegImage) {
|
||||||
|
// eslint-disable-next-line no-alert
|
||||||
alert("Please build the pdfjs-dist library using `gulp dist-install`");
|
alert("Please build the pdfjs-dist library using `gulp dist-install`");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,8 +62,8 @@ jpegImage.parse(typedArrayImage);
|
|||||||
var width = jpegImage.width,
|
var width = jpegImage.width,
|
||||||
height = jpegImage.height;
|
height = jpegImage.height;
|
||||||
var jpegData = jpegImage.getData({
|
var jpegData = jpegImage.getData({
|
||||||
width: width,
|
width,
|
||||||
height: height,
|
height,
|
||||||
forceRGB: true,
|
forceRGB: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
if (!pdfjsLib.getDocument || !pdfjsViewer.PDFViewer) {
|
if (!pdfjsLib.getDocument || !pdfjsViewer.PDFViewer) {
|
||||||
|
// eslint-disable-next-line no-alert
|
||||||
alert("Please build the pdfjs-dist library using\n `gulp dist-install`");
|
alert("Please build the pdfjs-dist library using\n `gulp dist-install`");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ var PDFViewerApplication = {
|
|||||||
* @returns {Promise} - Returns the promise, which is resolved when document
|
* @returns {Promise} - Returns the promise, which is resolved when document
|
||||||
* is opened.
|
* is opened.
|
||||||
*/
|
*/
|
||||||
open: function (params) {
|
open(params) {
|
||||||
if (this.pdfLoadingTask) {
|
if (this.pdfLoadingTask) {
|
||||||
// We need to destroy already opened document
|
// We need to destroy already opened document
|
||||||
return this.close().then(
|
return this.close().then(
|
||||||
@ -64,7 +65,7 @@ var PDFViewerApplication = {
|
|||||||
|
|
||||||
// Loading document.
|
// Loading document.
|
||||||
var loadingTask = pdfjsLib.getDocument({
|
var loadingTask = pdfjsLib.getDocument({
|
||||||
url: url,
|
url,
|
||||||
maxImageSize: MAX_IMAGE_SIZE,
|
maxImageSize: MAX_IMAGE_SIZE,
|
||||||
cMapUrl: CMAP_URL,
|
cMapUrl: CMAP_URL,
|
||||||
cMapPacked: CMAP_PACKED,
|
cMapPacked: CMAP_PACKED,
|
||||||
@ -120,7 +121,7 @@ var PDFViewerApplication = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadingErrorMessage.then(function (msg) {
|
loadingErrorMessage.then(function (msg) {
|
||||||
self.error(msg, { message: message });
|
self.error(msg, { message });
|
||||||
});
|
});
|
||||||
self.loadingBar.hide();
|
self.loadingBar.hide();
|
||||||
}
|
}
|
||||||
@ -132,7 +133,7 @@ var PDFViewerApplication = {
|
|||||||
* @returns {Promise} - Returns the promise, which is resolved when all
|
* @returns {Promise} - Returns the promise, which is resolved when all
|
||||||
* destruction is completed.
|
* destruction is completed.
|
||||||
*/
|
*/
|
||||||
close: function () {
|
close() {
|
||||||
var errorWrapper = document.getElementById("errorWrapper");
|
var errorWrapper = document.getElementById("errorWrapper");
|
||||||
errorWrapper.setAttribute("hidden", "true");
|
errorWrapper.setAttribute("hidden", "true");
|
||||||
|
|
||||||
@ -175,7 +176,7 @@ var PDFViewerApplication = {
|
|||||||
this.setTitle(title);
|
this.setTitle(title);
|
||||||
},
|
},
|
||||||
|
|
||||||
setTitleUsingMetadata: function (pdfDocument) {
|
setTitleUsingMetadata(pdfDocument) {
|
||||||
var self = this;
|
var self = this;
|
||||||
pdfDocument.getMetadata().then(function (data) {
|
pdfDocument.getMetadata().then(function (data) {
|
||||||
var info = data.info,
|
var info = data.info,
|
||||||
@ -345,7 +346,7 @@ var PDFViewerApplication = {
|
|||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
|
||||||
var linkService = new pdfjsViewer.PDFLinkService({
|
var linkService = new pdfjsViewer.PDFLinkService({
|
||||||
eventBus: eventBus,
|
eventBus,
|
||||||
});
|
});
|
||||||
this.pdfLinkService = linkService;
|
this.pdfLinkService = linkService;
|
||||||
|
|
||||||
@ -353,9 +354,9 @@ var PDFViewerApplication = {
|
|||||||
|
|
||||||
var container = document.getElementById("viewerContainer");
|
var container = document.getElementById("viewerContainer");
|
||||||
var pdfViewer = new pdfjsViewer.PDFViewer({
|
var pdfViewer = new pdfjsViewer.PDFViewer({
|
||||||
container: container,
|
container,
|
||||||
eventBus: eventBus,
|
eventBus,
|
||||||
linkService: linkService,
|
linkService,
|
||||||
l10n: this.l10n,
|
l10n: this.l10n,
|
||||||
useOnlyCssZoom: USE_ONLY_CSS_ZOOM,
|
useOnlyCssZoom: USE_ONLY_CSS_ZOOM,
|
||||||
textLayerMode: TEXT_LAYER_MODE,
|
textLayerMode: TEXT_LAYER_MODE,
|
||||||
@ -364,8 +365,8 @@ var PDFViewerApplication = {
|
|||||||
linkService.setViewer(pdfViewer);
|
linkService.setViewer(pdfViewer);
|
||||||
|
|
||||||
this.pdfHistory = new pdfjsViewer.PDFHistory({
|
this.pdfHistory = new pdfjsViewer.PDFHistory({
|
||||||
eventBus: eventBus,
|
eventBus,
|
||||||
linkService: linkService,
|
linkService,
|
||||||
});
|
});
|
||||||
linkService.setHistory(this.pdfHistory);
|
linkService.setHistory(this.pdfHistory);
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ function DOMElement(name) {
|
|||||||
if (name === "style") {
|
if (name === "style") {
|
||||||
this.sheet = {
|
this.sheet = {
|
||||||
cssRules: [],
|
cssRules: [],
|
||||||
insertRule: function (rule) {
|
insertRule(rule) {
|
||||||
this.cssRules.push(rule);
|
this.cssRules.push(rule);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -226,16 +226,16 @@ const document = {
|
|||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
createElementNS: function (NS, element) {
|
createElementNS(NS, element) {
|
||||||
var elObject = new DOMElement(element);
|
var elObject = new DOMElement(element);
|
||||||
return elObject;
|
return elObject;
|
||||||
},
|
},
|
||||||
|
|
||||||
createElement: function (element) {
|
createElement(element) {
|
||||||
return this.createElementNS("", element);
|
return this.createElementNS("", element);
|
||||||
},
|
},
|
||||||
|
|
||||||
getElementsByTagName: function (element) {
|
getElementsByTagName(element) {
|
||||||
if (element === "head") {
|
if (element === "head") {
|
||||||
return [this.head || (this.head = new DOMElement("head"))];
|
return [this.head || (this.head = new DOMElement("head"))];
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,8 @@ NodeCanvasFactory.prototype = {
|
|||||||
var canvas = Canvas.createCanvas(width, height);
|
var canvas = Canvas.createCanvas(width, height);
|
||||||
var context = canvas.getContext("2d");
|
var context = canvas.getContext("2d");
|
||||||
return {
|
return {
|
||||||
canvas: canvas,
|
canvas,
|
||||||
context: context,
|
context,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ var data = new Uint8Array(fs.readFileSync(pdfPath));
|
|||||||
|
|
||||||
// Load the PDF file.
|
// Load the PDF file.
|
||||||
var loadingTask = pdfjsLib.getDocument({
|
var loadingTask = pdfjsLib.getDocument({
|
||||||
data: data,
|
data,
|
||||||
cMapUrl: CMAP_URL,
|
cMapUrl: CMAP_URL,
|
||||||
cMapPacked: CMAP_PACKED,
|
cMapPacked: CMAP_PACKED,
|
||||||
});
|
});
|
||||||
@ -80,8 +80,8 @@ loadingTask.promise
|
|||||||
);
|
);
|
||||||
var renderContext = {
|
var renderContext = {
|
||||||
canvasContext: canvasAndContext.context,
|
canvasContext: canvasAndContext.context,
|
||||||
viewport: viewport,
|
viewport,
|
||||||
canvasFactory: canvasFactory,
|
canvasFactory,
|
||||||
};
|
};
|
||||||
|
|
||||||
var renderTask = page.render(renderContext);
|
var renderTask = page.render(renderContext);
|
||||||
|
@ -71,7 +71,7 @@ ReadableSVGStream.prototype._read = function () {
|
|||||||
// Streams the SVG element to the given file path.
|
// Streams the SVG element to the given file path.
|
||||||
function writeSvgToFile(svgElement, filePath) {
|
function writeSvgToFile(svgElement, filePath) {
|
||||||
var readableSvgStream = new ReadableSVGStream({
|
var readableSvgStream = new ReadableSVGStream({
|
||||||
svgElement: svgElement,
|
svgElement,
|
||||||
});
|
});
|
||||||
var writableStream = fs.createWriteStream(filePath);
|
var writableStream = fs.createWriteStream(filePath);
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
@ -89,7 +89,7 @@ function writeSvgToFile(svgElement, filePath) {
|
|||||||
// Will be using promises to load document, pages and misc data instead of
|
// Will be using promises to load document, pages and misc data instead of
|
||||||
// callback.
|
// callback.
|
||||||
var loadingTask = pdfjsLib.getDocument({
|
var loadingTask = pdfjsLib.getDocument({
|
||||||
data: data,
|
data,
|
||||||
cMapUrl: CMAP_URL,
|
cMapUrl: CMAP_URL,
|
||||||
cMapPacked: CMAP_PACKED,
|
cMapPacked: CMAP_PACKED,
|
||||||
fontExtraProperties: true,
|
fontExtraProperties: true,
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
if (!pdfjsLib.getDocument || !pdfjsViewer.PDFViewer) {
|
if (!pdfjsLib.getDocument || !pdfjsViewer.PDFViewer) {
|
||||||
|
// eslint-disable-next-line no-alert
|
||||||
alert("Please build the pdfjs-dist library using\n `gulp dist-install`");
|
alert("Please build the pdfjs-dist library using\n `gulp dist-install`");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,12 +38,12 @@ var eventBus = new pdfjsViewer.EventBus();
|
|||||||
|
|
||||||
// (Optionally) enable hyperlinks within PDF files.
|
// (Optionally) enable hyperlinks within PDF files.
|
||||||
var pdfLinkService = new pdfjsViewer.PDFLinkService({
|
var pdfLinkService = new pdfjsViewer.PDFLinkService({
|
||||||
eventBus: eventBus,
|
eventBus,
|
||||||
});
|
});
|
||||||
|
|
||||||
var pdfViewer = new pdfjsViewer.PDFViewer({
|
var pdfViewer = new pdfjsViewer.PDFViewer({
|
||||||
container: container,
|
container,
|
||||||
eventBus: eventBus,
|
eventBus,
|
||||||
linkService: pdfLinkService,
|
linkService: pdfLinkService,
|
||||||
renderer: "svg",
|
renderer: "svg",
|
||||||
textLayerMode: 0,
|
textLayerMode: 0,
|
||||||
|
@ -65,10 +65,8 @@ function pageLoaded() {
|
|||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
if (typeof pdfjsLib === "undefined") {
|
if (typeof pdfjsLib === "undefined") {
|
||||||
alert(
|
// eslint-disable-next-line no-alert
|
||||||
"Built version of PDF.js was not found.\n" +
|
alert("Please build the pdfjs-dist library using\n `gulp dist-install`");
|
||||||
"Please run `gulp dist-install`."
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pageLoaded();
|
pageLoaded();
|
||||||
|
@ -25,7 +25,7 @@ loadingTask.promise
|
|||||||
var ctx = canvas.getContext("2d");
|
var ctx = canvas.getContext("2d");
|
||||||
var renderTask = pdfPage.render({
|
var renderTask = pdfPage.render({
|
||||||
canvasContext: ctx,
|
canvasContext: ctx,
|
||||||
viewport: viewport,
|
viewport,
|
||||||
});
|
});
|
||||||
return renderTask.promise;
|
return renderTask.promise;
|
||||||
});
|
});
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": [
|
|
||||||
../.eslintrc
|
|
||||||
],
|
|
||||||
|
|
||||||
"rules": {
|
|
||||||
"no-restricted-globals": "off",
|
|
||||||
},
|
|
||||||
}
|
|
6
external/.eslintrc
vendored
6
external/.eslintrc
vendored
@ -6,10 +6,4 @@
|
|||||||
"env": {
|
"env": {
|
||||||
"node": true,
|
"node": true,
|
||||||
},
|
},
|
||||||
|
|
||||||
"rules": {
|
|
||||||
"mozilla/use-includes-instead-of-indexOf": "off",
|
|
||||||
"object-shorthand": "off",
|
|
||||||
"no-restricted-globals": "off",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
8
external/builder/preprocessor2.js
vendored
8
external/builder/preprocessor2.js
vendored
@ -35,7 +35,7 @@ function handlePreprocessorAction(ctx, actionName, args, loc) {
|
|||||||
throw new Error("No code for testing is given");
|
throw new Error("No code for testing is given");
|
||||||
}
|
}
|
||||||
var isTrue = !!evalWithDefines(arg.value, ctx.defines);
|
var isTrue = !!evalWithDefines(arg.value, ctx.defines);
|
||||||
return { type: "Literal", value: isTrue, loc: loc };
|
return { type: "Literal", value: isTrue, loc };
|
||||||
case "eval":
|
case "eval":
|
||||||
arg = args[0];
|
arg = args[0];
|
||||||
if (!arg || arg.type !== "Literal" || typeof arg.value !== "string") {
|
if (!arg || arg.type !== "Literal" || typeof arg.value !== "string") {
|
||||||
@ -47,7 +47,7 @@ function handlePreprocessorAction(ctx, actionName, args, loc) {
|
|||||||
typeof result === "string" ||
|
typeof result === "string" ||
|
||||||
typeof result === "number"
|
typeof result === "number"
|
||||||
) {
|
) {
|
||||||
return { type: "Literal", value: result, loc: loc };
|
return { type: "Literal", value: result, loc };
|
||||||
}
|
}
|
||||||
if (typeof result === "object") {
|
if (typeof result === "object") {
|
||||||
const parsedObj = acorn.parse("(" + JSON.stringify(result) + ")", {
|
const parsedObj = acorn.parse("(" + JSON.stringify(result) + ")", {
|
||||||
@ -333,8 +333,8 @@ function preprocessPDFJSCode(ctx, code) {
|
|||||||
sourceType: "module",
|
sourceType: "module",
|
||||||
};
|
};
|
||||||
var codegenOptions = {
|
var codegenOptions = {
|
||||||
format: format,
|
format,
|
||||||
parse: function (input) {
|
parse(input) {
|
||||||
return acorn.parse(input, { ecmaVersion: ACORN_ECMA_VERSION });
|
return acorn.parse(input, { ecmaVersion: ACORN_ECMA_VERSION });
|
||||||
},
|
},
|
||||||
sourceMap: ctx.sourceMap,
|
sourceMap: ctx.sourceMap,
|
||||||
|
4
external/builder/test-fixtures_esprima.js
vendored
4
external/builder/test-fixtures_esprima.js
vendored
@ -34,8 +34,8 @@ files.forEach(function (expectationFilename) {
|
|||||||
"import-alias": "import-name",
|
"import-alias": "import-name",
|
||||||
};
|
};
|
||||||
var ctx = {
|
var ctx = {
|
||||||
defines: defines,
|
defines,
|
||||||
map: map,
|
map,
|
||||||
rootPath: __dirname + "/../..",
|
rootPath: __dirname + "/../..",
|
||||||
};
|
};
|
||||||
var out;
|
var out;
|
||||||
|
8
external/systemjs/plugin-babel-cached.js
vendored
8
external/systemjs/plugin-babel-cached.js
vendored
@ -46,11 +46,11 @@ function storeCache(address, hashCode, translated, format) {
|
|||||||
var tx = db.transaction(dbCacheTable, "readwrite");
|
var tx = db.transaction(dbCacheTable, "readwrite");
|
||||||
var store = tx.objectStore(dbCacheTable);
|
var store = tx.objectStore(dbCacheTable);
|
||||||
store.put({
|
store.put({
|
||||||
address: address,
|
address,
|
||||||
hashCode: hashCode,
|
hashCode,
|
||||||
translated: translated,
|
translated,
|
||||||
expires: Date.now() + cacheExpiration,
|
expires: Date.now() + cacheExpiration,
|
||||||
format: format,
|
format,
|
||||||
});
|
});
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
tx.oncomplete = function () {
|
tx.oncomplete = function () {
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* eslint-env node */
|
/* eslint-env node */
|
||||||
/* eslint-disable object-shorthand */
|
|
||||||
/* globals target */
|
/* globals target */
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -222,7 +221,7 @@ function createWebpackConfig(
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
mode: "none",
|
mode: "none",
|
||||||
output: output,
|
output,
|
||||||
performance: {
|
performance: {
|
||||||
hints: false, // Disable messages about larger file sizes.
|
hints: false, // Disable messages about larger file sizes.
|
||||||
},
|
},
|
||||||
@ -629,7 +628,7 @@ gulp.task("buildnumber", function (done) {
|
|||||||
"version.json",
|
"version.json",
|
||||||
JSON.stringify(
|
JSON.stringify(
|
||||||
{
|
{
|
||||||
version: version,
|
version,
|
||||||
build: buildNumber,
|
build: buildNumber,
|
||||||
commit: buildCommit,
|
commit: buildCommit,
|
||||||
},
|
},
|
||||||
|
@ -7,8 +7,4 @@
|
|||||||
"node": true,
|
"node": true,
|
||||||
"jasmine": true,
|
"jasmine": true,
|
||||||
},
|
},
|
||||||
|
|
||||||
"rules": {
|
|
||||||
"no-restricted-globals": "off",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* eslint-disable object-shorthand */
|
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -110,17 +109,17 @@ function createExtensionGlobal() {
|
|||||||
};
|
};
|
||||||
var headers = {};
|
var headers = {};
|
||||||
return {
|
return {
|
||||||
open: function (method, url) {
|
open(method, url) {
|
||||||
assert.equal(invoked.open, false);
|
assert.equal(invoked.open, false);
|
||||||
invoked.open = true;
|
invoked.open = true;
|
||||||
assert.equal(method, "POST");
|
assert.equal(method, "POST");
|
||||||
assert.equal(url, LOG_URL);
|
assert.equal(url, LOG_URL);
|
||||||
},
|
},
|
||||||
setRequestHeader: function (k, v) {
|
setRequestHeader(k, v) {
|
||||||
assert.equal(invoked.open, true);
|
assert.equal(invoked.open, true);
|
||||||
headers[k] = String(v);
|
headers[k] = String(v);
|
||||||
},
|
},
|
||||||
send: function (body) {
|
send(body) {
|
||||||
assert.equal(invoked.open, true);
|
assert.equal(invoked.open, true);
|
||||||
assert.equal(invoked.send, false);
|
assert.equal(invoked.send, false);
|
||||||
invoked.send = true;
|
invoked.send = true;
|
||||||
@ -138,7 +137,7 @@ function createExtensionGlobal() {
|
|||||||
};
|
};
|
||||||
window.Date = {
|
window.Date = {
|
||||||
test_now_value: Date.now(),
|
test_now_value: Date.now(),
|
||||||
now: function () {
|
now() {
|
||||||
return window.Date.test_now_value;
|
return window.Date.test_now_value;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* eslint-disable object-shorthand */
|
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -133,7 +132,7 @@ function downloadManifestFiles(manifest, callback) {
|
|||||||
var linkfile = file + ".link";
|
var linkfile = file + ".link";
|
||||||
var url = fs.readFileSync(linkfile).toString();
|
var url = fs.readFileSync(linkfile).toString();
|
||||||
url = url.replace(/\s+$/, "");
|
url = url.replace(/\s+$/, "");
|
||||||
return { file: file, url: url };
|
return { file, url };
|
||||||
});
|
});
|
||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
11
test/test.js
11
test/test.js
@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* eslint-disable object-shorthand */
|
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -646,15 +645,15 @@ function refTestPostHandler(req, res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
taskResults[round][page] = {
|
taskResults[round][page] = {
|
||||||
failure: failure,
|
failure,
|
||||||
snapshot: snapshot,
|
snapshot,
|
||||||
};
|
};
|
||||||
if (stats) {
|
if (stats) {
|
||||||
stats.push({
|
stats.push({
|
||||||
browser: browser,
|
browser,
|
||||||
pdf: id,
|
pdf: id,
|
||||||
page: page,
|
page,
|
||||||
round: round,
|
round,
|
||||||
stats: data.stats,
|
stats: data.stats,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* eslint-disable object-shorthand */
|
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -53,7 +52,7 @@ function WebServer() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
WebServer.prototype = {
|
WebServer.prototype = {
|
||||||
start: function (callback) {
|
start(callback) {
|
||||||
this._ensureNonZeroPort();
|
this._ensureNonZeroPort();
|
||||||
this.server = http.createServer(this._handler.bind(this));
|
this.server = http.createServer(this._handler.bind(this));
|
||||||
this.server.listen(this.port, this.host, callback);
|
this.server.listen(this.port, this.host, callback);
|
||||||
@ -61,11 +60,11 @@ WebServer.prototype = {
|
|||||||
"Server running at http://" + this.host + ":" + this.port + "/"
|
"Server running at http://" + this.host + ":" + this.port + "/"
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
stop: function (callback) {
|
stop(callback) {
|
||||||
this.server.close(callback);
|
this.server.close(callback);
|
||||||
this.server = null;
|
this.server = null;
|
||||||
},
|
},
|
||||||
_ensureNonZeroPort: function () {
|
_ensureNonZeroPort() {
|
||||||
if (!this.port) {
|
if (!this.port) {
|
||||||
// If port is 0, a random port will be chosen instead. Do not set a host
|
// If port is 0, a random port will be chosen instead. Do not set a host
|
||||||
// name to make sure that the port is synchronously set by .listen().
|
// name to make sure that the port is synchronously set by .listen().
|
||||||
@ -78,7 +77,7 @@ WebServer.prototype = {
|
|||||||
server.close();
|
server.close();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_handler: function (req, res) {
|
_handler(req, res) {
|
||||||
var url = req.url.replace(/\/\//g, "/");
|
var url = req.url.replace(/\/\//g, "/");
|
||||||
var urlParts = /([^?]*)((?:\?(.*))?)/.exec(url);
|
var urlParts = /([^?]*)((?:\?(.*))?)/.exec(url);
|
||||||
try {
|
try {
|
||||||
@ -312,7 +311,7 @@ WebServer.prototype = {
|
|||||||
function serveRequestedFileRange(reqFilePath, start, end) {
|
function serveRequestedFileRange(reqFilePath, start, end) {
|
||||||
var stream = fs.createReadStream(reqFilePath, {
|
var stream = fs.createReadStream(reqFilePath, {
|
||||||
flags: "rs",
|
flags: "rs",
|
||||||
start: start,
|
start,
|
||||||
end: end - 1,
|
end: end - 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user