Fix mishandling of procedural cosmetic exceptions in logger

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.
This commit is contained in:
Raymond Hill 2019-09-12 13:05:41 -04:00
parent e393a52442
commit 97d6d5028b
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 10 additions and 4 deletions

View File

@ -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;
}