1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-11 22:45:48 +01:00

Fix potential races.

This commit is contained in:
Kris Maglione
2014-02-23 12:20:22 -08:00
parent 9470e18566
commit c37656f731
3 changed files with 10 additions and 7 deletions

View File

@@ -103,11 +103,12 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
target = null;
this.setData(doc, "listeners", listeners.filter(function (args) {
if (target == null || args[0].get() == target && args[1] == event && args[2].wrapped == callback && args[3] == capture) {
args[0].get().removeEventListener.apply(args[0].get(), args.slice(1));
let elem = args[0].get();
if (target == null || elem == target && args[1] == event && args[2].wrapped == callback && args[3] == capture) {
elem.removeEventListener.apply(elem, args.slice(1));
return false;
}
return !args[0].get();
return elem;
}));
},