Fixes lint warning W004 in /test
This commit is contained in:
parent
b348243866
commit
7a2cb7cddd
@ -28,19 +28,20 @@ function downloadFile(file, url, callback, redirects) {
|
|||||||
var completed = false;
|
var completed = false;
|
||||||
var protocol = /^https:\/\//.test(url) ? https : http;
|
var protocol = /^https:\/\//.test(url) ? https : http;
|
||||||
protocol.get(url, function (response) {
|
protocol.get(url, function (response) {
|
||||||
|
var redirectTo;
|
||||||
if (response.statusCode === 301 || response.statusCode === 302 ||
|
if (response.statusCode === 301 || response.statusCode === 302 ||
|
||||||
response.statusCode === 307 || response.statusCode === 308) {
|
response.statusCode === 307 || response.statusCode === 308) {
|
||||||
if (redirects > 10) {
|
if (redirects > 10) {
|
||||||
callback('Too many redirects');
|
callback('Too many redirects');
|
||||||
}
|
}
|
||||||
var redirectTo = response.headers.location;
|
redirectTo = response.headers.location;
|
||||||
redirectTo = require('url').resolve(url, redirectTo);
|
redirectTo = require('url').resolve(url, redirectTo);
|
||||||
downloadFile(file, redirectTo, callback, (redirects || 0) + 1);
|
downloadFile(file, redirectTo, callback, (redirects || 0) + 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (response.statusCode === 404 && url.indexOf('web.archive.org') < 0) {
|
if (response.statusCode === 404 && url.indexOf('web.archive.org') < 0) {
|
||||||
// trying waybackmachine
|
// trying waybackmachine
|
||||||
var redirectTo = 'http://web.archive.org/web/' + url;
|
redirectTo = 'http://web.archive.org/web/' + url;
|
||||||
downloadFile(file, redirectTo, callback, (redirects || 0) + 1);
|
downloadFile(file, redirectTo, callback, (redirects || 0) + 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -438,10 +438,11 @@ function refTestPostHandler(req, res) {
|
|||||||
res.writeHead(200, {'Content-Type': 'text/plain'});
|
res.writeHead(200, {'Content-Type': 'text/plain'});
|
||||||
res.end();
|
res.end();
|
||||||
|
|
||||||
|
var session;
|
||||||
if (pathname === '/tellMeToQuit') {
|
if (pathname === '/tellMeToQuit') {
|
||||||
// finding by path
|
// finding by path
|
||||||
var browserPath = parsedUrl.query.path;
|
var browserPath = parsedUrl.query.path;
|
||||||
var session = sessions.filter(function (session) {
|
session = sessions.filter(function (session) {
|
||||||
return session.config.path === browserPath;
|
return session.config.path === browserPath;
|
||||||
})[0];
|
})[0];
|
||||||
monitorBrowserTimeout(session, null);
|
monitorBrowserTimeout(session, null);
|
||||||
@ -463,7 +464,7 @@ function refTestPostHandler(req, res) {
|
|||||||
var snapshot = data.snapshot;
|
var snapshot = data.snapshot;
|
||||||
var lastPageNum = data.lastPageNum;
|
var lastPageNum = data.lastPageNum;
|
||||||
|
|
||||||
var session = getSession(browser);
|
session = getSession(browser);
|
||||||
monitorBrowserTimeout(session, handleSessionTimeout);
|
monitorBrowserTimeout(session, handleSessionTimeout);
|
||||||
|
|
||||||
var taskResults = session.taskResults[id];
|
var taskResults = session.taskResults[id];
|
||||||
@ -720,4 +721,4 @@ var host = '127.0.0.1';
|
|||||||
var options = parseOptions();
|
var options = parseOptions();
|
||||||
var stats;
|
var stats;
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
@ -75,14 +75,15 @@ var stdinBuffer = '', endOfStdin = false, stdinInitialized = false;
|
|||||||
var stdinOnLineCallbacks = [];
|
var stdinOnLineCallbacks = [];
|
||||||
|
|
||||||
function handleStdinBuffer() {
|
function handleStdinBuffer() {
|
||||||
|
var callback;
|
||||||
if (endOfStdin) {
|
if (endOfStdin) {
|
||||||
if (stdinBuffer && stdinOnLineCallbacks.length > 0) {
|
if (stdinBuffer && stdinOnLineCallbacks.length > 0) {
|
||||||
var callback = stdinOnLineCallbacks.shift();
|
callback = stdinOnLineCallbacks.shift();
|
||||||
callback(stdinBuffer);
|
callback(stdinBuffer);
|
||||||
stdinBuffer = null;
|
stdinBuffer = null;
|
||||||
}
|
}
|
||||||
while (stdinOnLineCallbacks.length > 0) {
|
while (stdinOnLineCallbacks.length > 0) {
|
||||||
var callback = stdinOnLineCallbacks.shift();
|
callback = stdinOnLineCallbacks.shift();
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -92,7 +93,7 @@ function handleStdinBuffer() {
|
|||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var callback = stdinOnLineCallbacks.shift();
|
callback = stdinOnLineCallbacks.shift();
|
||||||
var result = stdinBuffer.substring(0, i + 1);
|
var result = stdinBuffer.substring(0, i + 1);
|
||||||
stdinBuffer = stdinBuffer.substring(i + 1);
|
stdinBuffer = stdinBuffer.substring(i + 1);
|
||||||
callback(result);
|
callback(result);
|
||||||
@ -143,4 +144,4 @@ exports.confirm = function confirm(message, callback) {
|
|||||||
confirm(message, callback);
|
confirm(message, callback);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -196,7 +196,7 @@ describe('font', function() {
|
|||||||
expect(charset.charset[1]).toEqual('exclam');
|
expect(charset.charset[1]).toEqual('exclam');
|
||||||
|
|
||||||
// CID font
|
// CID font
|
||||||
var charset = parser.parseCharsets(3, 2, new CFFStrings(), true);
|
charset = parser.parseCharsets(3, 2, new CFFStrings(), true);
|
||||||
expect(charset.charset[1]).toEqual(2);
|
expect(charset.charset[1]).toEqual(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ describe('font', function() {
|
|||||||
expect(charset.charset).toEqual(['.notdef', 'quoteright', 'parenleft']);
|
expect(charset.charset).toEqual(['.notdef', 'quoteright', 'parenleft']);
|
||||||
|
|
||||||
// CID font
|
// CID font
|
||||||
var charset = parser.parseCharsets(3, 2, new CFFStrings(), true);
|
charset = parser.parseCharsets(3, 2, new CFFStrings(), true);
|
||||||
expect(charset.charset).toEqual(['.notdef', 8, 9]);
|
expect(charset.charset).toEqual(['.notdef', 8, 9]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ describe('font', function() {
|
|||||||
expect(charset.charset).toEqual(['.notdef', 'quoteright', 'parenleft']);
|
expect(charset.charset).toEqual(['.notdef', 'quoteright', 'parenleft']);
|
||||||
|
|
||||||
// CID font
|
// CID font
|
||||||
var charset = parser.parseCharsets(3, 2, new CFFStrings(), true);
|
charset = parser.parseCharsets(3, 2, new CFFStrings(), true);
|
||||||
expect(charset.charset).toEqual(['.notdef', 8, 9]);
|
expect(charset.charset).toEqual(['.notdef', 8, 9]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -349,7 +349,7 @@ describe('font', function() {
|
|||||||
var parser = new Type1Parser(stream);
|
var parser = new Type1Parser(stream);
|
||||||
expect(parser.readNumberArray()).toEqual([1, 2]);
|
expect(parser.readNumberArray()).toEqual([1, 2]);
|
||||||
// Variation on spacing.
|
// Variation on spacing.
|
||||||
var stream = new StringStream('[ 1 2 ]');
|
stream = new StringStream('[ 1 2 ]');
|
||||||
parser = new Type1Parser(stream);
|
parser = new Type1Parser(stream);
|
||||||
expect(parser.readNumberArray()).toEqual([1, 2]);
|
expect(parser.readNumberArray()).toEqual([1, 2]);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user