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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 { | 122 { |
123 let name; | 123 let name; |
124 if (type == "filter" && action == "loaded") | 124 if (type == "filter" && action == "loaded") |
125 name = "load"; | 125 name = "load"; |
126 else | 126 else |
127 name = type + "." + action; | 127 name = type + "." + action; |
128 | 128 |
129 if (!(name in listenedFilterChanges)) | 129 if (!(name in listenedFilterChanges)) |
130 { | 130 { |
131 listenedFilterChanges[name] = null; | 131 listenedFilterChanges[name] = null; |
132 FilterNotifier.on(name, (...args) => | 132 FilterNotifier.on(name, (item) => |
133 { | 133 { |
134 sendMessage(type, action, args[0]); | 134 sendMessage(type, action, item); |
a.giammarchi
2018/03/07 08:14:29
I understand you want to keep doors opened in the
Thomas Greiner
2018/03/07 14:05:31
Done.
| |
135 }); | 135 }); |
136 } | 136 } |
137 } | 137 } |
138 } | |
139 | |
140 function getListenerFilters(page) | |
141 { | |
142 let listenerFilters = changeListeners.get(page); | |
143 if (!listenerFilters) | |
144 { | |
145 listenerFilters = Object.create(null); | |
146 changeListeners.set(page, listenerFilters); | |
147 } | |
148 return listenerFilters; | |
149 } | 138 } |
150 | 139 |
151 function addSubscription(subscription, properties) | 140 function addSubscription(subscription, properties) |
152 { | 141 { |
153 subscription.disabled = false; | 142 subscription.disabled = false; |
154 if ("title" in properties) | 143 if ("title" in properties) |
155 subscription.title = properties.title; | 144 subscription.title = properties.title; |
156 if ("homepage" in properties) | 145 if ("homepage" in properties) |
157 subscription.homepage = properties.homepage; | 146 subscription.homepage = properties.homepage; |
158 | 147 |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
468 let filters = new Map(); | 457 let filters = new Map(); |
469 uiPorts.set(uiPort, filters); | 458 uiPorts.set(uiPort, filters); |
470 | 459 |
471 uiPort.onDisconnect.addListener(() => | 460 uiPort.onDisconnect.addListener(() => |
472 { | 461 { |
473 uiPorts.delete(uiPort); | 462 uiPorts.delete(uiPort); |
474 }); | 463 }); |
475 | 464 |
476 uiPort.onMessage.addListener((message) => | 465 uiPort.onMessage.addListener((message) => |
477 { | 466 { |
478 let [type, action] = message.type.split(".", 2); | 467 let [type, action] = message.type.split(".", 2); |
a.giammarchi
2018/03/07 08:14:29
WOW, first time in my life I've found a use case f
| |
479 | 468 |
480 // For now we're only using long-lived connections for handling | 469 // For now we're only using long-lived connections for handling |
481 // "*.listen" messages to tackle #6440 | 470 // "*.listen" messages to tackle #6440 |
482 if (action == "listen") | 471 if (action == "listen") |
483 { | 472 { |
484 listen(type, filters, message.filter); | 473 listen(type, filters, message.filter); |
485 } | 474 } |
486 }); | 475 }); |
487 } | 476 } |
488 | 477 |
489 browser.runtime.onConnect.addListener(onConnect); | 478 browser.runtime.onConnect.addListener(onConnect); |
490 })(this); | 479 })(this); |
LEFT | RIGHT |