WorkerLocation.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. GC_DECLARE_ALLOCATOR(WorkerLocation);
  13. public:
  14. virtual ~WorkerLocation() override;
  15. WebIDL::ExceptionOr<String> href() const;
  16. 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. String pathname() const;
  22. WebIDL::ExceptionOr<String> search() const;
  23. WebIDL::ExceptionOr<String> hash() const;
  24. private:
  25. explicit WorkerLocation(WorkerGlobalScope&);
  26. virtual void initialize(JS::Realm&) override;
  27. virtual void visit_edges(Cell::Visitor&) override;
  28. GC::Ref<WorkerGlobalScope> m_global_scope;
  29. };
  30. }