content/dom: set navigator.onLine attribute to true (#36560)

Sets the navigator.onLine attribute to true.

Testing:
Ran `./mach run https://pinterest.com
--enable-experimental-web-platform-features`. This doesn't show the
"Hmm..you're not connected to the internet" text anymore.
<img width="1027" alt="Screenshot 2025-04-16 at 11 31 02 AM"
src="https://github.com/user-attachments/assets/3745077b-dc51-42ce-88a0-38d5f157fc0c"
/>


part of: #36554

---------

Signed-off-by: Siddhant N. Trivedi <sidntrivedi012@gmail.com>
Signed-off-by: Siddhant N Trivedi <sidntrivedi012@gmail.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Siddhant N Trivedi 2025-04-19 07:04:13 +05:30 committed by GitHub
parent c787688afc
commit 7ee9d07a9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 18 additions and 24 deletions

View file

@ -9,7 +9,7 @@ interface Navigator {
};
Navigator includes NavigatorID;
Navigator includes NavigatorLanguage;
//Navigator includes NavigatorOnLine;
Navigator includes NavigatorOnLine;
//Navigator includes NavigatorContentUtils;
//Navigator includes NavigatorStorageUtils;
Navigator includes NavigatorPlugins;
@ -43,6 +43,12 @@ interface mixin NavigatorLanguage {
readonly attribute any languages;
};
// https://html.spec.whatwg.org/multipage/#dom-navigator-online
[Exposed=(Window,Worker)]
interface mixin NavigatorOnLine {
readonly attribute boolean onLine;
};
// https://html.spec.whatwg.org/multipage/#navigatorplugins
interface mixin NavigatorPlugins {
[SameObject] readonly attribute PluginArray plugins;

View file

@ -7,7 +7,7 @@
interface WorkerNavigator {};
WorkerNavigator includes NavigatorID;
WorkerNavigator includes NavigatorLanguage;
//WorkerNavigator includes NavigatorOnLine;
WorkerNavigator includes NavigatorOnLine;
WorkerNavigator includes NavigatorConcurrentHardware;
// https://w3c.github.io/permissions/#navigator-and-workernavigator-extension