Skip to content

Commit 9645daa

Browse files
committed
LibWeb: Remove RemoteBrowsingContext and AbstractBrowsingContext
With the transition to Navigables, and a working implementation of window.open(), we no longer need this abstraction layer.
1 parent 6e75440 commit 9645daa

File tree

11 files changed

+23
-154
lines changed

11 files changed

+23
-154
lines changed

Meta/gn/secondary/Userland/Libraries/LibWeb/HTML/BUILD.gn

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ source_set("HTML") {
1111
"//Userland/Libraries/LibWeb:all_generated",
1212
]
1313
sources = [
14-
"AbstractBrowsingContext.cpp",
1514
"AnimatedBitmapDecodedImageData.cpp",
1615
"AttributeNames.cpp",
1716
"AudioTrack.cpp",
@@ -140,7 +139,6 @@ source_set("HTML") {
140139
"PluginArray.cpp",
141140
"PotentialCORSRequest.cpp",
142141
"PromiseRejectionEvent.cpp",
143-
"RemoteBrowsingContext.cpp",
144142
"SelectItem.cpp",
145143
"SessionHistoryEntry.cpp",
146144
"SharedImageRequest.cpp",

Userland/Libraries/LibWeb/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ set(SOURCES
226226
Geometry/DOMRect.cpp
227227
Geometry/DOMRectList.cpp
228228
Geometry/DOMRectReadOnly.cpp
229-
HTML/AbstractBrowsingContext.cpp
230229
HTML/AnimatedBitmapDecodedImageData.cpp
231230
HTML/AttributeNames.cpp
232231
HTML/AudioTrack.cpp
@@ -374,7 +373,6 @@ set(SOURCES
374373
HTML/PluginArray.cpp
375374
HTML/PotentialCORSRequest.cpp
376375
HTML/PromiseRejectionEvent.cpp
377-
HTML/RemoteBrowsingContext.cpp
378376
HTML/Scripting/ClassicScript.cpp
379377
HTML/Scripting/Environments.cpp
380378
HTML/Scripting/ExceptionReporter.cpp

Userland/Libraries/LibWeb/HTML/AbstractBrowsingContext.cpp

Lines changed: 0 additions & 18 deletions
This file was deleted.

Userland/Libraries/LibWeb/HTML/AbstractBrowsingContext.h

Lines changed: 0 additions & 48 deletions
This file was deleted.

Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,14 @@
1010
#include <LibWeb/DOM/Event.h>
1111
#include <LibWeb/DOM/HTMLCollection.h>
1212
#include <LibWeb/DOM/Range.h>
13-
#include <LibWeb/Fetch/Infrastructure/HTTP/Requests.h>
1413
#include <LibWeb/HTML/BrowsingContext.h>
1514
#include <LibWeb/HTML/BrowsingContextGroup.h>
1615
#include <LibWeb/HTML/CrossOrigin/CrossOriginOpenerPolicy.h>
1716
#include <LibWeb/HTML/DocumentState.h>
18-
#include <LibWeb/HTML/EventLoop/EventLoop.h>
1917
#include <LibWeb/HTML/HTMLAnchorElement.h>
2018
#include <LibWeb/HTML/HTMLDocument.h>
2119
#include <LibWeb/HTML/HTMLInputElement.h>
2220
#include <LibWeb/HTML/NavigableContainer.h>
23-
#include <LibWeb/HTML/RemoteBrowsingContext.h>
2421
#include <LibWeb/HTML/SandboxingFlagSet.h>
2522
#include <LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h>
2623
#include <LibWeb/HTML/TraversableNavigable.h>
@@ -29,7 +26,6 @@
2926
#include <LibWeb/HighResolutionTime/TimeOrigin.h>
3027
#include <LibWeb/Infra/Strings.h>
3128
#include <LibWeb/Layout/BreakNode.h>
32-
#include <LibWeb/Layout/TextNode.h>
3329
#include <LibWeb/Layout/Viewport.h>
3430
#include <LibWeb/Namespace.h>
3531
#include <LibWeb/Page/Page.h>
@@ -515,7 +511,7 @@ BrowsingContext::ChosenBrowsingContext BrowsingContext::choose_a_browsing_contex
515511
{
516512
// The rules for choosing a browsing context, given a browsing context name name, a browsing context current, and
517513
// a boolean noopener are as follows:
518-
JS::GCPtr<AbstractBrowsingContext> matching_name_in_tree = nullptr;
514+
JS::GCPtr<BrowsingContext> matching_name_in_tree = nullptr;
519515
top_level_browsing_context()->for_each_in_subtree([&](auto& context) {
520516
if (context.name() == name) {
521517
matching_name_in_tree = &context;
@@ -526,7 +522,7 @@ BrowsingContext::ChosenBrowsingContext BrowsingContext::choose_a_browsing_contex
526522
});
527523

528524
// 1. Let chosen be null.
529-
JS::GCPtr<AbstractBrowsingContext> chosen = nullptr;
525+
JS::GCPtr<BrowsingContext> chosen = nullptr;
530526

531527
// 2. Let windowType be "existing or none".
532528
auto window_type = WindowType::ExistingOrNone;

Userland/Libraries/LibWeb/HTML/BrowsingContext.h

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <LibJS/Forward.h>
1717
#include <LibJS/Heap/Cell.h>
1818
#include <LibWeb/DOM/Position.h>
19-
#include <LibWeb/HTML/AbstractBrowsingContext.h>
2019
#include <LibWeb/HTML/ActivateTab.h>
2120
#include <LibWeb/HTML/HistoryHandlingBehavior.h>
2221
#include <LibWeb/HTML/NavigableContainer.h>
@@ -31,10 +30,9 @@
3130

3231
namespace Web::HTML {
3332

34-
class BrowsingContext final
35-
: public AbstractBrowsingContext
33+
class BrowsingContext final : public JS::Cell
3634
, public Weakable<BrowsingContext> {
37-
JS_CELL(BrowsingContext, AbstractBrowsingContext);
35+
JS_CELL(BrowsingContext, JS::Cell);
3836
JS_DECLARE_ALLOCATOR(BrowsingContext);
3937

4038
public:
@@ -107,8 +105,8 @@ class BrowsingContext final
107105
DOM::Document const* active_document() const;
108106
DOM::Document* active_document();
109107

110-
virtual HTML::WindowProxy* window_proxy() override;
111-
virtual HTML::WindowProxy const* window_proxy() const override;
108+
HTML::WindowProxy* window_proxy();
109+
HTML::WindowProxy const* window_proxy() const;
112110

113111
void set_window_proxy(JS::GCPtr<WindowProxy>);
114112

@@ -130,7 +128,7 @@ class BrowsingContext final
130128
};
131129

132130
struct ChosenBrowsingContext {
133-
JS::GCPtr<AbstractBrowsingContext> browsing_context;
131+
JS::GCPtr<BrowsingContext> browsing_context;
134132
WindowType window_type;
135133
};
136134

@@ -175,10 +173,13 @@ class BrowsingContext final
175173

176174
bool has_been_discarded() const { return m_has_been_discarded; }
177175

178-
Optional<AK::URL> const& creator_url() const { return m_creator_url; }
176+
JS::GCPtr<BrowsingContext> opener_browsing_context() const { return m_opener_browsing_context; }
177+
void set_opener_browsing_context(JS::GCPtr<BrowsingContext> browsing_context) { m_opener_browsing_context = browsing_context; }
179178

180-
virtual String const& window_handle() const override { return m_window_handle; }
181-
virtual void set_window_handle(String handle) override { m_window_handle = move(handle); }
179+
void set_is_popup(TokenizedFeature::Popup is_popup) { m_is_popup = is_popup; }
180+
181+
String const& name() const { return m_name; }
182+
void set_name(String name) { m_name = move(name); }
182183

183184
private:
184185
explicit BrowsingContext(JS::NonnullGCPtr<Page>, HTML::NavigableContainer*);
@@ -216,6 +217,14 @@ class BrowsingContext final
216217
// https://html.spec.whatwg.org/multipage/browsers.html#browsing-context
217218
JS::GCPtr<HTML::WindowProxy> m_window_proxy;
218219

220+
// https://html.spec.whatwg.org/multipage/browsers.html#is-popup
221+
TokenizedFeature::Popup m_is_popup { TokenizedFeature::Popup::No };
222+
223+
// https://html.spec.whatwg.org/multipage/browsers.html#opener-browsing-context
224+
JS::GCPtr<BrowsingContext> m_opener_browsing_context;
225+
226+
String m_name;
227+
219228
JS::GCPtr<DOM::Position> m_cursor_position;
220229
RefPtr<Core::Timer> m_cursor_blink_timer;
221230
bool m_cursor_blink_state { false };

Userland/Libraries/LibWeb/HTML/HTMLFormElement.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#include <AK/Time.h>
1212
#include <LibWeb/ARIA/Roles.h>
13-
#include <LibWeb/HTML/AbstractBrowsingContext.h>
1413
#include <LibWeb/HTML/HTMLElement.h>
1514
#include <LibWeb/HTML/HTMLInputElement.h>
1615
#include <LibWeb/HTML/Navigable.h>

Userland/Libraries/LibWeb/HTML/Navigable.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <LibWeb/HTML/StructuredSerialize.h>
2929
#include <LibWeb/HTML/TraversableNavigable.h>
3030
#include <LibWeb/HTML/Window.h>
31+
#include <LibWeb/HTML/WindowProxy.h>
3132
#include <LibWeb/Infra/Strings.h>
3233
#include <LibWeb/Layout/Node.h>
3334
#include <LibWeb/Loader/GeneratedPagesLoader.h>

Userland/Libraries/LibWeb/HTML/RemoteBrowsingContext.cpp

Lines changed: 0 additions & 32 deletions
This file was deleted.

Userland/Libraries/LibWeb/HTML/RemoteBrowsingContext.h

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)