From 76190a644e5b73240af2b02625e0a773e6634a86 Mon Sep 17 00:00:00 2001 From: hackademix Date: Wed, 1 Aug 2018 17:48:45 +0200 Subject: Improved support for debugging code removal in releases. --- build.sh | 6 +++++- src/content/content.js | 2 +- src/content/media.js | 2 +- src/content/webglHook.js | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index a43a66a..ec912fc 100644 --- a/build.sh +++ b/build.sh @@ -44,7 +44,11 @@ if ! grep '"id":' "$MANIFEST_OUT" >/dev/null; then exit 1 fi -sed -re 's/\/\/\s*(.*)\s*\/\/ XPI_ONLY/\1/' $SRC/content/content.js > $BUILD/content/content.js +for file in $SRC/content/*.js; do + if grep -P '\/\/\s(REL|DEV)_ONLY' $file >/dev/null; then + sed -re 's/\s*\/\/\s*(\S.*)\s*\/\/\s*REL_ONLY.*/\1/' -e 's/.*\/\/\s*DEV_ONLY.*//' $file > $BUILD/content/$(basename $file) + fi +done if [ "$1" == "sign" ]; then BUILD_CMD="$BASE/../../we-sign" diff --git a/src/content/content.js b/src/content/content.js index 222cc05..886c363 100644 --- a/src/content/content.js +++ b/src/content/content.js @@ -1,6 +1,6 @@ 'use strict'; - // debug = () => {}; // XPI_ONLY + // debug = () => {}; // REL_ONLY var canScript = true, shouldScript = false; diff --git a/src/content/media.js b/src/content/media.js index 5a6827a..ffa67e0 100644 --- a/src/content/media.js +++ b/src/content/media.js @@ -1,5 +1,5 @@ { - debug("Media Hook (blocked %s)", !!window.mediaBlocker, document.URL, document.documentElement && document.documentElement.innerHTML); + debug("Media Hook (blocked %s)", !!window.mediaBlocker, document.URL, document.documentElement && document.documentElement.innerHTML); // DEV_ONLY (() => { let unpatched = new Map(); function patch(obj, methodName, replacement) { diff --git a/src/content/webglHook.js b/src/content/webglHook.js index 171ce59..d4c064a 100644 --- a/src/content/webglHook.js +++ b/src/content/webglHook.js @@ -1,5 +1,5 @@ { - debug("WebGL Hook", document.URL, document.documentElement && document.documentElement.innerHTML); + debug("WebGL Hook", document.URL, document.documentElement && document.documentElement.innerHTML); // DEV_ONLY let proto = HTMLCanvasElement.prototype; let getContext = proto.getContext; exportFunction(function(type, ...rest) { -- cgit v1.2.3