question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Web Worker compatibility

See original GitHub issue

Over at jsdom, our web worker test fail if we update our dependencies. Here is the error that I got:

ReferenceError: window is not defined at https://github.com/visionmedia/debug/blob/17d0e0bb49b46f53bd97aa6d7b56bf9990a8cb62/browser.js#L13

This line is missing a typeof window !== 'undefined' check. This check is present in other locations in this file, so this issue looks like a small oversight.

After #378 is resolved, you might be interested in https://www.npmjs.com/package/karma-mocha-webworker @yamikuronue

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Joris-van-der-Welcommented, Dec 23, 2016

This should be fixed for 2.5.x Can you confirm?

Almost 😉, the issue still occurs on line 185:

/** Attach to Window*/
if (window) {
  window.debug = exports;
}

This line should be if (typeof window !== 'undefined') {

Alternatively, you could replace all instances of window with self. This works within a worker, but also outside of a worker.


I noticed that a lot of other modules pin debug to specific versions instead of using a version range, I end up with 13 different copies of debug in jsdom. Luckily the only one that ends up in my browserify bundle is pinned at ^2.0.0.

0reactions
thebigredgeekcommented, Dec 26, 2016

On it right now. Merry Christmas everyone!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Web Workers | Can I use... Support tables for HTML5, CSS3, etc
Web Workers · Global · Chrome · Edge * · Safari · Firefox · Opera · IE · Chrome for Android.
Read more >
Worker - Web APIs - MDN Web Docs
Chrome Edge Worker Full support. Chrome4. Toggle history Full support. Edge... Worker() constructor Full support. Chrome4. Toggle history Full support. Edge... Support for ECMAScript modules Full...
Read more >
Browser Compatibility Testing of Web Workers - LambdaTest
BROWSER SUPPORT FOR Web Workers · Google Chrome · Mozilla Firefox · Internet Explorer · Safari · Microsoft Edge · Opera.
Read more >
Browser versions that support web workers? - Stack Overflow
Internet Explorer 10, Firefox, Chrome, Safari and Opera support Web workers. But it is a bit vague for me. It does not state...
Read more >
The State Of Web Workers In 2021 - Smashing Magazine
Something that has only been explored at the surface is that Web Workers can also help your app consume less of your user's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found