<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">By doing some "refactoring" of the rules, if-domain and unless-domain seem sufficient for my use cases.<div class=""><br class=""></div><div class="">There is just one case that can’t be elegantly fulfilled right now: when a user navigates to a given webpage (either through an hyperlink or by typing the webpage’s URL in the address field) and that webpage is in the user’s whitelist for an active content blocker.</div><div class=""><div class=""><br class=""></div><div class="">First, since the URL won’t always be just a valid domain, there is no easy way to ignore the rules for the given webpage and all its content.</div><div class="">Second, even when the URL is a valid domain, it <b class="">might</b> be inefficient to use ignore-previous-rules in this case. Please note that I insist on the “might” since I’m quite ignorant about the content blocking implementation.</div><div class=""><br class=""></div><div class="">In both cases, it may be a good idea to have a new action type: “whitelist” (or “ignore-all-rules”). Please note that this wouldn’t be the exact opposite of “ignore-previous-rules” (the exact opposite would be “ignore-next-rules”).</div><div class=""><br class=""></div><div class="">This would be something like this:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"action"</span>: {</div><div style="margin: 0px;" class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""> </span></font><span style="font-family: Menlo; font-size: 11px; color: rgb(209, 47, 27);" class="">"type"</span><font face="Menlo" class=""><span style="font-size: 11px;" class="">: </span></font><font color="#d12f1b" face="Menlo" class=""><span style="font-size: 11px;" class="">“whitelist"</span></font></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> },</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"trigger"</span>: {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(209, 47, 27);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>"url-filter"<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">: </span>"apple\\.com/mac"</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> }</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> }</div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">or for a full website:</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><div style="margin: 0px;" class=""> {</div><div style="margin: 0px;" class=""> <span style="color: rgb(209, 47, 27);" class="">"action"</span>: {</div><div style="font-family: Helvetica; font-size: 12px; margin: 0px;" class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""> </span></font><span style="font-family: Menlo; font-size: 11px; color: rgb(209, 47, 27);" class="">"type"</span><font face="Menlo" class=""><span style="font-size: 11px;" class="">: </span></font><font color="#d12f1b" face="Menlo" class=""><span style="font-size: 11px;" class="">“whitelist"</span></font></div><div style="margin: 0px;" class=""> },</div><div style="margin: 0px;" class=""> <span style="color: rgb(209, 47, 27);" class="">"trigger"</span>: {</div><div style="margin: 0px; color: rgb(209, 47, 27);" class=""><span style="color: rgb(0, 0, 0);" class=""> </span>"url-filter"<span style="color: rgb(0, 0, 0);" class="">: </span>“.*”,</div><div style="margin: 0px; color: rgb(209, 47, 27);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span> “if-domain": “*<a href="http://apple.com" class="">apple.com</a>”</div><div style="margin: 0px;" class=""> }</div><div style="margin: 0px;" class=""> }</div></div><div class=""><br class=""></div><div class="">When the user opens a new webpage, the engine should first evaluate the whitelist rules. If the rule activates for the current URL, all the other rules of the current content blocker should be ignored.</div><div class=""><br class=""></div><div class="">It is actually possible to go even further. Indeed, the whitelist rules are frequently updated since they are mostly user-generated — the user decides which websites or webpages he/she doesn’t want to block — and, as stated above, they should always be the first rules to be evaluated and are therefore completely independent from the other rules. Therefore it may be better to create a separate whitelist JSON file for the content blocker. This way, it is no longer necessary to recompile the whole blocker list every time a user adds or remove an URL from the whitelist.</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 13, 2015, at 11:58 PM, Alex Christensen <<a href="mailto:achristensen@apple.com" class="">achristensen@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Right now, if-domain and unless-domain are the only features that query the main document URL. This is a known limitation, and something we’ve been thinking about. If you have suggestions of ways to do this that are elegant and perform well with thousands of such rules, we would welcome such input.<br class=""><div class=""><blockquote type="cite" class=""><div class="">On Aug 13, 2015, at 2:54 PM, Romain Jacquinot <<a href="mailto:rjacquinot@me.com" class="">rjacquinot@me.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thank you for your quick reply.<div class=""><br class=""></div><div class="">The if-domain only solves half the issue. For instance, if I want to whitelist all pages under the <a href="http://apple.com/" class="">apple.com</a> domain, it works with something like this:<br class=""><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"action"</span>: {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(209, 47, 27);" class=""><span style="" class=""> </span>"type"<span style="" class="">: </span>"ignore-previous-rules"</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> },</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"trigger"</span>: {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(209, 47, 27);" class=""><span style="" class=""> </span>"url-filter"<span style="" class="">: </span>".*"<span style="" class="">,</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(209, 47, 27);" class=""><span style="" class=""> </span>"if-domain"<span style="" class="">: [</span>"*<a href="http://apple.com/" class="">apple.com</a>"<span style="" class="">]</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> }</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> }</div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px;" class=""><span style="font-size: 12px; font-family: Helvetica;" class="">It also works with sub</span>domains, like <a href="http://appleid.apple.com/" class="">appleid.apple.com</a>:</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><div style="margin: 0px;" class=""> {</div><div style="margin: 0px;" class=""> <span style="color: rgb(209, 47, 27);" class="">"action"</span>: {</div><div style="margin: 0px; color: rgb(209, 47, 27);" class=""><span style="" class=""> </span>"type"<span style="" class="">: </span>"ignore-previous-rules"</div><div style="margin: 0px;" class=""> },</div><div style="margin: 0px;" class=""> <span style="color: rgb(209, 47, 27);" class="">"trigger"</span>: {</div><div style="margin: 0px; color: rgb(209, 47, 27);" class=""><span style="" class=""> </span>"url-filter"<span style="" class="">: </span>".*"<span style="" class="">,</span></div><div style="margin: 0px; color: rgb(209, 47, 27);" class=""><span style="" class=""> </span>"if-domain"<span style="" class="">: [</span>“*<a href="http://appleid.apple.com/" class="">appleid.apple.com</a>"<span style="" class="">]</span></div><div style="margin: 0px;" class=""> }</div><div style="margin: 0px;" class=""> }</div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><span style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></span></div><div style="margin: 0px;" class="">However, if I only want to whitelist a given webpage like <a href="http://apple.com/mac" style="font-family: Helvetica; font-size: 12px;" class="">apple.com/mac</a>, this doesn’t work:</div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"action"</span>: {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(209, 47, 27);" class=""><span style="" class=""> </span>"type"<span style="" class="">: </span>"ignore-previous-rules"</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> },</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"trigger"</span>: {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(209, 47, 27);" class=""><span style="" class=""> </span>"url-filter"<span style="" class="">: </span>"apple\\.com/mac"<span style="" class="">,</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(209, 47, 27);" class=""><span style="" class=""> </span>"if-domain"<span style="" class="">: [</span>"*<a href="http://apple.com/" class="">apple.com</a>"<span style="" class="">]</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> }</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> }</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px;" class="">This also doesn’t work since this is not a valid domain:</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px;" class=""><div style="font-family: Menlo; font-size: 11px; margin: 0px;" class=""> {</div><div style="font-family: Menlo; font-size: 11px; margin: 0px;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"action"</span>: {</div><div style="font-family: Menlo; font-size: 11px; margin: 0px; color: rgb(209, 47, 27);" class=""><span style="" class=""> </span>"type"<span style="" class="">: </span>"ignore-previous-rules"</div><div style="font-family: Menlo; font-size: 11px; margin: 0px;" class=""> },</div><div style="font-family: Menlo; font-size: 11px; margin: 0px;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"trigger"</span>: {</div><div style="font-family: Menlo; font-size: 11px; margin: 0px; color: rgb(209, 47, 27);" class=""><span style="" class=""> </span>"url-filter"<span style="" class="">: </span>".*"<span style="" class="">,</span></div><div style="font-family: Menlo; font-size: 11px; margin: 0px; color: rgb(209, 47, 27);" class=""><span style="" class=""> </span>"if-domain"<span style="" class="">: [</span>"*<a href="http://apple.com/mac" class="">apple.com/mac</a>"<span style="" class="">]</span></div><div style="font-family: Menlo; font-size: 11px; margin: 0px;" class=""> }</div><div style="font-family: Menlo; font-size: 11px; margin: 0px;" class=""> }</div><div style="font-family: Menlo; font-size: 11px; margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">Is there currently some </span>way to only whitelist a given webpage and have all its resources loaded?</div></div></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Aug 13, 2015, at 11:24 PM, Alex Christensen <<a href="mailto:achristensen@apple.com" class="">achristensen@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thank you for your bug reports. Feedback like this helps improve our development.<br class=""><div class=""><blockquote type="cite" class=""><div class="">On Aug 13, 2015, at 9:49 AM, Romain Jacquinot <<a href="mailto:rjacquinot@me.com" class="">rjacquinot@me.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi,<br class=""><br class="">After a few days experimenting with Content Blocking in Safari, I have a few questions / some feedback:<br class=""><br class="">1) There are currently no recursive exception rules. It is therefore not possible to whitelist a full website or webpage, i.e. ignoring all rules regardless of where the content comes from. I've filed a bug report at <a href="http://bugreport.apple.com/" class="">bugreport.apple.com</a>: #22268224. Are there any plans to add this feature before the release of iOS 9.0 and OS X 10.11?<br class=""></div></div></blockquote>This is what if-domain and unless-domain are for. Sometimes a website needs a very specific rule that would break other websites, or a common rule would break a certain website. Try something like this:</div><div class="">{"action": {"type": "ignore-previous-rules"},"trigger": {"url-filter": ".*","if-domain”:”*<a href="http://example.com/" class="">example.com</a>”}}</div><div class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">2) Enabling content blockers from Safari Settings may be complicated for some non-tech-savvy users. It would be great to be able to open Safari Settings directly (or even better Content Blockers' Settings) from a third-party app using URL-schemes. Bug report: #22217664</div></div></blockquote><blockquote type="cite" class=""><div class=""><div class=""><br class="">3) With iOS 9.0 (13A4325c), content blocking doesn’t work on iPad, only in the simulator. I've filed a bug report at <a href="http://bugreport.apple.com/" class="">bugreport.apple.com</a>: #22217578. Is it a known bug?<br class=""><br class=""><span class="" style="float: none; display: inline !important;">4) There doesn’t seem to be a way to programmatically enable/disable a previously-enabled content blocker without having to go through the compiler again when re-enabling it. I’ve filed a bug report at </span><a href="http://bugreport.apple.com/" class="">bugreport.apple.com</a><span class="" style="float: none; display: inline !important;"> (#22270848) with an example of use case.</span></div></div></blockquote><blockquote type="cite" class=""><div class=""><div class="">Thanks.<br class=""><br class="">Romain<br class="">_______________________________________________<br class="">webkit-help mailing list<br class=""><a href="mailto:webkit-help@lists.webkit.org" class="">webkit-help@lists.webkit.org</a><br class=""><a href="https://lists.webkit.org/mailman/listinfo/webkit-help" class="">https://lists.webkit.org/mailman/listinfo/webkit-help</a><br class=""></div></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div></div></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div></body></html>