Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Nuke any non-webdriver scripts for now. Regular WPT
// scripts would have been pre-processed when the task was
// initially parsed.
script = undefined;
}
url = url.trim();
if (!((/^https?:\/\//i).test(url))) {
url = 'http://' + url;
}
} catch (e) {
job.testError = e.message;
this.abortJob_(job);
return;
}
logger.info('%s run %d%s/%d of job %s',
(job.retryError ? 'Retrying' : 'Starting'), job.runNumber,
(job.isFirstViewOnly ? '' : (job.isCacheWarm ? 'b' : 'a')),
job.runs, job.id);
if (this.wdServer_ && !job.isCacheWarm) {
if (!job.retryError) {
throw new Error('Internal error: unclean non-retry first view');
}
logger.debug('Cleaning before repeat first-view');
this.scheduleCleanup_(job, /*isEndOfJob=*/false);
}
this.scheduleCleanRunTempDir_();
if (this.isTrafficShaping_(job)) {
this.startTrafficShaper_(job); // Start shaping.
} else {
var pid = process.pid;
var pi; // Declare outside the loop, to avoid a jshint warning
while (pid) {
pi = undefined;
for (var i = 0; i < processInfos.length; ++i) {
if (processInfos[i].pid === pid) {
pi = processInfos.splice(i, 1)[0];
logger.debug('Not killing user %s pid=%s: %s %s', process.env.USER,
pid, pi.command, pi.args.join(' '));
break;
}
}
pid = (pi ? pi.ppid : undefined);
}
if (processInfos.length > 0) {
logger.info('Killing %s pids owned by user %s: %s', processInfos.length,
process.env.USER,
processInfos.map(function(pi) { return pi.pid; }).join(', '));
process_utils.scheduleKillAll(
this.app_, 'Kill dangling pids', processInfos);
}
}.bind(this), function(e) {
logger.error('Unable to killall pids: ' + e.message);
proc.on('exit', function(code, signal) {
logger.info(name + ' EXIT code %s signal %s', code, signal);
this.childProcess_ = undefined;
this.onChildProcessExit();
}.bind(this));
}.bind(this));
serverProcess.on('exit', function(code, signal) {
if (code === 0) {
logger.info('devtools2har exit code %d, signal %s', code, signal);
callback();
} else {
var e = new Error(
'devtools2har failed, exit code ' + code + ', signal ' + signal);
logger.error(e);
callback(e);
}
});
serverProcess.stdout.on('data', function(data) {
this.proxyProcess_.on('exit', function(code, signal) {
logger.info('Proxy EXIT code %s signal %s', code, signal);
this.proxyProcess_ = undefined;
this.devToolsUrl_ = undefined;
}.bind(this));
}.bind(this));