Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
profileDirectory: config.srcProfileDir,
destinationDirectory: config.profileDir
},
(err, profile) => {
if (err || !profile) {
reject(err);
} else {
profile.shouldDeleteOnExit(false);
resolve(profile);
}
});
} else {
await fs.ensureDir(config.profileDir);
let profile = new FirefoxProfile({
destinationDirectory: config.profileDir
});
profile.shouldDeleteOnExit(false);
resolve(profile);
}
});
}
const profileIsDirPath = await isDirectory(profilePath);
if (profileIsDirPath) {
log.debug(`Using profile directory "${profilePath}"`);
destinationDirectory = profilePath;
} else {
log.debug(`Assuming ${profilePath} is a named profile`);
destinationDirectory = await getProfilePath(profilePath);
if (!destinationDirectory) {
throw new UsageError(
`The request "${profilePath}" profile name ` +
'cannot be resolved to a profile path'
);
}
}
const profile = new FirefoxProfile({destinationDirectory});
return await configureThisProfile(profile, {app, customPrefs});
}
export async function createProfile(
{
app,
configureThisProfile = configureProfile,
customPrefs = {},
}: CreateProfileParams = {},
): Promise {
const profile = new FirefoxProfile();
return await configureThisProfile(profile, {app, customPrefs});
}
onPrepare (config, caps) {
this.config = config
this.caps = caps
/**
* don't do anything if no profile is specified
*/
if (!config.firefoxProfile) {
return
}
this.profile = new FirefoxProfile()
for (let preference in config.firefoxProfile) {
/**
* extensions are getting set at the end
*/
if (SPECIAL_PROPERTIES.includes(preference)) {
continue
}
this.profile.setPreference(preference, config.firefoxProfile[preference])
}
if (this.config.firefoxProfile.proxy) {
this.profile.setProxy(this.config.firefoxProfile.proxy)
}