WorkerLocation.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2022, Andrew Kaster <akaster@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/Bindings/PlatformObject.h>
  8. namespace Web::HTML {
  9. // https://html.spec.whatwg.org/multipage/workers.html#worker-locations
  10. class WorkerLocation : public Bindings::PlatformObject {
  11. WEB_PLATFORM_OBJECT(WorkerLocation, Bindings::PlatformObject);
  12. JS_DECLARE_ALLOCATOR(WorkerLocation);
  13. public:
  14. virtual ~WorkerLocation() override;
  15. WebIDL::ExceptionOr<String> href() const;
  16. WebIDL::ExceptionOr<String> origin() const;
  17. WebIDL::ExceptionOr<String> protocol() const;
  18. WebIDL::ExceptionOr<String> host() const;
  19. WebIDL::ExceptionOr<String> hostname() const;
  20. WebIDL::ExceptionOr<String> port() const;
  21. WebIDL::ExceptionOr<String> pathname() const;
  22. WebIDL::ExceptionOr<String> search() const;
  23. WebIDL::ExceptionOr<String> hash() const;
  24. private:
  25. explicit WorkerLocation(WorkerGlobalScope&);
  26. virtual void visit_edges(Cell::Visitor&) override;
  27. JS::NonnullGCPtr<WorkerGlobalScope> m_global_scope;
  28. };
  29. }