WindowOrWorkerGlobalScope.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (c) 2023, Linus Groh <linusg@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Forward.h>
  8. #include <LibWeb/Bindings/PlatformObject.h>
  9. #include <LibWeb/Fetch/Request.h>
  10. #include <LibWeb/Forward.h>
  11. #include <LibWeb/HTML/MessagePort.h>
  12. namespace Web::HTML {
  13. // https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope
  14. class WindowOrWorkerGlobalScopeMixin {
  15. public:
  16. virtual ~WindowOrWorkerGlobalScopeMixin();
  17. virtual Bindings::PlatformObject& this_impl() = 0;
  18. virtual Bindings::PlatformObject const& this_impl() const = 0;
  19. // JS API functions
  20. WebIDL::ExceptionOr<String> origin() const;
  21. bool is_secure_context() const;
  22. bool cross_origin_isolated() const;
  23. WebIDL::ExceptionOr<String> btoa(String const& data) const;
  24. WebIDL::ExceptionOr<String> atob(String const& data) const;
  25. void queue_microtask(WebIDL::CallbackType&);
  26. WebIDL::ExceptionOr<JS::Value> structured_clone(JS::Value, StructuredSerializeOptions const&) const;
  27. JS::NonnullGCPtr<JS::Promise> fetch(Fetch::RequestInfo const&, Fetch::RequestInit const&) const;
  28. };
  29. }