Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More improvements to the google-ima shim script (#3908)
We have enabled the google-ima shim script again in the DuckDuckGo Privacy Essentials browser extension, and found a couple more issues: - Some websites set the enablePreloading[1] option, which should cause[2] the AdsManager.init() method to trigger the LOADED AdEvent to fire. If the event doesn't fire, those websites can get stuck waiting for the event forever. - When AdsManager.start() method is called, a bunch of events are dispatched in order, to simulate ads loading, playing and finishing. There was a mistake in that logic though. The CONTENT_PAUSE_REQUESTED and CONTENT_RESUME_REQUESTED events[3] should fire as the ads start and finish respectively. By firing the latter early, and skipping the former, some websites got confused and tried to display ad overlays at the same time as playing their content, or didn't display they content at all. 1 - https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.AdsRenderingSettings#enablePreloading 2 - https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/preload#timing 3 - https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.AdEvent
- Loading branch information