Skip to content

Commit

Permalink
Support AdGuard's emptyArr/emptyObj for increased compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Nov 17, 2023
1 parent bfb6629 commit a4f8ec6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions assets/resources/scriptlets.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,9 @@ function setConstantCore(
cValue = null;
} else if ( cValue === "''" || cValue === '' ) {
cValue = '';
} else if ( cValue === '[]' ) {
} else if ( cValue === '[]' || cValue === 'emptyArr' ) {
cValue = [];
} else if ( cValue === '{}' ) {
} else if ( cValue === '{}' || cValue === 'emptyObj' ) {
cValue = {};
} else if ( cValue === 'noopFunc' ) {
cValue = cloakFunc(function(){});
Expand Down Expand Up @@ -830,6 +830,13 @@ function setLocalStorageItemFn(
) {
if ( key === '' ) { return; }

// For increased compatibility with AdGuard
if ( value === 'emptyArr' ) {
value = '[]';
} else if ( value === 'emptyObj' ) {
value = '{}';
}

const trustedValues = [
'',
'undefined', 'null',
Expand Down

0 comments on commit a4f8ec6

Please sign in to comment.