Skip to content

Commit

Permalink
LibWeb/HTML: Store NonnullGCPtr in browsing context set
Browse files Browse the repository at this point in the history
These are never supposed to be null.
  • Loading branch information
linusg committed Apr 20, 2023
1 parent af20b74 commit 4ee7242
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ JS::NonnullGCPtr<BrowsingContext> BrowsingContext::create_a_new_top_level_browsi
auto group = BrowsingContextGroup::create_a_new_browsing_context_group(page);

// 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
Expand Down Expand Up @@ -858,7 +858,7 @@ void BrowsingContext::remove()
set_group(nullptr);

// 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.
// NOTE: This is done by ~BrowsingContextGroup() when the refcount reaches 0.
Expand Down
2 changes: 1 addition & 1 deletion Userland/Libraries/LibWeb/HTML/BrowsingContextGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void BrowsingContextGroup::append(BrowsingContext& browsing_context)
VERIFY(browsing_context.is_top_level());

// 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.
browsing_context.set_group(this);
Expand Down
2 changes: 1 addition & 1 deletion Userland/Libraries/LibWeb/HTML/BrowsingContextGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class BrowsingContextGroup final : public JS::Cell {
virtual void visit_edges(Cell::Visitor&) override;

// 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;
};
Expand Down

0 comments on commit 4ee7242

Please sign in to comment.