diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index 0d9879b352..9c53a5e023 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -283,6 +283,7 @@ set(SOURCES HTML/Plugin.cpp HTML/PluginArray.cpp HTML/PromiseRejectionEvent.cpp + HTML/RemoteBrowsingContext.cpp HTML/Scripting/ClassicScript.cpp HTML/Scripting/Environments.cpp HTML/Scripting/ExceptionReporter.cpp diff --git a/Userland/Libraries/LibWeb/HTML/RemoteBrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/RemoteBrowsingContext.cpp new file mode 100644 index 0000000000..59f0599574 --- /dev/null +++ b/Userland/Libraries/LibWeb/HTML/RemoteBrowsingContext.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2023, Aliaksandr Kalenik + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include + +namespace Web::HTML { + +JS::NonnullGCPtr RemoteBrowsingContext::create_a_new_remote_browsing_context(String handle) +{ + auto browsing_context = Bindings::main_thread_vm().heap().allocate_without_realm(handle); + return browsing_context; +}; + +HTML::WindowProxy* RemoteBrowsingContext::window_proxy() +{ + return nullptr; +} + +HTML::WindowProxy const* RemoteBrowsingContext::window_proxy() const +{ + return nullptr; +} + +RemoteBrowsingContext::RemoteBrowsingContext(String handle) + : m_window_handle(handle) {}; + +} diff --git a/Userland/Libraries/LibWeb/HTML/RemoteBrowsingContext.h b/Userland/Libraries/LibWeb/HTML/RemoteBrowsingContext.h new file mode 100644 index 0000000000..5f7a358e45 --- /dev/null +++ b/Userland/Libraries/LibWeb/HTML/RemoteBrowsingContext.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2023, Aliaksandr Kalenik + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include +#include + +namespace Web::HTML { + +class RemoteBrowsingContext final + : public AbstractBrowsingContext + , public Weakable { + JS_CELL(RemoteBrowsingContext, AbstractBrowsingContext); + +public: + static JS::NonnullGCPtr create_a_new_remote_browsing_context(String handle); + + virtual HTML::WindowProxy* window_proxy() override; + virtual HTML::WindowProxy const* window_proxy() const override; + + virtual WebIDL::ExceptionOr navigate( + JS::NonnullGCPtr, + BrowsingContext&, + bool, + HistoryHandlingBehavior, + Optional, + DeprecatedString, + Optional, + Function)>) override + { + return {}; + }; + + virtual String const& window_handle() const override { return m_window_handle; } + virtual void set_window_handle(String handle) override { m_window_handle = handle; }; + +private: + explicit RemoteBrowsingContext(String); + + String m_window_handle; +}; + +}