LibGC+Everywhere: Factor out a LibGC from LibJS

Resulting in a massive rename across almost everywhere! Alongside the
namespace change, we now have the following names:

 * JS::NonnullGCPtr -> GC::Ref
 * JS::GCPtr -> GC::Ptr
 * JS::HeapFunction -> GC::Function
 * JS::CellImpl -> GC::Cell
 * JS::Handle -> GC::Root
This commit is contained in:
Shannon Booth 2024-11-15 04:01:23 +13:00 committed by Andreas Kling
parent ce23efc5f6
commit f87041bf3a
Notes: github-actions[bot] 2024-11-15 13:50:17 +00:00
1722 changed files with 9939 additions and 9906 deletions

View file

@ -28,24 +28,24 @@
namespace Web::HTML {
class BrowsingContext final : public JS::Cell {
JS_CELL(BrowsingContext, JS::Cell);
JS_DECLARE_ALLOCATOR(BrowsingContext);
GC_CELL(BrowsingContext, JS::Cell);
GC_DECLARE_ALLOCATOR(BrowsingContext);
public:
struct BrowsingContextAndDocument {
JS::NonnullGCPtr<BrowsingContext> browsing_context;
JS::NonnullGCPtr<DOM::Document> document;
GC::Ref<BrowsingContext> browsing_context;
GC::Ref<DOM::Document> document;
};
static WebIDL::ExceptionOr<BrowsingContextAndDocument> create_a_new_browsing_context_and_document(JS::NonnullGCPtr<Page> page, JS::GCPtr<DOM::Document> creator, JS::GCPtr<DOM::Element> embedder, JS::NonnullGCPtr<BrowsingContextGroup> group);
static WebIDL::ExceptionOr<BrowsingContextAndDocument> create_a_new_auxiliary_browsing_context_and_document(JS::NonnullGCPtr<Page> page, JS::NonnullGCPtr<HTML::BrowsingContext> opener);
static WebIDL::ExceptionOr<BrowsingContextAndDocument> create_a_new_browsing_context_and_document(GC::Ref<Page> page, GC::Ptr<DOM::Document> creator, GC::Ptr<DOM::Element> embedder, GC::Ref<BrowsingContextGroup> group);
static WebIDL::ExceptionOr<BrowsingContextAndDocument> create_a_new_auxiliary_browsing_context_and_document(GC::Ref<Page> page, GC::Ref<HTML::BrowsingContext> opener);
virtual ~BrowsingContext() override;
JS::NonnullGCPtr<HTML::TraversableNavigable> top_level_traversable() const;
GC::Ref<HTML::TraversableNavigable> top_level_traversable() const;
JS::GCPtr<BrowsingContext> first_child() const;
JS::GCPtr<BrowsingContext> next_sibling() const;
GC::Ptr<BrowsingContext> first_child() const;
GC::Ptr<BrowsingContext> next_sibling() const;
bool is_ancestor_of(BrowsingContext const&) const;
bool is_familiar_with(BrowsingContext const&) const;
@ -103,7 +103,7 @@ public:
HTML::WindowProxy* window_proxy();
HTML::WindowProxy const* window_proxy() const;
void set_window_proxy(JS::GCPtr<WindowProxy>);
void set_window_proxy(GC::Ptr<WindowProxy>);
HTML::Window* active_window();
HTML::Window const* active_window() const;
@ -113,7 +113,7 @@ public:
u64 virtual_browsing_context_group_id() const { return m_virtual_browsing_context_group_id; }
JS::GCPtr<BrowsingContext> top_level_browsing_context() const;
GC::Ptr<BrowsingContext> top_level_browsing_context() const;
BrowsingContextGroup* group();
BrowsingContextGroup const* group() const;
@ -127,23 +127,23 @@ public:
bool has_navigable_been_destroyed() const;
JS::GCPtr<BrowsingContext> opener_browsing_context() const { return m_opener_browsing_context; }
void set_opener_browsing_context(JS::GCPtr<BrowsingContext> browsing_context) { m_opener_browsing_context = browsing_context; }
GC::Ptr<BrowsingContext> opener_browsing_context() const { return m_opener_browsing_context; }
void set_opener_browsing_context(GC::Ptr<BrowsingContext> browsing_context) { m_opener_browsing_context = browsing_context; }
void set_is_popup(TokenizedFeature::Popup is_popup) { m_is_popup = is_popup; }
private:
explicit BrowsingContext(JS::NonnullGCPtr<Page>);
explicit BrowsingContext(GC::Ref<Page>);
virtual void visit_edges(Cell::Visitor&) override;
JS::NonnullGCPtr<Page> m_page;
GC::Ref<Page> m_page;
// https://html.spec.whatwg.org/multipage/document-sequences.html#browsing-context
JS::GCPtr<HTML::WindowProxy> m_window_proxy;
GC::Ptr<HTML::WindowProxy> m_window_proxy;
// https://html.spec.whatwg.org/multipage/browsers.html#opener-browsing-context
JS::GCPtr<BrowsingContext> m_opener_browsing_context;
GC::Ptr<BrowsingContext> m_opener_browsing_context;
// https://html.spec.whatwg.org/multipage/document-sequences.html#opener-origin-at-creation
Optional<URL::Origin> m_opener_origin_at_creation;
@ -161,17 +161,17 @@ private:
u64 m_virtual_browsing_context_group_id = { 0 };
// https://html.spec.whatwg.org/multipage/browsers.html#tlbc-group
JS::GCPtr<BrowsingContextGroup> m_group;
GC::Ptr<BrowsingContextGroup> m_group;
JS::GCPtr<BrowsingContext> m_first_child;
JS::GCPtr<BrowsingContext> m_last_child;
JS::GCPtr<BrowsingContext> m_next_sibling;
JS::GCPtr<BrowsingContext> m_previous_sibling;
GC::Ptr<BrowsingContext> m_first_child;
GC::Ptr<BrowsingContext> m_last_child;
GC::Ptr<BrowsingContext> m_next_sibling;
GC::Ptr<BrowsingContext> m_previous_sibling;
};
URL::Origin determine_the_origin(Optional<URL::URL> const&, SandboxingFlagSet, Optional<URL::Origin> source_origin);
SandboxingFlagSet determine_the_creation_sandboxing_flags(BrowsingContext const&, JS::GCPtr<DOM::Element> embedder);
SandboxingFlagSet determine_the_creation_sandboxing_flags(BrowsingContext const&, GC::Ptr<DOM::Element> embedder);
// FIXME: Find a better home for these
bool url_matches_about_blank(URL::URL const& url);