1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:47:45 +00:00

LibWeb: Make Fetch::Infrastructure::{Request,Response,HeaderList} GC'd

This is the way.

On a more serious note, there's no reason to keep adding ref-counted
classes to LibWeb now that the majority of classes is GC'd - it only
adds the risk of discovering some cycle down the line, and forces us to
use handles as we can't visit().
This commit is contained in:
Linus Groh 2022-10-30 01:52:07 +00:00
parent 63122d0276
commit b1968b8bed
19 changed files with 270 additions and 169 deletions

View file

@ -31,7 +31,7 @@ class Response final
WEB_PLATFORM_OBJECT(Response, Bindings::PlatformObject);
public:
static JS::NonnullGCPtr<Response> create(NonnullRefPtr<Infrastructure::Response>, Headers::Guard, JS::Realm&);
static JS::NonnullGCPtr<Response> create(JS::Realm&, JS::NonnullGCPtr<Infrastructure::Response>, Headers::Guard);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Response>> construct_impl(JS::Realm&, Optional<BodyInit> const& body = {}, ResponseInit const& init = {});
virtual ~Response() override;
@ -41,7 +41,7 @@ public:
virtual Optional<Infrastructure::Body&> body_impl() override;
virtual Optional<Infrastructure::Body const&> body_impl() const override;
[[nodiscard]] NonnullRefPtr<Infrastructure::Response> response() const { return m_response; }
[[nodiscard]] JS::NonnullGCPtr<Infrastructure::Response> response() const { return m_response; }
// JS API functions
[[nodiscard]] static JS::NonnullGCPtr<Response> error(JS::VM&);
@ -60,7 +60,7 @@ public:
using BodyMixin::json;
private:
Response(JS::Realm&, NonnullRefPtr<Infrastructure::Response>);
Response(JS::Realm&, JS::NonnullGCPtr<Infrastructure::Response>);
virtual void visit_edges(Cell::Visitor&) override;
@ -68,7 +68,7 @@ private:
// https://fetch.spec.whatwg.org/#concept-response-response
// A Response object has an associated response (a response).
NonnullRefPtr<Infrastructure::Response> m_response;
JS::NonnullGCPtr<Infrastructure::Response> m_response;
// https://fetch.spec.whatwg.org/#response-headers
// A Response object also has an associated headers (null or a Headers object), initially null.