LibWeb/HTML: Update BroadcastChannel::is_eligible_for_messaging() spec

Corresponds to part of:
e9ccb97eb1

The majority of that spec change is in algorithms that we don't yet
implement. So this is just a small text change and an update to use
as_if() instead of static_cast().
This commit is contained in:
Sam Atkins 2025-11-27 14:01:01 +00:00
parent ed5169af8d
commit 04f1dbce2e
Notes: github-actions[bot] 2025-12-01 11:09:19 +00:00

View file

@ -88,13 +88,14 @@ bool BroadcastChannel::is_eligible_for_messaging() const
auto const& global = relevant_global_object(*this);
// * a Window object whose associated Document is fully active, or
if (is<Window>(global))
return static_cast<Window const&>(global).associated_document().is_fully_active();
if (auto* window = as_if<Window>(global))
return window->associated_document().is_fully_active();
// * a WorkerGlobalScope object whose closing flag is false and whose worker is not a suspendable worker.
// * a WorkerGlobalScope object whose closing flag is false and is not suspendable.
// FIXME: Suspendable worker
if (is<WorkerGlobalScope>(global))
return !static_cast<WorkerGlobalScope const&>(global).is_closing();
if (auto* worker_global_scope = as_if<WorkerGlobalScope>(global)) {
return !worker_global_scope->is_closing();
}
return false;
}