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

Unified Diff: 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/
Patch Set: Created July 12, 2018, 11:39 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/requestBlocker.js
===================================================================
--- a/lib/requestBlocker.js
+++ b/lib/requestBlocker.js
@@ -189,17 +189,17 @@
let [filter, thirdParty] = matchRequest(url, type, docDomain,
sitekey, specificOnly);
let result;
let rewrittenUrl;
if (filter instanceof BlockingFilter)
{
- if (filter.rewrite)
+ 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.
{
rewrittenUrl = filter.rewriteUrl(details.url);
// If no rewrite happened (error, different origin), we'll
// return undefined in order to avoid an "infinite" loop.
if (rewrittenUrl != details.url)
result = {redirectUrl: rewrittenUrl};
}
else
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld