/* * Copyright (c) 2024, Mohamed amine Bounya * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include namespace Web::Fetch::Infrastructure { // https://fetch.spec.whatwg.org/#concept-fetch-record class FetchRecord : public JS::Cell { JS_CELL(FetchRecord, JS::Cell); JS_DECLARE_ALLOCATOR(FetchRecord); public: [[nodiscard]] static JS::NonnullGCPtr create(JS::VM&, JS::NonnullGCPtr); [[nodiscard]] static JS::NonnullGCPtr create(JS::VM&, JS::NonnullGCPtr, JS::GCPtr); [[nodiscard]] JS::NonnullGCPtr request() const { return m_request; } void set_request(JS::NonnullGCPtr request) { m_request = request; } [[nodiscard]] JS::GCPtr fetch_controller() const { return m_fetch_controller; } void set_fetch_controller(JS::GCPtr fetch_controller) { m_fetch_controller = fetch_controller; } private: explicit FetchRecord(JS::NonnullGCPtr); FetchRecord(JS::NonnullGCPtr, JS::GCPtr); virtual void visit_edges(Visitor&) override; // https://fetch.spec.whatwg.org/#concept-request // A fetch record has an associated request (a request) JS::NonnullGCPtr m_request; // https://fetch.spec.whatwg.org/#fetch-controller // A fetch record has an associated controller (a fetch controller or null) JS::GCPtr m_fetch_controller { nullptr }; }; }