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

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

Issue 29351744: Issue 4399 - Add WebView inheritor with ad blocking (Closed)
Patch Set: changed packages, now using AdblockEngine (original ABPEngine), improved demo app Created Oct. 25, 2016, 11:20 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
Index: libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidWebRequest.java
diff --git a/libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java b/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidWebRequest.java
similarity index 79%
rename from libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java
rename to libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidWebRequest.java
index 6796cd076d45eb8da866a989f02d6362df3756aa..da8b12139cf3a026a0480e5a803ee0baedda20ac 100644
--- a/libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java
+++ b/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidWebRequest.java
@@ -15,7 +15,7 @@
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
-package org.adblockplus.android;
+package org.adblockplus.libadblockplus.android;
import java.io.BufferedReader;
import java.io.InputStreamReader;
@@ -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