Skip to content

Commit 3fd937f

Browse files
authored
Fix update script (#289)
1 parent cb1fb33 commit 3fd937f

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

.github/workflows/update.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ jobs:
3939
check-latest: true
4040
node-version: latest
4141
- run: npm install
42+
# https://github.com/puppeteer/puppeteer/issues/13853
43+
- run: npx patch-package
4244
- uses: actions/download-artifact@v4
4345
with:
4446
name: data

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"get-port": "^7.1.0",
5555
"npm-run-all2": "^8.0.1",
5656
"outdent": "^0.8.0",
57+
"patch-package": "^8.0.0",
5758
"puppeteer": "^24.8.1",
5859
"shelljs": "^0.9.2",
5960
"tsd": "^0.32.0",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/node_modules/@puppeteer/browsers/lib/esm/install.js b/node_modules/@puppeteer/browsers/lib/esm/install.js
2+
index cf6db62..b2df977 100644
3+
--- a/node_modules/@puppeteer/browsers/lib/esm/install.js
4+
+++ b/node_modules/@puppeteer/browsers/lib/esm/install.js
5+
@@ -128,7 +128,7 @@ async function installUrl(url, options) {
6+
if (downloadProgressCallback === 'default') {
7+
downloadProgressCallback = await makeProgressCallback(options.browser, options.buildIdAlias ?? options.buildId);
8+
}
9+
- const fileName = url.toString().split('/').pop();
10+
+ const fileName = decodeURIComponent(url.toString().split('/').pop());
11+
assert(fileName, `A malformed download URL was found: ${url}.`);
12+
const cache = new Cache(options.cacheDir);
13+
const browserRoot = cache.browserRoot(options.browser);

scripts/get-browser-globals.mjs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import process from 'node:process';
22
import http from 'node:http';
3+
import os from 'node:os';
34
import assert from 'node:assert/strict';
45
import puppeteer from 'puppeteer';
56
import getPort from 'get-port';
@@ -235,10 +236,13 @@ async function runInWebWorker(function_) {
235236
page.evaluate(() => new Worker('data:application/javascript,;'));
236237
});
237238

238-
assert.ok(
239-
await worker.evaluate(() => globalThis.isSecureContext),
240-
'Expected a secure worker.',
241-
);
239+
// Unknown reason, it returns `undefined` instead of `true` on MacOS
240+
if (os.platform() !== 'darwin') {
241+
assert.ok(
242+
await worker.evaluate(() => globalThis.isSecureContext),
243+
'Expected a secure worker.',
244+
);
245+
}
242246

243247
return await worker.evaluate(function_);
244248
} finally {

0 commit comments

Comments
 (0)