Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(575)

Unified Diff: LayoutTests/fast/dom/event-target-arguments.html

Issue 329053002: Throw TypeError when addEventListener or removeEventListener are called without enough arguments (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
index a91793dd24b5db4410fed9b780536874261aaadc..7ada54cefc3e52895a3e53261446149c3cf6d689 100644
--- a/LayoutTests/fast/dom/event-target-arguments.html
+++ b/LayoutTests/fast/dom/event-target-arguments.html
@@ -10,28 +10,25 @@ 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');
+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
-shouldBe('document.addEventListener(null)', 'undefined');
+shouldThrow('document.addEventListener(null)');
shouldNotThrow('document.addEventListener(null, listener)'); // converted to "null"
-// FIXME: throw on |null|: http://crbug.com/249598
-// shouldThrow('document.addEventListener("foo", null)');
shouldBe('document.addEventListener("foo", null)', 'undefined');
shouldNotThrow('document.addEventListener("zork", listener, null)');
// undefined
+shouldThrow('document.addEventListener(undefined)');
// FIXME: behavior of undefined for mandatory arguments is unclear, but
// probably should throw
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=23532
-shouldBe('document.addEventListener(undefined)', 'undefined');
+// As of 2014 June, IE and Firefox do not throw here, however:
+// http://lists.w3.org/Archives/Public/public-script-coord/2014AprJun/0166.html
// shouldThrow('document.addEventListener(undefined, listener)');
// shouldThrow('document.addEventListener("foo", undefined)');
shouldBe('document.addEventListener(undefined, listener)', 'undefined');
@@ -41,28 +38,25 @@ 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');
+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.removeEventListener("bar", listener, true)');
// null
-shouldBe('document.removeEventListener(null)', 'undefined');
+shouldThrow('document.removeEventListener(null)');
shouldNotThrow('document.removeEventListener(null, listener)'); // converted to "null"
-// FIXME: throw on |null|: http://crbug.com/249598
-// shouldThrow('document.removeEventListener("foo", null)');
shouldBe('document.removeEventListener("foo", null)', 'undefined');
shouldNotThrow('document.removeEventListener("zork", listener, null)');
// undefined
+shouldThrow('document.removeEventListener(undefined)');
// FIXME: behavior of undefined for mandatory arguments is unclear, but
// probably should throw
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=23532
-shouldBe('document.removeEventListener(undefined)', 'undefined');
+// As of 2014 June, IE and Firefox do not throw here, however:
+// http://lists.w3.org/Archives/Public/public-script-coord/2014AprJun/0166.html
// shouldthrow('document.removeeventlistener("foo", undefined)');
// shouldthrow('document.removeeventlistener(undefined, listener)');
shouldBe('document.removeEventListener(undefined, listener)', 'undefined');

Powered by Google App Engine
This is Rietveld 408576698