Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit behavior for removing last NetworkIntercept #663

Closed
Lightning00Blade opened this issue Feb 16, 2024 · 2 comments · Fixed by #665
Closed

Explicit behavior for removing last NetworkIntercept #663

Lightning00Blade opened this issue Feb 16, 2024 · 2 comments · Fixed by #665
Labels
module-network Network module needs-discussion Issues to be discussed by the working group

Comments

@Lightning00Blade
Copy link
Contributor

Lightning00Blade commented Feb 16, 2024

Currently there is an implicit behavior when removing the last intercept from the session's intercept map.
Let's say we do the following steps:

  1. We subscribe to the network module
  2. We add network interception for URL A (phase BeforeRequestSent).
  3. We make a fetch request from the page to URL A.
  4. The BeforeRequestSent get emitted and event get a isBlocked: true and intecepts: [ "<ID>" ]
  5. We remove the network interception.
  6. The request continues to wait for a network.continueRequest command

The question here is if this would be the expected from the user?

I think we should either:

  • Mention this behavior explicitly as a note in the network.removeIntercept command.
  • Fail the network.removeIntercept command when there are request in-flight that are being blocked only by this.
  • Continue the request as if the network.continueRequest command were called.

Note: This was discovered as CDP's behavior is to continue the request if interception is removed.

@Lightning00Blade Lightning00Blade added needs-discussion Issues to be discussed by the working group module-network Network module labels Feb 16, 2024
@juliandescottes
Copy link
Contributor

The first option sounds good. Since the intercept is only really necessary to block the request I think the current behavior is fine, and calling it out explicitly in the spec could be enough.

@OrKoN
Copy link
Contributor

OrKoN commented Feb 20, 2024

I think it's worth mentioning as non-normative note (first option) because the spec already defined this behavior. About CDP implementation: we will need to keep the interception on, until the last request is handled, and auto-continue new requests.

@mathiasbynens mathiasbynens changed the title Explicit behavior for removing last NetworkIntecept Explicit behavior for removing last NetworkIntercept Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module-network Network module needs-discussion Issues to be discussed by the working group
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants