mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb/HTML: Default ErrorEvent error to undefined
This was a change in the HTML spec, see:
032523196
This commit is contained in:
parent
cb9e3d5c9b
commit
8214371ad5
Notes:
github-actions[bot]
2025-01-05 12:37:18 +00:00
Author: https://github.com/shannonbooth
Commit: 8214371ad5
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3148
4 changed files with 73 additions and 2 deletions
|
@ -0,0 +1,60 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Event handlers processing algorithm: error events</title>
|
||||
<script src="../../../../../resources/testharness.js"></script>
|
||||
<script src="../../../../../resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-event-handler-processing-algorithm">
|
||||
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
|
||||
|
||||
<div id="log"></div>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
setup({ allow_uncaught_exception: true });
|
||||
|
||||
promise_test(t => {
|
||||
document.onerror = t.step_func((...args) => {
|
||||
assert_equals(args.length, 1);
|
||||
return true;
|
||||
});
|
||||
|
||||
const eventWatcher = new EventWatcher(t, document, "error");
|
||||
const promise = eventWatcher.wait_for("error").then(e => {
|
||||
assert_equals(e.defaultPrevented, false);
|
||||
assert_equals(e.message, "");
|
||||
assert_equals(e.filename, "");
|
||||
assert_equals(e.lineno, 0);
|
||||
assert_equals(e.colno, 0);
|
||||
assert_equals(e.error, undefined);
|
||||
});
|
||||
|
||||
document.dispatchEvent(new ErrorEvent("error", { cancelable: true }));
|
||||
|
||||
return promise;
|
||||
}, "error event is normal (return true does not cancel; one arg) on Document, with a synthetic ErrorEvent");
|
||||
|
||||
test(() => {
|
||||
const e = new ErrorEvent("error");
|
||||
assert_equals(e.message, "");
|
||||
assert_equals(e.filename, "");
|
||||
assert_equals(e.lineno, 0);
|
||||
assert_equals(e.colno, 0);
|
||||
assert_equals(e.error, undefined);
|
||||
}, "Initial values of ErrorEvent members")
|
||||
|
||||
test(() => {
|
||||
const e = new ErrorEvent("error", {error : null});
|
||||
assert_equals(e.error, null);
|
||||
}, "error member can be set to null")
|
||||
|
||||
test(() => {
|
||||
const e = new ErrorEvent("error", {error : undefined});
|
||||
assert_equals(e.error, undefined);
|
||||
}, "error member can be set to undefined")
|
||||
|
||||
test(() => {
|
||||
const e = new ErrorEvent("error", {error : "foo"});
|
||||
assert_equals(e.error, "foo");
|
||||
}, "error member can be set to arbitrary")
|
||||
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue