mixmark-io / turndown

🛏 An HTML to Markdown converter written in JavaScript
https://mixmark-io.github.io/turndown
MIT License
8.62k stars 870 forks source link

shouldUseActiveX() is referencing window without testing it #421

Closed ccordoui closed 1 year ago

ccordoui commented 1 year ago

In the function shouldUseActiveX, window.ActiveXObject is referenced before testing if window exist:

if (window.ActiveXObject) useActiveX = true;

Which trigger an error if window is undefined (in a service worker for example), it can be fixed using something like:

if (typeof window !== 'undefined' && window.ActiveXObject) useActiveX = true;
ccordoui commented 1 year ago

Duplicate of #397