mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-20 17:21:52 +00:00
Resulting in a massive rename across almost everywhere! Alongside the namespace change, we now have the following names: * JS::NonnullGCPtr -> GC::Ref * JS::GCPtr -> GC::Ptr * JS::HeapFunction -> GC::Function * JS::CellImpl -> GC::Cell * JS::Handle -> GC::Root
61 lines
1.5 KiB
C++
61 lines
1.5 KiB
C++
/*
|
|
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
|
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/Bindings/IDBRequestPrototype.h>
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
|
#include <LibWeb/HTML/EventNames.h>
|
|
#include <LibWeb/IndexedDB/IDBRequest.h>
|
|
|
|
namespace Web::IndexedDB {
|
|
|
|
GC_DEFINE_ALLOCATOR(IDBRequest);
|
|
|
|
IDBRequest::~IDBRequest() = default;
|
|
|
|
IDBRequest::IDBRequest(JS::Realm& realm)
|
|
: EventTarget(realm)
|
|
{
|
|
}
|
|
|
|
void IDBRequest::initialize(JS::Realm& realm)
|
|
{
|
|
Base::initialize(realm);
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(IDBRequest);
|
|
}
|
|
|
|
void IDBRequest::visit_edges(Visitor& visitor)
|
|
{
|
|
Base::visit_edges(visitor);
|
|
visitor.visit(m_error);
|
|
visitor.visit(m_result);
|
|
}
|
|
|
|
// https://w3c.github.io/IndexedDB/#dom-idbrequest-onsuccess
|
|
void IDBRequest::set_onsuccess(WebIDL::CallbackType* event_handler)
|
|
{
|
|
set_event_handler_attribute(HTML::EventNames::success, event_handler);
|
|
}
|
|
|
|
// https://w3c.github.io/IndexedDB/#dom-idbrequest-onsuccess
|
|
WebIDL::CallbackType* IDBRequest::onsuccess()
|
|
{
|
|
return event_handler_attribute(HTML::EventNames::success);
|
|
}
|
|
|
|
// https://w3c.github.io/IndexedDB/#dom-idbrequest-onerror
|
|
void IDBRequest::set_onerror(WebIDL::CallbackType* event_handler)
|
|
{
|
|
set_event_handler_attribute(HTML::EventNames::error, event_handler);
|
|
}
|
|
|
|
// https://w3c.github.io/IndexedDB/#dom-idbrequest-onerror
|
|
WebIDL::CallbackType* IDBRequest::onerror()
|
|
{
|
|
return event_handler_attribute(HTML::EventNames::error);
|
|
}
|
|
|
|
}
|