2023-03-14 12:02:33 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2023, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibJS/Forward.h>
|
|
|
|
#include <LibJS/Heap/Cell.h>
|
|
|
|
#include <LibWeb/HTML/HistoryHandlingBehavior.h>
|
|
|
|
#include <LibWeb/HTML/PolicyContainers.h>
|
2023-03-21 14:22:10 +03:00
|
|
|
#include <LibWeb/HTML/TokenizedFeatures.h>
|
2023-03-14 12:02:33 +03:00
|
|
|
#include <LibWeb/HTML/WindowProxy.h>
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
|
|
class AbstractBrowsingContext : public JS::Cell {
|
|
|
|
JS_CELL(AbstractBrowsingContext, Cell);
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual HTML::WindowProxy* window_proxy() = 0;
|
|
|
|
virtual HTML::WindowProxy const* window_proxy() const = 0;
|
|
|
|
|
2023-03-19 15:11:56 +03:00
|
|
|
String const& name() const { return m_name; }
|
|
|
|
void set_name(String const& name) { m_name = name; }
|
2023-03-14 12:02:33 +03:00
|
|
|
|
|
|
|
JS::GCPtr<BrowsingContext> opener_browsing_context() const { return m_opener_browsing_context; }
|
|
|
|
void set_opener_browsing_context(JS::GCPtr<BrowsingContext> browsing_context) { m_opener_browsing_context = browsing_context; }
|
|
|
|
|
|
|
|
virtual WebIDL::ExceptionOr<void> navigate(
|
|
|
|
JS::NonnullGCPtr<Fetch::Infrastructure::Request> resource,
|
|
|
|
BrowsingContext& source_browsing_context,
|
|
|
|
bool exceptions_enabled = false,
|
|
|
|
HistoryHandlingBehavior history_handling = HistoryHandlingBehavior::Default,
|
|
|
|
Optional<PolicyContainer> history_policy_container = {},
|
|
|
|
DeprecatedString navigation_type = "other",
|
2023-04-10 12:07:24 +03:00
|
|
|
Optional<String> navigation_id = {},
|
2023-03-14 12:02:33 +03:00
|
|
|
Function<void(JS::NonnullGCPtr<Fetch::Infrastructure::Response>)> process_response_end_of_body = {})
|
|
|
|
= 0;
|
|
|
|
|
2023-03-21 14:22:10 +03:00
|
|
|
void set_is_popup(TokenizedFeature::Popup is_popup) { m_is_popup = is_popup; }
|
2023-03-14 12:02:33 +03:00
|
|
|
|
|
|
|
virtual String const& window_handle() const = 0;
|
|
|
|
virtual void set_window_handle(String handle) = 0;
|
|
|
|
|
|
|
|
protected:
|
2023-03-19 15:11:56 +03:00
|
|
|
String m_name;
|
2023-03-14 12:02:33 +03:00
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/browsers.html#is-popup
|
2023-03-21 14:22:10 +03:00
|
|
|
TokenizedFeature::Popup m_is_popup { TokenizedFeature::Popup::No };
|
2023-03-14 12:02:33 +03:00
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/browsers.html#opener-browsing-context
|
|
|
|
JS::GCPtr<BrowsingContext> m_opener_browsing_context;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|