From 02c7b32befbaf3e5d66b7dd5a7f4ecd9f41c9a89 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sat, 7 Oct 2023 12:27:03 -0400 Subject: [PATCH] Improve `google-ima.js` surrogate Related issues: - https://github.com/uBlockOrigin/uBlock-issues/issues/2265 - https://github.com/uBlockOrigin/uAssets/issues/19981 --- src/web_accessible_resources/google-ima.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/web_accessible_resources/google-ima.js b/src/web_accessible_resources/google-ima.js index 68375877f..ad1277289 100644 --- a/src/web_accessible_resources/google-ima.js +++ b/src/web_accessible_resources/google-ima.js @@ -7,6 +7,8 @@ * - Avoid JS syntax not supported by older browser versions * - Add missing shim event * - Modified to avoid jshint warnings as per uBO's config + * - Added `OmidVerificationVendor` to `ima` + * - Have `AdError.getInnerError()` return `null` * * Related issue: * - https://github.com/uBlockOrigin/uBlock-issues/issues/2158 @@ -228,7 +230,7 @@ if (!window.google || !window.google.ima || !window.google.ima.VERSION) { }; })(); - let ima = {}; + const ima = {}; class AdDisplayContainer { destroy() {} @@ -613,7 +615,9 @@ if (!window.google || !window.google.ima || !window.google.ima.VERSION) { getErrorCode() { return this.errorCode; } - getInnerError() {} + getInnerError() { + return null; + } getMessage() { return this.message; } @@ -789,6 +793,12 @@ if (!window.google || !window.google.ima || !window.google.ima.VERSION) { FULL: "full", LIMITED: "limited", }, + OmidVerificationVendor: new Proxy({}, { + get(target, prop) { + if ( typeof prop === 'number' ) { return ''; } + return 0; + } + }), settings: new ImaSdkSettings(), UiElements: { AD_ATTRIBUTION: "adAttribution",