1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-04 10:09:38 +02:00

Fix logger's reverse-lookup of selectors with no \w characters

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1139
This commit is contained in:
Raymond Hill 2020-07-03 14:32:12 -04:00
parent 941898e54e
commit d1715fb19f
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -124,7 +124,9 @@ const fromCosmeticFilter = function(details) {
const hostname = details.hostname;
// The longer the needle, the lower the number of false positives.
const needle = selector.match(/\w+/g).reduce(function(a, b) {
// https://github.com/uBlockOrigin/uBlock-issues/issues/1139
// Mind that there is no guarantee a selector has `\w` characters.
const needle = selector.match(/\w+|^.*$/g).reduce(function(a, b) {
return a.length > b.length ? a : b;
});