summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhackademix2018-08-01 17:48:45 +0200
committerhackademix2018-08-01 17:48:45 +0200
commit76190a644e5b73240af2b02625e0a773e6634a86 (patch)
tree199eda2fac72653eca43c0f715b3ab051b493be2
parent140d8759cfe4a4bbaedcf9e7d4429e8cb889a3c9 (diff)
downloadnoscript-76190a644e5b73240af2b02625e0a773e6634a86.tar.gz
noscript-76190a644e5b73240af2b02625e0a773e6634a86.tar.xz
noscript-76190a644e5b73240af2b02625e0a773e6634a86.zip
Improved support for debugging code removal in releases.
-rw-r--r--build.sh6
-rw-r--r--src/content/content.js2
-rw-r--r--src/content/media.js2
-rw-r--r--src/content/webglHook.js2
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) {