Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | #!/bin/sh |
michael@0 | 2 | # |
michael@0 | 3 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 6 | |
michael@0 | 7 | ## |
michael@0 | 8 | ## Usage: |
michael@0 | 9 | ## |
michael@0 | 10 | ## $ mozilla [args] |
michael@0 | 11 | ## |
michael@0 | 12 | ## This script is meant to run the application binary from mozilla/dist/bin. |
michael@0 | 13 | ## |
michael@0 | 14 | ## The script will setup all the environment voodoo needed to make |
michael@0 | 15 | ## the application binary to work. |
michael@0 | 16 | ## |
michael@0 | 17 | |
michael@0 | 18 | #uncomment for debugging |
michael@0 | 19 | #set -x |
michael@0 | 20 | |
michael@0 | 21 | moz_libdir=%MOZAPPDIR% |
michael@0 | 22 | |
michael@0 | 23 | # Use run-mozilla.sh in the current dir if it exists |
michael@0 | 24 | # If not, then start resolving symlinks until we find run-mozilla.sh |
michael@0 | 25 | found=0 |
michael@0 | 26 | progname="$0" |
michael@0 | 27 | curdir=`dirname "$progname"` |
michael@0 | 28 | progbase=`basename "$progname"` |
michael@0 | 29 | run_moz="$curdir/run-mozilla.sh" |
michael@0 | 30 | if test -x "$run_moz"; then |
michael@0 | 31 | dist_bin="$curdir" |
michael@0 | 32 | found=1 |
michael@0 | 33 | else |
michael@0 | 34 | here=`/bin/pwd` |
michael@0 | 35 | while [ -h "$progname" ]; do |
michael@0 | 36 | bn=`basename "$progname"` |
michael@0 | 37 | cd `dirname "$progname"` |
michael@0 | 38 | # Resolve symlink of dirname |
michael@0 | 39 | cd `/bin/pwd` |
michael@0 | 40 | progname=`/bin/ls -l "$bn" | sed -e 's/^.* -> //' ` |
michael@0 | 41 | progbase=`basename "$progname"` |
michael@0 | 42 | if [ ! -x "$progname" ]; then |
michael@0 | 43 | break |
michael@0 | 44 | fi |
michael@0 | 45 | curdir=`dirname "$progname"` |
michael@0 | 46 | run_moz="$curdir/run-mozilla.sh" |
michael@0 | 47 | if [ -x "$run_moz" ]; then |
michael@0 | 48 | cd "$curdir" |
michael@0 | 49 | dist_bin=`/bin/pwd` |
michael@0 | 50 | run_moz="$dist_bin/run-mozilla.sh" |
michael@0 | 51 | found=1 |
michael@0 | 52 | break |
michael@0 | 53 | fi |
michael@0 | 54 | done |
michael@0 | 55 | cd "$here" |
michael@0 | 56 | fi |
michael@0 | 57 | if [ $found = 0 ]; then |
michael@0 | 58 | # Check default compile-time libdir |
michael@0 | 59 | if [ -x "$moz_libdir/run-mozilla.sh" ]; then |
michael@0 | 60 | dist_bin="$moz_libdir" |
michael@0 | 61 | run_moz="$moz_libdir/run-mozilla.sh" |
michael@0 | 62 | else |
michael@0 | 63 | echo "Cannot find %MOZ_APP_DISPLAYNAME% runtime directory. Exiting." |
michael@0 | 64 | exit 1 |
michael@0 | 65 | fi |
michael@0 | 66 | fi |
michael@0 | 67 | |
michael@0 | 68 | script_args="" |
michael@0 | 69 | debugging=0 |
michael@0 | 70 | MOZILLA_BIN="${progbase}-bin" |
michael@0 | 71 | |
michael@0 | 72 | if [ "$OSTYPE" = "beos" ]; then |
michael@0 | 73 | mimeset -F "$MOZILLA_BIN" |
michael@0 | 74 | fi |
michael@0 | 75 | |
michael@0 | 76 | pass_arg_count=0 |
michael@0 | 77 | while [ $# -gt $pass_arg_count ] |
michael@0 | 78 | do |
michael@0 | 79 | case "$1" in |
michael@0 | 80 | -p | --pure | -pure) |
michael@0 | 81 | MOZILLA_BIN="${MOZILLA_BIN}.pure" |
michael@0 | 82 | shift |
michael@0 | 83 | ;; |
michael@0 | 84 | -g | --debug) |
michael@0 | 85 | script_args="$script_args -g" |
michael@0 | 86 | debugging=1 |
michael@0 | 87 | shift |
michael@0 | 88 | ;; |
michael@0 | 89 | -d | --debugger) |
michael@0 | 90 | script_args="$script_args -d $2" |
michael@0 | 91 | shift 2 |
michael@0 | 92 | ;; |
michael@0 | 93 | *) |
michael@0 | 94 | # Move the unrecognized argument to the end of the list. |
michael@0 | 95 | arg="$1" |
michael@0 | 96 | shift |
michael@0 | 97 | set -- "$@" "$arg" |
michael@0 | 98 | pass_arg_count=`expr $pass_arg_count + 1` |
michael@0 | 99 | ;; |
michael@0 | 100 | esac |
michael@0 | 101 | done |
michael@0 | 102 | |
michael@0 | 103 | if [ $debugging = 1 ] |
michael@0 | 104 | then |
michael@0 | 105 | echo $dist_bin/run-mozilla.sh $script_args $dist_bin/$MOZILLA_BIN "$@" |
michael@0 | 106 | fi |
michael@0 | 107 | exec "$dist_bin/run-mozilla.sh" $script_args "$dist_bin/$MOZILLA_BIN" "$@" |
michael@0 | 108 | # EOF. |