| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 callback(); | 57 callback(); |
| 58 return; | 58 return; |
| 59 } | 59 } |
| 60 let removeListener; | 60 let removeListener; |
| 61 let updateListener = (tabId, changeInfo, tab) => | 61 let updateListener = (tabId, changeInfo, tab) => |
| 62 { | 62 { |
| 63 if (potentialOptionTabIds.has(tabId) && | 63 if (potentialOptionTabIds.has(tabId) && |
| 64 changeInfo.status == "complete") | 64 changeInfo.status == "complete") |
| 65 { | 65 { |
| 66 potentialOptionTabIds.delete(tabId); | 66 potentialOptionTabIds.delete(tabId); |
| 67 let urlMatches = tab.url == fullOptionsUrl; | 67 let urlMatch = tab.url == fullOptionsUrl; |
|
Wladimir Palant
2017/11/23 11:37:12
Nit: Variable names are supposed to be nouns, not
kzar
2017/11/23 11:51:08
Done. (It's quite nice in Clojure you can use symb
| |
| 68 if (urlMatches || potentialOptionTabIds.size == 0) | 68 if (urlMatch || potentialOptionTabIds.size == 0) |
| 69 { | 69 { |
| 70 browser.tabs.onUpdated.removeListener(updateListener); | 70 browser.tabs.onUpdated.removeListener(updateListener); |
| 71 browser.tabs.onRemoved.removeListener(removeListener); | 71 browser.tabs.onRemoved.removeListener(removeListener); |
| 72 callback(urlMatches ? tab : undefined); | 72 callback(urlMatch ? tab : undefined); |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 }; | 75 }; |
| 76 browser.tabs.onUpdated.addListener(updateListener); | 76 browser.tabs.onUpdated.addListener(updateListener); |
| 77 removeListener = removedTabId => | 77 removeListener = removedTabId => |
| 78 { | 78 { |
| 79 potentialOptionTabIds.delete(removedTabId); | 79 potentialOptionTabIds.delete(removedTabId); |
| 80 if (potentialOptionTabIds.size == 0) | 80 if (potentialOptionTabIds.size == 0) |
| 81 { | 81 { |
| 82 browser.tabs.onUpdated.removeListener(updateListener); | 82 browser.tabs.onUpdated.removeListener(updateListener); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 args: [ | 189 args: [ |
| 190 { | 190 { |
| 191 host: getDecodedHostname(currentPage.url).replace(/^www\./, ""), | 191 host: getDecodedHostname(currentPage.url).replace(/^www\./, ""), |
| 192 whitelisted: !!checkWhitelisted(currentPage) | 192 whitelisted: !!checkWhitelisted(currentPage) |
| 193 } | 193 } |
| 194 ] | 194 ] |
| 195 }); | 195 }); |
| 196 }); | 196 }); |
| 197 }); | 197 }); |
| 198 }); | 198 }); |
| LEFT | RIGHT |