mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:57:34 +00:00
LibWeb/HTML: Move WindowOrWorkerGlobalScope code into a mixin class
This will allow us to easily share the implementations of these methods
between Window and WorkerGlobalScope. The mixin class mirrors what I
already did for the Fetch API's Body mixin in 5ad62833
.
This commit is contained in:
parent
b118cc782e
commit
1a6b61b0cc
5 changed files with 125 additions and 81 deletions
31
Userland/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.h
Normal file
31
Userland/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Linus Groh <linusg@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Forward.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope
|
||||
class WindowOrWorkerGlobalScopeMixin {
|
||||
public:
|
||||
virtual ~WindowOrWorkerGlobalScopeMixin();
|
||||
|
||||
virtual Bindings::PlatformObject& this_impl() = 0;
|
||||
virtual Bindings::PlatformObject const& this_impl() const = 0;
|
||||
|
||||
// JS API functions
|
||||
WebIDL::ExceptionOr<String> origin() const;
|
||||
bool is_secure_context() const;
|
||||
bool cross_origin_isolated() const;
|
||||
WebIDL::ExceptionOr<String> btoa(String const& data) const;
|
||||
WebIDL::ExceptionOr<String> atob(String const& data) const;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue