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

@ -16,23 +16,23 @@ namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigateeventinit
struct NavigateEventInit : public DOM::EventInit {
Bindings::NavigationType navigation_type = Bindings::NavigationType::Push;
JS::GCPtr<NavigationDestination> destination;
GC::Ptr<NavigationDestination> destination;
bool can_intercept = false;
bool user_initiated = false;
bool hash_change = false;
JS::GCPtr<DOM::AbortSignal> signal;
JS::GCPtr<XHR::FormData> form_data = nullptr;
GC::Ptr<DOM::AbortSignal> signal;
GC::Ptr<XHR::FormData> form_data = nullptr;
Optional<String> download_request = {};
Optional<JS::Value> info;
bool has_ua_visual_transition = false;
};
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigationintercepthandler
using NavigationInterceptHandler = JS::NonnullGCPtr<WebIDL::CallbackType>;
using NavigationInterceptHandler = GC::Ref<WebIDL::CallbackType>;
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigationinterceptoptions
struct NavigationInterceptOptions {
JS::GCPtr<WebIDL::CallbackType> handler;
GC::Ptr<WebIDL::CallbackType> handler;
Optional<Bindings::NavigationFocusReset> focus_reset;
Optional<Bindings::NavigationScrollBehavior> scroll;
};
@ -40,7 +40,7 @@ struct NavigationInterceptOptions {
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigateevent
class NavigateEvent : public DOM::Event {
WEB_PLATFORM_OBJECT(NavigateEvent, DOM::Event);
JS_DECLARE_ALLOCATOR(NavigateEvent);
GC_DECLARE_ALLOCATOR(NavigateEvent);
public:
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigateevent-interception-state
@ -52,17 +52,17 @@ public:
Finished
};
[[nodiscard]] static JS::NonnullGCPtr<NavigateEvent> construct_impl(JS::Realm&, FlyString const& event_name, NavigateEventInit const&);
[[nodiscard]] static GC::Ref<NavigateEvent> construct_impl(JS::Realm&, FlyString const& event_name, NavigateEventInit const&);
// The navigationType, destination, canIntercept, userInitiated, hashChange, signal, formData,
// downloadRequest, info, and hasUAVisualTransition attributes must return the values they are initialized to.
Bindings::NavigationType navigation_type() const { return m_navigation_type; }
JS::NonnullGCPtr<NavigationDestination> destination() const { return m_destination; }
GC::Ref<NavigationDestination> destination() const { return m_destination; }
bool can_intercept() const { return m_can_intercept; }
bool user_initiated() const { return m_user_initiated; }
bool hash_change() const { return m_hash_change; }
JS::NonnullGCPtr<DOM::AbortSignal> signal() const { return m_signal; }
JS::GCPtr<XHR::FormData> form_data() const { return m_form_data; }
GC::Ref<DOM::AbortSignal> signal() const { return m_signal; }
GC::Ptr<XHR::FormData> form_data() const { return m_form_data; }
Optional<String> download_request() const { return m_download_request; }
JS::Value info() const { return m_info; }
bool has_ua_visual_transition() const { return m_has_ua_visual_transition; }
@ -72,12 +72,12 @@ public:
virtual ~NavigateEvent() override;
JS::NonnullGCPtr<DOM::AbortController> abort_controller() const { return *m_abort_controller; }
GC::Ref<DOM::AbortController> abort_controller() const { return *m_abort_controller; }
InterceptionState interception_state() const { return m_interception_state; }
Vector<NavigationInterceptHandler> const& navigation_handler_list() const { return m_navigation_handler_list; }
Optional<SerializationRecord> classic_history_api_state() const { return m_classic_history_api_state; }
void set_abort_controller(JS::NonnullGCPtr<DOM::AbortController> c) { m_abort_controller = c; }
void set_abort_controller(GC::Ref<DOM::AbortController> c) { m_abort_controller = c; }
void set_interception_state(InterceptionState s) { m_interception_state = s; }
void set_classic_history_api_state(Optional<SerializationRecord> r) { m_classic_history_api_state = move(r); }
@ -107,7 +107,7 @@ private:
Optional<Bindings::NavigationScrollBehavior> m_scroll_behavior = {};
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigateevent-abort-controller
JS::GCPtr<DOM::AbortController> m_abort_controller = { nullptr };
GC::Ptr<DOM::AbortController> m_abort_controller = { nullptr };
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigateevent-classic-history-api-state
Optional<SerializationRecord> m_classic_history_api_state = {};
@ -116,7 +116,7 @@ private:
Bindings::NavigationType m_navigation_type = { Bindings::NavigationType::Push };
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigateevent-destination
JS::NonnullGCPtr<NavigationDestination> m_destination;
GC::Ref<NavigationDestination> m_destination;
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigateevent-canintercept
bool m_can_intercept = { false };
@ -128,10 +128,10 @@ private:
bool m_hash_change = { false };
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigateevent-signal
JS::NonnullGCPtr<DOM::AbortSignal> m_signal;
GC::Ref<DOM::AbortSignal> m_signal;
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigateevent-formdata
JS::GCPtr<XHR::FormData> m_form_data;
GC::Ptr<XHR::FormData> m_form_data;
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigateevent-downloadrequest
Optional<String> m_download_request;