Improve `google-ima.js` surrogate

Related issues:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2265
- https://github.com/uBlockOrigin/uAssets/issues/19981
This commit is contained in:
Raymond Hill 2023-10-07 12:27:03 -04:00
parent d4918c1d0a
commit 02c7b32bef
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 12 additions and 2 deletions

View File

@ -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",