Skip to content

Truly independent web browser

1.0 KB
Raw Blame
/*
 * Copyright (c) 2026, Tim Flynn <[email protected]>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/Utf16String.h>
#include <LibGC/Cell.h>
#include <LibGC/CellAllocator.h>
#include <LibGC/HeapVector.h>
#include <LibWeb/Forward.h>

namespace Web::ServiceWorker {

// https://w3c.github.io/ServiceWorker/#dfn-request-response-list
struct RequestResponse : public GC::Cell {
    GC_CELL(RequestResponse, GC::Cell);
    GC_DECLARE_ALLOCATOR(RequestResponse);

    RequestResponse(NonnullRefPtr<Fetch::Infrastructure::Request>, GC::Ref<Fetch::Infrastructure::ResponseView>);

    virtual void visit_edges(Visitor&) override;

    NonnullRefPtr<Fetch::Infrastructure::Request> request;
    GC::Ref<Fetch::Infrastructure::ResponseView> response;
};

// https://w3c.github.io/ServiceWorker/#dfn-request-response-list
using RequestResponseList = GC::HeapVector<GC::Ref<RequestResponse>>;

// https://w3c.github.io/ServiceWorker/#dfn-name-to-cache-map
using NameToCacheMap = OrderedHashMap<Utf16String, GC::Ref<RequestResponseList>>;

}