firefox-profile
Advanced tools
Comparing version 0.5.0 to 1.0.0
@@ -0,1 +1,5 @@ | ||
# 1.0.0 | ||
* BREAKING CHANGE: handle errors in `encoded(cb)` callback function | ||
# 0.5.0 | ||
@@ -2,0 +6,0 @@ |
@@ -113,3 +113,7 @@ #!/usr/bin/env node | ||
fp.encoded(function(zippedProfileString) { | ||
fp.encoded(function(err, zippedProfileString) { | ||
if (err) { | ||
console.error('oops, an error occured:', err); | ||
process.exit(4); | ||
} | ||
if (encoded === true) { | ||
@@ -116,0 +120,0 @@ process.stdout.write(zippedProfileString); |
@@ -416,24 +416,32 @@ /** | ||
* | ||
* @param {Function} function a callback function with first params as a zipped, base64 encoded string of the profile directory | ||
* @param {Function} function a callback function with first param: an error, and 2nd param: a zipped, base64 encoded string of the profile directory | ||
*/ | ||
FirefoxProfile.prototype.encoded = function(cb) { | ||
var self = this, | ||
tmpFolder = this._createTempFolder(), | ||
zipStream = fs.createWriteStream(path.join(tmpFolder,'profile.zip')), | ||
archive = archiver('zip', { forceUTC: true }); | ||
try { | ||
var self = this, | ||
tmpFolder = this._createTempFolder(), | ||
zipStream = fs.createWriteStream(path.join(tmpFolder,'profile.zip')), | ||
archive = archiver('zip', { forceUTC: true }); | ||
if (this._preferencesModified) { | ||
this.updatePreferences(); | ||
if (this._preferencesModified) { | ||
this.updatePreferences(); | ||
} | ||
zipStream.on('error', function (err) { | ||
cb(err); | ||
}); | ||
zipStream.on('close', function() { | ||
fs.readFile(path.join(tmpFolder,'profile.zip'), function(err, content) { | ||
cb(null, content.toString('base64')); | ||
deleteParallel([path.join(tmpFolder,'profile.zip'), tmpFolder]); | ||
}); | ||
}); | ||
archive.pipe(zipStream); | ||
archive.glob('**', { | ||
cwd: self.profileDir, expand: true | ||
}, {}); | ||
archive.finalize(); | ||
} catch (e) { | ||
cb(e); | ||
} | ||
zipStream.on('close', function() { | ||
fs.readFile(path.join(tmpFolder,'profile.zip'), function(err, content) { | ||
cb(content.toString('base64')); | ||
deleteParallel([path.join(tmpFolder,'profile.zip'), tmpFolder]); | ||
}); | ||
}); | ||
archive.pipe(zipStream); | ||
archive.glob('**', { | ||
cwd: self.profileDir, expand: true | ||
}, {}); | ||
archive.finalize(); | ||
}; | ||
@@ -440,0 +448,0 @@ |
{ | ||
"name": "firefox-profile", | ||
"version": "0.5.0", | ||
"version": "1.0.0", | ||
"description": "firefox profile for selenium WebDriverJs, admc/wd or any other node selenium driver that supports capabilities", | ||
@@ -90,3 +90,3 @@ "main": "lib/firefox_profile", | ||
"archiver": "~1.3.0", | ||
"async": "~2.1.2", | ||
"async": "~2.3.0", | ||
"fs-extra": "~2.1.2", | ||
@@ -93,0 +93,0 @@ "ini": "~1.3.3", |
@@ -10,5 +10,14 @@ # firefox-profile-js | ||
Firefox Profile for [Selenium WebdriverJS](https://code.google.com/p/selenium/wiki/WebDriverJs), | ||
[admc/wd](https://github.com/admc/wd) or any other library that allows you to set capabilities. | ||
Create or update Firefox Profile programmatically. | ||
## Notes for Selenium-webdriver package users | ||
If you are using [`selenium-webdriver` package](http://seleniumhq.github.io/selenium/docs/api/javascript/), you no longer need to use this package: `selenium-webdriver` package now implements [a class that allows to create firefox profiles](http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/firefox/profile.html). And this new class [doesn't play well](/saadtazi/firefox-profile-js/issues/86) with this package. Check | ||
[this link](http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/firefox/index.html) | ||
for an example on how to set your own profile with `selenium-webdriver`. | ||
This package is still useful if you use another webdriver library like [`wd.js`](http://admc.io/wd/) or any other webdriver json wire protocol implementation (`webdriver.io`?). | ||
# Introduction | ||
This class allows you to: | ||
@@ -21,6 +30,9 @@ | ||
* specify proxy settings, | ||
* set the user preferences... | ||
* set the user preferences... | ||
More info on user preferences [here](http://kb.mozillazine.org/User.js_file). | ||
It also contains a [command line interface](#command-line-interface) that allows to copy or create profiles. | ||
@@ -32,5 +44,12 @@ | ||
npm install firefox-profile | ||
``` | ||
npm install firefox-profile | ||
``` | ||
or `yarn`: | ||
``` | ||
yarn add firefox-profile | ||
``` | ||
## Usage | ||
@@ -110,3 +129,7 @@ | ||
fp.addExtensions(['./test/extensions/firebug-1.12.4-fx.xpi'], function() { | ||
fp.encoded(function(zippedProfile) { | ||
fp.encoded(function(err, zippedProfile) { | ||
if (err) { | ||
console.error('oops, an error occured:', err); | ||
return; | ||
} | ||
browser = wd.promiseChainRemote(); | ||
@@ -113,0 +136,0 @@ browser.init({ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
45084
942
1
198
9
+ Addedasync@2.3.0(transitive)
- Removedasync@2.1.5(transitive)
Updatedasync@~2.3.0