Skip to content

[Bug]: WebKit/macOS: Set-Cookie headers with Expires commas aren’t split; second cookie lost #38311

@weillercarvalho

Description

@weillercarvalho

Version

1.58.0-next

Steps to reproduce

  1. Clone the repo and install deps:
     git clone https://github.com/microsoft/playwright.git
     cd playwright
     npm ci
     npm run watch  
  2. Run this minimal repro script (mirrors WebKit/macOS path where set-cookie separator is ,):
     node - <<'NODE'
     const { headersObjectToArray } = require('./packages/playwright-core/lib/utils/isomorphic/headers');
     const value = 'id=1; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/, session=abc; Secure';
     console.log(headersObjectToArray({ 'Set-Cookie': value }, ',', ','));
     NODE
  3. Observe the output is a single entry:
     [ { name: 'Set-Cookie', value: 'id=1; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/, session=abc; Secure' } ]

Expected behavior

The header is split into two cookies:

  • id=1; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/
  • session=abc; Secure

Actual behavior

The entire header is kept as a single Set-Cookie value (id=1; ... Path=/, session=abc; Secure), causing the second cookie to be lost/corrupted.

Additional context

No response

Environment

System:
    OS: Linux 6.6 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz
    Memory: 6.59 GB / 7.61 GB
    Container: Yes
  Binaries:
    Node: 24.11.1 - /home/weillercarvalho/.nvm/versions/node/v24.11.1/bin/node
    Yarn: 1.22.22 - /home/weillercarvalho/.nvm/versions/node/v24.11.1/bin/yarn
    npm: 11.6.2 - /home/weillercarvalho/.nvm/versions/node/v24.11.1/bin/npm
    pnpm: 10.22.0 - /home/weillercarvalho/.nvm/versions/node/v24.11.1/bin/pnpm
  IDEs:
    VSCode: 1.106.2 - /mnt/c/Users/engwe/AppData/Local/Programs/Microsoft VS Code/bin/code
    Codex: 0.63.0 - /home/weillercarvalho/.nvm/versions/node/v24.11.1/bin/codex
  Languages:
    Bash: 5.1.16 - /usr/bin/bash

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions