This repository has been archived by the owner on Jan 17, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #2542, check event.isTrusted around all interactive events
scroll and resize events are skipped, as they have no immediate effect and so synthetic events here won't affect the process sitehelper is skipped because those events are deliberately synthetic Add assertIsTrusted globals declaration
- Loading branch information
Showing
5 changed files
with
44 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** For use with addEventListener, assures that any events have event.isTrusted set to true | ||
https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted | ||
Should be applied *inside* catcher.watchFunction | ||
*/ | ||
function assertIsTrusted(handlerFunction) { | ||
return function (event) { | ||
if (! event) { | ||
let exc = new Error("assertIsTrusted did not get an event"); | ||
exc.noPopup = true; | ||
throw exc; | ||
} | ||
if (! event.isTrusted) { | ||
let exc = new Error(`Received untrusted event (type: ${event.type})`); | ||
exc.noPopup = true; | ||
throw exc; | ||
} | ||
return handlerFunction.call(this, event); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters