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

Unified Diff: src/org/adblockplus/android/AdblockPlus.java

Issue 29331923: Issue 3364 - Implement JNI bindings for IsDocument/ElemhideWhitelisted (Closed)
Patch Set: Created Dec. 4, 2015, 3:14 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
« no previous file with comments | « src/org/adblockplus/android/ABPEngine.java ('k') | src/org/adblockplus/android/AndroidWebRequest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/org/adblockplus/android/AdblockPlus.java
diff --git a/src/org/adblockplus/android/AdblockPlus.java b/src/org/adblockplus/android/AdblockPlus.java
index eb44cc168d2cfc52197f283f200d1f8a151ef807..700e7be8995811aaeca9816d4b29919fb179efd0 100755
--- a/src/org/adblockplus/android/AdblockPlus.java
+++ b/src/org/adblockplus/android/AdblockPlus.java
@@ -274,22 +274,30 @@ public class AdblockPlus extends Application
* @param domain The domain
* @return A list of CSS selectors
*/
- public String[] getSelectorsForDomain(final String domain)
+ public String[] getSelectorsForDomain(final String url, String referrer)
{
- /* We need to ignore element hiding rules here to work around two bugs:
- * 1. CSS is being injected even when there's an exception rule with $elemhide
- * 2. The injected CSS causes blank pages in Chrome for Android
- *
- * Starting with 1.1.2, we ignored element hiding rules after download anyway, to keep the
- * memory usage down. Doing this with libadblockplus is trickier, but would be the clean
- * solution. */
- return null;
-/*
- if (!filteringEnabled)
+ if (this.abpEngine.isElemhideEnabled() && this.filteringEnabled)
+ {
+ if (referrer != null)
+ {
+ this.referrerMapping.add(url, referrer);
+ }
+ final List<String> referrerChain = this.referrerMapping.buildReferrerChain(referrer);
+ final String[] referrerChainArray = referrerChain.toArray(new String[referrerChain.size()]);
+ final List<String> selectors = this.abpEngine.getElementHidingSelectors(url, referrerChainArray);
+ return selectors.toArray(new String[selectors.size()]);
+ }
+ else
+ {
+ /* We need to ignore element hiding rules here to work around two bugs:
+ * 1. CSS is being injected even when there's an exception rule with $elemhide
+ * 2. The injected CSS causes blank pages in Chrome for Android
+ *
+ * Starting with 1.1.2, we ignored element hiding rules after download anyway, to keep the
+ * memory usage down. Doing this with libadblockplus is trickier, but would be the clean
+ * solution. */
return null;
-
- return abpEngine.getSelectorsForDomain(domain);
-*/
+ }
}
/**
« no previous file with comments | « src/org/adblockplus/android/ABPEngine.java ('k') | src/org/adblockplus/android/AndroidWebRequest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld