fix: remove Chromium channels (#10536)
This commit is contained in:
parent
c308266111
commit
c0dc8ad8a8
@ -68,7 +68,9 @@ export async function resolveBuildId(
|
|||||||
case BrowserTag.CANARY:
|
case BrowserTag.CANARY:
|
||||||
case BrowserTag.DEV:
|
case BrowserTag.DEV:
|
||||||
case BrowserTag.STABLE:
|
case BrowserTag.STABLE:
|
||||||
throw new Error(`${tag} is not supported for ${browser}`);
|
throw new Error(
|
||||||
|
`${tag} is not supported for ${browser}. Use 'latest' instead.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
case Browser.CHROME:
|
case Browser.CHROME:
|
||||||
switch (tag as BrowserTag) {
|
switch (tag as BrowserTag) {
|
||||||
@ -113,26 +115,13 @@ export async function resolveBuildId(
|
|||||||
case Browser.CHROMIUM:
|
case Browser.CHROMIUM:
|
||||||
switch (tag as BrowserTag) {
|
switch (tag as BrowserTag) {
|
||||||
case BrowserTag.LATEST:
|
case BrowserTag.LATEST:
|
||||||
return await chromium.resolveBuildId(platform, 'latest');
|
return await chromium.resolveBuildId(platform);
|
||||||
case BrowserTag.BETA:
|
case BrowserTag.BETA:
|
||||||
return await chromium.resolveBuildId(
|
|
||||||
platform,
|
|
||||||
ChromeReleaseChannel.BETA
|
|
||||||
);
|
|
||||||
case BrowserTag.CANARY:
|
case BrowserTag.CANARY:
|
||||||
return await chromium.resolveBuildId(
|
|
||||||
platform,
|
|
||||||
ChromeReleaseChannel.CANARY
|
|
||||||
);
|
|
||||||
case BrowserTag.DEV:
|
case BrowserTag.DEV:
|
||||||
return await chromium.resolveBuildId(
|
|
||||||
platform,
|
|
||||||
ChromeReleaseChannel.DEV
|
|
||||||
);
|
|
||||||
case BrowserTag.STABLE:
|
case BrowserTag.STABLE:
|
||||||
return await chromium.resolveBuildId(
|
throw new Error(
|
||||||
platform,
|
`${tag} is not supported for ${browser}. Use 'latest' instead.`
|
||||||
ChromeReleaseChannel.STABLE
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,12 +156,11 @@ export function resolveSystemExecutablePath(
|
|||||||
switch (browser) {
|
switch (browser) {
|
||||||
case Browser.CHROMEDRIVER:
|
case Browser.CHROMEDRIVER:
|
||||||
case Browser.FIREFOX:
|
case Browser.FIREFOX:
|
||||||
|
case Browser.CHROMIUM:
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`System browser detection is not supported for ${browser} yet.`
|
`System browser detection is not supported for ${browser} yet.`
|
||||||
);
|
);
|
||||||
case Browser.CHROME:
|
case Browser.CHROME:
|
||||||
return chromium.resolveSystemExecutablePath(platform, channel);
|
|
||||||
case Browser.CHROMIUM:
|
|
||||||
return chrome.resolveSystemExecutablePath(platform, channel);
|
return chrome.resolveSystemExecutablePath(platform, channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,7 @@ import path from 'path';
|
|||||||
|
|
||||||
import {getText} from '../httpUtil.js';
|
import {getText} from '../httpUtil.js';
|
||||||
|
|
||||||
import {getLastKnownGoodReleaseForChannel} from './chrome.js';
|
import {BrowserPlatform} from './types.js';
|
||||||
import {BrowserPlatform, ChromeReleaseChannel} from './types.js';
|
|
||||||
|
|
||||||
export {resolveSystemExecutablePath} from './chrome.js';
|
|
||||||
|
|
||||||
function archive(platform: BrowserPlatform, buildId: string): string {
|
function archive(platform: BrowserPlatform, buildId: string): string {
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
@ -89,17 +86,13 @@ export function relativeExecutablePath(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
export async function resolveBuildId(
|
export async function resolveBuildId(
|
||||||
platform: BrowserPlatform,
|
platform: BrowserPlatform
|
||||||
channel: ChromeReleaseChannel | 'latest' = 'latest'
|
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
if (channel === 'latest') {
|
return await getText(
|
||||||
return await getText(
|
new URL(
|
||||||
new URL(
|
`https://storage.googleapis.com/chromium-browser-snapshots/${folder(
|
||||||
`https://storage.googleapis.com/chromium-browser-snapshots/${folder(
|
platform
|
||||||
platform
|
)}/LAST_CHANGE`
|
||||||
)}/LAST_CHANGE`
|
)
|
||||||
)
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
return (await getLastKnownGoodReleaseForChannel(channel)).revision;
|
|
||||||
}
|
}
|
||||||
|
@ -17,14 +17,10 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
import {
|
import {BrowserPlatform} from '../../../lib/cjs/browser-data/browser-data.js';
|
||||||
BrowserPlatform,
|
|
||||||
ChromeReleaseChannel,
|
|
||||||
} from '../../../lib/cjs/browser-data/browser-data.js';
|
|
||||||
import {
|
import {
|
||||||
resolveDownloadUrl,
|
resolveDownloadUrl,
|
||||||
relativeExecutablePath,
|
relativeExecutablePath,
|
||||||
resolveSystemExecutablePath,
|
|
||||||
} from '../../../lib/cjs/browser-data/chromium.js';
|
} from '../../../lib/cjs/browser-data/chromium.js';
|
||||||
|
|
||||||
describe('Chromium', () => {
|
describe('Chromium', () => {
|
||||||
@ -73,36 +69,4 @@ describe('Chromium', () => {
|
|||||||
path.join('chrome-win', 'chrome.exe')
|
path.join('chrome-win', 'chrome.exe')
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should resolve system executable path', () => {
|
|
||||||
process.env['PROGRAMFILES'] = 'C:\\ProgramFiles';
|
|
||||||
try {
|
|
||||||
assert.strictEqual(
|
|
||||||
resolveSystemExecutablePath(
|
|
||||||
BrowserPlatform.WIN32,
|
|
||||||
ChromeReleaseChannel.DEV
|
|
||||||
),
|
|
||||||
'C:\\ProgramFiles\\Google\\Chrome Dev\\Application\\chrome.exe'
|
|
||||||
);
|
|
||||||
} finally {
|
|
||||||
delete process.env['PROGRAMFILES'];
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.strictEqual(
|
|
||||||
resolveSystemExecutablePath(
|
|
||||||
BrowserPlatform.MAC,
|
|
||||||
ChromeReleaseChannel.BETA
|
|
||||||
),
|
|
||||||
'/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta'
|
|
||||||
);
|
|
||||||
assert.throws(() => {
|
|
||||||
assert.strictEqual(
|
|
||||||
resolveSystemExecutablePath(
|
|
||||||
BrowserPlatform.LINUX,
|
|
||||||
ChromeReleaseChannel.CANARY
|
|
||||||
),
|
|
||||||
path.join('chrome-linux', 'chrome')
|
|
||||||
);
|
|
||||||
}, new Error(`Unable to detect browser executable path for 'canary' on linux.`));
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user