Socket
Socket
Sign inDemoInstall

selenium-standalone

Package Overview
Dependencies
Maintainers
10
Versions
169
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

selenium-standalone - npm Package Compare versions

Comparing version 9.2.0 to 9.2.1

2

lib/default-config.js

@@ -30,3 +30,3 @@ module.exports = () => {

version: 'latest',
fallbackVersion: '96.0.1054.34',
fallbackVersion: '117.0.2045.55',
arch: process.arch,

@@ -33,0 +33,0 @@ onlyDriverArgs: [],

@@ -9,5 +9,5 @@ const tarStream = require('tar-stream');

const got = require('got');
const merge = require('lodash.merge');
const debug = require('debug')('selenium-standalone:install');
const { logError } = require('./log-error');
const md5 = require('md5');

@@ -83,26 +83,17 @@ const installers = ['selenium', 'chrome', 'ie', 'firefox', 'edge', 'chromiumedge'];

async function isUpToDate(url, requestOpts, etag) {
if (!etag) {
async function isUpToDate(url, file, pathToFile) {
if (!file) {
return false;
}
const options = merge({}, requestOpts, {
headers: {
'If-None-Match': etag,
},
timeout: 2500,
});
try {
const response = await got(url, options);
return response.statusCode === 304;
} catch (err) {
if (err.response && err.response.statusCode === 304) {
const response = await got.head(url, {
timeout: 2500,
});
if (response.headers['content-length'] === `${fs.statSync(pathToFile).size}`) {
return true;
}
logError(
`Could not request headers from ${url}: ` +
(err.response ? err.response.statusCode : err.message) +
', continue without checking for latest version.'
);
return true;
return response.headers.etag.includes(md5(file).toString());
} catch (err) {
logError(`Remote file size/hash in ${url} don't match with local file ${pathToFile}`);
return false;
}

@@ -109,0 +100,0 @@ }

@@ -124,10 +124,12 @@ /* eslint-disable no-shadow */

async function onlyInstallMissingFiles(opts) {
let etag;
let file;
try {
etag = await readFile(`${opts.to}.etag`);
file = await readFile(opts.to);
} catch (err) {
// ENOENT means not found which is ok. But anything else re-raise
if (err.code != 'ENOENT') throw err;
if (err.code != 'ENOENT') {
throw err;
}
}
const isLatest = await isUpToDate(opts.from, requestOpts, etag);
const isLatest = await isUpToDate(opts.from, file, opts.to);

@@ -134,0 +136,0 @@ // File already exists. Prevent download/installation.

{
"name": "selenium-standalone",
"version": "9.2.0",
"version": "9.2.1",
"description": "installs a `selenium-standalone` command line to install and start a standalone selenium server",

@@ -53,2 +53,3 @@ "main": "index.js",

"lodash.merge": "^4.6.2",
"md5": "^2.3.0",
"minimist": "^1.2.5",

@@ -55,0 +56,0 @@ "mkdirp": "^2.1.3",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc