LibWeb: Implement IDBRequest.onsuccess
This commit is contained in:
parent
fe3962a64d
commit
5ebc09c83b
Notes:
sideshowbarker
2024-07-16 23:38:54 +09:00
Author: https://github.com/jamierocks Commit: https://github.com/LadybirdBrowser/ladybird/commit/5ebc09c83b Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/242 Reviewed-by: https://github.com/AtkinsSJ ✅
4 changed files with 20 additions and 1 deletions
|
@ -105,6 +105,7 @@ namespace Web::HTML::EventNames {
|
|||
__ENUMERATE_HTML_EVENT(statechange) \
|
||||
__ENUMERATE_HTML_EVENT(storage) \
|
||||
__ENUMERATE_HTML_EVENT(submit) \
|
||||
__ENUMERATE_HTML_EVENT(success) \
|
||||
__ENUMERATE_HTML_EVENT(suspend) \
|
||||
__ENUMERATE_HTML_EVENT(timeupdate) \
|
||||
__ENUMERATE_HTML_EVENT(toggle) \
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
/*
|
||||
* 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 {
|
||||
|
@ -25,4 +27,16 @@ void IDBRequest::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(IDBRequest);
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
||||
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -17,6 +18,9 @@ class IDBRequest : public DOM::EventTarget {
|
|||
public:
|
||||
virtual ~IDBRequest() override;
|
||||
|
||||
void set_onsuccess(WebIDL::CallbackType*);
|
||||
WebIDL::CallbackType* onsuccess();
|
||||
|
||||
protected:
|
||||
explicit IDBRequest(JS::Realm&);
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ interface IDBRequest : EventTarget {
|
|||
[FIXME] readonly attribute IDBRequestReadyState readyState;
|
||||
|
||||
// Event handlers:
|
||||
[FIXME] attribute EventHandler onsuccess;
|
||||
attribute EventHandler onsuccess;
|
||||
[FIXME] attribute EventHandler onerror;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue