Hi!

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": [
"third-party"
]
},
"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:
http://info.singtel.com
http://www.harveynorman.com.au

Here is a code used by them:
http://pastebin.com/awYa9s95

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
_______________________________________________
webkit-help mailing list
webkit-help@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-help

Reply via email to