addon-sdk/source/bin/cfx

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rwxr-xr-x

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.

     1 #! /usr/bin/env python
     2 # This Source Code Form is subject to the terms of the Mozilla Public
     3 # License, v. 2.0. If a copy of the MPL was not distributed with this
     4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
     7 import os
     8 import sys
    10 # set the cuddlefish "root directory" for this process if it's not already
    11 # set in the environment
    12 cuddlefish_root = os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0])))
    14 if 'CUDDLEFISH_ROOT' not in os.environ:
    15     os.environ['CUDDLEFISH_ROOT'] = cuddlefish_root
    17 # add our own python-lib path to the python module search path.
    18 python_lib_dir = os.path.join(cuddlefish_root, "python-lib")
    19 if python_lib_dir not in sys.path:
    20     sys.path.insert(0, python_lib_dir)
    22 # now export to env so sub-processes get it too
    23 if 'PYTHONPATH' not in os.environ:
    24     os.environ['PYTHONPATH'] = python_lib_dir
    25 elif python_lib_dir not in os.environ['PYTHONPATH'].split(os.pathsep):
    26     paths = os.environ['PYTHONPATH'].split(os.pathsep)
    27     paths.insert(0, python_lib_dir)
    28     os.environ['PYTHONPATH'] = os.pathsep.join(paths)
    30 import cuddlefish
    32 if __name__ == '__main__':
    33     cuddlefish.run()

mercurial