mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-05 16:41:52 +00:00
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:
parent
7dd7e5b438
commit
5290ebfe19
Notes:
github-actions[bot]
2025-04-25 14:45:34 +00:00
Author: https://github.com/shannonbooth
Commit: 5290ebfe19
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4453
6 changed files with 31 additions and 9 deletions
|
@ -21,6 +21,9 @@ struct Agent : public JS::Agent {
|
|||
GC::Root<HTML::EventLoop> event_loop;
|
||||
|
||||
virtual void spin_event_loop_until(GC::Root<GC::Function<bool()>> goal_condition) override;
|
||||
|
||||
protected:
|
||||
using JS::Agent::Agent;
|
||||
};
|
||||
|
||||
Agent& relevant_agent(JS::Object const&);
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
|
||||
namespace Web::HTML {
|
||||
|
||||
bool SimilarOriginWindowAgent::can_block() const
|
||||
NonnullOwnPtr<SimilarOriginWindowAgent> SimilarOriginWindowAgent::create()
|
||||
{
|
||||
// similar-origin window agents can not block, see: https://html.spec.whatwg.org/multipage/webappapis.html#obtain-similar-origin-window-agent
|
||||
return false;
|
||||
// See 'creating an agent' step in: https://html.spec.whatwg.org/multipage/webappapis.html#obtain-similar-origin-window-agent
|
||||
return adopt_own(*new SimilarOriginWindowAgent(CanBlock::No));
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#relevant-agent
|
||||
|
|
|
@ -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&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue