Support AdGuard's `emptyArr`/`emptyObj` for increased compatibility

Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2411
This commit is contained in:
Raymond Hill 2023-11-17 09:28:23 -05:00
parent bfb66297dd
commit a4f8ec6d54
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 9 additions and 2 deletions

View File

@ -414,9 +414,9 @@ function setConstantCore(
cValue = null; cValue = null;
} else if ( cValue === "''" || cValue === '' ) { } else if ( cValue === "''" || cValue === '' ) {
cValue = ''; cValue = '';
} else if ( cValue === '[]' ) { } else if ( cValue === '[]' || cValue === 'emptyArr' ) {
cValue = []; cValue = [];
} else if ( cValue === '{}' ) { } else if ( cValue === '{}' || cValue === 'emptyObj' ) {
cValue = {}; cValue = {};
} else if ( cValue === 'noopFunc' ) { } else if ( cValue === 'noopFunc' ) {
cValue = cloakFunc(function(){}); cValue = cloakFunc(function(){});
@ -830,6 +830,13 @@ function setLocalStorageItemFn(
) { ) {
if ( key === '' ) { return; } if ( key === '' ) { return; }
// For increased compatibility with AdGuard
if ( value === 'emptyArr' ) {
value = '[]';
} else if ( value === 'emptyObj' ) {
value = '{}';
}
const trustedValues = [ const trustedValues = [
'', '',
'undefined', 'null', 'undefined', 'null',