Skip to content

Commit 9e09711

Browse files
ilonatommyCopilot
andcommitted
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 <[email protected]>
1 parent 630c387 commit 9e09711

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/BenchmarksApps/Lighthouse/src/blazor-scenario.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ function throwOnFutureUncachedWasmDownloads(page) {
132132

133133
page.on('requestfinished', request => {
134134
const url = request.url();
135-
if (url.endsWith('.wasm') && request.response().status() !== 304) {
135+
const response = request.response();
136+
if (url.endsWith('.wasm') && response.status() !== 304 && !response.fromCache()) {
136137
throw new Error(`Unexpected uncached wasm resource '${url}'`);
137138
}
138139
});

0 commit comments

Comments
 (0)