Open Bug 1940568 Opened 7 months ago Updated 6 months ago

fetchError event is not received for intercepted requests

Categories

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

defect
Points:
3

Tracking

(Not tracked)

People

(Reporter: jdescottes, Unassigned)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [webdriver:backlog])

Related to the following playwright test:

page/page-request-continue.spec.ts :: should not throw if request was cancelled by the page

STRs:

  • subscribe to fetchError and beforeRequestSent events
  • intercept a request in beforeRequestSent phase
  • abort the request (eg with an AbortController driving a fetch call)

On Chrome, a fetchError will be received without having to resume the request.
On Firefox the fetchError event will only be received once the request is resumed.

wdspec test showing the issue:

@pytest.mark.asyncio
async def test_fetch_error_during_intercept(
    subscribe_events,
    setup_network_test,
    url,
    add_intercept,
    wait_for_event,
    fetch,
):
    await setup_network_test(
        events=[
            BEFORE_REQUEST_SENT_EVENT,
            FETCH_ERROR_EVENT,
        ],
    )

    text_url = url(PAGE_EMPTY_TEXT)

    await add_intercept(
        phases=["beforeRequestSent"],
        url_patterns=[{"type": "string", "pattern": text_url}],
    )

    on_network_event = wait_for_event(FETCH_ERROR_EVENT)

    # Send a fetch that will be blocked by the intercept, and will be aborted
    # after 1 second.
    with pytest.raises(ScriptEvaluateResultException):
        await fetch(text_url, timeout_in_seconds=1)

    await on_network_event

Might turn out to be very complex if we need platform changes here.

Points: --- → 3
Priority: -- → P2
Whiteboard: [webdriver:backlog]
Severity: -- → S3
You need to log in before you can comment on or make changes to this bug.