Skip to content

Commit

Permalink
rename RedirectCompatibilityObject, fix createOnErrorHandler calls
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-atr committed May 14, 2023
1 parent 6cc6597 commit 5ac964d
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/helpers/compatibility-redirects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* e.g. googletagmanager-gtm is removed and should be removed from compatibility table as well
* but now it works as alias for google-analytics so it should stay valid for compiler
*/
const redirects: RedirectCompatibilityObject[] = [
const redirects: RedirectCompatibilityMap[] = [
{
adg: '1x1-transparent.gif',
ubo: '1x1.gif',
Expand Down
6 changes: 3 additions & 3 deletions src/helpers/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { ADG_SCRIPTLET_MASK } from './parse-rule';
import * as scriptletsList from '../scriptlets/scriptlets-list';
import redirects from './compatibility-redirects';

interface UboToAdgCompatibilityObject extends RedirectCompatibilityObject {
interface UboToAdgCompatibilityObject extends RedirectCompatibilityMap {
ubo: string;
}

interface AbpToAdgCompatibilityObject extends RedirectCompatibilityObject {
interface AbpToAdgCompatibilityObject extends RedirectCompatibilityMap {
abp: string;
}

Expand Down Expand Up @@ -244,7 +244,7 @@ const ABSENT_SOURCE_TYPE_REPLACEMENT = [
},
];

const validAdgRedirects = redirects.filter((el): el is RedirectCompatibilityObject => !!el.adg);
const validAdgRedirects = redirects.filter((el): el is RedirectCompatibilityMap => !!el.adg);

/**
* Compatibility object where KEYS = UBO redirect names and VALUES = ADG redirect names
Expand Down
2 changes: 1 addition & 1 deletion src/scriptlets/abort-current-inline-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export function abortCurrentInlineScript(source, property, search) {

setChainPropAccess(window, property);

window.onerror = createOnErrorHandler(window, rid)
window.onerror = createOnErrorHandler(rid)
.bind();
}

Expand Down
2 changes: 1 addition & 1 deletion src/scriptlets/abort-on-property-read.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function abortOnPropertyRead(source, property) {

setChainPropAccess(window, property);

window.onerror = createOnErrorHandler(window, rid)
window.onerror = createOnErrorHandler(rid)
.bind();
}

Expand Down
2 changes: 1 addition & 1 deletion src/scriptlets/abort-on-property-write.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function abortOnPropertyWrite(source, property) {

setChainPropAccess(window, property);

window.onerror = createOnErrorHandler(window, rid).bind();
window.onerror = createOnErrorHandler(rid).bind();
}

abortOnPropertyWrite.names = [
Expand Down
2 changes: 1 addition & 1 deletion src/scriptlets/abort-on-stack-trace.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export function abortOnStackTrace(source, property, stack) {

setChainPropAccess(window, property);

window.onerror = createOnErrorHandler(window, rid)
window.onerror = createOnErrorHandler(rid)
.bind();
}

Expand Down
2 changes: 1 addition & 1 deletion src/scriptlets/debug-current-inline-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export function debugCurrentInlineScript(source, property, search) {

setChainPropAccess(window, property);

window.onerror = createOnErrorHandler(window, rid)
window.onerror = createOnErrorHandler(rid)
.bind();
}

Expand Down
2 changes: 1 addition & 1 deletion src/scriptlets/debug-on-property-read.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function debugOnPropertyRead(source, property) {

setChainPropAccess(window, property);

window.onerror = createOnErrorHandler(window, rid)
window.onerror = createOnErrorHandler(rid)
.bind();
}

Expand Down
2 changes: 1 addition & 1 deletion src/scriptlets/debug-on-property-write.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function debugOnPropertyWrite(source, property) {

setChainPropAccess(window, property);

window.onerror = createOnErrorHandler(window, rid).bind();
window.onerror = createOnErrorHandler(rid).bind();
}

debugOnPropertyWrite.names = [
Expand Down
2 changes: 1 addition & 1 deletion src/scriptlets/prevent-popads-net.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function preventPopadsNet(source) {
popns: { set: throwError },
});

window.onerror = createOnErrorHandler(window, rid).bind();
window.onerror = createOnErrorHandler(rid).bind();
hit(source);
}

Expand Down
2 changes: 1 addition & 1 deletion types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type MarkerData = {
marker: RedirectMarker;
};

interface RedirectCompatibilityObject {
interface RedirectCompatibilityMap {
adg: string;
ubo?: string;
abp?: string;
Expand Down

0 comments on commit 5ac964d

Please sign in to comment.