Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: ext/common.js

Issue 29332839: Issue 3427 - Ensure consistent behavior of EventTarget if listeners remove themselves when called (Closed)
Patch Set: Corrected base revision Created Dec. 17, 2015, 10:51 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ext/common.js
===================================================================
--- a/ext/common.js
+++ b/ext/common.js
@@ -34,16 +34,17 @@
{
var idx = this._listeners.indexOf(listener);
if (idx != -1)
this._listeners.splice(idx, 1);
},
_dispatch: function()
{
var results = [];
+ var listeners = this._listeners.slice();
- for (var i = 0; i < this._listeners.length; i++)
- results.push(this._listeners[i].apply(null, arguments));
+ for (var i = 0; i < listeners.length; i++)
+ results.push(listeners[i].apply(null, arguments));
return results;
}
};
})();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld