| Index: LayoutTests/fast/events/event-listener-arguments.html
|
| diff --git a/LayoutTests/fast/events/event-listener-arguments.html b/LayoutTests/fast/events/event-listener-arguments.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..96107f853dc4cfe197065fdcaf22cd1dffdeca97
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/events/event-listener-arguments.html
|
| @@ -0,0 +1,53 @@
|
| +<!DOCTYPE html>
|
| +<script src="../../resources/js-test.js"></script>
|
| +<body>
|
| +<script>
|
| +description('EventTarget.addEventListener and EventTarget.removeEventLister should throw on invalid arguments.');
|
| +
|
| +function listener(event)
|
| +{
|
| +}
|
| +
|
| +debug('Signature:')
|
| +debug('void addEventListener(DOMString type, EventListener listener, optional boolean useCapture)');
|
| +shouldThrow('document.addEventListener()');
|
| +shouldThrow('document.addEventListener("foo")');
|
| +shouldNotThrow('document.addEventListener("foo", listener)');
|
| +shouldNotThrow('document.addEventListener("", listener)');
|
| +shouldNotThrow('document.addEventListener("", function(){})');
|
| +shouldNotThrow('document.addEventListener("bar", listener, false)');
|
| +shouldNotThrow('document.addEventListener("bar", listener, true)');
|
| +// null
|
| +shouldNotThrow('document.addEventListener(null, listener)'); // converted to "null"
|
| +// FIXME: throw on |null|: http://crbug.com/249598
|
| +// shouldThrow('document.addEventListener("foo", null)');
|
| +shouldNotThrow('document.addEventListener("zork", listener, null)');
|
| +// undefined
|
| +// FIXME: behavior of undefined here is unclear, but probably should throw
|
| +// https://www.w3.org/Bugs/Public/show_bug.cgi?id=23532
|
| +// shouldThrow('document.addEventListener(undefined, listener)');
|
| +// shouldThrow('document.addEventListener("foo", undefined)');
|
| +shouldNotThrow('document.addEventListener("zork", listener, undefined)');
|
| +
|
| +debug('');
|
| +debug('Signature:');
|
| +debug('void removeEventListener(DOMString type, EventListener listener, optional boolean useCapture)');
|
| +shouldThrow('document.removeEventListener()');
|
| +shouldThrow('document.removeEventListener("foo")');
|
| +shouldNotThrow('document.removeEventListener("foo", listener)');
|
| +shouldNotThrow('document.removeEventListener("foo", listener, true)');
|
| +shouldNotThrow('document.removeEventListener("bar", listener, false)');
|
| +shouldNotThrow('document.removeEventListener("bar", listener, false)');
|
| +shouldNotThrow('document.addEventListener("bar", listener, true)');
|
| +// null
|
| +shouldNotThrow('document.removeEventListener(null, listener)'); // converted to "null"
|
| +// FIXME: throw on |null|: http://crbug.com/249598
|
| +// shouldThrow('document.removeEventListener("foo", null)');
|
| +shouldNotThrow('document.removeEventListener("zork", listener, null)');
|
| +// undefined
|
| +// FIXME: behavior of undefined here is unclear, but probably should throw
|
| +// https://www.w3.org/Bugs/Public/show_bug.cgi?id=23532
|
| +// shouldThrow('document.removeEventListener("foo", undefined)');
|
| +// shouldThrow('document.removeEventListener(undefined, listener)');
|
| +shouldNotThrow('document.removeEventListener("zork", listener, undefined)');
|
| +</script>
|
|
|