LibJS: Switch Agent [[CanBlock]] slot to a enum member

It turns out it was a mistake to make this a virtual since
ServiceWorkerAgents are effectively the exact same as
DedicatedWorkerAgents and SharedWorkerAgents just with [[CanBlock]]
set to false.
This commit is contained in:
Shannon Booth 2025-04-24 16:16:08 +12:00 committed by Andreas Kling
parent 7dd7e5b438
commit 5290ebfe19
Notes: github-actions[bot] 2025-04-25 14:45:34 +00:00
6 changed files with 31 additions and 9 deletions

View file

@ -20,6 +20,8 @@ namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/webappapis.html#similar-origin-window-agent
struct SimilarOriginWindowAgent : public Agent {
static NonnullOwnPtr<SimilarOriginWindowAgent> create();
// https://dom.spec.whatwg.org/#mutation-observer-compound-microtask-queued-flag
// Each similar-origin window agent has a mutation observer microtask queued (a boolean), which is initially false. [HTML]
bool mutation_observer_microtask_queued { false };
@ -41,8 +43,11 @@ struct SimilarOriginWindowAgent : public Agent {
Vector<GC::Root<DOM::Element>>& current_element_queue() { return custom_element_reactions_stack.element_queue_stack.last(); }
Vector<GC::Root<DOM::Element>> const& current_element_queue() const { return custom_element_reactions_stack.element_queue_stack.last(); }
// [[CanBlock]]
virtual bool can_block() const override;
private:
explicit SimilarOriginWindowAgent(CanBlock can_block)
: Agent(can_block)
{
}
};
SimilarOriginWindowAgent& relevant_similar_origin_window_agent(JS::Object const&);