duckduckgo / tracker-surrogates

💉 Surrogates are small scripts that our apps and extensions serve in place of trackers that cause site breakage when blocked.
Other
20 stars 11 forks source link

Further improve the google-ima.js surrogate script #24

Closed kzar closed 11 months ago

kzar commented 11 months ago

I worked through some of the websites listed in the uBlock issue[1] for the google-ima.js surrogate script, to see what was going wrong:

  1. It turns out the addEventListener method supports an optional context Object, which is bound to the listener if provided. Some websites make use of that, and then break when this is not bound correctly when events are dispatched.
  2. The AdError.prototype.getInnerError()[2] method should return null or an Error Object, but was returning undefined. This broke websites that explicitly checked for null.

1 - https://github.com/uBlockOrigin/uBlock-issues/issues/2265 2 - https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.AdError#getInnerError