Uncaught error when run in browser extension
- Dominant language
- JavaScript
- Stars
- 441
- Forks
- 254
- PR merge metrics
- No merged PRs in 30d
Description
[mouse.support.js#checkSupport](https://github.com/bitovi/syn/blob/b9aa2416597282a6fa642cc7f655cece15c58dc7/src/mouse.support.js) throws an error when run in a
Chrome browser extension [Content Script](https://developer.chrome.com/extensions/content_scripts):
```
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](https://www.npmjs.com/package/syn/v/0.13.0)
Browser: Version 74.0.3686.3 (Official Build) canary (64-bit)
OS: Mac os X 10.12.6
Contributor guide
Research direction
Start in src/mouse.support.js at checkSupport and reproduce the failure in a Chrome Content Script. Read how the __synthTest check and inline javascript URL are used, then verify the behavior under a restrictive CSP. Done means the check no longer throws an uncaught error in the reported extension context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100