1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:48:11 +00:00

LibWeb: Make WorkerNavigator GC-allocated

This commit is contained in:
Andreas Kling 2022-09-04 14:37:49 +02:00
parent 9da72cdaba
commit 2fe97fa8db
8 changed files with 51 additions and 14 deletions

View file

@ -22,12 +22,18 @@ namespace Web::HTML {
WorkerGlobalScope::WorkerGlobalScope(JS::Realm& realm)
: DOM::EventTarget(realm)
, m_navigator(make_ref_counted<WorkerNavigator>())
{
}
WorkerGlobalScope::~WorkerGlobalScope() = default;
void WorkerGlobalScope::initialize(JS::Realm& realm)
{
Base::initialize(realm);
m_navigator = WorkerNavigator::create(*this);
}
void WorkerGlobalScope::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
@ -69,7 +75,7 @@ JS::NonnullGCPtr<WorkerLocation> WorkerGlobalScope::location() const
}
// https://html.spec.whatwg.org/multipage/workers.html#dom-worker-navigator
NonnullRefPtr<WorkerNavigator const> WorkerGlobalScope::navigator() const
JS::NonnullGCPtr<WorkerNavigator> WorkerGlobalScope::navigator() const
{
// The navigator attribute of the WorkerGlobalScope interface must return an instance of the WorkerNavigator interface,
// which represents the identity and state of the user agent (the client).