mixmark-io / turndown

🛏 An HTML to Markdown converter written in JavaScript
https://mixmark-io.github.io/turndown
MIT License
8.94k stars 881 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