mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Convert var
to const
/let
in the test/unit
folder
This has been done automatically using ESLint's `--fix` argument.
This commit is contained in:
parent
314ac21842
commit
3e2bfb5819
17 changed files with 630 additions and 604 deletions
|
@ -17,26 +17,26 @@ import { AbortException } from "../../src/shared/util.js";
|
|||
import { PDFNetworkStream } from "../../src/display/network.js";
|
||||
|
||||
describe("network", function () {
|
||||
var pdf1 = new URL("../pdfs/tracemonkey.pdf", window.location).href;
|
||||
var pdf1Length = 1016315;
|
||||
const pdf1 = new URL("../pdfs/tracemonkey.pdf", window.location).href;
|
||||
const pdf1Length = 1016315;
|
||||
|
||||
it("read without stream and range", function (done) {
|
||||
var stream = new PDFNetworkStream({
|
||||
const stream = new PDFNetworkStream({
|
||||
url: pdf1,
|
||||
rangeChunkSize: 65536,
|
||||
disableStream: true,
|
||||
disableRange: true,
|
||||
});
|
||||
|
||||
var fullReader = stream.getFullReader();
|
||||
const fullReader = stream.getFullReader();
|
||||
|
||||
var isStreamingSupported, isRangeSupported;
|
||||
var promise = fullReader.headersReady.then(function () {
|
||||
let isStreamingSupported, isRangeSupported;
|
||||
const promise = fullReader.headersReady.then(function () {
|
||||
isStreamingSupported = fullReader.isStreamingSupported;
|
||||
isRangeSupported = fullReader.isRangeSupported;
|
||||
});
|
||||
|
||||
var len = 0,
|
||||
let len = 0,
|
||||
count = 0;
|
||||
var read = function () {
|
||||
return fullReader.read().then(function (result) {
|
||||
|
@ -49,7 +49,7 @@ describe("network", function () {
|
|||
});
|
||||
};
|
||||
|
||||
var readPromise = Promise.all([read(), promise]);
|
||||
const readPromise = Promise.all([read(), promise]);
|
||||
|
||||
readPromise
|
||||
.then(function (page) {
|
||||
|
@ -67,8 +67,8 @@ describe("network", function () {
|
|||
it("read custom ranges", function (done) {
|
||||
// We don't test on browsers that don't support range request, so
|
||||
// requiring this test to pass.
|
||||
var rangeSize = 32768;
|
||||
var stream = new PDFNetworkStream({
|
||||
const rangeSize = 32768;
|
||||
const stream = new PDFNetworkStream({
|
||||
url: pdf1,
|
||||
length: pdf1Length,
|
||||
rangeChunkSize: rangeSize,
|
||||
|
@ -76,10 +76,10 @@ describe("network", function () {
|
|||
disableRange: false,
|
||||
});
|
||||
|
||||
var fullReader = stream.getFullReader();
|
||||
const fullReader = stream.getFullReader();
|
||||
|
||||
var isStreamingSupported, isRangeSupported, fullReaderCancelled;
|
||||
var promise = fullReader.headersReady.then(function () {
|
||||
let isStreamingSupported, isRangeSupported, fullReaderCancelled;
|
||||
const promise = fullReader.headersReady.then(function () {
|
||||
isStreamingSupported = fullReader.isStreamingSupported;
|
||||
isRangeSupported = fullReader.isRangeSupported;
|
||||
// we shall be able to close the full reader without issues
|
||||
|
@ -88,15 +88,18 @@ describe("network", function () {
|
|||
});
|
||||
|
||||
// Skipping fullReader results, requesting something from the PDF end.
|
||||
var tailSize = pdf1Length % rangeSize || rangeSize;
|
||||
const tailSize = pdf1Length % rangeSize || rangeSize;
|
||||
|
||||
var range1Reader = stream.getRangeReader(
|
||||
const range1Reader = stream.getRangeReader(
|
||||
pdf1Length - tailSize - rangeSize,
|
||||
pdf1Length - tailSize
|
||||
);
|
||||
var range2Reader = stream.getRangeReader(pdf1Length - tailSize, pdf1Length);
|
||||
const range2Reader = stream.getRangeReader(
|
||||
pdf1Length - tailSize,
|
||||
pdf1Length
|
||||
);
|
||||
|
||||
var result1 = { value: 0 },
|
||||
const result1 = { value: 0 },
|
||||
result2 = { value: 0 };
|
||||
var read = function (reader, lenResult) {
|
||||
return reader.read().then(function (result) {
|
||||
|
@ -108,7 +111,7 @@ describe("network", function () {
|
|||
});
|
||||
};
|
||||
|
||||
var readPromises = Promise.all([
|
||||
const readPromises = Promise.all([
|
||||
read(range1Reader, result1),
|
||||
read(range2Reader, result2),
|
||||
promise,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue