Closed
Bug 664650
Opened 13 years ago
Closed 13 years ago
worker.onerror should get 3 parameters (message, url, line number) not an ErrorEvent.
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
DUPLICATE
of bug 649537
People
(Reporter: levin, Unassigned)
Details
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.792.0 Safari/535.1 Build Identifier: WorkerGlobalScope.onerror is suppose to work like this for consistency with window.onerror API: http://www.whatwg.org/specs/web-apps/current-work/#concept-error-nothandled (ref https://bugs.webkit.org/show_bug.cgi?id=36375#c9). Opera, Safari, and Chrome all behave this way. The incompatibility in Firefox forces code like this: http://cggallant.blogspot.com/2010/08/deeper-look-at-html-5-web-workers.html for onerror. Reproducible: Always Steps to Reproduce: Create a worker (worker-error.js) with this code: var msg = ""; var port = self; self.onerror = function(message, url, lineNumber) { msg = "Message: " + message + " Url: " +url + " Line Number: " + lineNumber; port.postMessage(msg); } self.onconnect = function(event) { port = event.ports[0]; } setTimeout( function() { throw new Error("Test Error"); }, 0); 2. Then a main page like this <HTML> <BODY> <div id=result></div> <script type="text/javascript" language="javascript"> function log(message) { document.getElementById("result").innerHTML += message + "<br>"; } var worker = new Worker("worker-error.js"); worker.onmessage = function(){ log("Message received from worker: " + event.data ); } </script> </BODY> </HTML> 3. Open the main page. Actual Results: Not the expected result (because Firefox sends an ErrorEvent to onerror). Expected Results: You should get an error with the message, url, and line number displayed. Something like this Message received from worker: Message: Test Error Url file://.../worker-error.js Line Number 15
Reporter | ||
Comment 1•13 years ago
|
||
Adding Ben Turner since it looks like he has been involved in similar bugs.
Updated•13 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
The spec clearly says that we're doing the right thing, and that WebKit is incorrect: http://www.whatwg.org/specs/web-workers/current-work/#the-workerglobalscope-abstract-interface In fact, looking at the bug you referenced, it seems that WebKit realized their mistake and have taken a patch to fix it.
Also, the HTML spec you cited says this: "Whenever an uncaught runtime script error occurs in one of the scripts associated with a Document..." Worker scopes are not associated with a document.
(In reply to comment #2) > In fact, looking at the bug you referenced, it seems that WebKit realized > their mistake and have taken a patch to fix it. I spoke too soon, it seems. They filed the bug saying "oops, WebKit is wrong, it's supposed to be an event handler" and then Hixie apparently told them otherwise but never fixed the spec...
This is now addressed in bug 649537. Thanks for bringing this to our attention!
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
Assignee | ||
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•