Skip to content

Commit

Permalink
Fix logger's reverse-lookup of selectors with no \w characters
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Jul 3, 2020
1 parent 941898e commit d1715fb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/js/reverselookup-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});

Expand Down

3 comments on commit d1715fb

@uBlock-user
Copy link
Contributor

@uBlock-user uBlock-user commented on d1715fb Jul 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Post commit, the issue isn't fixed and now getting error TypeError: can't access property "reduce", selector.match(. . .) is null appears in Firefox Stable and Nightly on uBO extension console with the aformentioned repro in the issue.

Capture2

Edit: the same error appeared before this commit too, so no change.

@gorhill
Copy link
Owner Author

@gorhill gorhill commented on d1715fb Jul 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't have the fix, the reported line in your screenshot does not match the source code after the fix.

@uBlock-user
Copy link
Contributor

@uBlock-user uBlock-user commented on d1715fb Jul 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, the fix is in b1 build.

Please sign in to comment.