-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibWeb/HTML: Default ErrorEvent error to undefined
This was a change in the HTML spec, see: whatwg/html@032523196
- Loading branch information
1 parent
cb9e3d5
commit 8214371
Showing
4 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...ripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Harness status: OK | ||
|
||
Found 5 tests | ||
|
||
5 Pass | ||
Pass error event is normal (return true does not cancel; one arg) on Document, with a synthetic ErrorEvent | ||
Pass Initial values of ErrorEvent members | ||
Pass error member can be set to null | ||
Pass error member can be set to undefined | ||
Pass error member can be set to arbitrary |
60 changes: 60 additions & 0 deletions
60
...ipting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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:[email protected]"> | ||
|
||
<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> |