1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 12:57:57 +02:00

Logging-related changes

This commit is contained in:
Raymond Hill 2023-05-28 10:37:13 -04:00
parent 3c9e946107
commit 82eee10c3a
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -556,7 +556,7 @@ function replaceNodeTextCore(
} }
observer.disconnect(); observer.disconnect();
if ( shouldLog !== 0 ) { if ( shouldLog !== 0 ) {
safe.uboLog(`sed.js: quitting "${pattern}" => "${replacement}"`); safe.uboLog(`replace-node-text-core.fn: quitting "${pattern}" => "${replacement}"`);
} }
}; };
let sedCount = extraArgs.sedCount || 0; let sedCount = extraArgs.sedCount || 0;
@ -569,8 +569,8 @@ function replaceNodeTextCore(
: replacement; : replacement;
node.textContent = after; node.textContent = after;
if ( shouldLog !== 0 ) { if ( shouldLog !== 0 ) {
safe.uboLog('sed.js before:\n', before); safe.uboLog('replace-node-text-core.fn before:\n', before);
safe.uboLog('sed.js after:\n', after); safe.uboLog('replace-node-text-core.fn after:\n', after);
} }
return sedCount === 0 || (sedCount -= 1) !== 0; return sedCount === 0 || (sedCount -= 1) !== 0;
}; };
@ -600,7 +600,7 @@ function replaceNodeTextCore(
stop(); break; stop(); break;
} }
if ( shouldLog !== 0 ) { if ( shouldLog !== 0 ) {
safe.uboLog(`sed.js ${count} nodes present before installing mutation observer`); safe.uboLog(`replace-node-text-core.fn ${count} nodes present before installing mutation observer`);
} }
} }
if ( extraArgs.stay ) { return; } if ( extraArgs.stay ) { return; }
@ -2041,17 +2041,14 @@ function xmlPrune(
} }
const elems = queryAll(xmlDoc, selector); const elems = queryAll(xmlDoc, selector);
if ( elems.length !== 0 ) { if ( elems.length !== 0 ) {
if ( log ) { safeSelf().uboLog(`xmlPrune: removing ${elems.length} nodes`); }
for ( const elem of elems ) { for ( const elem of elems ) {
elem.remove(); elem.remove();
if ( log ) { if ( log ) { safeSelf().uboLog(`xmlPrune: ${elem.nodeName} removed`); }
safeSelf().uboLog(`xmlPrune: ${elem.nodeName} removed`);
}
} }
} }
} catch(ex) { } catch(ex) {
if ( log ) { if ( log ) { safeSelf().uboLog(ex); }
safeSelf().uboLog(ex);
}
} }
return xmlDoc; return xmlDoc;
}; };