Closed Bug 2052932 Opened 9 days ago Closed 1 day ago

`emulation.setLocaleOverride` does not override `Accept-Language` header for in `Worker` for `fetch` and `WebSocket`

Categories

(Remote Protocol :: WebDriver BiDi, defect, P3)

defect

Tracking

(firefox154 fixed)

RESOLVED FIXED
154 Branch
Tracking Status
firefox154 --- fixed

People

(Reporter: hi, Assigned: hi)

References

(Blocks 1 open bug)

Details

(Whiteboard: [webdriver:m21][webdriver:external], [wptsync upstream])

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36 Edg/150.0.0.0

Steps to reproduce:

  1. navigate a top-level context to a page
  2. emulation.setLocaleOverride { locale: "de-DE", contexts: [<context>] }
  3. in the page, create a Worker with one/both of:
    • fetch("/echo-accept-language")
    • new WebSocket("ws://.../echo")
  4. for comparison, issue the same fetch and WebSocket from the document itself

Actual results:

document fetch and WebSocket handshake have Accept-Language: de-DE

Worker fetch and WebSocket have default Accept-Language

Expected results:

Worker fetch and WebSocket handshakes send Accept-Language: de-DE, matching document requests and matching the JS locale that bug 2015655 already emulates in Worker

Blocks: 1938048
See Also: → 1995691, 2015655

Bug 1995691 made emulation.setLocaleOverride override the Accept-Language request header, but only for document-initiated requests.
Bug 2015655 made the locale override apply to the JS realm and navigator.language in Worker and SharedWorker but it did not touch the Accept-Language header or WebSocket path.

HttpBaseChannel::Init builds Accept-Language from mLoadInfo->GetBrowsingContext()->Top()->GetLanguageOverride().
For Worker requests GetBrowsingContext() is null, and the code never consults GetAssociatedBrowsingContext(), which fetch() already populates on the channel's LoadInfo.

Worker WebSocket handshakes are additionally missing that association as the channel's LoadInfo never gets associatedBrowsingContextID set at all.

Assignee: nobody → hi
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Severity: -- → S3
Priority: -- → P3
Whiteboard: [webdriver:m21][webdriver:external]
Attachment #9605234 - Attachment description: Bug 2052932 - `emulation.setLocaleOverride` does not override `Accept-Language` header for in `Worker` for `fetch` and `WebSocket` → Bug 2052932 - [webdriver-bidi] `emulation.setLocaleOverride` does not override `Accept-Language` header for in `Worker` for `fetch` and `WebSocket`
Pushed by hskupin@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/a0439072852c https://hg.mozilla.org/integration/autoland/rev/2fa94676a276 [webdriver-bidi] `emulation.setLocaleOverride` does not override `Accept-Language` header for in `Worker` for `fetch` and `WebSocket` r=necko-reviewers,kershaw,jdescottes,whimboo

Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/61276 for changes under testing/web-platform/tests

Whiteboard: [webdriver:m21][webdriver:external] → [webdriver:m21][webdriver:external], [wptsync upstream]
Status: ASSIGNED → RESOLVED
Closed: 1 day ago
Resolution: --- → FIXED
Target Milestone: --- → 154 Branch

Upstream PR merged by moz-wptsync-bot

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: