Socket
Socket
Sign inDemoInstall

firefox-profile

Package Overview
Dependencies
53
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.0 to 4.1.0

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 4.1.0
- remove jetpack dependency (thanks to @rpl)
- update deps, thanks to @fregante
# 4.0.0

@@ -2,0 +6,0 @@

5

lib/cli.js

@@ -5,3 +5,2 @@ #!/usr/bin/env node

fs = require('fs'),
_ = require('lodash'),
FirefoxProfile = require('./firefox_profile');

@@ -93,7 +92,7 @@

if (_.isString(extensionPaths)) {
if (typeof extensionPaths === 'string') {
extensionPaths = [extensionPaths];
}
// still not an array? it should be ok to call addExtensions with empty array...
if (!_.isArray(extensionPaths)) {
if (!Array.isArray(extensionPaths)) {
extensionPaths = [];

@@ -100,0 +99,0 @@ }

@@ -8,2 +8,3 @@ /**

path = require('path'),
util = require('util'),
fs = require('fs-extra'),

@@ -15,5 +16,2 @@ // third-party

uuid = require('uuid'),
async = require('async'),
getID = require('jetpack-id'),
_ = require('lodash'),
Finder = require('./profile_finder');

@@ -81,2 +79,33 @@

/**
* Regex taken from XPIProvider.jsm in the Addon Manager to validate proper
* IDs that are able to be used:
* https://searchfox.org/mozilla-central/rev/c8ce16e4299a3afd560320d8d094556f2b5504cd/toolkit/mozapps/extensions/internal/XPIProvider.jsm#182
*/
function isValidAOMAddonId (s) {
return /^(\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\}|[a-z0-9-\._]*\@[a-z0-9-\._]+)$/i.test(s || "");
}
/**
* Return the addon id given the addon manifest file.
*
* TODO: this still includes backward compatibility with the deprecated jetpack
* manifest file, it could be removed in a follow up (along with rewriting some
* of the test cases).
*/
function getID(manifest) {
if (manifest.id) {
return isValidAOMAddonId(manifest.id) ? manifest.id : null;
}
// This is currently used to keep the backward compatible behavior
// expected on the deprecated jetpack extensions manifest file.
if (manifest.name && typeof manifest.name == 'string') {
const id = `@${manifest.name}`;
return isValidAOMAddonId(id) ? id : null;
}
return null;
}
function unprefix(root, node, prefix) {

@@ -87,3 +116,3 @@ return root[prefix + ':' + node] || root[node];

function parseOptions(opts) {
if (_.isString(opts)) {
if (typeof opts === 'string') {
return { profileDirectory: opts };

@@ -120,3 +149,3 @@ }

this.profileDir = opts.profileDirectory;
this.defaultPreferences = _.clone(config.DEFAULT_PREFERENCES);
this.defaultPreferences = {...config.DEFAULT_PREFERENCES};
// if true, the profile folder is deleted after

@@ -159,15 +188,2 @@ this._deleteOnExit = !hasDestDir;

function deleteParallel(files, cb) {
async.parallel(
files.map(function (file) {
return function (next) {
fs.remove(file, next);
};
}),
function () {
cb && cb();
}
);
}
FirefoxProfile.prototype._copy = function (profileDirectory, cb) {

@@ -359,9 +375,7 @@ fs.copy(

FirefoxProfile.prototype.addExtensions = function (extensions, cb) {
var self = this,
functions = extensions.map(function (extension) {
return function (callback) {
self.addExtension(path.normalize(extension), callback);
};
});
async.parallel(functions, cb);
var addExtension = util.promisify(this.addExtension.bind(this));
var promises = extensions.map(extension =>
addExtension(path.normalize(extension))
);
util.callbackify(() => Promise.all(promises))(cb);
};

@@ -478,3 +492,4 @@

cb(null, content.toString('base64'));
deleteParallel([path.join(tmpFolder, 'profile.zip'), tmpFolder]);
fs.remove(path.join(tmpFolder, 'profile.zip'));
fs.remove(tmpFolder);
});

@@ -615,53 +630,23 @@ });

var addonPath = path.join(self.extensionsDir, path.sep, addonId);
async.series(
[
// creates extensionsDir
function (next) {
fs.exists(self.extensionsDir, function (exists) {
if (!exists) {
fs.mkdir(self.extensionsDir, function () {
next();
});
return;
}
// already exists
next();
});
},
function (next) {
if (!unpack && xpiFile) {
fs.copy(xpiFile, addonPath + '.xpi', function () {
next();
});
} else {
// copy it!
fs.mkdir(addonPath, function () {
fs.copy(
addon,
addonPath,
{
clobber: true,
},
function () {
next();
}
);
});
util.callbackify(async function run() {
await fs.mkdirp(self.extensionsDir);
if (!unpack && xpiFile) {
await fs.copy(xpiFile, addonPath + '.xpi');
} else {
await fs.mkdir(addonPath);
await fs.copy(
addon,
addonPath,
{
clobber: true,
}
},
function (next) {
if (tmpDir) {
fs.remove(tmpDir, function () {
next();
});
} else {
next();
}
},
],
function () {
// done!
cb && cb(null, addonDetails);
);
}
);
if (tmpDir) {
await fs.remove(tmpDir);
}
return addonDetails;
})(cb)
});

@@ -668,0 +653,0 @@ };

@@ -7,4 +7,3 @@ 'use strict';

ini = require('ini'),
_ = require('lodash');
ini = require('ini');

@@ -59,4 +58,6 @@

if (err) { cb(err); }
self.profiles = _.filter(ini.parse(data), function(value, key) {
return _.isString(key) && key.match(/^Profile/);
Object.entries(ini.parse(data)).forEach(function ([key, value]) {
if (typeof key === 'string' && key.match(/^Profile/)) {
self.profiles.push(value);
}
});

@@ -79,3 +80,3 @@ self.hasReadProfiles = true;

var pathFound,
found = _.find(self.profiles, function(profile) {
found = self.profiles.find(function(profile) {
return profile.Name === name;

@@ -82,0 +83,0 @@ });

{
"name": "firefox-profile",
"version": "4.0.0",
"version": "4.1.0",
"description": "firefox profile for selenium WebDriverJs, admc/wd or any other node selenium driver that supports capabilities",

@@ -69,2 +69,10 @@ "main": "lib/firefox_profile",

"url": "https://github.com/hbenl"
},
{
"name": "Federico",
"url": "https://github.com/fregante"
},
{
"name": "Luca Greco",
"url": "https://github.com/rpl"
}

@@ -89,14 +97,11 @@ ],

"dependencies": {
"adm-zip": "~0.4.x",
"archiver": "~5.0.2",
"async": "~2.5.0",
"fs-extra": "~4.0.2",
"ini": "~1.3.3",
"jetpack-id": "1.0.0",
"adm-zip": "~0.5.x",
"archiver": "~5.2.0",
"fs-extra": "~9.0.1",
"ini": "~2.0.0",
"lazystream": "~1.0.0",
"lodash": "~4.17.2",
"minimist": "^1.1.1",
"uuid": "^3.0.0",
"xml2js": "~0.4.4"
"minimist": "^1.2.5",
"uuid": "^8.3.2",
"xml2js": "~0.4.23"
}
}
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc