#!/bin/sh -
umask 077

# Recommended about:config resettings:
# * network.http.speculative-parallel-limit = 0 (no accesses from hovers)
# * see also `vigreph about:config`

# * If need "flexible spacing"/"spring"s for toolbar, enable "Classic
#   Theme Restorer" add-on, place them as desired, then disable add-on.

# * If get "/l/firefox*/firefox-bin: error while loading shared libraries:
#   /l/firefox*/libxul.so: cannot restore segment prot after reloc:
#   Permission denied", then run as root:
#	chcon -t textrel_shlib_t /l/firefox*/libxul.so

# so downloads for external viewers don't get left in /tmp
TMPDIR="$HOME"/.mozilla/tmp; export TMPDIR

# need now when restarting firefox on alembic ... May 10
rm -f "$HOME"/.mozilla/firefox/*.default/compatibility.ini

# firefoxwin - open a new firefox/mozilla/netscape window, start it if needed
# Steve Kinzler, steve@kinzler.com, Jun 03/Jan 11
# https://kinzler.com/me/home.html#web

case "$TMPDIR" in
?*)	test -d "$TMPDIR" || mkdir -p "$TMPDIR";;
esac
# NOTE: With newer Firefox (>= 36.0), the `webrowse` itself will start a new
#	firefox if one isn't running, so $TMPDIR would need to be cleaned up
#	somehow somewhere outside this script.

case "`webrowse -uw $WWW_HOME 2>&1`" in
*[Nn]o*running*)	case "$TMPDIR" in
			?*)	${WB_MOZILLA-firefox}
				rm -fr "$TMPDIR"/.??* "$TMPDIR"/*;; # see above

			*)	exec ${WB_MOZILLA-firefox};;
			esac;;
esac
