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

View file

@ -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(){});
@ -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',