ServiceWorker.h 1.0 KB

123456789101112131415161718192021222324252627
  1. /*
  2. * Copyright (c) 2024, Andrew Kaster <andrew@ladybird.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibURL/URL.h>
  8. #include <LibWeb/Bindings/ServiceWorkerPrototype.h>
  9. #include <LibWeb/Bindings/WorkerPrototype.h>
  10. namespace Web::ServiceWorker {
  11. // https://w3c.github.io/ServiceWorker/#dfn-service-worker
  12. // This class corresponds to "service worker", not "ServiceWorker"
  13. // FIXME: This should be owned and managed at the user agent level
  14. // FIXME: A lot of the fields for this struct actually need to live in the Agent for the service worker in the WebWorker process
  15. struct ServiceWorker {
  16. Bindings::ServiceWorkerState state = Bindings::ServiceWorkerState::Parsed; // https://w3c.github.io/ServiceWorker/#dfn-state
  17. URL::URL script_url; // https://w3c.github.io/ServiceWorker/#dfn-script-url
  18. Bindings::WorkerType worker_type = Bindings::WorkerType::Classic; // https://w3c.github.io/ServiceWorker/#dfn-type
  19. // FIXME: A lot more fields after this...
  20. };
  21. }