mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 11:26:09 +00:00
Bug 981370 - Make MousePosTracker use a Set rather than manage an array itself. r=dao
This commit is contained in:
parent
735d9279f3
commit
c5871513f9
@ -7097,7 +7097,7 @@ XPCOMUtils.defineLazyGetter(window, "gShowPageResizers", function () {
|
||||
});
|
||||
|
||||
var MousePosTracker = {
|
||||
_listeners: [],
|
||||
_listeners: new Set(),
|
||||
_x: 0,
|
||||
_y: 0,
|
||||
get _windowUtils() {
|
||||
@ -7106,21 +7106,17 @@ var MousePosTracker = {
|
||||
},
|
||||
|
||||
addListener: function (listener) {
|
||||
if (this._listeners.indexOf(listener) >= 0)
|
||||
if (this._listeners.has(listener))
|
||||
return;
|
||||
|
||||
listener._hover = false;
|
||||
this._listeners.push(listener);
|
||||
this._listeners.add(listener);
|
||||
|
||||
this._callListener(listener);
|
||||
},
|
||||
|
||||
removeListener: function (listener) {
|
||||
var index = this._listeners.indexOf(listener);
|
||||
if (index < 0)
|
||||
return;
|
||||
|
||||
this._listeners.splice(index, 1);
|
||||
this._listeners.delete(listener);
|
||||
},
|
||||
|
||||
handleEvent: function (event) {
|
||||
|
Loading…
Reference in New Issue
Block a user