summaryrefslogtreecommitdiffstats
path: root/remote/test/puppeteer/packages/browsers/src/browser-data/firefox.ts
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /remote/test/puppeteer/packages/browsers/src/browser-data/firefox.ts
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'remote/test/puppeteer/packages/browsers/src/browser-data/firefox.ts')
-rw-r--r--remote/test/puppeteer/packages/browsers/src/browser-data/firefox.ts132
1 files changed, 115 insertions, 17 deletions
diff --git a/remote/test/puppeteer/packages/browsers/src/browser-data/firefox.ts b/remote/test/puppeteer/packages/browsers/src/browser-data/firefox.ts
index 87e3804c8f..95e03c54c0 100644
--- a/remote/test/puppeteer/packages/browsers/src/browser-data/firefox.ts
+++ b/remote/test/puppeteer/packages/browsers/src/browser-data/firefox.ts
@@ -11,7 +11,7 @@ import {getJSON} from '../httpUtil.js';
import {BrowserPlatform, type ProfileOptions} from './types.js';
-function archive(platform: BrowserPlatform, buildId: string): string {
+function archiveNightly(platform: BrowserPlatform, buildId: string): string {
switch (platform) {
case BrowserPlatform.LINUX:
return `firefox-${buildId}.en-US.${platform}-x86_64.tar.bz2`;
@@ -24,48 +24,146 @@ function archive(platform: BrowserPlatform, buildId: string): string {
}
}
+function archive(platform: BrowserPlatform, buildId: string): string {
+ switch (platform) {
+ case BrowserPlatform.LINUX:
+ return `firefox-${buildId}.tar.bz2`;
+ case BrowserPlatform.MAC_ARM:
+ case BrowserPlatform.MAC:
+ return `Firefox ${buildId}.dmg`;
+ case BrowserPlatform.WIN32:
+ case BrowserPlatform.WIN64:
+ return `Firefox Setup ${buildId}.exe`;
+ }
+}
+
+function platformName(platform: BrowserPlatform): string {
+ switch (platform) {
+ case BrowserPlatform.LINUX:
+ return `linux-x86_64`;
+ case BrowserPlatform.MAC_ARM:
+ case BrowserPlatform.MAC:
+ return `mac`;
+ case BrowserPlatform.WIN32:
+ case BrowserPlatform.WIN64:
+ return platform;
+ }
+}
+
+function parseBuildId(buildId: string): [FirefoxChannel, string] {
+ for (const value of Object.values(FirefoxChannel)) {
+ if (buildId.startsWith(value + '_')) {
+ buildId = buildId.substring(value.length + 1);
+ return [value, buildId];
+ }
+ }
+ // Older versions do not have channel as the prefix.«
+ return [FirefoxChannel.NIGHTLY, buildId];
+}
+
export function resolveDownloadUrl(
platform: BrowserPlatform,
buildId: string,
- baseUrl = 'https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central'
+ baseUrl?: string
): string {
- return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
+ const [channel, resolvedBuildId] = parseBuildId(buildId);
+ switch (channel) {
+ case FirefoxChannel.NIGHTLY:
+ baseUrl ??=
+ 'https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central';
+ break;
+ case FirefoxChannel.DEVEDITION:
+ baseUrl ??= 'https://archive.mozilla.org/pub/devedition/releases';
+ break;
+ case FirefoxChannel.BETA:
+ case FirefoxChannel.STABLE:
+ case FirefoxChannel.ESR:
+ baseUrl ??= 'https://archive.mozilla.org/pub/firefox/releases';
+ break;
+ }
+ switch (channel) {
+ case FirefoxChannel.NIGHTLY:
+ return `${baseUrl}/${resolveDownloadPath(platform, resolvedBuildId).join('/')}`;
+ case FirefoxChannel.DEVEDITION:
+ case FirefoxChannel.BETA:
+ case FirefoxChannel.STABLE:
+ case FirefoxChannel.ESR:
+ return `${baseUrl}/${resolvedBuildId}/${platformName(platform)}/en-US/${archive(platform, resolvedBuildId)}`;
+ }
}
export function resolveDownloadPath(
platform: BrowserPlatform,
buildId: string
): string[] {
- return [archive(platform, buildId)];
+ return [archiveNightly(platform, buildId)];
}
export function relativeExecutablePath(
platform: BrowserPlatform,
- _buildId: string
+ buildId: string
): string {
- switch (platform) {
- case BrowserPlatform.MAC_ARM:
- case BrowserPlatform.MAC:
- return path.join('Firefox Nightly.app', 'Contents', 'MacOS', 'firefox');
- case BrowserPlatform.LINUX:
- return path.join('firefox', 'firefox');
- case BrowserPlatform.WIN32:
- case BrowserPlatform.WIN64:
- return path.join('firefox', 'firefox.exe');
+ const [channel] = parseBuildId(buildId);
+ switch (channel) {
+ case FirefoxChannel.NIGHTLY:
+ switch (platform) {
+ case BrowserPlatform.MAC_ARM:
+ case BrowserPlatform.MAC:
+ return path.join(
+ 'Firefox Nightly.app',
+ 'Contents',
+ 'MacOS',
+ 'firefox'
+ );
+ case BrowserPlatform.LINUX:
+ return path.join('firefox', 'firefox');
+ case BrowserPlatform.WIN32:
+ case BrowserPlatform.WIN64:
+ return path.join('firefox', 'firefox.exe');
+ }
+ case FirefoxChannel.BETA:
+ case FirefoxChannel.DEVEDITION:
+ case FirefoxChannel.ESR:
+ case FirefoxChannel.STABLE:
+ switch (platform) {
+ case BrowserPlatform.MAC_ARM:
+ case BrowserPlatform.MAC:
+ return path.join('Firefox.app', 'Contents', 'MacOS', 'firefox');
+ case BrowserPlatform.LINUX:
+ return path.join('firefox', 'firefox');
+ case BrowserPlatform.WIN32:
+ case BrowserPlatform.WIN64:
+ return path.join('core', 'firefox.exe');
+ }
}
}
+export enum FirefoxChannel {
+ STABLE = 'stable',
+ ESR = 'esr',
+ DEVEDITION = 'devedition',
+ BETA = 'beta',
+ NIGHTLY = 'nightly',
+}
+
export async function resolveBuildId(
- channel: 'FIREFOX_NIGHTLY' = 'FIREFOX_NIGHTLY'
+ channel: FirefoxChannel = FirefoxChannel.NIGHTLY
): Promise<string> {
+ const channelToVersionKey = {
+ [FirefoxChannel.ESR]: 'FIREFOX_ESR',
+ [FirefoxChannel.STABLE]: 'LATEST_FIREFOX_VERSION',
+ [FirefoxChannel.DEVEDITION]: 'FIREFOX_DEVEDITION',
+ [FirefoxChannel.BETA]: 'FIREFOX_DEVEDITION',
+ [FirefoxChannel.NIGHTLY]: 'FIREFOX_NIGHTLY',
+ };
const versions = (await getJSON(
new URL('https://product-details.mozilla.org/1.0/firefox_versions.json')
)) as Record<string, string>;
- const version = versions[channel];
+ const version = versions[channelToVersionKey[channel]];
if (!version) {
throw new Error(`Channel ${channel} is not found.`);
}
- return version;
+ return channel + '_' + version;
}
export async function createProfile(options: ProfileOptions): Promise<void> {