| <!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> |