зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1310718 - Don't wrap invalid listeners r=billm
`makeFilteringListener` uses the listener as a key for a WeakMap, so we cannot blindly use the listener as a WeakMap key. addEventListener and removeEventListeer only accept objects/functions (and undefined/null), so not wrapping will lead to a descriptive error message from addEventListener/removeEventListeer. MozReview-Commit-ID: HF2WAyXDeD9 --HG-- extra : rebase_source : 5574c118cf0881ddc1477ceeb1b9c979814d67d6
This commit is contained in:
Родитель
2dda282bea
Коммит
90c596e654
|
@ -611,7 +611,8 @@ function makeFilteringListener(eventType, listener)
|
|||
// Some events are actually targeted at the <browser> element
|
||||
// itself, so we only handle the ones where know that won't happen.
|
||||
let eventTypes = ["mousedown", "mouseup", "click"];
|
||||
if (eventTypes.indexOf(eventType) == -1) {
|
||||
if (!eventTypes.includes(eventType) || !listener ||
|
||||
(typeof listener != "object" && typeof listener != "function")) {
|
||||
return listener;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче