Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: lib/requestBlocker.js

Issue 29828591: Issue 6787 - Apply rewrite filter even if the rewrite URL is blank (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Left Patch Set: Created July 12, 2018, 11:39 a.m.
Right Patch Set: Use typeof instead Created July 12, 2018, 12:05 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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 != null) 197 if (typeof filter.rewrite == "string")
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
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);
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld