WorkerLocation.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. public:
  13. virtual ~WorkerLocation() override;
  14. WebIDL::ExceptionOr<String> href() const;
  15. WebIDL::ExceptionOr<String> origin() const;
  16. WebIDL::ExceptionOr<String> protocol() const;
  17. WebIDL::ExceptionOr<String> host() const;
  18. WebIDL::ExceptionOr<String> hostname() const;
  19. WebIDL::ExceptionOr<String> port() const;
  20. WebIDL::ExceptionOr<String> pathname() const;
  21. WebIDL::ExceptionOr<String> search() const;
  22. WebIDL::ExceptionOr<String> hash() const;
  23. private:
  24. explicit WorkerLocation(WorkerGlobalScope&);
  25. virtual void visit_edges(Cell::Visitor&) override;
  26. JS::NonnullGCPtr<WorkerGlobalScope> m_global_scope;
  27. };
  28. }