Left: | ||
Right: |
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-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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 let [docDomain, sitekey, specificOnly] = getDocumentInfo(page, frame, | 187 let [docDomain, sitekey, specificOnly] = getDocumentInfo(page, frame, |
188 originUrl); | 188 originUrl); |
189 let [filter, thirdParty] = matchRequest(url, type, docDomain, | 189 let [filter, thirdParty] = matchRequest(url, type, docDomain, |
190 sitekey, specificOnly); | 190 sitekey, specificOnly); |
191 | 191 |
192 let result; | 192 let result; |
193 let rewrittenUrl; | 193 let rewrittenUrl; |
194 | 194 |
195 if (filter instanceof BlockingFilter) | 195 if (filter instanceof BlockingFilter) |
196 { | 196 { |
197 if (filter.rewrite) | 197 if (filter.rewrite != null) |
kzar
2018/07/12 12:02:13
Nit: I think I'd prefer `if (typeof filter.rewrite
Manish Jethani
2018/07/12 12:06:28
Yeah I kinda prefer that as well.
Done.
| |
198 { | 198 { |
199 rewrittenUrl = filter.rewriteUrl(details.url); | 199 rewrittenUrl = filter.rewriteUrl(details.url); |
200 // If no rewrite happened (error, different origin), we'll | 200 // If no rewrite happened (error, different origin), we'll |
201 // return undefined in order to avoid an "infinite" loop. | 201 // return undefined in order to avoid an "infinite" loop. |
202 if (rewrittenUrl != details.url) | 202 if (rewrittenUrl != details.url) |
203 result = {redirectUrl: rewrittenUrl}; | 203 result = {redirectUrl: rewrittenUrl}; |
204 } | 204 } |
205 else | 205 else |
206 result = {cancel: true}; | 206 result = {cancel: true}; |
207 } | 207 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
328 } | 328 } |
329 | 329 |
330 FilterNotifier.on("subscription.added", onFilterChange); | 330 FilterNotifier.on("subscription.added", onFilterChange); |
331 FilterNotifier.on("subscription.removed", onFilterChange); | 331 FilterNotifier.on("subscription.removed", onFilterChange); |
332 FilterNotifier.on("subscription.updated", onFilterChange); | 332 FilterNotifier.on("subscription.updated", onFilterChange); |
333 FilterNotifier.on("subscription.disabled", arg => onFilterChange(arg, true)); | 333 FilterNotifier.on("subscription.disabled", arg => onFilterChange(arg, true)); |
334 FilterNotifier.on("filter.added", onFilterChange); | 334 FilterNotifier.on("filter.added", onFilterChange); |
335 FilterNotifier.on("filter.removed", onFilterChange); | 335 FilterNotifier.on("filter.removed", onFilterChange); |
336 FilterNotifier.on("filter.disabled", arg => onFilterChange(arg, true)); | 336 FilterNotifier.on("filter.disabled", arg => onFilterChange(arg, true)); |
337 FilterNotifier.on("load", onFilterChange); | 337 FilterNotifier.on("load", onFilterChange); |
OLD | NEW |