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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 30 matching lines...) Expand all Loading... |
41 { | 41 { |
42 let results = []; | 42 let results = []; |
43 let listeners = this._listeners.slice(); | 43 let listeners = this._listeners.slice(); |
44 | 44 |
45 for (let listener of listeners) | 45 for (let listener of listeners) |
46 results.push(listener(...args)); | 46 results.push(listener(...args)); |
47 | 47 |
48 return results; | 48 return results; |
49 } | 49 } |
50 }; | 50 }; |
| 51 |
| 52 // Workaround since HTMLCollection and NodeList didn't have iterator support |
| 53 // before Chrome 51. |
| 54 // https://bugs.chromium.org/p/chromium/issues/detail?id=401699 |
| 55 let arrayIterator = Array.prototype[Symbol.iterator]; |
| 56 if (!(Symbol.iterator in HTMLCollection.prototype)) |
| 57 HTMLCollection.prototype[Symbol.iterator] = arrayIterator; |
| 58 if (!(Symbol.iterator in NodeList.prototype)) |
| 59 NodeList.prototype[Symbol.iterator] = arrayIterator; |
| 60 |
| 61 /* Message passing */ |
| 62 |
| 63 ext.onMessage = new ext._EventTarget(); |
| 64 |
| 65 |
| 66 /* Background page */ |
| 67 |
| 68 ext.backgroundPage = { |
| 69 sendMessage: chrome.runtime.sendMessage, |
| 70 getWindow() |
| 71 { |
| 72 return chrome.extension.getBackgroundPage(); |
| 73 } |
| 74 }; |
| 75 |
| 76 |
| 77 /* Utils */ |
| 78 |
| 79 ext.getURL = chrome.extension.getURL; |
| 80 ext.i18n = chrome.i18n; |
51 }()); | 81 }()); |
OLD | NEW |