[whatwg] Questions on error handling in web workers

David Levin levin at chromium.org
Wed Jun 15 22:23:03 PDT 2011


On Wed, Jul 15, 2009 at 5:17 PM, Ian Hickson <ian at hixie.ch> wrote:

> On Wed, 15 Jul 2009, Jian Li wrote:
> >
> > I have a couple questions regarding error handling in HTML 5 workers. In
> > the spec, it says "Whenever a runtime script error occurs in one of the
> > worker's scripts, if the error did not occur while handling a previous
> > script error, the user agent must report the error using the
> > WorkerGlobalScope object's onerror attribute.". Does it mean that
> > onerror attribute of WorkerContext would be called? In addition to the
> > errors being thrown?
>
> The term "report the error" is defined here:
>
>   http://www.whatwg.org/specs/web-apps/current-work/#report-the-error



The wording in the Web Workers part of the spec about what to do for onerror
has confused a number of people.

Recently, when asked about it, I thought that it should send through an
ErrorEvent when I was pointed at the spec (even though I had seen this issue
before).

Owen Merkling added a repro case here under that assumption:
    https://bugs.webkit.org/show_bug.cgi?id=35302

Separately, Yury Semikhatsky got it mixed up here:
    https://bugs.webkit.org/show_bug.cgi?id=36375
And a number of us (Jian Li, etc.) were confused about it.

We can see that Ben Turner also found it confusing:
https://bugzilla.mozilla.org/show_bug.cgi?id=664650

Hopefully, the spec can be clarified in this regard to avoid
incompatibilities and confusion among implementors. One possible
clarification would be a link in the onerror section for Web Workers to
indicate that they use this definition:
http://www.whatwg.org/specs/web-apps/current-work/#report-the-error

Thanks,
dave


>
> > The spec also says "For dedicated workers, if the error is still not
> > handled afterwards, or if the error occurred while handling a previous
> > script error, the user agent must queue a task to fire a worker error
> > event at the Worker object associated with the worker.".  What does it
> > mean by "the error is still not handled afterwards"? Does it mean that
> > the onerror attribute is not set for WorkerContext?
>
> The term "not handled" is defined here:
>
>
> http://www.whatwg.org/specs/web-apps/current-work/#concept-error-nothandled
>
> --
> Ian Hickson               U+1047E                )\._.,--....,'``.    fL
> http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
> Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
>


More information about the whatwg mailing list