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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 let [filter, thirdParty] = matchRequest(url, type, docDomain, | 191 let [filter, thirdParty] = matchRequest(url, type, docDomain, |
192 sitekey, specificOnly); | 192 sitekey, specificOnly); |
193 | 193 |
194 let result; | 194 let result; |
195 let rewrittenUrl; | 195 let rewrittenUrl; |
196 | 196 |
197 if (filter instanceof BlockingFilter) | 197 if (filter instanceof BlockingFilter) |
198 { | 198 { |
199 if (typeof filter.rewrite == "string") | 199 if (typeof filter.rewrite == "string") |
200 { | 200 { |
201 rewrittenUrl = filter.rewriteUrl(details.url); | 201 if (details.method == "GET") |
Sebastian Noack
2019/02/08 22:07:59
Nit: Any reason for introducing another block? Can
a.giammarchi
2019/02/09 13:27:20
I think if we go for `if (details.method == "OPTIO
| |
202 // If no rewrite happened (error, different origin), we'll | 202 { |
203 // return undefined in order to avoid an "infinite" loop. | 203 rewrittenUrl = filter.rewriteUrl(details.url); |
204 if (rewrittenUrl != details.url) | 204 // If no rewrite happened (error, different origin), we'll |
205 result = {redirectUrl: rewrittenUrl}; | 205 // return undefined in order to avoid an "infinite" loop. |
206 if (rewrittenUrl != details.url) | |
207 result = {redirectUrl: rewrittenUrl}; | |
a.giammarchi
2019/02/08 12:10:27
Minor aesthetic improvement: how about we rename `
hub
2019/02/08 17:05:26
it is named this way because it is the $rewrite op
| |
208 } | |
206 } | 209 } |
207 else | 210 else |
208 result = {cancel: true}; | 211 result = {cancel: true}; |
209 } | 212 } |
210 | 213 |
211 getRelatedTabIds(details).then(tabIds => | 214 getRelatedTabIds(details).then(tabIds => |
212 { | 215 { |
213 logRequest( | 216 logRequest( |
214 tabIds, | 217 tabIds, |
215 { | 218 { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
330 } | 333 } |
331 | 334 |
332 filterNotifier.on("subscription.added", onFilterChange); | 335 filterNotifier.on("subscription.added", onFilterChange); |
333 filterNotifier.on("subscription.removed", arg => onFilterChange(arg, false)); | 336 filterNotifier.on("subscription.removed", arg => onFilterChange(arg, false)); |
334 filterNotifier.on("subscription.updated", onFilterChange); | 337 filterNotifier.on("subscription.updated", onFilterChange); |
335 filterNotifier.on("subscription.disabled", arg => onFilterChange(arg, true)); | 338 filterNotifier.on("subscription.disabled", arg => onFilterChange(arg, true)); |
336 filterNotifier.on("filter.added", onFilterChange); | 339 filterNotifier.on("filter.added", onFilterChange); |
337 filterNotifier.on("filter.removed", onFilterChange); | 340 filterNotifier.on("filter.removed", onFilterChange); |
338 filterNotifier.on("filter.disabled", arg => onFilterChange(arg, true)); | 341 filterNotifier.on("filter.disabled", arg => onFilterChange(arg, true)); |
339 filterNotifier.on("load", onFilterChange); | 342 filterNotifier.on("load", onFilterChange); |
OLD | NEW |