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: Typos and unrelated changes. Created Dec. 4, 2015, 3:18 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: src/org/adblockplus/android/AdblockPlus.java
diff --git a/src/org/adblockplus/android/AdblockPlus.java b/src/org/adblockplus/android/AdblockPlus.java
index eb44cc168d2cfc52197f283f200d1f8a151ef807..78f94ea13f706a8a40b909dc2def1c25904c5786 100755
--- a/src/org/adblockplus/android/AdblockPlus.java
+++ b/src/org/adblockplus/android/AdblockPlus.java
@@ -269,27 +269,35 @@ public class AdblockPlus extends Application
}
/**
- * Returns ElemHide selectors for domain.
+ * Returns ElemHide selectors for the supplied URL.
*
- * @param domain The domain
+ * @param url The URL
* @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);
-*/
+ }
}
/**

Powered by Google App Engine
This is Rietveld