videojs / videojs-contrib-ads

A Tool for Building Video.js Ad Plugins
http://videojs.github.io/videojs-contrib-ads/
Other
379 stars 257 forks source link

fix: suppress errors while looking for `__uspapiLocator` #561

Closed Essk closed 1 year ago

Essk commented 1 year ago

Integrations where the video.js player is in an iframe with a different origin are throwing errors when findUspApiLocatorWindow attempts to locate an ancestor frame with ancestor.frames.__uspapiLocator.

No error is thown:

To remedy, we can wrap attempts to read ancestorFrame.__uspapiLocator in a try / catch. There is no need to handle the error as a) we'd expect to run into this while traversing multiple cross domain ancestors and b) if we don't find one in the top window, it probably just means there's no CMP. Users can't control whether this runs or not, so a warning or error would just be clutter.