W3C home > Mailing lists > Public > public-html@w3.org > September 2012

[Bug 19143] New: setTimeout and setInterval should clamp at the maximum timeout value

From: <bugzilla@jessica.w3.org>
Date: Sat, 29 Sep 2012 15:13:31 +0000
To: public-html@w3.org
Message-ID: <bug-19143-2495@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=19143

           Summary: setTimeout and setInterval should clamp at the maximum
                    timeout value
           Product: HTML WG
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HTML5 spec
        AssignedTo: erika.doyle@microsoft.com
        ReportedBy: nogwater@gmail.com
         QAContact: public-html-bugzilla@w3.org
                CC: mike@w3.org, public-html-wg-issue-tracking@w3.org,
                    public-html@w3.org


The timeout is currently defined as a signed 32-bit int (aka "long").  I
recently ran into a case where some code overflowed this int.  In all cases I
found, the browsers treated the timeout as 0 (or possibly 4-10ms).  It seems
reasonable that if the spec says to clamp small values to 4ms, then it would be
nice to clamp large values to the something useful like the maximum allowed
value (2^31 - 1).  It might also make sense to change from long to unsigned
long, but that's a different issue.

Here's the sample code that got me in trouble:
setInterval(function () { console.log('test') }, 300000000000)

Here's where I filed an issue with Mozilla:
https://bugzilla.mozilla.org/show_bug.cgi?id=795373

and Chromium:
http://code.google.com/p/chromium/issues/detail?id=152991

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
Received on Saturday, 29 September 2012 15:13:32 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 29 September 2012 15:13:32 GMT