From ab981e2c0a6da409957a111e2f4b2df8124d4e80 Mon Sep 17 00:00:00 2001 From: "microsoft-playwright-automation[bot]" <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com> Date: Mon, 21 Sep 2026 21:03:44 +0000 Subject: [PATCH] feat(firefox): roll to r1551 --- .../firefox/juggler/NetworkObserver.js | 36 ++++++++++++++----- .../firefox/juggler/content/main.js | 2 +- packages/playwright-core/browsers.json | 2 +- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/browser_patches/firefox/juggler/NetworkObserver.js b/browser_patches/firefox/juggler/NetworkObserver.js index bc4428b996d24..e2e4f1993e07e 100644 --- a/browser_patches/firefox/juggler/NetworkObserver.js +++ b/browser_patches/firefox/juggler/NetworkObserver.js @@ -553,7 +553,7 @@ class NetworkRequest { responseStart: this.httpChannel.responseStartTime, }; - const { status, statusText, headers } = responseHead(this.httpChannel, opt_statusCode, opt_statusText); + const { status, statusText, headers } = responseHead(this.httpChannel, fromCache, opt_statusCode, opt_statusText); if (redirectStatus.includes(status) && this._overriddenHeadersForRedirect) this._overriddenHeadersForRedirect = filterHeadersForRedirect(this._overriddenHeadersForRedirect, this.httpChannel.requestMethod, status); let remoteIPAddress = undefined; @@ -968,19 +968,39 @@ class ResponseStorage { } } -function responseHead(httpChannel, opt_statusCode, opt_statusText) { - const headers = []; +function responseHead(httpChannel, fromCache, opt_statusCode, opt_statusText) { + let headers = []; let status = opt_statusCode || 0; let statusText = opt_statusText || ''; try { status = httpChannel.responseStatus; statusText = httpChannel.responseStatusText; - httpChannel.visitResponseHeaders({ - visitHeader: (name, value) => headers.push({name, value}), - }); } catch (e) { - // Response headers, status and/or statusText are not available - // when redirect did not actually hit the network. + if (e.result !== Cr.NS_ERROR_NOT_AVAILABLE) + console.error('Failed to read response status', e); + return { status, statusText, headers }; + } + const visitor = { + visitHeader: (name, value) => headers.push({name, value}), + }; + // Responses are cached after cookies and authentication headers are revalidated/pruned. + // As such, do not use the original headers as that may not reflect what was actually used. + if (!fromCache) { + try { + httpChannel.visitOriginalResponseHeaders(visitor); + } catch (e) { + if (e.result !== Cr.NS_ERROR_NOT_AVAILABLE) + console.error('Failed to read original response headers', e); + headers = []; + } + } + if (!headers.length) { + try { + httpChannel.visitResponseHeaders(visitor); + } catch (e) { + if (e.result !== Cr.NS_ERROR_NOT_AVAILABLE) + console.error('Failed to read response headers', e); + } } return { status, statusText, headers }; } diff --git a/browser_patches/firefox/juggler/content/main.js b/browser_patches/firefox/juggler/content/main.js index 8028692f876ce..5842ed8fb23ed 100644 --- a/browser_patches/firefox/juggler/content/main.js +++ b/browser_patches/firefox/juggler/content/main.js @@ -61,7 +61,7 @@ export function initialize(browsingContext, docShell) { for (const { worldName, name, script } of [...contextCrossProcessCookie.bindings, ...pageCrossProcessCookie.bindings]) data.frameTree.addBinding(worldName, name, script); data.frameTree.setInitScripts([...contextCrossProcessCookie.initScripts, ...pageCrossProcessCookie.initScripts]); - data.channel = new SimpleChannel('', 'process-' + Services.appinfo.processID); + data.channel = new SimpleChannel('', 'process-' + Services.appinfo.processID + '-' + helper.generateId()); data.pageAgent = new PageAgent(data.channel, data.frameTree); docShell.fileInputInterceptionEnabled = !!pageCrossProcessCookie.interceptFileChooserDialog; diff --git a/packages/playwright-core/browsers.json b/packages/playwright-core/browsers.json index 45dd907b98c57..94d8286f2622a 100644 --- a/packages/playwright-core/browsers.json +++ b/packages/playwright-core/browsers.json @@ -17,7 +17,7 @@ }, { "name": "firefox", - "revision": "1549", + "revision": "1551", "installByDefault": true, "browserVersion": "156.0", "title": "Firefox"