<div dir="ltr">Hi Benjamin,<br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 16, 2015 at 10:19 PM, Benjamin Poulain <span dir="ltr"><<a href="mailto:benjamin@webkit.org" target="_blank">benjamin@webkit.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Rob,<span class=""><br>
<br>
On 6/16/15 9:54 PM, Robert Jones wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm trying out some things with the new content blocking features in<br>
WebKit. Does anyone have suggestions on how to test content blocking<br>
beyond the following technique:<br>
<br>
- Create JSON file<br>
- Force iOS Simulator to reload the JSON file<br>
- Reload the web page in mobile Safari<br>
- Visually observe the correct behavior<br>
</blockquote>
<br></span>
I don't know if you use it, but you can ask Safari to reload the extension once it is enabled:<br>
+[SFContentBlockerManager reloadContentBlockerWithIdentifier:completionHandler:]<br></blockquote><div><br></div><div>Thanks for the suggestion. That's much easier than what I've been doing.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
You can hook up that to a button so that you can just change the file, press the button, enjoy.<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I've noticed, when using 'css-display-none', that the blocked content is<br>
still visible in the web inspector, although the content is correctly<br>
blocked in mobile Safari. So, I don't think I can observe the output of<br>
the web inspector.<br>
</blockquote>
<br></span>
If you select the element in inspector and check its computed style in the sidebar, you will see that its display is set to none.<br>
<br>
You can also see in the "Rules" panel that there is a "User Stylesheet" that will have your selector and "display: none !important".</blockquote><div><br></div><div>Ah, I didn't know about these. That helps a lot.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Is it possible to hook into some other part of WebKit to find out what's<br>
being blocked? Are there perhaps some unit tests that do something like<br>
this?<br>
</blockquote>
<br></span>
In WebKit, we can test the rules in browser by using Minibrowser. It lets us load any json file and we do a lot of ad hoc testing like that.<br></blockquote><div><br></div><div>What is Minibrowser? Do you have a URL? Is this something I can use too?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
The unit tests are in Tools/TestWebKitAPI/Tests/WebCore<br>
The closest to the front end is ContentExtensions.cpp.<br></blockquote><div><br></div><div>Thanks, I'll look there to start.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Please file a bug report on <a href="http://bugreport.apple.com" rel="noreferrer" target="_blank">http://bugreport.apple.com</a> with what tools you would like to help you develop your rules.<br>
We have been mostly converting giant privacy list into the declarative format and we are still getting feedback on what tools developers want.<br></blockquote><div><br></div><div>I will once I've spent a bit more time on this. I have a pretty good idea of what I'd like to see.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
If you run into any problem, email us on this list and we'll try to help.<br><br></blockquote><div><br></div><div>Great!</div><div><br></div><div>Cheers,</div><div>Rob </div></div><br></div></div>