Skip to content

Commit

Permalink
Fix mishandling of procedural cosmetic exceptions in logger
Browse files Browse the repository at this point in the history
Issue reported by @uBlock-user in team channel.

Creating cosmetic procedural exception filters was
causing `cosmetic-logger.js` scriptlet to throw at
and thus further breaking the logging of cosmetic
filters overall.
  • Loading branch information
gorhill committed Sep 12, 2019
1 parent e393a52 commit 97d6d50
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/js/scriptlets/cosmetic-logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,18 @@ const handlers = {
if ( Array.isArray(changes.exceptions) ) {
for ( const selector of changes.exceptions ) {
if ( loggedSelectors.has(selector) ) { continue; }
if ( selector.charCodeAt(0) === 0x7B /* '{' */ ) {
const details = JSON.parse(selector);
exceptionDict.set(details.style[0], details.raw);
} else {
if ( selector.charCodeAt(0) !== 0x7B /* '{' */ ) {
exceptionDict.set(selector, selector);
continue;
}
const details = JSON.parse(selector);
if ( Array.isArray(details.style) ) {
exceptionDict.set(details.style[0], details.raw);
continue;
}
// TODO:
// Handling of procedural cosmetic exception filters
// not implemented.
}
exceptionStr = undefined;
}
Expand Down

0 comments on commit 97d6d50

Please sign in to comment.