[mv3] Do not pollute browser console in stable release versions

This commit is contained in:
Raymond Hill 2024-03-06 12:46:12 -05:00
parent 4f6fa840c3
commit 02966afb8c
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 20 additions and 2 deletions

View File

@ -131,11 +131,22 @@ export const broadcastMessage = message => {
/******************************************************************************/
const ubolLog = (...args) => {
// Do not pollute dev console in stable release.
if ( browser.runtime.id === 'ddkjiahejlhfcafbddmgiahcphecmpfh' ) { return; }
// Do not pollute dev console in stable releases.
if ( shouldLog !== true ) { return; }
console.info('[uBOL]', ...args);
};
const shouldLog = (( ) => {
const { id } = browser.runtime;
// https://addons.mozilla.org/en-US/firefox/addon/ublock-origin-lite/
if ( id === 'uBOLite@raymondhill.net' ) { return false; }
// https://chromewebstore.google.com/detail/ddkjiahejlhfcafbddmgiahcphecmpfh
if ( id === 'ddkjiahejlhfcafbddmgiahcphecmpfh' ) { return false; }
// https://microsoftedge.microsoft.com/addons/detail/cimighlppcgcoapaliogpjjdehbnofhn
if ( id === 'cimighlppcgcoapaliogpjjdehbnofhn' ) { return false; }
return true;
})();
/******************************************************************************/
export {

View File

@ -124,6 +124,13 @@ fi
echo "*** uBOLite.mv3: extension ready"
echo "Extension location: $DES/"
# Local build: use a different extension id than the official one
if [ -z "$TAGNAME" ]; then
tmp=$(mktemp)
jq '.browser_specific_settings.gecko.id = "uBOLite.dev@raymondhill.net"' "$DES/manifest.json" > "$tmp" \
&& mv "$tmp" "$DES/manifest.json"
fi
if [ "$FULL" = "yes" ]; then
if [ -n "$BEFORE" ]; then
echo "*** uBOLite.mv3: salvaging rule ids to minimize diff size"