[Webkit-unassigned] [Bug 55662] Web Worker 'onmessage' event doesn't fire if "function onmessage(...) { }" is defined

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Mar 3 15:14:56 PST 2011


https://bugs.webkit.org/show_bug.cgi?id=55662





--- Comment #3 from Jon Leighton <j at jonathanleighton.com>  2011-03-03 15:14:56 PST ---
(In reply to comment #2)
> This email thread has relevant information: https://lists.webkit.org/pipermail/webkit-dev/2009-July/009093.html
> 
> If I read it right, the consensus seems to be that FF is the only browser considering the function definition to add an event listener, IE/Chrome/Safari/Opera do the opposite thing and therefore perhaps it's FF that should change. In any case, it's a potential compat issue.

Yes, I wasn't sure which was the "correct" behavior per the spec(s).

Purely from a developer's perspective, as I was playing around with this I found "function onmessage() { }" more aesthetically pleasing, particularly as I had other functions defined inside my worker. I did the initial development in Firefox and it "just worked" so I didn't think this was a problem.

I then switched to Chromium and it didn't work. The biggest problem was that it was no immediately obvious *why* it didn't work - there were obviously no errors because the worker didn't pick up any of the messages I was sending it, so I had to examine the situation more closely.

So I would argue for this syntax to be support because it's what I expect as a developer.

Alternatively, it might be an idea to show some sort of warning in the developer console when a worker was sent a message and it does not have a handler defined to receive it.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list