Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Chromium returns "en-US@posix" for navigator.language #34046

Open
Torgen opened this issue Dec 17, 2024 · 6 comments
Open

[Bug]: Chromium returns "en-US@posix" for navigator.language #34046

Torgen opened this issue Dec 17, 2024 · 6 comments

Comments

@Torgen
Copy link

Torgen commented Dec 17, 2024

Version

1.49.0 and 1.49.1

Steps to reproduce

in node repl:

const { chromium } = require('playwright')
await browser = chromium.launch()
await page = browser.newPage()
await page.evaluate("navigator.language")

Expected behavior

It should return any legal BCP47 language code.

Actual behavior

'en-US@posix'

Additional context

Running on Ubuntu 24.04 on WSL2, but something similarly illegal is getting returned on my github actions runners based on how my tests are failing in Torgen/codex-blackboard#1361 and Torgen/codex-blackboard#1374. Basically it's consistent with https://github.com/Torgen/codex-blackboard/blob/master/client/imports/timestamp.js throwing an error when I try to pass navigator.language to the constructor of Intl.DateTimeFormat at the module top level. I don't expect you to run those, but they're how I noticed there was a problem.

Environment

System:
    OS: Linux 5.4 Ubuntu 24.04 LTS 24.04 LTS (Noble Numbat)
    CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
    Memory: 7.06 GB / 7.73 GB
    Container: Yes
  Binaries:
    Node: 18.19.1 - /usr/bin/node
    Yarn: 1.22.22 - /usr/local/bin/yarn
    npm: 9.2.0 - /usr/bin/npm
  IDEs:
    VSCode: 1.95.3 - /mnt/c/Users/Dan/AppData/Local/Programs/Microsoft VS Code/bin/code
  Languages:
    Bash: 5.2.21 - /usr/bin/bash
  npmPackages:
    @playwright/browser-chromium: ^1.49.1 => 1.49.1
    @playwright/browser-firefox: ^1.49.1 => 1.49.1
    playwright: ^1.49.1 => 1.49.1
@pavelfeldman
Copy link
Member

adobe/react-spectrum#7457 has a good analysis and links. Sounds like overriding language in the config is the only workaround.

@krassowski
Copy link

This has bitten Jupyter ecosystem as well, breaking CI on dozens of repositories. If my understanding is correct, this would be a bug in Chromium and not in playwright, correct?

I see that the Chromium team stumbled upon this in May and committed a workaround for their use case in https://issues.chromium.org/issues/337047877.

@Torgen
Copy link
Author

Torgen commented Dec 18, 2024

Tried setting LANG=en_US on both my node repl example and on my actual tests and it seemed to be an effective workaround.

@mxschmitt
Copy link
Member

I was not able to reproduce on WSL2 with Ubuntu 24.04 on Windows 11. @Torgen what was the original value of echo $LANG? or did env yield something interesting?

@Torgen
Copy link
Author

Torgen commented Dec 18, 2024

$ echo $LANG
C.UTF-8

@pavelfeldman
Copy link
Member

@krassowski

If my understanding is correct, this would be a bug in Chromium and not in playwright, correct?

Yes, and the workaround with setting the LANG env variable above sounds like the easiest fix. It is a little hard to file the issue upstream https://issues.chromium.org/issues?q=status:open without the repro. If you have the repro, could you file it and mention it here? The issue you point to only mentions it briefly, so it was not addressed in full.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants