gorhill / uBlock

uBlock Origin - An efficient blocker for Chromium and Firefox. Fast and lean.
GNU General Public License v3.0
46.33k stars 3.1k forks source link

Add AdRequest.omidAccessModeRules property to google-ima shim #3911

Open kzar opened 10 months ago

kzar commented 10 months ago

Add the missing AdRequest.omidAccessModeRules[1] property, to avoid breaking websites that access it.

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

kzar commented 10 months ago

@gorhill if you'd like to test this, browse to https://www.corriere.it/video-articoli/2022/07/13/missione-wwf-liberare-mare-plastica/9abb64de-029d-11ed-a0cc-ad3c68cacbae.shtml (making sure google-ima.js is being redirected to the shim) and try playing the video. Without the fix, I found the video wouldn't play and an error showed up in the console about the missing property.

gorhill commented 10 months ago

On my side, the video still doesn't play with uBO + default lists + the filter ||imasdk.googleapis.com/js/sdkloader/ima3.js$script,redirect-rule=google-ima.js:10,from=corriere.it and the fix.

What works to unbreak the video on our side is *$script,redirect-rule=noopjs,from=corriere.it for that site, or simply blocking ||imasdk.googleapis.com^ without redirection.

kzar commented 10 months ago

Dang OK, yea there's quite a lot going on in that website. It's probably not the best test case, but it's the only one I have. In the DuckDuckGo Privacy Essentials extension, this change fixed video playback. But there we are also blocking and redirecting a bunch of other requests. Reproducing the issue to see it being fixed here might be a PITA, sorry :/.

FWIW I am quite confident in the change though, the website attempts to do t.omidAccessModeRules[google.ima.OmidVerificationVendor.OTHER]=google.ima.OmidAccessMode.FULL with t being an AdRequest in 4.min.js. The AdRequest.omidAccessModeRules property is also listed in the docs.

But yea, no pressure if you'd rather not merge. Just wanted to share this back! Sorry I don't have a good test website.

gorhill commented 10 months ago

I will investigate more when I get the time to find out where it fails on my side.

kzar commented 10 months ago

OK cool, sounds good. If it helps, here's a (compressed) HAR file showing which requests the DuckDuckGo extension redirected/blocked/allowed.