LibWeb: Return a representation of an 'Agent' in 'relevant agent'

This makes it more convenient to use the 'relvant agent' concept,
instead of the awkward dynamic casts we needed to do for every call
site.

mutation_observers is also changed to hold a GC::Root instead of raw
GC::Ptr. Somehow this was not causing problems before, but trips up CI
after these changes.
This commit is contained in:
Shannon Booth 2025-01-04 23:12:55 +13:00 committed by Tim Flynn
parent 5bed8f4055
commit 64eeda6450
Notes: github-actions[bot] 2025-01-11 15:40:39 +00:00
15 changed files with 140 additions and 98 deletions

View file

@ -34,6 +34,7 @@
#include <LibWeb/HTML/EventNames.h>
#include <LibWeb/HTML/Location.h>
#include <LibWeb/HTML/PromiseRejectionEvent.h>
#include <LibWeb/HTML/Scripting/Agent.h>
#include <LibWeb/HTML/Scripting/ClassicScript.h>
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Scripting/ExceptionReporter.h>
@ -92,6 +93,10 @@ ErrorOr<void> initialize_main_thread_vm(HTML::EventLoop::Type type)
VERIFY(!s_main_thread_vm);
s_main_thread_vm = TRY(JS::VM::create(make<WebEngineCustomData>()));
auto& custom_data = verify_cast<WebEngineCustomData>(*s_main_thread_vm->custom_data());
custom_data.agent.event_loop = s_main_thread_vm->heap().allocate<HTML::EventLoop>(type);
s_main_thread_vm->on_unimplemented_property_access = [](auto const& object, auto const& property_key) {
dbgln("FIXME: Unimplemented IDL interface: '{}.{}'", object.class_name(), property_key.to_string());
};
@ -100,9 +105,6 @@ ErrorOr<void> initialize_main_thread_vm(HTML::EventLoop::Type type)
// This avoids doing an exhaustive garbage collection on process exit.
s_main_thread_vm->ref();
auto& custom_data = verify_cast<WebEngineCustomData>(*s_main_thread_vm->custom_data());
custom_data.event_loop = s_main_thread_vm->heap().allocate<HTML::EventLoop>(type);
// These strings could potentially live on the VM similar to CommonPropertyNames.
DOM::MutationType::initialize_strings();
Editing::CommandNames::initialize_strings();
@ -692,25 +694,24 @@ JS::VM& main_thread_vm()
void queue_mutation_observer_microtask(DOM::Document const& document)
{
auto& vm = main_thread_vm();
auto& custom_data = verify_cast<WebEngineCustomData>(*vm.custom_data());
auto& surrounding_agent = verify_cast<WebEngineCustomData>(*vm.custom_data()).agent;
// 1. If the surrounding agents mutation observer microtask queued is true, then return.
if (custom_data.mutation_observer_microtask_queued)
if (surrounding_agent.mutation_observer_microtask_queued)
return;
// 2. Set the surrounding agents mutation observer microtask queued to true.
custom_data.mutation_observer_microtask_queued = true;
surrounding_agent.mutation_observer_microtask_queued = true;
// 3. Queue a microtask to notify mutation observers.
// NOTE: This uses the implied document concept. In the case of mutation observers, it is always done in a node context, so document should be that node's document.
// FIXME: Is it safe to pass custom_data through?
HTML::queue_a_microtask(&document, GC::create_function(vm.heap(), [&custom_data, &heap = document.heap()]() {
HTML::queue_a_microtask(&document, GC::create_function(vm.heap(), [&surrounding_agent, &heap = document.heap()]() {
// 1. Set the surrounding agents mutation observer microtask queued to false.
custom_data.mutation_observer_microtask_queued = false;
surrounding_agent.mutation_observer_microtask_queued = false;
// 2. Let notifySet be a clone of the surrounding agents mutation observers.
GC::RootVector<DOM::MutationObserver*> notify_set(heap);
for (auto& observer : custom_data.mutation_observers)
for (auto& observer : surrounding_agent.mutation_observers)
notify_set.append(observer);
// FIXME: 3. Let signalSet be a clone of the surrounding agents signal slots.

View file

@ -13,56 +13,16 @@
#include <LibWeb/DOM/Element.h>
#include <LibWeb/DOM/MutationObserver.h>
#include <LibWeb/HTML/EventLoop/EventLoop.h>
#include <LibWeb/HTML/Scripting/Agent.h>
namespace Web::Bindings {
// https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-reactions-stack
struct CustomElementReactionsStack {
CustomElementReactionsStack() = default;
~CustomElementReactionsStack() = default;
// https://html.spec.whatwg.org/multipage/custom-elements.html#element-queue
// Each item in the stack is an element queue, which is initially empty as well. Each item in an element queue is an element.
// (The elements are not necessarily custom yet, since this queue is used for upgrades as well.)
Vector<Vector<GC::Root<DOM::Element>>> element_queue_stack;
// https://html.spec.whatwg.org/multipage/custom-elements.html#backup-element-queue
// Each custom element reactions stack has an associated backup element queue, which an initially-empty element queue.
Vector<GC::Root<DOM::Element>> backup_element_queue;
// https://html.spec.whatwg.org/multipage/custom-elements.html#processing-the-backup-element-queue
// To prevent reentrancy when processing the backup element queue, each custom element reactions stack also has a processing the backup element queue flag, initially unset.
bool processing_the_backup_element_queue { false };
};
struct WebEngineCustomData final : public JS::VM::CustomData {
virtual ~WebEngineCustomData() override = default;
virtual void spin_event_loop_until(GC::Root<GC::Function<bool()>> goal_condition) override;
GC::Root<HTML::EventLoop> event_loop;
// FIXME: These should only be on similar-origin window agents, but we don't currently differentiate agent types.
// https://dom.spec.whatwg.org/#mutation-observer-compound-microtask-queued-flag
bool mutation_observer_microtask_queued { false };
// https://dom.spec.whatwg.org/#mutation-observer-list
// FIXME: This should be a set.
Vector<GC::Ref<DOM::MutationObserver>> mutation_observers;
GC::Root<JS::Realm> internal_realm;
OwnPtr<JS::ExecutionContext> root_execution_context;
// https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-reactions-stack
// Each similar-origin window agent has a custom element reactions stack, which is initially empty.
CustomElementReactionsStack custom_element_reactions_stack {};
// https://html.spec.whatwg.org/multipage/custom-elements.html#current-element-queue
// A similar-origin window agent's current element queue is the element queue at the top of its custom element reactions stack.
Vector<GC::Root<DOM::Element>>& current_element_queue() { return custom_element_reactions_stack.element_queue_stack.last(); }
Vector<GC::Root<DOM::Element>> const& current_element_queue() const { return custom_element_reactions_stack.element_queue_stack.last(); }
HTML::Agent agent;
};
struct WebEngineCustomJobCallbackData final : public JS::JobCallback::CustomData {

View file

@ -462,6 +462,7 @@ set(SOURCES
HTML/PotentialCORSRequest.cpp
HTML/PromiseRejectionEvent.cpp
HTML/RadioNodeList.cpp
HTML/Scripting/Agent.cpp
HTML/Scripting/ClassicScript.cpp
HTML/Scripting/Environments.cpp
HTML/Scripting/EnvironmentSettingsSnapshot.cpp

View file

@ -118,6 +118,7 @@
#include <LibWeb/HTML/Numbers.h>
#include <LibWeb/HTML/Parser/HTMLParser.h>
#include <LibWeb/HTML/PopStateEvent.h>
#include <LibWeb/HTML/Scripting/Agent.h>
#include <LibWeb/HTML/Scripting/ClassicScript.h>
#include <LibWeb/HTML/Scripting/ExceptionReporter.h>
#include <LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h>
@ -3949,7 +3950,7 @@ void Document::unload(GC::Ptr<Document>)
auto intend_to_store_in_bfcache = false;
// 6. Let eventLoop be oldDocument's relevant agent's event loop.
auto& event_loop = *verify_cast<Bindings::WebEngineCustomData>(*HTML::relevant_agent(*this).custom_data()).event_loop;
auto& event_loop = *HTML::relevant_agent(*this).event_loop;
// 7. Increase eventLoop's termination nesting level by 1.
event_loop.increment_termination_nesting_level();
@ -6096,7 +6097,7 @@ Document::StepsToFireBeforeunloadResult Document::steps_to_fire_beforeunload(boo
m_unload_counter++;
// 3. Increase document's relevant agent's event loop's termination nesting level by 1.
auto& event_loop = *verify_cast<Bindings::WebEngineCustomData>(*HTML::relevant_agent(*this).custom_data()).event_loop;
auto& event_loop = *HTML::relevant_agent(*this).event_loop;
event_loop.increment_termination_nesting_level();
// 4. Let eventFiringResult be the result of firing an event named beforeunload at document's relevant global object,

View file

@ -54,6 +54,7 @@
#include <LibWeb/HTML/HTMLTextAreaElement.h>
#include <LibWeb/HTML/Numbers.h>
#include <LibWeb/HTML/Parser/HTMLParser.h>
#include <LibWeb/HTML/Scripting/Agent.h>
#include <LibWeb/HTML/TraversableNavigable.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Infra/CharacterTypes.h>
@ -2088,8 +2089,7 @@ void Element::enqueue_an_element_on_the_appropriate_element_queue()
{
// 1. Let reactionsStack be element's relevant agent's custom element reactions stack.
auto& relevant_agent = HTML::relevant_agent(*this);
auto* custom_data = verify_cast<Bindings::WebEngineCustomData>(relevant_agent.custom_data());
auto& reactions_stack = custom_data->custom_element_reactions_stack;
auto& reactions_stack = relevant_agent.custom_element_reactions_stack;
// 2. If reactionsStack is empty, then:
if (reactions_stack.element_queue_stack.is_empty()) {
@ -2105,10 +2105,8 @@ void Element::enqueue_an_element_on_the_appropriate_element_queue()
// 4. Queue a microtask to perform the following steps:
// NOTE: `this` is protected by GC::Function
HTML::queue_a_microtask(&document(), GC::create_function(relevant_agent.heap(), [this]() {
auto& relevant_agent = HTML::relevant_agent(*this);
auto* custom_data = verify_cast<Bindings::WebEngineCustomData>(relevant_agent.custom_data());
auto& reactions_stack = custom_data->custom_element_reactions_stack;
HTML::queue_a_microtask(&document(), GC::create_function(heap(), [this]() {
auto& reactions_stack = HTML::relevant_agent(*this).custom_element_reactions_stack;
// 1. Invoke custom element reactions in reactionsStack's backup element queue.
Bindings::invoke_custom_element_reactions(reactions_stack.backup_element_queue);
@ -2121,7 +2119,7 @@ void Element::enqueue_an_element_on_the_appropriate_element_queue()
}
// 3. Otherwise, add element to element's relevant agent's current element queue.
custom_data->current_element_queue().append(*this);
relevant_agent.current_element_queue().append(*this);
}
// https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-upgrade-reaction

View file

@ -9,6 +9,7 @@
#include <LibWeb/Bindings/MutationObserverPrototype.h>
#include <LibWeb/DOM/MutationObserver.h>
#include <LibWeb/DOM/Node.h>
#include <LibWeb/HTML/Scripting/Agent.h>
namespace Web::DOM {
@ -29,14 +30,12 @@ MutationObserver::MutationObserver(JS::Realm& realm, GC::Ptr<WebIDL::CallbackTyp
// 1. Set thiss callback to callback.
// 2. Append this to thiss relevant agents mutation observers.
auto* agent_custom_data = verify_cast<Bindings::WebEngineCustomData>(realm.vm().custom_data());
agent_custom_data->mutation_observers.append(*this);
HTML::relevant_agent(*this).mutation_observers.append(*this);
}
MutationObserver::~MutationObserver()
{
auto* agent_custom_data = verify_cast<Bindings::WebEngineCustomData>(vm().custom_data());
agent_custom_data->mutation_observers.remove_all_matching([this](auto& observer) {
HTML::relevant_agent(*this).mutation_observers.remove_all_matching([this](auto& observer) {
return observer.ptr() == this;
});
}

View file

@ -552,6 +552,7 @@ enum class AllowMultipleFiles;
enum class MediaSeekMode;
enum class SandboxingFlagSet;
struct Agent;
struct EmbedderPolicy;
struct Environment;
struct EnvironmentSettingsObject;

View file

@ -0,0 +1,35 @@
/*
* Copyright (c) 2021-2023, Luke Wilde <lukew@serenityos.org>
* Copyright (c) 2025, Shannon Booth <shannon@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Vector.h>
#include <LibGC/Root.h>
#include <LibWeb/Forward.h>
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-reactions-stack
struct CustomElementReactionsStack {
CustomElementReactionsStack() = default;
~CustomElementReactionsStack() = default;
// https://html.spec.whatwg.org/multipage/custom-elements.html#element-queue
// Each item in the stack is an element queue, which is initially empty as well. Each item in an element queue is an element.
// (The elements are not necessarily custom yet, since this queue is used for upgrades as well.)
Vector<Vector<GC::Root<DOM::Element>>> element_queue_stack;
// https://html.spec.whatwg.org/multipage/custom-elements.html#backup-element-queue
// Each custom element reactions stack has an associated backup element queue, which an initially-empty element queue.
Vector<GC::Root<DOM::Element>> backup_element_queue;
// https://html.spec.whatwg.org/multipage/custom-elements.html#processing-the-backup-element-queue
// To prevent reentrancy when processing the backup element queue, each custom element reactions stack also has a processing the backup element queue flag, initially unset.
bool processing_the_backup_element_queue { false };
};
}

View file

@ -14,6 +14,7 @@
#include <LibWeb/DOM/Element.h>
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/HTML/EventLoop/EventLoop.h>
#include <LibWeb/HTML/Scripting/Agent.h>
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
#include <LibWeb/HTML/TraversableNavigable.h>
@ -67,7 +68,7 @@ void EventLoop::schedule()
EventLoop& main_thread_event_loop()
{
return *static_cast<Bindings::WebEngineCustomData*>(Bindings::main_thread_vm().custom_data())->event_loop;
return *static_cast<Bindings::WebEngineCustomData*>(Bindings::main_thread_vm().custom_data())->agent.event_loop;
}
// https://html.spec.whatwg.org/multipage/webappapis.html#spin-the-event-loop
@ -460,8 +461,7 @@ TaskID queue_a_task(HTML::Task::Source source, GC::Ptr<EventLoop> event_loop, GC
TaskID queue_global_task(HTML::Task::Source source, JS::Object& global_object, GC::Ref<GC::Function<void()>> steps)
{
// 1. Let event loop be global's relevant agent's event loop.
auto& global_custom_data = verify_cast<Bindings::WebEngineCustomData>(*global_object.vm().custom_data());
auto& event_loop = global_custom_data.event_loop;
auto& event_loop = relevant_agent(global_object).event_loop;
// 2. Let document be global's associated Document, if global is a Window object; otherwise null.
DOM::Document* document { nullptr };

View file

@ -36,6 +36,7 @@
#include <LibWeb/HTML/Parser/HTMLEncodingDetection.h>
#include <LibWeb/HTML/Parser/HTMLParser.h>
#include <LibWeb/HTML/Parser/HTMLToken.h>
#include <LibWeb/HTML/Scripting/Agent.h>
#include <LibWeb/HTML/Scripting/ExceptionReporter.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/HighResolutionTime/TimeOrigin.h>
@ -752,8 +753,7 @@ GC::Ref<DOM::Element> HTMLParser::create_element_for(HTMLToken const& token, Opt
perform_a_microtask_checkpoint();
// 3. Push a new element queue onto document's relevant agent's custom element reactions stack.
auto& custom_data = verify_cast<Bindings::WebEngineCustomData>(*vm.custom_data());
custom_data.custom_element_reactions_stack.element_queue_stack.append({});
relevant_agent(document).custom_element_reactions_stack.element_queue_stack.append({});
}
// 9. Let element be the result of creating an element given document, localName, given namespace, null, is, and willExecuteScript.
@ -770,9 +770,7 @@ GC::Ref<DOM::Element> HTMLParser::create_element_for(HTMLToken const& token, Opt
// 11. If willExecuteScript is true:
if (will_execute_script) {
// 1. Let queue be the result of popping from document's relevant agent's custom element reactions stack. (This will be the same element queue as was pushed above.)
auto& vm = main_thread_event_loop().vm();
auto& custom_data = verify_cast<Bindings::WebEngineCustomData>(*vm.custom_data());
auto queue = custom_data.custom_element_reactions_stack.element_queue_stack.take_last();
auto queue = relevant_agent(document).custom_element_reactions_stack.element_queue_stack.take_last();
// 2. Invoke custom element reactions in queue.
Bindings::invoke_custom_element_reactions(queue);
@ -5150,8 +5148,7 @@ void HTMLParser::insert_an_element_at_the_adjusted_insertion_location(GC::Ref<DO
// 3. If the parser was not created as part of the HTML fragment parsing algorithm,
// then push a new element queue onto element's relevant agent's custom element reactions stack.
if (!m_parsing_fragment) {
auto& custom_data = verify_cast<Bindings::WebEngineCustomData>(*relevant_agent(*element).custom_data());
custom_data.custom_element_reactions_stack.element_queue_stack.append({});
relevant_agent(*element).custom_element_reactions_stack.element_queue_stack.append({});
}
// 4. Insert element at the adjusted insertion location.
@ -5160,8 +5157,7 @@ void HTMLParser::insert_an_element_at_the_adjusted_insertion_location(GC::Ref<DO
// 5. If the parser was not created as part of the HTML fragment parsing algorithm,
// then pop the element queue from element's relevant agent's custom element reactions stack, and invoke custom element reactions in that queue.
if (!m_parsing_fragment) {
auto& custom_data = verify_cast<Bindings::WebEngineCustomData>(*relevant_agent(*element).custom_data());
auto queue = custom_data.custom_element_reactions_stack.element_queue_stack.take_last();
auto queue = relevant_agent(*element).custom_element_reactions_stack.element_queue_stack.take_last();
Bindings::invoke_custom_element_reactions(queue);
}
}

View file

@ -0,0 +1,21 @@
/*
* Copyright (c) 2025, Shannon Booth <shannon@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/MainThreadVM.h>
#include <LibWeb/HTML/Scripting/Agent.h>
#include <LibWeb/HTML/Scripting/Environments.h>
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/webappapis.html#relevant-agent
Agent& relevant_agent(JS::Object const& object)
{
// The relevant agent for a platform object platformObject is platformObject's relevant Realm's agent.
// Spec Note: This pointer is not yet defined in the JavaScript specification; see tc39/ecma262#1357.
return verify_cast<Bindings::WebEngineCustomData>(relevant_realm(object).vm().custom_data())->agent;
}
}

View file

@ -0,0 +1,43 @@
/*
* Copyright (c) 2025, Shannon Booth <shannon@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/OwnPtr.h>
#include <AK/Vector.h>
#include <LibGC/Root.h>
#include <LibJS/Forward.h>
#include <LibWeb/Forward.h>
#include <LibWeb/HTML/CustomElements/CustomElementReactionsStack.h>
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/webappapis.html#similar-origin-window-agent
struct Agent {
GC::Root<HTML::EventLoop> event_loop;
// FIXME: These should only be on similar-origin window agents, but we don't currently differentiate agent types.
// https://dom.spec.whatwg.org/#mutation-observer-compound-microtask-queued-flag
bool mutation_observer_microtask_queued { false };
// https://dom.spec.whatwg.org/#mutation-observer-list
// FIXME: This should be a set.
Vector<GC::Root<DOM::MutationObserver>> mutation_observers;
// https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-reactions-stack
// Each similar-origin window agent has a custom element reactions stack, which is initially empty.
CustomElementReactionsStack custom_element_reactions_stack {};
// https://html.spec.whatwg.org/multipage/custom-elements.html#current-element-queue
// A similar-origin window agent's current element queue is the element queue at the top of its custom element reactions stack.
Vector<GC::Root<DOM::Element>>& current_element_queue() { return custom_element_reactions_stack.element_queue_stack.last(); }
Vector<GC::Root<DOM::Element>> const& current_element_queue() const { return custom_element_reactions_stack.element_queue_stack.last(); }
};
Agent& relevant_agent(JS::Object const&);
}

View file

@ -13,6 +13,7 @@
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOMURL/DOMURL.h>
#include <LibWeb/Fetch/Infrastructure/FetchRecord.h>
#include <LibWeb/HTML/Scripting/Agent.h>
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Scripting/ExceptionReporter.h>
#include <LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h>
@ -102,10 +103,8 @@ EventLoop& EnvironmentSettingsObject::responsible_event_loop()
if (m_responsible_event_loop)
return *m_responsible_event_loop;
auto& vm = global_object().vm();
auto& event_loop = verify_cast<Bindings::WebEngineCustomData>(vm.custom_data())->event_loop;
m_responsible_event_loop = event_loop;
return *event_loop;
m_responsible_event_loop = relevant_agent(global_object()).event_loop;
return *m_responsible_event_loop;
}
// https://html.spec.whatwg.org/multipage/webappapis.html#check-if-we-can-run-script
@ -513,13 +512,6 @@ JS::Object& entry_global_object()
return entry_realm().global_object();
}
JS::VM& relevant_agent(JS::Object const& object)
{
// The relevant agent for a platform object platformObject is platformObject's relevant Realm's agent.
// Spec Note: This pointer is not yet defined in the JavaScript specification; see tc39/ecma262#1357.
return relevant_realm(object).vm();
}
// https://html.spec.whatwg.org/multipage/webappapis.html#secure-context
bool is_secure_context(Environment const& environment)
{

View file

@ -168,7 +168,6 @@ JS::Object& relevant_principal_global_object(JS::Object const&);
JS::Realm& entry_realm();
EnvironmentSettingsObject& entry_settings_object();
JS::Object& entry_global_object();
JS::VM& relevant_agent(JS::Object const&);
[[nodiscard]] bool is_secure_context(Environment const&);
[[nodiscard]] bool is_non_secure_context(Environment const&);

View file

@ -2077,9 +2077,7 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::@function.name:snakecase@@overload_suffi
if (function.extended_attributes.contains("CEReactions")) {
// 1. Push a new element queue onto this object's relevant agent's custom element reactions stack.
function_generator.append(R"~~~(
auto& relevant_agent = HTML::relevant_agent(*impl);
auto* custom_data = verify_cast<Bindings::WebEngineCustomData>(relevant_agent.custom_data());
auto& reactions_stack = custom_data->custom_element_reactions_stack;
auto& reactions_stack = HTML::relevant_agent(*impl).custom_element_reactions_stack;
reactions_stack.element_queue_stack.append({});
)~~~");
}
@ -3566,9 +3564,7 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::@attribute.getter_callback@)
if (attribute.extended_attributes.contains("CEReactions")) {
// 1. Push a new element queue onto this object's relevant agent's custom element reactions stack.
attribute_generator.append(R"~~~(
auto& relevant_agent = HTML::relevant_agent(*impl);
auto* custom_data = verify_cast<Bindings::WebEngineCustomData>(relevant_agent.custom_data());
auto& reactions_stack = custom_data->custom_element_reactions_stack;
auto& reactions_stack = HTML::relevant_agent(*impl).custom_element_reactions_stack;
reactions_stack.element_queue_stack.append({});
)~~~");
}
@ -3914,9 +3910,7 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::@attribute.setter_callback@)
if (attribute.extended_attributes.contains("CEReactions")) {
// 1. Push a new element queue onto this object's relevant agent's custom element reactions stack.
attribute_generator.append(R"~~~(
auto& relevant_agent = HTML::relevant_agent(*impl);
auto* custom_data = verify_cast<Bindings::WebEngineCustomData>(relevant_agent.custom_data());
auto& reactions_stack = custom_data->custom_element_reactions_stack;
auto& reactions_stack = HTML::relevant_agent(*impl).custom_element_reactions_stack;
reactions_stack.element_queue_stack.append({});
)~~~");
}
@ -4912,6 +4906,7 @@ void generate_prototype_implementation(IDL::Interface const& interface, StringBu
#include <LibWeb/DOM/NodeFilter.h>
#include <LibWeb/DOM/Range.h>
#include <LibWeb/HTML/Numbers.h>
#include <LibWeb/HTML/Scripting/Agent.h>
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/HTML/WindowProxy.h>