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

Remove Engadget workaround from google-ima shim #36

Closed kzar closed 10 months ago

kzar commented 10 months ago

There was a workaround in the google-ima shim that applied only to www.engadget.com that set a current advert to be returned by AdEvent.getAd() and AdsManager.getCurrentAd(). When testing the website, I couldn't see that code-path being hit at all, so let's remove the workaround. Also, let's take care to return null instead of undefined as is specified[1].

In the future, we could expand this logic if necessary. I think setting the currentAd to new Ad() when the AdEvent.Type.LOADED event fires and back to null when AdEvent.Type.ALL_ADS_COMPLETED fires would make sense - but we would need to test that doesn't cause more website breakage first.

1 - https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.AdEvent#getAd