Index: LayoutTests/fast/dom/event-target-arguments.html |
diff --git a/LayoutTests/fast/dom/event-target-arguments.html b/LayoutTests/fast/dom/event-target-arguments.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d828867340455a247558db9909e01deac21be9e5 |
--- /dev/null |
+++ b/LayoutTests/fast/dom/event-target-arguments.html |
@@ -0,0 +1,59 @@ |
+<!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)'); |
+// FIXME: should throw on missing arguments: http://crbug.com/353484 |
+// shouldThrow('document.addEventListener()'); |
+// shouldThrow('document.addEventListener("foo")'); |
+shouldBe('document.addEventListener()', 'undefined'); |
+shouldBe('document.addEventListener("foo")', 'undefined'); |
+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)'); |
+// FIXME: should throw on missing arguments: http://crbug.com/353484 |
+// shouldThrow('document.removeEventListener()'); |
+// shouldThrow('document.removeEventListener("foo")'); |
+shouldBe('document.removeEventListener()', 'undefined'); |
+shouldBe('document.removeEventListener("foo")', 'undefined'); |
+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> |