Closed Bug 1769514 Opened 2 years ago Closed 8 months ago

Add support for handling pushstate/popstate to "browsingContext.navigate"

Categories

(Remote Protocol :: WebDriver BiDi, task)

task

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1861655

People

(Reporter: whimboo, Unassigned)

References

(Blocks 1 open bug)

Details

Single page applications will use pushstate and popstate to navigate through different pages of the website. We should have coverage for these scenarios.

The WebProgress listener supports the LOCATION_CHANGE_SAME_DOCUMENT flag for onLocationChange notifications, which can be used here.

https://searchfox.org/mozilla-central/rev/da6a85e615827d353e5ca0e05770d8d346b761a9/uriloader/base/nsIWebProgressListener.idl#426-429

Priority: -- → P3

To test this feature the wdspec tests should be able to evaluate code in the given browsing context. This work is done on bug 1742979.

Depends on: 1742979
Duplicate of this bug: 1861719

Resetting priority because this missing feature blocks a P1 Puppeteer test. See more details on bug 1861719.

Here a wdspec test example which fails because a new navigation id is created:

async def test_navigate_history_pushstate(bidi_session, inline, new_tab, wait_for_event):
    NAVIGATION_STARTED_EVENT = "browsingContext.navigationStarted"
    await bidi_session.session.subscribe(events=[NAVIGATION_STARTED_EVENT])

    on_entry = wait_for_event(NAVIGATION_STARTED_EVENT)
    url = inline("""
        <script>
            window.addEventListener('DOMContentLoaded', () => {
            history.pushState({}, '', '#1');
            });
        </script>""")
    result = await bidi_session.browsing_context.navigate(
        context=new_tab["context"], url=url, wait="complete"
    )
    event = await on_entry

    assert event["navigation"] == result["navigation"]
Priority: P3 → --

I think this might also be addressed by Bug 1861655, but it's an interesting scenario.

Depends on: 1861655
Status: NEW → RESOLVED
Closed: 8 months ago
Duplicate of bug: 1861655
Resolution: --- → DUPLICATE
Whiteboard: [webdriver:backlog]
You need to log in before you can comment on or make changes to this bug.