Improve `prevent-addEventListener` scriptlet

Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3061#issuecomment-2159662039
This commit is contained in:
Raymond Hill 2024-06-11 07:44:43 -04:00
parent 79c2eec802
commit 91ee5bdeae
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
4 changed files with 5 additions and 3 deletions

View File

@ -1642,6 +1642,8 @@ function addEventListenerDefuser(
const debug = shouldDebug(extraArgs);
const targetSelector = extraArgs.elements || undefined;
const elementMatches = elem => {
if ( targetSelector === 'window' ) { return elem === window; }
if ( targetSelector === 'document' ) { return elem === document; }
if ( elem && elem.matches && elem.matches(targetSelector) ) { return true; }
const elems = Array.from(document.querySelectorAll(targetSelector));
return elems.includes(elem);

View File

@ -156,7 +156,7 @@
"description": "Label for a checkbox in the options page"
},
"showBlockedCountLabel": {
"message": "在工具栏图标上显示拦截请求数",
"message": "在工具栏图标上显示拦截请求数",
"description": "Label for a checkbox in the options page"
}
}

View File

@ -4,7 +4,7 @@
"description": "extension name."
},
"extShortDesc": {
"message": "Нарэшце, эфектыўны блакіроўшчык. Не нагружае працэсар і памяць.",
"message": "Нарэшце, эфектыўны блакавальнік. Не нагружае працэсар і памяць.",
"description": "this will be in the Chrome web store: must be 132 characters or less"
},
"dashboardName": {

View File

@ -540,7 +540,7 @@
"description": "Warning against copy-pasting filters from random sources"
},
"1pEnableMyFiltersLabel": {
"message": "Enable my custom filters",
"message": "Aktibatu nire filtro pertsonalitsatuak",
"description": "Label for the checkbox use to enable/disable 'My filters' list"
},
"1pTrustMyFiltersLabel": {