mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 16:55:09 +00:00
LibWeb: Add HTML::EventNames and UIEvents::EventNames
This commit is contained in:
parent
e68348298f
commit
9950270808
15 changed files with 271 additions and 19 deletions
|
@ -34,6 +34,7 @@
|
|||
#include <LibWeb/DOM/EventListener.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/DOM/XMLHttpRequest.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/Loader/ResourceLoader.h>
|
||||
#include <LibWeb/Origin.h>
|
||||
|
||||
|
@ -83,7 +84,7 @@ void XMLHttpRequest::send()
|
|||
if (!weak_this)
|
||||
return;
|
||||
const_cast<XMLHttpRequest&>(*weak_this).set_ready_state(ReadyState::Done);
|
||||
const_cast<XMLHttpRequest&>(*weak_this).dispatch_event(DOM::Event::create("error"));
|
||||
const_cast<XMLHttpRequest&>(*weak_this).dispatch_event(DOM::Event::create(HTML::EventNames::error));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -96,14 +97,14 @@ void XMLHttpRequest::send()
|
|||
return;
|
||||
const_cast<XMLHttpRequest&>(*weak_this).m_response = data;
|
||||
const_cast<XMLHttpRequest&>(*weak_this).set_ready_state(ReadyState::Done);
|
||||
const_cast<XMLHttpRequest&>(*weak_this).dispatch_event(DOM::Event::create("load"));
|
||||
const_cast<XMLHttpRequest&>(*weak_this).dispatch_event(DOM::Event::create(HTML::EventNames::load));
|
||||
},
|
||||
[weak_this = make_weak_ptr()](auto& error) {
|
||||
if (!weak_this)
|
||||
return;
|
||||
dbg() << "XHR failed to load: " << error;
|
||||
const_cast<XMLHttpRequest&>(*weak_this).set_ready_state(ReadyState::Done);
|
||||
const_cast<XMLHttpRequest&>(*weak_this).dispatch_event(DOM::Event::create("error"));
|
||||
const_cast<XMLHttpRequest&>(*weak_this).dispatch_event(DOM::Event::create(HTML::EventNames::error));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue