From a4f8ec6d5469beba7f9cda413c177b3db6862a24 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 17 Nov 2023 09:28:23 -0500 Subject: [PATCH] Support AdGuard's `emptyArr`/`emptyObj` for increased compatibility Related issue: https://github.com/uBlockOrigin/uBlock-issues/issues/2411 --- assets/resources/scriptlets.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/assets/resources/scriptlets.js b/assets/resources/scriptlets.js index d4fd1e07f..5d671606a 100644 --- a/assets/resources/scriptlets.js +++ b/assets/resources/scriptlets.js @@ -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',