Closed Bug 1997556 Opened 3 months ago Closed 3 months ago

Emulation settings are overridden on context creation when applying multiple emulations at once

Categories

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

defect
Points:
2

Tracking

(firefox-esr140 unaffected, firefox144 unaffected, firefox145 unaffected, firefox146 fixed)

RESOLVED FIXED
146 Branch
Tracking Status
firefox-esr140 --- unaffected
firefox144 --- unaffected
firefox145 --- unaffected
firefox146 --- fixed

People

(Reporter: hbenl, Assigned: Sasha)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression, Whiteboard: [webdriver:m18], [wptsync upstream])

Attachments

(2 files)

This Playwright test recently started failing. It evaluates new Date(1479579154987).toString() which returns "Sat Nov 19 2016 19:12:34 GMT+0100 (Central European Standard Time)" instead of the expected "Sat Nov 19 2016 19:12:34 GMT+0100 (Mitteleuropäische Normalzeit)". I verified that it was regressed by Bug 1988725.
Interestingly the Playwright test passes when I remove the timezoneId from it.
I was unable to reproduce the issue without Playwright (i.e. in a wdspec test) so far.

Set release status flags based on info from the regressing bug 1988725

:Sasha, since you are the author of the regressor, bug 1988725, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Assignee: nobody → aborovova
Status: NEW → ASSIGNED
Flags: needinfo?(aborovova)

Ok, I could reproduce it. The issue happens when we set multiple emulation at once, like in this case locale and timezone, so then when they're applied on the browser context creation timezone overrides locale (that's why removing timezone ID resolves the issue). The fix is coming.

FWIW, this test reproduces it:

async def test_locale_affects_date_formatting(bidi_session, create_user_context, get_current_locale, some_locale):

    user_context = await create_user_context()

    await bidi_session.emulation.set_locale_override(
        user_contexts=[user_context],
        locale=some_locale
    )

    await bidi_session.emulation.set_timezone_override(
        user_contexts=[user_context],
        timezone="Europe/Berlin"
    )

    context_in_user_context = await bidi_session.browsing_context.create(
        user_context=user_context, type_hint="tab"
    )

    formatted_date = await bidi_session.script.evaluate(
        expression="new Date(1479579154987).toString()",
        target=ContextTarget(context_in_user_context["context"]),
        await_promise=False,
    )
    assert formatted_date["value"] == "Sat Nov 19 2016 19:12:34 GMT+0100 (Mitteleuropäische Normalzeit)"

This test passes if I remove the timezone override or if I move browsing_context.create up before emulation.set_locale_override.

Points: --- → 2
Priority: -- → P2
Whiteboard: [webdriver:m18]
Pushed by aborovova@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/d47322285bb1 https://hg.mozilla.org/integration/autoland/rev/798ce7663725 [webdriver-bidi] Do not override emulations when applying them to newly created browsing context. r=jdescottes https://github.com/mozilla-firefox/firefox/commit/ce61ed0fc593 https://hg.mozilla.org/integration/autoland/rev/a15226bdc709 [wdspec] Add a test for setting locale and timezone override at the same time. r=jdescottes
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/55793 for changes under testing/web-platform/tests
Whiteboard: [webdriver:m18] → [webdriver:m18], [wptsync upstream]
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 146 Branch
Upstream PR merged by moz-wptsync-bot
Severity: -- → S3
Summary: Regression (Playwright): dates not formatted correctly with locale override → Emulation settings are overridden on context creation when applying multiple emulations at once
Whiteboard: [webdriver:m18], [wptsync upstream] → [webdriver:m18], [wptsync upstream][webdriver:relnote]
Whiteboard: [webdriver:m18], [wptsync upstream][webdriver:relnote] → [webdriver:m18], [wptsync upstream]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: