[webkit-help] Content Blocker - blocked requests should not seem successful to requester

Andrey Meshkov am at adguard.com
Sun Nov 29 15:46:14 PST 2015


There is an issue with the way content blockers present blocked requests to
the requesters.

Usually (e.g. for all other browsers) when request is blocked by add-on or
extension it looks like an error to the page code. For instance, "onerror"
is called for XMLHttpRequest and "element.onerror" callback is called for
the DOM element if it's load is blocked by the ad blocker.

This is a common behavior and it's handled by web developers.

In case of Safari content blocker "onerror" event is not raised and it may
seem that request is successful while it is not.

Here is an example.

This is a rule blocking access to visualwebsiteoptimizer.com domain.
This domain is a known tracker so you can see this rule in all "privacy"
related filter lists like EasyPrivacy and such.
"trigger": {
"url-filter": "^https?://[^.]+\\.?visualwebsiteoptimizer\\.com[/:&?]?",
"load-type": [
"action": {
"type": "block"

But it can't be used in Safari because the "silent" blocking breaks entire
website which use visualwebsiteoptimizer.com. Examples of such websites:

Here is a code used by them:

As you can see they handle "onerror" callback, but it's not fired in Safari
so the "body" element remains hidden.

Btw, this issue also causes significant delays when ads are blocked on
Youtube. They also are waiting for "onerror" callback to fire, but as it is
not fired, video does not start until "ontimeout" is fired.

wbr, Andrey Meshkov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-help/attachments/20151130/7060a92b/attachment.html>

More information about the webkit-help mailing list