How do I talk to Firebug from a Web Worker?
-
20-09-2019 - |
Question
My web workers are becoming increasingly complicated and I'm sorely missing Firebug access while working with them. This:
console.log("test");
Does not produce anything from a web worker. I've also tried the following:
dump("test");
And that doesn't produce any output either.
Firefox version:
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
Firebug version 1.4X.5
Solution
You can't print to console directly. You have to send messages from worker threads to the main window and then print to console from there. See this article for details: http://www.nczonline.net/blog/2009/08/25/web-workers-errors-and-debugging/.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow