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

Unified Diff: libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java

Issue 29351744: Issue 4399 - Add WebView inheritor with ad blocking (Closed)
Patch Set: added goBack/goForward support, added 'setAAenabled' setting, modified app for testing Created Sept. 26, 2016, 12:59 p.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
Index: libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java
diff --git a/libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java b/libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java
index 6796cd076d45eb8da866a989f02d6362df3756aa..d7d78039a2d804d9955917467628bdff6ed0bc6a 100644
--- a/libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java
+++ b/libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java
@@ -92,35 +92,21 @@ public class AndroidWebRequest extends WebRequest
final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
final StringBuilder sb = new StringBuilder();
- if (!this.elemhideEnabled && isListedSubscriptionUrl(url))
+ String line;
+ while ((line = reader.readLine()) != null)
{
- Log.d(TAG, "Removing element hiding rules from: '" + url + "'");
-
- String line;
- while ((line = reader.readLine()) != null)
- {
- // We're only appending non-element-hiding filters here.
- //
- // See:
- // https://issues.adblockplus.org/ticket/303
- //
- // Follow-up issue for removing this hack:
- // https://issues.adblockplus.org/ticket/1541
- //
- if (line.indexOf('#') == -1)
- {
- sb.append(line);
- sb.append('\n');
- }
- }
- }
- else
- {
- int character;
-
- while ((character = reader.read()) != -1)
+ // We're only appending non-element-hiding filters here.
+ //
+ // See:
+ // https://issues.adblockplus.org/ticket/303
+ //
+ // Follow-up issue for removing this hack:
+ // https://issues.adblockplus.org/ticket/1541
+ //
+ if (this.elemhideEnabled || !isListedSubscriptionUrl(url) || line.indexOf('#') == -1)
{
- sb.append((char) character);
+ sb.append(line);
+ sb.append('\n');
}
}
@@ -133,10 +119,12 @@ public class AndroidWebRequest extends WebRequest
{
response.setStatus(NsStatus.ERROR_FAILURE);
}
+ Log.d(TAG, "Downloading finished");
return response;
}
catch (final Throwable t)
{
+ Log.e(TAG, "WebRequest failed", t);
throw new AdblockPlusException("WebRequest failed", t);
}
}

Powered by Google App Engine
This is Rietveld