Skip to content

[Bug]: Firefox response.text() fails for Content-Encoding: Identity #42501

Description

@ghostarmor

Version

1.62.1

Steps to reproduce

I created a minimal reproduction with a local HTTP server:

https://github.com/ghostarmor/playwright-firefox-identity-repro

Run:

npm ci
npx playwright install firefox chromium
npx playwright test --project=firefox

The server returns a plain-text response with this header:
Content-Encoding: Identity
The test calls response.text() on the response returned by page.goto().
For comparison, run:
npx playwright test --project=chromium
The same test passes in Chromium.

Expected behavior

response.text() should return "hello" in Firefox, matching Chromium.
The Firefox page navigation itself succeeds, so Firefox can consume and display the response. The failure occurs when Playwright tries to retrieve the body through Network.getResponseBody.

Actual behavior

Firefox throws:

Error: response.text: Protocol error (Network.getResponseBody): Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIStreamConverterService.asyncConvertData]
Response body is not available for a response that was navigated away from. Read response.body() before triggering any navigation.

No second navigation occurs before response.text() is called.

Additional context

This appears related to #39160, but the failure is different. That issue failed in nsIStreamListener.onDataAvailable while handling Brotli responses and was marked fixed for Playwright 1.60.
This reproduction still fails in Playwright 1.62.1. It fails in nsIStreamConverterService.asyncConvertData when the response declares Content-Encoding: Identity.
My current suspicion is that Firefox Juggler attempts to create a stream converter for Identity instead of treating it as an unencoded response.
Explicitly sending Content-Encoding: identity is unnecessary and discouraged, but real servers still return it. Firefox accepts the response, and Playwright's Chromium implementation handles the same response correctly.

Environment

System:
    OS: macOS 14.6
    CPU: (11) arm64 Apple M3 Pro
    Memory: 105.55 MB / 18.00 GB
  Binaries:
    Node: 25.2.1 - /opt/homebrew/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 11.6.2 - /opt/homebrew/bin/npm
    pnpm: 10.6.5 - /opt/homebrew/bin/pnpm
  IDEs:
    VSCode: 3.15.6 - /usr/local/bin/code
    Cursor: 3.15.6 - /usr/local/bin/cursor
    Claude Code: 2.1.62 - /Users/aryanshah/.local/bin/claude
    Codex: 0.152.0 - /opt/homebrew/bin/codex
  Languages:
    Bash: 5.2.32 - /opt/homebrew/bin/bash
  npmPackages:
    @playwright/test: 1.62.1 => 1.62.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions