Ticket #5477: noscript-merge.sh

File noscript-merge.sh, 1008 bytes (added by ma1, 7 years ago)

Merging bash/perl script to sync with current stable NoScript

Line 
1#!/bin/bash
2URL="https://addons.mozilla.org/firefox/downloads/latest/722/addon-722-latest.xpi"
3DIR=noscript-merge
4mkdir -p "$DIR"
5pushd 2>/dev/null "$DIR/" || exit
6if [ "$1" != "-n" ]; then 
7  rm -rf **
8  curl -Lo noscript.xpi "$URL" 
9  unzip noscript.xpi
10  unzip chrome/noscript.jar
11fi
12echo 'if (!this.ABE) this.ABE = { log: function(s) {CU.reportError(s)}, consoleDump: false };' > IOUtil.js
13grep -A 5000 'const IO = {' components/noscriptService.js | \
14  grep -B 5000 'Thread = {' | \
15  head -n-1 >> IOUtil.js
16cat content/noscript/ChannelReplacement.js >> IOUtil.js
17REP='s/\r\n/\n/g; s/\bCi\b/CI/g; s/\bCc\b/CC/g;'\
18's/ns\.categoryManager/CC["\@mozilla.org\/categorymanager;1"].getService(CI.nsICategoryManager)/;'\
19's/(this\.window = IOUtil\.findWindow\(chan\));/($1) && this.window._replacedChannel = chan;/;'\
20's/ABERequest\.getLoadingChannel\(this\.window\)/this.window._replacedChannel/'
21echo $REP
22perl -pi -e "$REP" IOUtil.js
23
24popd 2>/dev/null
25mv noscript-merge/IOUtil.js src/chrome/content/code/
26