mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-11-03 23:00:58 +00:00 
			
		
		
		
	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.
		
			
				
	
	
		
			31 lines
		
	
	
	
		
			902 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
	
		
			902 B
		
	
	
	
		
			C++
		
	
	
	
	
	
/*
 | 
						|
 * Copyright (c) 2025, Shannon Booth <shannon@serenityos.org>
 | 
						|
 *
 | 
						|
 * SPDX-License-Identifier: BSD-2-Clause
 | 
						|
 */
 | 
						|
 | 
						|
#pragma once
 | 
						|
 | 
						|
#include <LibGC/Root.h>
 | 
						|
#include <LibJS/Forward.h>
 | 
						|
#include <LibJS/Runtime/Agent.h>
 | 
						|
#include <LibWeb/Forward.h>
 | 
						|
 | 
						|
namespace Web::HTML {
 | 
						|
 | 
						|
struct Agent : public JS::Agent {
 | 
						|
    // https://html.spec.whatwg.org/multipage/webappapis.html#window-event-loop
 | 
						|
    // The event loop of a similar-origin window agent is known as a window event loop.
 | 
						|
    // The event loop of a dedicated worker agent, shared worker agent, or service worker agent is known as a worker event loop.
 | 
						|
    // And the event loop of a worklet agent is known as a worklet event loop.
 | 
						|
    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&);
 | 
						|
 | 
						|
}
 |