summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhackademix2018-10-13 10:34:18 +0200
committerhackademix2018-10-13 10:34:18 +0200
commit816d8ae48511f6ed29e70b711dc302fc74c8eb08 (patch)
treea770e0c90f2079b47755e94a645ba012d543f5b5
parent808fd652be324098b3083302bc3218e47a11aba5 (diff)
downloadnoscript-816d8ae48511f6ed29e70b711dc302fc74c8eb08.tar.gz
noscript-816d8ae48511f6ed29e70b711dc302fc74c8eb08.tar.xz
noscript-816d8ae48511f6ed29e70b711dc302fc74c8eb08.zip
[Build] Fixes for cygwin-related cross-platform compatibility quirks.
-rw-r--r--build.sh10
-rw-r--r--html5_events/html5_events.pl20
2 files changed, 19 insertions, 11 deletions
diff --git a/build.sh b/build.sh
index 6041789..4707a87 100644
--- a/build.sh
+++ b/build.sh
@@ -88,7 +88,15 @@ done
echo "Creating $XPI.xpi..."
mkdir -p "$XPI_DIR"
-"$BUILD_CMD" $BUILD_OPTS --source-dir=$(cygpath -w "$BUILD") --artifacts-dir=$(cygpath -w "$XPI_DIR") --ignore-files=test/XSS_test.js
+if which cygpath; then
+ WEBEXT_IN="$(cygpath -w "$BUILD")"
+ WEBEXT_OUT="$(cygpath -w "$XPI_DIR")"
+else
+ WEBEXT_IN="$BUILD"
+ WEBEXT_OUT="$XPI_DIR"
+fi
+
+"$BUILD_CMD" $BUILD_OPTS --source-dir="$WEBEXT_IN" --artifacts-dir="$WEBEXT_OUT" --ignore-files=test/XSS_test.js
SIGNED="$XPI_DIR/noscript_security_suite-$VER-an+fx.xpi"
if [ -f "$SIGNED" ]; then
mv "$SIGNED" "$XPI.xpi"
diff --git a/html5_events/html5_events.pl b/html5_events/html5_events.pl
index 8d2b873..0406ff1 100644
--- a/html5_events/html5_events.pl
+++ b/html5_events/html5_events.pl
@@ -3,7 +3,7 @@ use strict;
require LWP::UserAgent;
use LWP::Simple;
-use RegExp::List;
+use Regexp::List;
use File::stat;
use File::Basename;
use List::MoreUtils qw(uniq);
@@ -17,7 +17,7 @@ sub create_re
{
my $cache = "$HERE/html5_events.re";
my $archive = "$HERE/html5_events_archive.txt";
-
+
my $sb = stat($cache);
if ($sb && time() - $sb->mtime < 86400)
@@ -27,7 +27,7 @@ sub create_re
close IN;
return $content[0];
}
-
+
sub fetch_url
{
my $url = shift(@_);
@@ -53,30 +53,30 @@ sub create_re
$content = join("\n", grep(/^\s*Atom\("on\w+"/, split(/[\n\r]/, $content)));
$content =~ s/.*"(on\w+)".*/$1 /g;
-
+
open IN, "<$archive";
my @archived = <IN>;
close IN;
$content .= join("\n", @archived);
-
+
$content =~ s/\s+/\n/g;
$content =~ s/^\s+|\s+$//g;
-
+
my @all_events = grep(!/^only$/, uniq(split("\n", $content)));
-
+
open (OUT, ">$archive");
print OUT join("\n", @all_events);
close OUT;
-
+
my $l = Regexp::List->new;
my $re = $l->list2re(@all_events);
$re =~ s/\(\?[-^]\w+:(.*)\)/$1/;
-
+
open (OUT, ">$cache");
print OUT $re;
close OUT;
-
+
$re;
}