From 576b51c550c69228ebd3df05de98d59794da61bb Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Tue, 3 Mar 2026 16:48:33 +0100 Subject: [PATCH 1/2] Restore --unsafely-treat-insecure-origin-as-secure flag for Blazor WASM Lighthouse scenario Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/BenchmarksApps/Lighthouse/src/blazor-scenario.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/BenchmarksApps/Lighthouse/src/blazor-scenario.js b/src/BenchmarksApps/Lighthouse/src/blazor-scenario.js index c1b4be995..18660f3e7 100644 --- a/src/BenchmarksApps/Lighthouse/src/blazor-scenario.js +++ b/src/BenchmarksApps/Lighthouse/src/blazor-scenario.js @@ -24,7 +24,13 @@ logReadyStateText(); // Required by the Crank job const browser = await puppeteer.launch({ headless: headless === 'true', - args: ['--no-sandbox'] + args: [ + '--no-sandbox', + // Treat the target URL as a secure origin so that crypto.subtle is available. + // This is needed because Blazor WASM requires crypto.subtle, which is only + // available in secure contexts (HTTPS or localhost). + `--unsafely-treat-insecure-origin-as-secure=${targetBaseUrl}`, + ], }); const pageUrl = `${targetBaseUrl}/counter`; From aae2433a65b04534a5ccd94b4006fdd246d34226 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Tue, 3 Mar 2026 18:21:31 +0100 Subject: [PATCH 2/2] Also accept cached (fromCache) responses in WASM caching check The WASM caching enforcement check previously only accepted HTTP 304 (Not Modified) as proof that a .wasm resource was cached. However, browsers may serve cached resources with HTTP 200 from disk/memory cache without making a network round-trip at all. Puppeteer exposes this via response.fromCache(). Both cases indicate the resource was properly cached after the first page load, so both should be accepted. Without this fix, the 'Second page load' step fails with: Unexpected uncached wasm resource '...System.Runtime.InteropServices.JavaScript.*.wasm' even though the resource is served from the browser cache. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/BenchmarksApps/Lighthouse/src/blazor-scenario.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/BenchmarksApps/Lighthouse/src/blazor-scenario.js b/src/BenchmarksApps/Lighthouse/src/blazor-scenario.js index 18660f3e7..ddebd8a8b 100644 --- a/src/BenchmarksApps/Lighthouse/src/blazor-scenario.js +++ b/src/BenchmarksApps/Lighthouse/src/blazor-scenario.js @@ -132,7 +132,8 @@ function throwOnFutureUncachedWasmDownloads(page) { page.on('requestfinished', request => { const url = request.url(); - if (url.endsWith('.wasm') && request.response().status() !== 304) { + const response = request.response(); + if (url.endsWith('.wasm') && response.status() !== 304 && !response.fromCache()) { throw new Error(`Unexpected uncached wasm resource '${url}'`); } });