Summary: | Worker error events do not have their message, filename, and lineno fields properly set | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Andrew Wilson <atwilson> | ||||||
Component: | WebCore JavaScript | Assignee: | David Levin <levin> | ||||||
Status: | RESOLVED INVALID | ||||||||
Severity: | Normal | CC: | ap, caseq, chocoros, dimich, jianli, levin, omerkling, yurys | ||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | PC | ||||||||
OS: | OS X 10.5 | ||||||||
Attachments: |
|
Description
Andrew Wilson
2010-02-23 09:48:14 PST
Created attachment 97306 [details]
SharedWorker or Worker js to demonstrate ErrorEvent bug
ErrorEvents created inside the WorkerGlobal scope also do not have their properties defined. It appears that instead the paramater passed to onerror is the message itself, not an ErrorEvent. Attached files that demonstrate this issue. Expected output to console from running errors.html: Message recieved from worker1: Uncaught Error: Test Error (or similar message) Message recieved from worker2: Uncaught Error: Test Error (or similar message) Uncaught Error: Test Error Actual: Message recieved from worker1: No Error Message:Uncaught Error: Test Error Message recieved from worker2: No Error Message:Uncaught Error: Test Error Uncaught Error: Test Error The 'No Error Message' indicates that error.message was undefined, and 'Uncaught Error: Test Error' was the string value of error. Created attachment 97307 [details]
Page to demonstrate worker ErrorEvent problems
Two issues: 1. The onerror is fired for both Workers and Window in the same was (using JSErrorHandler). For Window it should give three arguements: Message, URL, Line Number. For a Web Worker, I think it should be giving a ErrorEvent. Firefox gives the ErrorEvent and the current situation results in people having to write ugly code to detect the type of the first argument (like this http://cggallant.blogspot.com/2010/08/deeper-look-at-html-5-web-workers.html). 2. The 2nd and 3rd parameter are not set. (The URL is typically undefined and the line number is 0.) (In reply to comment #4) > Two issues: > 1. The onerror is fired for both Workers and Window in the same was (using JSErrorHandler). For Window it should give three arguements: Message, URL, Line Number. For a Web Worker, I think it should be giving a ErrorEvent. Firefox gives the ErrorEvent and the current situation results in people having to write ugly code to detect the type of the first argument (like this http://cggallant.blogspot.com/2010/08/deeper-look-at-html-5-web-workers.html). Ok, Firefox is simply wrong and perhaps the spec should be made more clear but WebKit is behaving correctly with respect to #1 (and the examples in this bug are incorrect actually). See https://bugs.webkit.org/show_bug.cgi?id=36375#c6 > > 2. The 2nd and 3rd parameter are not set. (The URL is typically undefined and the line number is 0.) This one is still an issue. (In reply to comment #5) > Ok, Firefox is simply wrong and perhaps the spec should be made more clear but WebKit is behaving correctly with respect to #1 (and the examples in this bug are incorrect actually). Just verified that Opera also does what Safari does (except that it sets the url and line number correctly), so Firefox seems to be in the minority. I filed https://bugzilla.mozilla.org/show_bug.cgi?id=664650 for Firefox. #2 works in v8 but not with JavaScriptCore, but it turns out to be a generic problem with using throw, so I filed https://bugs.webkit.org/show_bug.cgi?id=62897. Overall this bug is based on the onerror getting an ErrorEvent which isn't right. The spec has been clarified on this point. I filed bug https://bugs.webkit.org/show_bug.cgi?id=62898 about expanding test coverage for onerror. |