Socket
Socket
Sign inDemoInstall

@puppeteer/browsers

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@puppeteer/browsers - npm Package Compare versions

Comparing version 2.2.2 to 2.2.3

21

lib/cjs/browser-data/firefox.js

@@ -333,11 +333,20 @@ "use strict";

async function writePreferences(options) {
const prefsPath = path_1.default.join(options.path, 'prefs.js');
const lines = Object.entries(options.preferences).map(([key, value]) => {
return `user_pref(${JSON.stringify(key)}, ${JSON.stringify(value)});`;
});
await fs_1.default.promises.writeFile(path_1.default.join(options.path, 'user.js'), lines.join('\n'));
// Create a backup of the preferences file if it already exitsts.
const prefsPath = path_1.default.join(options.path, 'prefs.js');
if (fs_1.default.existsSync(prefsPath)) {
const prefsBackupPath = path_1.default.join(options.path, 'prefs.js.puppeteer');
await fs_1.default.promises.copyFile(prefsPath, prefsBackupPath);
// Use allSettled to prevent corruption
const result = await Promise.allSettled([
fs_1.default.promises.writeFile(path_1.default.join(options.path, 'user.js'), lines.join('\n')),
// Create a backup of the preferences file if it already exitsts.
fs_1.default.promises.access(prefsPath, fs_1.default.constants.F_OK).then(async () => {
await fs_1.default.promises.copyFile(prefsPath, path_1.default.join(options.path, 'prefs.js.puppeteer'));
},
// Swallow only if file does not exist
() => { }),
]);
for (const command of result) {
if (command.status === 'rejected') {
throw command.reason;
}
}

@@ -344,0 +353,0 @@ }

@@ -322,11 +322,20 @@ /**

async function writePreferences(options) {
const prefsPath = path.join(options.path, 'prefs.js');
const lines = Object.entries(options.preferences).map(([key, value]) => {
return `user_pref(${JSON.stringify(key)}, ${JSON.stringify(value)});`;
});
await fs.promises.writeFile(path.join(options.path, 'user.js'), lines.join('\n'));
// Create a backup of the preferences file if it already exitsts.
const prefsPath = path.join(options.path, 'prefs.js');
if (fs.existsSync(prefsPath)) {
const prefsBackupPath = path.join(options.path, 'prefs.js.puppeteer');
await fs.promises.copyFile(prefsPath, prefsBackupPath);
// Use allSettled to prevent corruption
const result = await Promise.allSettled([
fs.promises.writeFile(path.join(options.path, 'user.js'), lines.join('\n')),
// Create a backup of the preferences file if it already exitsts.
fs.promises.access(prefsPath, fs.constants.F_OK).then(async () => {
await fs.promises.copyFile(prefsPath, path.join(options.path, 'prefs.js.puppeteer'));
},
// Swallow only if file does not exist
() => { }),
]);
for (const command of result) {
if (command.status === 'rejected') {
throw command.reason;
}
}

@@ -333,0 +342,0 @@ }

{
"name": "@puppeteer/browsers",
"version": "2.2.2",
"version": "2.2.3",
"description": "Download and launch browsers",

@@ -5,0 +5,0 @@ "scripts": {

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

async function writePreferences(options: ProfileOptions): Promise<void> {
const prefsPath = path.join(options.path, 'prefs.js');
const lines = Object.entries(options.preferences).map(([key, value]) => {

@@ -414,12 +415,21 @@ return `user_pref(${JSON.stringify(key)}, ${JSON.stringify(value)});`;

await fs.promises.writeFile(
path.join(options.path, 'user.js'),
lines.join('\n')
);
// Create a backup of the preferences file if it already exitsts.
const prefsPath = path.join(options.path, 'prefs.js');
if (fs.existsSync(prefsPath)) {
const prefsBackupPath = path.join(options.path, 'prefs.js.puppeteer');
await fs.promises.copyFile(prefsPath, prefsBackupPath);
// Use allSettled to prevent corruption
const result = await Promise.allSettled([
fs.promises.writeFile(path.join(options.path, 'user.js'), lines.join('\n')),
// Create a backup of the preferences file if it already exitsts.
fs.promises.access(prefsPath, fs.constants.F_OK).then(
async () => {
await fs.promises.copyFile(
prefsPath,
path.join(options.path, 'prefs.js.puppeteer')
);
},
// Swallow only if file does not exist
() => {}
),
]);
for (const command of result) {
if (command.status === 'rejected') {
throw command.reason;
}
}

@@ -426,0 +436,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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