This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 13095 - setTimeout behavior seems to be undefined if ToString throws
Summary: setTimeout behavior seems to be undefined if ToString throws
Status: RESOLVED WORKSFORME
Alias: None
Product: HTML WG
Classification: Unclassified
Component: LC1 HTML5 spec (show other bugs)
Version: unspecified
Hardware: Other other
: P2 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-30 07:16 UTC by contributor
Modified: 2011-08-17 21:36 UTC (History)
6 users (show)

See Also:


Attachments

Description contributor 2011-06-30 07:16:23 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html
Multipage: http://www.whatwg.org/C#timers
Complete: http://www.whatwg.org/c#timers

Comment:
setTimeout behavior seems to be undefined if ToString throws

Posted from: 71.184.125.56
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0a1) Gecko/20110628 Firefox/7.0a1
Comment 1 Boris Zbarsky 2011-06-30 07:17:05 UTC
In particular, just propagating the exception out from that point would leave the timeout list in an inconsistent state (with an entry that can't actually be processed).
Comment 2 Boris Zbarsky 2011-06-30 07:23:04 UTC
More data here:

Gecko tries to do the ToString conversion _before_ adding anything to the timeout list, and if ToString() throws will just throw from setTimeout.  But that's not compatible with the spec's requirements on timer ordering (e.g. a timer added from inside ToString() should per spec fire after the one that was being added when ToString() was called, while in Gecko it will fire before).
Comment 3 Michael[tm] Smith 2011-08-04 05:34:07 UTC
mass-move component to LC1
Comment 4 Ian 'Hixie' Hickson 2011-08-17 21:36:07 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff below
Rationale: Recent changes mean that this is now defined in such a way as to be what you describe. I've added a note and example to make it clearer.
Comment 5 contributor 2011-08-17 21:36:59 UTC
Checked in as WHATWG revision r6492.
Check-in comment: Explain ordering of setTimeout() calls better
http://html5.org/tools/web-apps-tracker?from=6491&to=6492