[Bug] vimium's `window.forTrusted()` blocks javascript-dispatched events **not only from itself, but from the whole page**
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 27k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
To Reproduce
Example in chrome; also reproduces the same way in firefox.
-
Go to a site where vimium works (i.e. example.com)
-
Devtools > Sources > Enable Listener Breakpoints > Keyboard (check)
-
Console & dispatch a sample event:
event = new KeyboardEvent("keydown", { key: "Enter" });
element = document.querySelector("body");
element.dispatchEvent(event);
-
Get thrown back into Sources, straight into the
utils.jsfile from vimium (full pathchrome-extension://dbepggeogbaibhgnhhndojpepiihcmeb/lib/utils.js) -
See that the event get ignored instead of getting handled, since
event.isTrusted !== true. -
Explore further with F10; exit from breakpoint with F8
-
See
trueget returned from the same place.
That's essentially it. I myself encountered this at gitlab, and, well, I ain't getting those 7 hours of debugging back, so I hope we can fix this so that others don't need to:D
Browser and Vimium version
$ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version
Google Chrome 84.0.4147.135
$ /Applications/Firefox\ Developer\ Edition.app/Contents/MacOS/firefox --version
Mozilla Firefox 81.0b2
vimium version 1.66 in both
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/utils.js and reproduce the issue using the DevTools Keyboard Listener Breakpoint and the dispatchEvent example from the report. Trace the event handling path and verify that JavaScript-dispatched events from the page are treated correctly without changing the intended handling of Vimium's own events.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100