Skip to content

Commit 5c73dc4

Browse files
Beryesabbhtt
authored andcommitted
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 5c73dc4

1 file changed

Lines changed: 23 additions & 9 deletions

File tree

node/flatpak_node_generator/providers/special.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -352,41 +352,55 @@ async def _handle_playwright(self, package: Package) -> None:
352352
revision = int(browser['revision'])
353353

354354
if name == 'chromium':
355+
version = browser['browserVersion']
355356
# Revision number scheme was changed from Chromium revisions to incrementing
356357
# integers above 1000; now it's same as for other browsers
357358
if (
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+
version = browser['browserVersion']
372+
if SemVer.parse(package.version) < SemVer.parse('1.58.0'):
373+
dl_file = 'chromium-headless-shell-linux.zip'
374+
dl_url = f'https://cdn.playwright.dev/builds/chromium/{revision}/{dl_file}'
375+
else:
376+
dl_file = 'chrome-headless-shell-linux64.zip'
377+
dl_url = f'https://cdn.playwright.dev/builds/cft/{version}/linux64/{dl_file}'
369378
elif name == 'firefox':
370-
url_tp = 'https://playwright.azureedge.net/builds/firefox/%d/%s'
371379
if revision < 1140:
372380
dl_file = 'firefox-linux.zip'
373381
else:
374382
dl_file = 'firefox-ubuntu-22.04.zip'
383+
dl_url = (
384+
f'https://cdn.playwright.dev/builds/firefox/{revision}/{dl_file}'
385+
)
375386
elif name == 'webkit':
376-
url_tp = 'https://playwright.azureedge.net/builds/webkit/%d/%s'
377387
if revision < 1317:
378388
dl_file = 'minibrowser-gtk-wpe.zip'
379389
elif revision <= 2092:
380390
dl_file = 'webkit-ubuntu-20.04.zip'
381391
else:
382392
dl_file = 'webkit-ubuntu-24.04.zip'
393+
dl_url = (
394+
f'https://cdn.playwright.dev/builds/webkit/{revision}/{dl_file}'
395+
)
383396
elif name == 'ffmpeg':
384-
url_tp = 'https://playwright.azureedge.net/builds/ffmpeg/%d/%s'
385397
dl_file = 'ffmpeg-linux.zip'
398+
dl_url = (
399+
f'https://cdn.playwright.dev/builds/ffmpeg/{revision}/{dl_file}'
400+
)
386401
else:
387402
raise ValueError(f'Unknown playwright browser {name}')
388403

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

0 commit comments

Comments
 (0)