mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-19 08:51:57 +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
|
@ -16,12 +16,26 @@ namespace JS {
|
|||
// https://tc39.es/ecma262/#sec-agents
|
||||
class Agent {
|
||||
public:
|
||||
enum class CanBlock {
|
||||
Yes,
|
||||
No,
|
||||
};
|
||||
|
||||
virtual ~Agent();
|
||||
|
||||
// [[CanBlock]]
|
||||
virtual bool can_block() const = 0;
|
||||
CanBlock can_block() const { return m_can_block; }
|
||||
|
||||
virtual void spin_event_loop_until(GC::Root<GC::Function<bool()>> goal_condition) = 0;
|
||||
|
||||
protected:
|
||||
explicit Agent(CanBlock can_block)
|
||||
: m_can_block(can_block)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
// [[CanBlock]]
|
||||
CanBlock m_can_block { false };
|
||||
};
|
||||
|
||||
bool agent_can_suspend(VM const&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue