mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 15:19:42 +00:00
LibWeb: Pass along the init dictionary for error / buffer change events
Otherwise, information stored in the base event init dictionary will be dropped.
This commit is contained in:
parent
a8285f255b
commit
b9e2c79ebb
5 changed files with 24 additions and 6 deletions
|
@ -25,7 +25,7 @@ WebIDL::ExceptionOr<GC::Ref<ErrorEvent>> ErrorEvent::construct_impl(JS::Realm& r
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorEvent::ErrorEvent(JS::Realm& realm, FlyString const& event_name, ErrorEventInit const& event_init)
|
ErrorEvent::ErrorEvent(JS::Realm& realm, FlyString const& event_name, ErrorEventInit const& event_init)
|
||||||
: DOM::Event(realm, event_name)
|
: DOM::Event(realm, event_name, event_init)
|
||||||
, m_message(event_init.message)
|
, m_message(event_init.message)
|
||||||
, m_filename(event_init.filename)
|
, m_filename(event_init.filename)
|
||||||
, m_lineno(event_init.lineno)
|
, m_lineno(event_init.lineno)
|
||||||
|
|
|
@ -17,8 +17,8 @@ WebIDL::ExceptionOr<GC::Ref<BufferedChangeEvent>> BufferedChangeEvent::construct
|
||||||
return realm.create<BufferedChangeEvent>(realm, type, event_init);
|
return realm.create<BufferedChangeEvent>(realm, type, event_init);
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferedChangeEvent::BufferedChangeEvent(JS::Realm& realm, AK::FlyString const& type, BufferedChangeEventInit const&)
|
BufferedChangeEvent::BufferedChangeEvent(JS::Realm& realm, AK::FlyString const& type, BufferedChangeEventInit const& event_init)
|
||||||
: DOM::Event(realm, type)
|
: DOM::Event(realm, type, event_init)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
Tests/LibWeb/Text/expected/DOM/cancelable-events.txt
Normal file
4
Tests/LibWeb/Text/expected/DOM/cancelable-events.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
event=test1 cancelable=false
|
||||||
|
event=test2 cancelable=true
|
||||||
|
event=test3 cancelable=false
|
||||||
|
event=test4 cancelable=true
|
|
@ -2,13 +2,12 @@ Harness status: OK
|
||||||
|
|
||||||
Found 8 tests
|
Found 8 tests
|
||||||
|
|
||||||
7 Pass
|
8 Pass
|
||||||
1 Fail
|
|
||||||
Pass event exists on window, which is initially set to undefined
|
Pass event exists on window, which is initially set to undefined
|
||||||
Pass window.event is only defined during dispatch
|
Pass window.event is only defined during dispatch
|
||||||
Pass window.event is undefined if the target is in a shadow tree (event dispatched outside shadow tree)
|
Pass window.event is undefined if the target is in a shadow tree (event dispatched outside shadow tree)
|
||||||
Pass window.event is undefined if the target is in a shadow tree (event dispatched inside shadow tree)
|
Pass window.event is undefined if the target is in a shadow tree (event dispatched inside shadow tree)
|
||||||
Fail window.event is undefined inside window.onerror if the target is in a shadow tree (ErrorEvent dispatched inside shadow tree)
|
Pass window.event is undefined inside window.onerror if the target is in a shadow tree (ErrorEvent dispatched inside shadow tree)
|
||||||
Pass window.event is set to the current event during dispatch
|
Pass window.event is set to the current event during dispatch
|
||||||
Pass window.event is set to the current event, which is the event passed to dispatch
|
Pass window.event is set to the current event, which is the event passed to dispatch
|
||||||
Pass window.event is set to the current event, which is the event passed to dispatch (2)
|
Pass window.event is set to the current event, which is the event passed to dispatch (2)
|
15
Tests/LibWeb/Text/input/DOM/cancelable-events.html
Normal file
15
Tests/LibWeb/Text/input/DOM/cancelable-events.html
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<script src="../include.js"></script>
|
||||||
|
<script>
|
||||||
|
test(() => {
|
||||||
|
const printEvent = event => {
|
||||||
|
println(`event=${event.type} cancelable=${event.cancelable}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
printEvent(new ErrorEvent("test1"));
|
||||||
|
printEvent(new ErrorEvent("test2", { cancelable: true }));
|
||||||
|
|
||||||
|
printEvent(new BufferedChangeEvent("test3"));
|
||||||
|
printEvent(new BufferedChangeEvent("test4", { cancelable: true }));
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue