make Navigator::OnLine and WorkerNavigator::OnLine use self.upcast::<GlobalScope>() to obtain the is_online value to return

Signed-off-by: TG <ebiritg@gmail.com>
This commit is contained in:
TG 2025-05-19 10:49:37 +01:00
parent 93dcf9bb86
commit f30c759c94
2 changed files with 4 additions and 2 deletions

View file

@ -224,9 +224,10 @@ impl NavigatorMethods<crate::DomTypeHolder> for Navigator {
/// <https://html.spec.whatwg.org/multipage/#dom-navigator-online>
fn OnLine(&self) -> bool {
true
*self.global().is_online().lock().unwrap()
}
// https://html.spec.whatwg.org/multipage/#dom-navigator-plugins
fn Plugins(&self) -> DomRoot<PluginArray> {
self.plugins

View file

@ -19,6 +19,7 @@ use crate::dom::webgpu::gpu::GPU;
use crate::dom::workerglobalscope::WorkerGlobalScope;
use crate::script_runtime::{CanGc, JSContext};
// https://html.spec.whatwg.org/multipage/#workernavigator
#[dom_struct]
pub(crate) struct WorkerNavigator {
@ -107,7 +108,7 @@ impl WorkerNavigatorMethods<crate::DomTypeHolder> for WorkerNavigator {
/// <https://html.spec.whatwg.org/multipage/#dom-navigator-online>
fn OnLine(&self) -> bool {
true
*self.global().is_online().lock().unwrap()
}
// https://w3c.github.io/permissions/#navigator-and-workernavigator-extension