How to use firefox-profile - 8 common examples

To help you get started, we’ve selected a few firefox-profile examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github firefox-devtools / vscode-firefox-debug / src / util / addon.ts View on Github external
try {
				fs.accessSync(manifestPath, fs.R_OK);
			} catch (err) {
				return Promise.reject(`Couldn't read ${manifestPath}`);
			}
			let manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
			return createJetpackXpi(manifest, { addonDir, destDir }).then((xpiPath) => {
				fs.renameSync(xpiPath, destFile);
			});
	}
}

// we perform some Voodoo tricks to extract the private _addonDetails method
// (which uses the _sanitizePref method) from FirefoxProfile
function FirefoxProfileVoodoo() {}
FirefoxProfileVoodoo.prototype._addonDetails = FirefoxProfile.prototype._addonDetails;
FirefoxProfileVoodoo.prototype._sanitizePref = FirefoxProfile.prototype._sanitizePref;
// and now more Voodoo tricks to turn the (blocking) callback-based method
// into a simple synchronous method
function getLegacyAddonId(addonPath: string): string {
	let addonDetails: any;
	let voodoo = new FirefoxProfileVoodoo();
	voodoo._addonDetails(addonPath, result => addonDetails = result);
	return addonDetails.id;
}
github firefox-devtools / vscode-firefox-debug / src / util / addon.ts View on Github external
fs.accessSync(manifestPath, fs.R_OK);
			} catch (err) {
				return Promise.reject(`Couldn't read ${manifestPath}`);
			}
			let manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
			return createJetpackXpi(manifest, { addonDir, destDir }).then((xpiPath) => {
				fs.renameSync(xpiPath, destFile);
			});
	}
}

// we perform some Voodoo tricks to extract the private _addonDetails method
// (which uses the _sanitizePref method) from FirefoxProfile
function FirefoxProfileVoodoo() {}
FirefoxProfileVoodoo.prototype._addonDetails = FirefoxProfile.prototype._addonDetails;
FirefoxProfileVoodoo.prototype._sanitizePref = FirefoxProfile.prototype._sanitizePref;
// and now more Voodoo tricks to turn the (blocking) callback-based method
// into a simple synchronous method
function getLegacyAddonId(addonPath: string): string {
	let addonDetails: any;
	let voodoo = new FirefoxProfileVoodoo();
	voodoo._addonDetails(addonPath, result => addonDetails = result);
	return addonDetails.id;
}
github mozilla / web-ext / src / firefox / index.js View on Github external
export async function isDefaultProfile(
  profilePathOrName: string,
  ProfileFinder?: typeof FirefoxProfile.Finder = FirefoxProfile.Finder,
  fsStat?: typeof fs.stat = fs.stat,
): Promise {
  if (DEFAULT_PROFILES_NAMES.includes(profilePathOrName)) {
    return true;
  }

  const baseProfileDir = ProfileFinder.locateUserDirectory();
  const profilesIniPath = path.join(baseProfileDir, 'profiles.ini');
  try {
    await fsStat(profilesIniPath);
  } catch (error) {
    if (isErrorWithCode('ENOENT', error)) {
      log.debug(`profiles.ini not found: ${error}`);

      // No profiles exist yet, default to false (the default profile name contains a
      // random generated component).
github firefox-devtools / vscode-firefox-debug / src / adapter / firefox / launch.ts View on Github external
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);
		}
	});
}
github firefox-devtools / vscode-firefox-debug / src / adapter / firefox / launch.ts View on Github external
return new Promise(async (resolve, reject) => {

		if (config.srcProfileDir) {

			FirefoxProfile.copy({
				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({
github mozilla / web-ext / src / firefox / index.js View on Github external
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});
}
github mozilla / web-ext / src / firefox / index.js View on Github external
export async function createProfile(
  {
    app,
    configureThisProfile = configureProfile,
    customPrefs = {},
  }: CreateProfileParams = {},
): Promise {
  const profile = new FirefoxProfile();
  return await configureThisProfile(profile, {app, customPrefs});
}
github webdriverio-boneyard / wdio-firefox-profile-service / lib / firefox-profile-launch-service.js View on Github external
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)
        }

firefox-profile

firefox profile for selenium WebDriverJs, admc/wd or any other node selenium driver that supports capabilities

MIT
Latest version published 4 months ago

Package Health Score

70 / 100
Full package analysis