blob: ba40e17d05758e7259fb5aec22974a23706a9a25 [file] [log] [blame]
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="../../resources/js-test-pre.js"></script>
<script>
description("A TypeError with sensible message should be thrown for a primitive EventListener that is neither null nor undefined");
shouldNotThrow(() => { (new EventTarget).addEventListener("foo", null); });
shouldNotThrow(() => { matchMedia("").removeListener(undefined); });
shouldThrowErrorName(() => { (new EventTarget).addEventListener("foo", 1); }, "TypeError");
shouldThrowErrorName(() => { (new EventTarget).removeEventListener("foo", false); }, "TypeError");
shouldThrowErrorName(() => { matchMedia("").addListener(Symbol()); }, "TypeError");
shouldThrowErrorName(() => { matchMedia("").removeListener("bar"); }, "TypeError");
</script>
<script src="../../resources/js-test-post.js"></script>
</body>