Last Comment Bug 512157 - Web worker onerror event object has blank message property
: Web worker onerror event object has blank message property
Status: RESOLVED DUPLICATE of bug 557346
:
Product: Core
Classification: Components
Component: DOM (show other bugs)
: unspecified
: x86 Windows XP
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
: Andrew Overholt [:overholt]
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-08-23 10:21 PDT by Nicholas C. Zakas
Modified: 2010-06-27 10:56 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Nicholas C. Zakas 2009-08-23 10:21:43 PDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.13) Gecko/2009073022 Firefox/3.0.13
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.13) Gecko/2009073022 Firefox/3.0.13

When an error occurs in a web worker script, the onerror event handler in the main page is called and the event object correctly contains a message property, a lineno property, and a filename property. The only problem is that the message property isn't filled in (it's always an empty string).

//in page
var worker = new Worker("worker.js");
worker.onerror = fucntion(event){
    alert("[" + event.message + "]");  //always empty string
};
worker.postMessage("start");

//in worker.js
self.onmessage = function(event){
    throw new Error("Something bad happened.");
};


Reproducible: Always

Steps to Reproduce:
1. Run above code
Actual Results:  
The alert displays "[]".

Expected Results:  
The alert displays "[Something bad happened.]"
Comment 1 Moos 2010-06-26 16:43:16 PDT
It seems it depends what is thrown:

//in worker.js (FF 3.6.3 on Win7)

1) throw new Error("Something bad happened."); –> handler's event.message is ""
2) throw "something" –>  "something"
3) throw something_undefined –>  "something_undefined is not defined"
4) throw new MyObjectWith_toString("something") –>  "uncaught exception: something"
5) throw new MyObjectWithout_toString("something") –>  "uncaught exception: [object Object]"

where MyObjectWith_toString is a custom object with a toString() method.

Chrome (5.0) prepends the message with "Uncaught : ", so

1) "Uncaught Error: Something bad happened."
2) "Uncaught something"
3) "Uncaught ReferenceError: something_undefined is not defined"
4) "Uncaught something"
5) "Uncaught #"
Comment 2 Moos 2010-06-26 16:45:48 PDT
hmmm... changes in FF 3.6.4 (win 7)

1) throw new Error('Something bad happened.'); –> "Something bad happened."  (FIXED!)
2) throw 'something' –>  'uncaught exception: something'  (SAME))
3) throw something_undefined –> == 'something_undefined is not defined' (SAME)
4) throw new MyObjectWith_toString('something') –> == 'uncaught exception: [object Object]' (REGRESS!)
5) throw new MyObjectWithout_toString('something') –> == 'uncaught exception: [object Object]' (SAME)
Comment 3 Moos 2010-06-26 16:46:52 PDT
in Comment 1: #5 for chrome should read:

5) "Uncaught #<a MyObjectWithout_toString>"
Comment 4 Ben Turner (not reading bugmail, use the needinfo flag!) 2010-06-27 10:56:05 PDT

*** This bug has been marked as a duplicate of bug 557346 ***

Note You need to log in before you can comment on or make changes to this bug.