Skip to content

Conversation

sadym-chromium
Copy link
Contributor

@sadym-chromium sadym-chromium commented Aug 18, 2025

Respect WebDriver BiDi emulated network offline condition in navigator.onLine property.

(See WHATWG Working Mode: Changes for more details.)


/infrastructure.html ( diff )
/system-state.html ( diff )

sadym-chromium added a commit to w3c/webdriver-bidi that referenced this pull request Oct 7, 2025
First step addressing #776.
* Fail all the intercepted requests, WebSocket and WebTransport.
* Html spec: whatwg/html#11575
* Fetch spec: whatwg/fetch#1852
@sadym-chromium sadym-chromium marked this pull request as ready for review October 8, 2025 12:28
@annevk
Copy link
Member

annevk commented Oct 8, 2025

I would suggest we introduce an "is online" abstraction in Fetch as part of whatwg/fetch#1852 and then make this getter return "is online".

@sadym-chromium
Copy link
Contributor Author

I would suggest we introduce an "is online" abstraction in Fetch as part of whatwg/fetch#1852 and then make this getter return "is online".

Ack, I will do

Copy link
Collaborator

@noamr noamr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Informal LGTM

@sadym-chromium
Copy link
Contributor Author

I would suggest we introduce an "is online" abstraction in Fetch as part of whatwg/fetch#1852 and then make this getter return "is online".

The only concern is that in the fetch spec we would still need to invoke WebDriver BiDi twice: in fetch and in "is online" getter.

@annevk
Copy link
Member

annevk commented Oct 8, 2025

Oh why? I thought that fetch could also use "is online". I guess in theory that would introduce novel behavior due to the extra condition, but in practice it already behaves like that when you're offline, no?

@sadym-chromium
Copy link
Contributor Author

sadym-chromium commented Oct 8, 2025

Oh why? I thought that fetch could also use "is online". I guess in theory that would introduce novel behavior due to the extra condition, but in practice it already behaves like that when you're offline, no?

I think with the current wording (in html) it's a chicken-egg problem:

The onLine attribute must return false if the user agent will not contact the network when the user follows links or when a script requests a remote page (or knows that such an attempt would fail), and must return true otherwise.

I'm not an expert here, but if you insist I can move this definition to the fetch spec. Please let me know if this is the preferred.

@annevk
Copy link
Member

annevk commented Oct 8, 2025

I'm not either. I was thinking we'd change that hand-wavy definition to another. Something like:

A user agent is considered to be online when the user agent assumes it has internet access.

@sadym-chromium
Copy link
Contributor Author

I'm not either. I was thinking we'd change that hand-wavy definition to another. Something like:

A user agent is considered to be online when the user agent assumes it has internet access.

So you want the HTML spec to refer the Fetch's environment is online, which in turn will refer to user agent is physically offline and environment is emulated offline (we need environment to get WebDriver BiDi Offline emulation status)?

@annevk
Copy link
Member

annevk commented Oct 9, 2025

Yeah, and Fetch's fetch algorithm would depend on the same primitive. Essentially the same thing we did as with the default User-Agent value, to avoid duplicating ourselves and making sure it all works in a consistent fashion.

@sadym-chromium
Copy link
Contributor Author

Yeah, and Fetch's fetch algorithm would depend on the same primitive. Essentially the same thing we did as with the default User-Agent value, to avoid duplicating ourselves and making sure it all works in a consistent fashion.

Done in whatwg/fetch#1852

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants