mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 09:12:13 -05:00
LibWeb/HTML: Make ErrorEvent::create a trusted event
Matching DOM::Event.
This commit is contained in:
parent
aa5207199f
commit
a5bdc56063
Notes:
github-actions[bot]
2024-12-16 13:04:03 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/a5bdc560630 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2920
3 changed files with 42 additions and 2 deletions
|
@ -14,12 +14,14 @@ GC_DEFINE_ALLOCATOR(ErrorEvent);
|
|||
|
||||
GC::Ref<ErrorEvent> ErrorEvent::create(JS::Realm& realm, FlyString const& event_name, ErrorEventInit const& event_init)
|
||||
{
|
||||
return realm.create<ErrorEvent>(realm, event_name, event_init);
|
||||
auto event = realm.create<ErrorEvent>(realm, event_name, event_init);
|
||||
event->set_is_trusted(true);
|
||||
return event;
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<GC::Ref<ErrorEvent>> ErrorEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, ErrorEventInit const& event_init)
|
||||
{
|
||||
return create(realm, event_name, event_init);
|
||||
return realm.create<ErrorEvent>(realm, event_name, event_init);
|
||||
}
|
||||
|
||||
ErrorEvent::ErrorEvent(JS::Realm& realm, FlyString const& event_name, ErrorEventInit const& event_init)
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
Harness status: OK
|
||||
|
||||
Found 1 tests
|
||||
|
||||
1 Pass
|
||||
Pass window.onerror - addEventListener
|
|
@ -0,0 +1,32 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - addEventListener</title>
|
||||
<script src="../../../../resources/testharness.js"></script>
|
||||
<script src="../../../../resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var ran = false;
|
||||
window.addEventListener('error', t.step_func(function(e){
|
||||
ran = true;
|
||||
assert_true(e.isTrusted, 'isTrusted');
|
||||
}), false);
|
||||
</script>
|
||||
<script>
|
||||
undefined_variable;
|
||||
</script>
|
||||
<script>
|
||||
for (;) {}
|
||||
</script>
|
||||
<script>
|
||||
t.step(function(){
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue