mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-01 00:38:48 +00:00
LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocated
This is a monster patch that turns all EventTargets into GC-allocated PlatformObjects. Their C++ wrapper classes are removed, and the LibJS garbage collector is now responsible for their lifetimes. There's a fair amount of hacks and band-aids in this patch, and we'll have a lot of cleanup to do after this.
This commit is contained in:
parent
bb547ce1c4
commit
6f433c8656
Notes:
sideshowbarker
2024-07-17 07:28:15 +09:00
Author: https://github.com/awesomekling
Commit: 6f433c8656
Pull-request: https://github.com/SerenityOS/serenity/pull/14816
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/linusg ✅
445 changed files with 4797 additions and 4268 deletions
|
@ -4,15 +4,15 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/WindowObject.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
WindowEnvironmentSettingsObject::WindowEnvironmentSettingsObject(Window& window, NonnullOwnPtr<JS::ExecutionContext> execution_context)
|
||||
: EnvironmentSettingsObject(move(execution_context))
|
||||
, m_window(window)
|
||||
, m_window(JS::make_handle(window))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ void WindowEnvironmentSettingsObject::setup(AK::URL const& creation_url, Nonnull
|
|||
|
||||
// 2. Let window be realm's global object.
|
||||
// NOTE: We want to store the Window impl rather than the WindowObject.
|
||||
auto& window = verify_cast<Bindings::WindowObject>(realm->global_object()).impl();
|
||||
auto& window = verify_cast<HTML::Window>(realm->global_object()).impl();
|
||||
|
||||
// 3. Let settings object be a new environment settings object whose algorithms are defined as follows:
|
||||
// NOTE: See the functions defined for this class.
|
||||
|
@ -61,7 +61,7 @@ void WindowEnvironmentSettingsObject::setup(AK::URL const& creation_url, Nonnull
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/window-object.html#script-settings-for-window-objects:responsible-document
|
||||
RefPtr<DOM::Document> WindowEnvironmentSettingsObject::responsible_document()
|
||||
JS::GCPtr<DOM::Document> WindowEnvironmentSettingsObject::responsible_document()
|
||||
{
|
||||
// Return window's associated Document.
|
||||
return m_window->associated_document();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue