[webkit-help] Testing content blocking
benjamin at webkit.org
Tue Jun 16 22:19:02 PDT 2015
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:
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".
> 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
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.
The unit tests are in Tools/TestWebKitAPI/Tests/WebCore
The closest to the front end is ContentExtensions.cpp.
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.
If you run into any problem, email us on this list and we'll try to help.
More information about the webkit-help