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