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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 21 matching lines...) Expand all
32 }, 32 },
33 removeListener: function(listener) 33 removeListener: function(listener)
34 { 34 {
35 var idx = this._listeners.indexOf(listener); 35 var idx = this._listeners.indexOf(listener);
36 if (idx != -1) 36 if (idx != -1)
37 this._listeners.splice(idx, 1); 37 this._listeners.splice(idx, 1);
38 }, 38 },
39 _dispatch: function() 39 _dispatch: function()
40 { 40 {
41 var results = []; 41 var results = [];
42 var listeners = this._listeners.slice();
42 43
43 for (var i = 0; i < this._listeners.length; i++) 44 for (var i = 0; i < listeners.length; i++)
44 results.push(this._listeners[i].apply(null, arguments)); 45 results.push(listeners[i].apply(null, arguments));
45 46
46 return results; 47 return results;
47 } 48 }
48 }; 49 };
49 })(); 50 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld