1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 04:49:12 +02:00

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; 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',