bitovi / syn

Standalone Synthetic Event Library
https://www.npmjs.com/package/syn
MIT License
444 stars 258 forks source link

Uncaught error when run in browser extension #170

Open ferbs opened 5 years ago

ferbs commented 5 years ago

mouse.support.js#checkSupport throws an error when run in a Chrome browser extension Content Script:

Uncaught ReferenceError: __synthTest is not defined

In a Content Script, document references the regular page's document object, but it has its own window object, one not shared with the page.

Also, the inline javascript:__synthTest() will be blocked on many sites, pretty much any that bother to set a CSP header.

I'm not sure what this check does, but could you assume the answer when window.__synthTest is not present?

I'm running it with Chrome Canary but I'm pretty sure all Chromium versions will exhibit the same problem. Syn version: 0.13.0 on npm Browser: Version 74.0.3686.3 (Official Build) canary (64-bit) OS: Mac os X 10.12.6