[webkit-help] Testing content blocking

Robert Jones robert.jones.sv at gmail.com
Tue Jun 16 22:32:10 PDT 2015


Hi Benjamin,

On Tue, Jun 16, 2015 at 10:19 PM, Benjamin Poulain <benjamin at webkit.org>
wrote:

> Hi Rob,
>
> On 6/16/15 9:54 PM, Robert Jones wrote:
>
>> I'm trying out some things with the new content blocking features in
>> WebKit.  Does anyone have suggestions on how to test content blocking
>> beyond the following technique:
>>
>>   - Create JSON file
>>   - Force iOS Simulator to reload the JSON file
>>   - Reload the web page in mobile Safari
>>   - Visually observe the correct behavior
>>
>
> I don't know if you use it, but you can ask Safari to reload the extension
> once it is enabled:
>     +[SFContentBlockerManager
> reloadContentBlockerWithIdentifier:completionHandler:]
>

Thanks for the suggestion.  That's much easier than what I've been doing.


>
> You can hook up that to a button so that you can just change the file,
> press the button, enjoy.
>
>  I've noticed, when using 'css-display-none', that the blocked content is
>> still visible in the web inspector, although the content is correctly
>> blocked in mobile Safari.  So, I don't think I can observe the output of
>> the web inspector.
>>
>
> 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.
>
> You can also see in the "Rules" panel that there is a "User Stylesheet"
> that will have your selector and "display: none !important".


Ah, I didn't know about these.  That helps a lot.


>
>
>  Is it possible to hook into some other part of WebKit to find out what's
>> being blocked?  Are there perhaps some unit tests that do something like
>> this?
>>
>
> 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.
>

What is Minibrowser?  Do you have a URL?  Is this something I can use too?


>
> The unit tests are in Tools/TestWebKitAPI/Tests/WebCore
> The closest to the front end is ContentExtensions.cpp.
>

Thanks, I'll look there to start.


>
> Please file a bug report on http://bugreport.apple.com with what tools
> you would like to help you develop your rules.
> We have been mostly converting giant privacy list into the declarative
> format and we are still getting feedback on what tools developers want.
>

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.


>
> If you run into any problem, email us on this list and we'll try to help.
>
>
Great!

Cheers,
Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-help/attachments/20150616/87566cce/attachment.html>


More information about the webkit-help mailing list