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

Delta Between Two Patch Sets: src/org/adblockplus/android/AndroidWebRequest.java

Issue 6680224334872576: Issue 303 - Don't load element hiding rules (Closed)
Left Patch Set: Naming, FIXME, whitelist-url Created Jan. 23, 2015, 1:28 p.m.
Right Patch Set: URL query removal Created Feb. 4, 2015, 12:08 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 | « src/org/adblockplus/android/ABPEngine.java ('k') | 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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 23 matching lines...) Expand all
34 import android.util.Log; 34 import android.util.Log;
35 35
36 public class AndroidWebRequest extends WebRequest 36 public class AndroidWebRequest extends WebRequest
37 { 37 {
38 public final static String TAG = Utils.getTag(WebRequest.class); 38 public final static String TAG = Utils.getTag(WebRequest.class);
39 39
40 private final HashSet<String> subscriptionURLs = new HashSet<String>(); 40 private final HashSet<String> subscriptionURLs = new HashSet<String>();
41 41
42 private boolean isListedSubscriptionUrl(final URL url) 42 private boolean isListedSubscriptionUrl(final URL url)
43 { 43 {
44 final String toCheck; 44 String toCheck = url.toString();
45 45
46 if (url.getQuery() != null) 46 final int idx = toCheck.indexOf('?');
Felix Dahlke 2015/01/27 08:40:51 It seems to me this conditional logic is pointless
47 if (idx != -1)
47 { 48 {
48 final String tmp = url.toString(); 49 toCheck = toCheck.substring(0, idx);
49 final int idx = tmp.indexOf('?');
50 toCheck = idx != -1 ? tmp.substring(0, idx) : tmp;
51 }
52 else
53 {
54 toCheck = url.toString();
55 } 50 }
56 51
57 return this.subscriptionURLs.contains(toCheck); 52 return this.subscriptionURLs.contains(toCheck);
58 } 53 }
59 54
60 protected void updateSubscriptionURLs(final FilterEngine engine) 55 protected void updateSubscriptionURLs(final FilterEngine engine)
61 { 56 {
62 for (final org.adblockplus.libadblockplus.Subscription s : engine.fetchAvail ableSubscriptions()) 57 for (final org.adblockplus.libadblockplus.Subscription s : engine.fetchAvail ableSubscriptions())
63 { 58 {
64 this.subscriptionURLs.add(s.getProperty("url").toString()); 59 this.subscriptionURLs.add(s.getProperty("url").toString());
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 response.setStatus(NsStatus.ERROR_FAILURE); 123 response.setStatus(NsStatus.ERROR_FAILURE);
129 } 124 }
130 return response; 125 return response;
131 } 126 }
132 catch (final Throwable t) 127 catch (final Throwable t)
133 { 128 {
134 throw new AdblockPlusException("WebRequest failed", t); 129 throw new AdblockPlusException("WebRequest failed", t);
135 } 130 }
136 } 131 }
137 } 132 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld