
This isn't perfect (especially the global object situation in activate_event_handler), but I believe it's in a much more complete state now :^) This fixes the issue of crashing in prepare_for_ordinary_call with the `i < m_size` crash, as it now uses the IDL callback functions which requires the Environment Settings Object. The environment settings object for the callback is fetched at the time the callback is created, for example, WrapperGenerator gets the incumbent settings object for the callback at the time of wrapping. This allows us to remove passing in ScriptExecutionContext into EventTarget's constructor. With this, we can now drop ScriptExecutionContext.
35 lines
1.4 KiB
C++
35 lines
1.4 KiB
C++
/*
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibJS/Interpreter.h>
|
|
#include <LibJS/Parser.h>
|
|
#include <LibWeb/DOM/Document.h>
|
|
#include <LibWeb/DOM/EventListener.h>
|
|
#include <LibWeb/HTML/EventHandler.h>
|
|
#include <LibWeb/HTML/EventNames.h>
|
|
#include <LibWeb/HTML/GlobalEventHandlers.h>
|
|
#include <LibWeb/UIEvents/EventNames.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
#undef __ENUMERATE
|
|
#define __ENUMERATE(attribute_name, event_name) \
|
|
void GlobalEventHandlers::set_##attribute_name(Optional<Bindings::CallbackType> value) \
|
|
{ \
|
|
global_event_handlers_to_event_target().set_event_handler_attribute(event_name, move(value)); \
|
|
} \
|
|
Bindings::CallbackType* GlobalEventHandlers::attribute_name() \
|
|
{ \
|
|
return global_event_handlers_to_event_target().event_handler_attribute(event_name); \
|
|
}
|
|
ENUMERATE_GLOBAL_EVENT_HANDLERS(__ENUMERATE)
|
|
#undef __ENUMERATE
|
|
|
|
GlobalEventHandlers::~GlobalEventHandlers()
|
|
{
|
|
}
|
|
|
|
}
|