1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:37:35 +00:00

LibWeb/HTML: Store NonnullGCPtr in browsing context set

These are never supposed to be null.
This commit is contained in:
Linus Groh 2023-04-20 16:44:54 +01:00
parent af20b74a83
commit 4ee72420e8
3 changed files with 4 additions and 4 deletions

View file

@ -80,7 +80,7 @@ JS::NonnullGCPtr<BrowsingContext> BrowsingContext::create_a_new_top_level_browsi
auto group = BrowsingContextGroup::create_a_new_browsing_context_group(page); auto group = BrowsingContextGroup::create_a_new_browsing_context_group(page);
// 2. Return group's browsing context set[0]. // 2. Return group's browsing context set[0].
return *(*group->browsing_context_set().begin()); return *group->browsing_context_set().begin();
} }
// https://html.spec.whatwg.org/multipage/browsers.html#creating-a-new-browsing-context // https://html.spec.whatwg.org/multipage/browsers.html#creating-a-new-browsing-context
@ -858,7 +858,7 @@ void BrowsingContext::remove()
set_group(nullptr); set_group(nullptr);
// 4. Remove browsingContext from group's browsing context set. // 4. Remove browsingContext from group's browsing context set.
group->browsing_context_set().remove(this); group->browsing_context_set().remove(*this);
// 5. If group's browsing context set is empty, then remove group from the user agent's browsing context group set. // 5. If group's browsing context set is empty, then remove group from the user agent's browsing context group set.
// NOTE: This is done by ~BrowsingContextGroup() when the refcount reaches 0. // NOTE: This is done by ~BrowsingContextGroup() when the refcount reaches 0.

View file

@ -58,7 +58,7 @@ void BrowsingContextGroup::append(BrowsingContext& browsing_context)
VERIFY(browsing_context.is_top_level()); VERIFY(browsing_context.is_top_level());
// 1. Append browsingContext to group's browsing context set. // 1. Append browsingContext to group's browsing context set.
m_browsing_context_set.set(&browsing_context); m_browsing_context_set.set(browsing_context);
// 2. Set browsingContext's group to group. // 2. Set browsingContext's group to group.
browsing_context.set_group(this); browsing_context.set_group(this);

View file

@ -35,7 +35,7 @@ private:
virtual void visit_edges(Cell::Visitor&) override; virtual void visit_edges(Cell::Visitor&) override;
// https://html.spec.whatwg.org/multipage/browsers.html#browsing-context-group-set // https://html.spec.whatwg.org/multipage/browsers.html#browsing-context-group-set
OrderedHashTable<JS::GCPtr<BrowsingContext>> m_browsing_context_set; OrderedHashTable<JS::NonnullGCPtr<BrowsingContext>> m_browsing_context_set;
WeakPtr<Page> m_page; WeakPtr<Page> m_page;
}; };