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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 callback(new ext.Page(optionsTab)); | 52 callback(new ext.Page(optionsTab)); |
53 } | 53 } |
54 else | 54 else |
55 { | 55 { |
56 // If we don't already have an options page, it means we've just opened | 56 // If we don't already have an options page, it means we've just opened |
57 // one, in which case we must find the tab, wait for it to be ready, and | 57 // one, in which case we must find the tab, wait for it to be ready, and |
58 // then return the call. | 58 // then return the call. |
59 findOptionsTab(tab => | 59 findOptionsTab(tab => |
60 { | 60 { |
61 if (!tab) | 61 if (!tab) |
62 { | |
63 // This likely means that there was an error. | |
64 return; | 62 return; |
65 } | |
66 | 63 |
67 function onMessage(message, sender) | 64 function onMessage(message, sender) |
68 { | 65 { |
69 if (message.type == "app.listen" && | 66 if (message.type == "app.listen" && |
70 sender.page && sender.page.id == tab.id) | 67 sender.page && sender.page.id == tab.id) |
71 { | 68 { |
72 port.off("app.listen", onMessage); | 69 port.off("app.listen", onMessage); |
73 callback(new ext.Page(tab)); | 70 callback(new ext.Page(tab)); |
74 } | 71 } |
75 } | 72 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 args: [ | 143 args: [ |
147 { | 144 { |
148 host: getDecodedHostname(currentPage.url).replace(/^www\./, ""), | 145 host: getDecodedHostname(currentPage.url).replace(/^www\./, ""), |
149 whitelisted: !!checkWhitelisted(currentPage) | 146 whitelisted: !!checkWhitelisted(currentPage) |
150 } | 147 } |
151 ] | 148 ] |
152 }); | 149 }); |
153 }); | 150 }); |
154 }); | 151 }); |
155 }); | 152 }); |
LEFT | RIGHT |