Timers

* Ian Hickson <ian@hixie.ch> wrote:
> I've been asking for people to volunteer to actually take parts of
> HTML5 and edit them for years now. The problem is that very few
> people are actually willing to invest the (large) amount of time and
> effort required. There are a number of areas where we've actually
> tried finding editors:
>
> [...]
>
> * setTimeout(). I moved the text for that section to a separate
> section of HTML5 labelled "things to be removed" or some such.
> Nobody has done anything that would take that text and spec it in
> another document, even though this would be a very small amount of
> work relative to everything else. I may end up having to reintegrate
> this into the rest of the spec, especially now that we have the
> event loop / task queue mechanism defined.


I volunteer to work on this.

A spec on timers should cover setTimeout, clearTimeout, setInterval
and clearInterval. It will also have to integrate with the event loop
defined in HTML5, the queue in Workers and interface with Web IDL.


I've started doing some research on this subject, details following
below. This is by no means complete in any way, but can provide a
basis for discussion and continued work.

Using Opera's internal data mining tools, I've gathered some data on
the usage of setTimeout, clearTimeout, setInterval and clearInterval.
The dataset of pages are mostly from the Open Directory Project
(dmoz.org), filtered for 404s, domain over-representation, expired
and hijacked domains.

Here are some numbers:

* setTimeout is used on 812,357 of the total dataset of 3,509,180
   pages.

* clearTimeout is used on 493,937 pages. It is almost never used
   withoutsetTimeout. The two appear together on 490,124 pages.

* setInterval is used on 392,436 pages.

* clearInterval is used on 316,922, of which 311,890 are together with
   setInterval.

A list of all pages in the dataset containing setTimeout can be found
here (30MB download):

   http://people.opera.com/wilhelmja/timers/urls/settimeout.txt

(Contents may have settled during shipping.)

A subset of these pages plus a selection of modern web applications
not covered by this study should be analyzed to figure out what use
cases authors are actually trying to solve using timers, and how they
are doing it.


I'm currently working my way through the bug tracking systems of
Opera, Mozilla and Webkit, trying to figure out what interoperability
issues and bugs on timers the various browser vendors have stumbled
into along the way. (Input from Microsoft on this is very welcome. I
do not have access to their BTS.)

I'm collecting and creating test cases based on the bug reports I
find, and will use these to determine where browsers are currently
interoperable and where they are not.

My tests are available here:

   http://people.opera.com/wilhelmja/timers/tests/

There's just a few there now. More will be added in the coming days.

-- 
Wilhelm Joys Andersen
Core QA, Opera Software

Received on Thursday, 9 October 2008 11:18:49 UTC