Skip to content

Commit

Permalink
Improve google-ima.js surrogate
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Oct 7, 2023
1 parent d4918c1 commit 02c7b32
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/web_accessible_resources/google-ima.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -228,7 +230,7 @@ if (!window.google || !window.google.ima || !window.google.ima.VERSION) {
};
})();

let ima = {};
const ima = {};

class AdDisplayContainer {
destroy() {}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 02c7b32

Please sign in to comment.