[nscl] Improved integration of the NoScript Commons Library.

This commit is contained in:
hackademix 2021-02-13 21:17:20 +01:00
parent f2c33945dd
commit f3223f8dad
2 changed files with 17 additions and 26 deletions

View File

@ -63,32 +63,8 @@ fi
XPI_DIR="$BASE/xpi" XPI_DIR="$BASE/xpi"
XPI="$XPI_DIR/noscript-$VER" XPI="$XPI_DIR/noscript-$VER"
LIB="$SRC/lib" LIB="$SRC/lib"
NSCL_SUBMOD="$BASE/nscl"
NSCL="$SRC/nscl"
NSCL_SRC="$NSCL_SUBMOD/src/nscl"
if [[ "$1" == "nscl" ]]; then
nscl_cp() {
nscl_from="$NSCL_SRC/$1"
nscl_to="$NSCL/$1/"
mkdir -p "$nscl_to"
pushd "$nscl_from" >/dev/null 2>&1
shift
echo "Copying $@ to $nscl_to..."
cp -Rp $@ "$nscl_to"
popd >/dev/null 2>&1
}
echo "Updating and synchronizing nscl..."
pushd "$NSCL_SUBMOD" && git submodule update --init && git fetch && git merge && popd || exit 1
nscl_cp common tld.js RequestKey.js Sites.js Permissions.js Policy.js
nscl_cp lib punycode.*
nscl_cp content patchWindow.js
git add "$NSCL" && git commit -m'[nscl] Updated NoScript Common Library inclusions.'
exit
fi
if node "$NSCL_SUBMOD/TLD/update.js" "$NSCL/common/tld.js"; then NSCL="$SRC/nscl"
git add src/lib/tld.js && git commit -m'[nscl] Updated TLDs.'
fi
if ./html5_events/html5_events.pl; then if ./html5_events/html5_events.pl; then
# update full event list as an array in src/lib/DocumentFreezer.js # update full event list as an array in src/lib/DocumentFreezer.js
@ -98,6 +74,21 @@ fi
rm -rf "$BUILD" "$XPI" rm -rf "$BUILD" "$XPI"
cp -pR "$SRC" "$BUILD" cp -pR "$SRC" "$BUILD"
# prune unused nscl stuff
rm -rf "$BUILD/nscl"
pushd "$SRC"
for f in $(grep 'nscl/[^"]*\.js' "manifest.json" */*.js | sed -re"s/^nscl.*//" -e "s/.*(nscl[^'\"]*\.js).*/\\1/" -e "/^ *$/d" | sort | uniq); do
nscl_curdir="$BUILD/$(dirname $f)"
mkdir -p "$nscl_curdir"
cp -p "$f" "$nscl_curdir"
echo "Including $f."
done
popd
if node "$NSCL/TLD/update.js" "$BUILD/nscl/common/tld.js"; then
echo 'Updated TLDs.'
fi
cp -p LICENSE.txt GPL.txt "$BUILD"/ cp -p LICENSE.txt GPL.txt "$BUILD"/
BUILD_CMD="web-ext" BUILD_CMD="web-ext"

@ -1 +1 @@
Subproject commit 2f4a970db83f28c2476703f961c529c2cd8b4ef6 Subproject commit 077b98985354ca42b9a73fd49d3c8c5b8b42ddfe