OLD | NEW |
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 Loading... |
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 })(); |
OLD | NEW |