Skip to content

Commit 04f1dbc

Browse files
committed
LibWeb/HTML: Update BroadcastChannel::is_eligible_for_messaging() spec
Corresponds to part of: whatwg/html@e9ccb97 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().
1 parent ed5169a commit 04f1dbc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Libraries/LibWeb/HTML/BroadcastChannel.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,14 @@ bool BroadcastChannel::is_eligible_for_messaging() const
8888
auto const& global = relevant_global_object(*this);
8989

9090
// * a Window object whose associated Document is fully active, or
91-
if (is<Window>(global))
92-
return static_cast<Window const&>(global).associated_document().is_fully_active();
91+
if (auto* window = as_if<Window>(global))
92+
return window->associated_document().is_fully_active();
9393

94-
// * a WorkerGlobalScope object whose closing flag is false and whose worker is not a suspendable worker.
94+
// * a WorkerGlobalScope object whose closing flag is false and is not suspendable.
9595
// FIXME: Suspendable worker
96-
if (is<WorkerGlobalScope>(global))
97-
return !static_cast<WorkerGlobalScope const&>(global).is_closing();
96+
if (auto* worker_global_scope = as_if<WorkerGlobalScope>(global)) {
97+
return !worker_global_scope->is_closing();
98+
}
9899

99100
return false;
100101
}

0 commit comments

Comments
 (0)