Skip to content

Commit 651eca4

Browse files
committed
node: Fix playwright handler for new versions
The old URL format with revisions has been deprecated for chromium and chromium-headless-shell; and fails on 1.58.0 Updated to the new CDN for all URLs
1 parent cc1d7b8 commit 651eca4

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

node/flatpak_node_generator/providers/special.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ async def _handle_playwright(self, package: Package) -> None:
350350
continue
351351
name = browser['name']
352352
revision = int(browser['revision'])
353+
version = browser.get('browserVersion')
353354

354355
if name == 'chromium':
355356
# Revision number scheme was changed from Chromium revisions to incrementing
@@ -358,35 +359,41 @@ async def _handle_playwright(self, package: Package) -> None:
358359
SemVer.parse(package.version) < SemVer.parse('1.21.0')
359360
and revision < 792639
360361
):
361-
url_tp = 'https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/%d/%s'
362362
dl_file = 'chrome-linux.zip'
363-
else:
364-
url_tp = 'https://playwright.azureedge.net/builds/chromium/%d/%s'
363+
dl_url = f'https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/{revision}/{dl_file}'
364+
elif SemVer.parse(package.version) < SemVer.parse('1.58.0'):
365365
dl_file = 'chromium-linux.zip'
366+
dl_url = f'https://cdn.playwright.dev/builds/chromium/{revision}/{dl_file}'
367+
else:
368+
dl_file = 'chrome-linux64.zip'
369+
dl_url = f'https://cdn.playwright.dev/builds/cft/{version}/linux64/{dl_file}'
366370
elif name == 'chromium-headless-shell':
367-
url_tp = 'https://playwright.azureedge.net/builds/chromium/%d/%s'
368-
dl_file = 'chromium-headless-shell-linux.zip'
371+
if SemVer.parse(package.version) < SemVer.parse('1.58.0'):
372+
dl_file = 'chromium-headless-shell-linux.zip'
373+
dl_url = f'https://cdn.playwright.dev/builds/chromium/{revision}/{dl_file}'
374+
else:
375+
dl_file = 'chrome-headless-shell-linux64.zip'
376+
dl_url = f'https://cdn.playwright.dev/builds/cft/{version}/linux64/{dl_file}'
369377
elif name == 'firefox':
370-
url_tp = 'https://playwright.azureedge.net/builds/firefox/%d/%s'
371378
if revision < 1140:
372379
dl_file = 'firefox-linux.zip'
373380
else:
374381
dl_file = 'firefox-ubuntu-22.04.zip'
382+
dl_url = f'https://cdn.playwright.dev/builds/firefox/{revision}/{dl_file}'
375383
elif name == 'webkit':
376-
url_tp = 'https://playwright.azureedge.net/builds/webkit/%d/%s'
377384
if revision < 1317:
378385
dl_file = 'minibrowser-gtk-wpe.zip'
379386
elif revision <= 2092:
380387
dl_file = 'webkit-ubuntu-20.04.zip'
381388
else:
382389
dl_file = 'webkit-ubuntu-24.04.zip'
390+
dl_url = f'https://cdn.playwright.dev/builds/webkit/{revision}/{dl_file}'
383391
elif name == 'ffmpeg':
384-
url_tp = 'https://playwright.azureedge.net/builds/ffmpeg/%d/%s'
385392
dl_file = 'ffmpeg-linux.zip'
393+
dl_url = f'https://cdn.playwright.dev/builds/ffmpeg/{revision}/{dl_file}'
386394
else:
387395
raise ValueError(f'Unknown playwright browser {name}')
388396

389-
dl_url = url_tp % (revision, dl_file)
390397
metadata = await RemoteUrlMetadata.get(dl_url, cachable=True)
391398
destdir = (
392399
self.gen.data_root / 'cache' / 'ms-playwright' / f'{name}-{revision}'

0 commit comments

Comments
 (0)