w3c / webdriver-bidi

Bidirectional WebDriver protocol for browser automation
https://w3c.github.io/webdriver-bidi/
336 stars 35 forks source link

Network Intercept: Removing in-flight (blocked) network intercepts #550

Closed thiagowfx closed 9 months ago

thiagowfx commented 10 months ago

What should happen in the following scenario?

  1. Add a network intercept, for example, to https://example.org/ (string pattern), all phases.
  2. Make a navigation to https://example.org. We know that the request will not complete, as it's actively blocked.
  3. Remove the network intercept added in the first step.

What happens to the in-flight navigation in step 2)?

Should the "remove intercept" step fail the in-flight request, or should it be left alone, untouched?

Let's assume the answer is "leave it alone".

Then, if I make another navigation to https://example.org, using the same browsing context, the request should remain blocked, as it is "stuck" from the initial navigation.

Does this sound correct? cc @jgraham @juliandescottes

Spec: https://w3c.github.io/webdriver-bidi/#network-intercepts

(also cc @sadym-chromium @OrKoN)

thiagowfx commented 10 months ago

In other words: The question here is whether "remove intercept" should also remove actively blocked requests.

OrKoN commented 10 months ago

Should the "remove intercept" step fail the in-flight request, or should it be left alone, untouched?

I think it should be possible to continue interception for the in-flight request.

Then, if I make another navigation to https://example.org, using the same browsing context, the request should remain blocked, as it is "stuck" from the initial navigation.

Should not the new navigation abort the previous navigation, which aborts the first request, and then the second navigation and the second request should not be intercepted because the intercept configuration was removed?

Is it a question based on observation (of a bug) or is it hypothetical?

thiagowfx commented 9 months ago

I think it should be possible to continue interception for the in-flight request.

In other words: "leave it alone" (as described in my first comment), correct?

Should not the new navigation abort the previous navigation, which aborts the first request, and then the second navigation and the second request should not be intercepted because the intercept configuration was removed?

Yes. Agreed. Thanks, this part I had originally misunderstood.

Is it a question based on observation (of a bug) or is it hypothetical?

Just hypothetical. I'm writing a test for it: test_fail_request_remove_intercept_inflight_request in test_fail_request.py in https://github.com/GoogleChromeLabs/chromium-bidi/pull/1409

thiagowfx commented 9 months ago

Closing as there's no needed AI here. This was just to request clarification.