Bug 973849 - Allow clearInterval/clearTimeout calls with no arguments; just treat them as no-ops. r=smaug, a=lsblakk
authorBoris Zbarsky <bzbarsky@mit.edu>
Sun, 23 Feb 2014 00:01:26 -0500
changeset 176374 c336953de57975d0a68b3f139312d1a654597fc5
parent 176373 e15b41883a5bc8fa86f51905dcfd1ba379654e86
child 176375 fcca34520a9497c118422d7a0c3498ee637a5308
child 176377 303a852bcba58edf113e215e7b4fd42dd1383f7b
child 176379 9039729f00856cc6b6008e1265a41262adf535e5
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, lsblakk
bugs973849
milestone28.0
Bug 973849 - Allow clearInterval/clearTimeout calls with no arguments; just treat them as no-ops. r=smaug, a=lsblakk
dom/base/test/mochitest.ini
dom/base/test/test_clearTimeoutIntervalNoArg.html
dom/webidl/Window.webidl
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -3,16 +3,17 @@ support-files =
   iframe_messageChannel_cloning.html
   iframe_messageChannel_pingpong.html
   iframe_messageChannel_post.html
   file_empty.html
 
 [test_Image_constructor.html]
 [test_appname_override.html]
 [test_bug913761.html]
+[test_clearTimeoutIntervalNoArg.html]
 [test_constructor-assignment.html]
 [test_constructor.html]
 [test_document.all_unqualified.html]
 [test_domcursor.html]
 [test_domrequest.html]
 [test_e4x_for_each.html]
 [test_error.html]
 [test_gsp-qualified.html]
new file mode 100644
--- /dev/null
+++ b/dom/base/test/test_clearTimeoutIntervalNoArg.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for clearTimeout/clearInterval with no arguments not throwing</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+test(function() {
+  clearTimeout();
+}, "clearTimeout with no args should not throw ");
+test(function() {
+  clearInterval();
+}, "clearInterval with no args should not throw ");
+</script>
--- a/dom/webidl/Window.webidl
+++ b/dom/webidl/Window.webidl
@@ -83,20 +83,20 @@ typedef any Transferable;
 Window implements GlobalEventHandlers;
 Window implements WindowEventHandlers;
 
 // http://www.whatwg.org/specs/web-apps/current-work/
 [NoInterfaceObject]
 interface WindowTimers {
   [Throws] long setTimeout(Function handler, optional long timeout = 0, any... arguments);
   [Throws] long setTimeout(DOMString handler, optional long timeout = 0, any... unused);
-  [Throws] void clearTimeout(long handle);
+  [Throws] void clearTimeout(optional long handle = 0);
   [Throws] long setInterval(Function handler, optional long timeout, any... arguments);
   [Throws] long setInterval(DOMString handler, optional long timeout, any... unused);
-  [Throws] void clearInterval(long handle);
+  [Throws] void clearInterval(optional long handle = 0);
 };
 Window implements WindowTimers;
 
 // http://www.whatwg.org/specs/web-apps/current-work/
 [NoInterfaceObject]
 interface WindowBase64 {
   [Throws] DOMString btoa(DOMString btoa);
   [Throws] DOMString atob(DOMString atob);