Commit ad1dc5b0 authored by Kathleen Brade's avatar Kathleen Brade Committed by Georg Koppen
Browse files

Bug 13252: Do not store data in the app bundle

Add an --enable-tor-browser-data-outside-app-dir configure option.
When this is enabled, all user data is stored in a directory named
TorBrowser-Data which is located next to the application directory.

The first time an updated browser is opened, migrate the existing
browser profile, Tor data directory contents, and UpdateInfo to the
TorBrowser-Data directory. If migration of the browser profile
fails, an error alert is displayed and the browser is started
using a new profile.

Display an informative error messages if the TorBrowser-Data
directory cannot be created due to an "access denied" or a
"read only volume" error.

Add support for installing "override" preferences within the user's
browser profile. All .js files in distribution/preferences (on
Mac OS, Contents/Resources/distribution/preferences) will be copied
to the preferences directory within the user's browser profile when
the profile is created and each time Tor Browser is updated. This
mechanism will be used to install the extension-overrides.js file
into the profile.

On Mac OS, add support for the --invisible command line option which
is used by the meek-http-helper to avoid showing an icon for the
helper browser on the dock.
parent a251af51
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -41,6 +41,8 @@ ac_add_options --enable-official-branding
ac_add_options --enable-optimize
ac_add_options --disable-debug

ac_add_options --enable-tor-browser-data-outside-app-dir

ac_add_options --disable-crashreporter
ac_add_options --disable-maintenance-service
ac_add_options --disable-webrtc
+3 −0
Original line number Diff line number Diff line
@@ -281,6 +281,9 @@ def old_configure_options(*options):
    '--with-user-appdir',
    '--x-includes',
    '--x-libraries',

    # Tor additions.
    '--enable-tor-browser-data-outside-app-dir',
)
@imports(_from='__builtin__', _import='compile')
@imports(_from='__builtin__', _import='open')
+15 −0
Original line number Diff line number Diff line
@@ -3192,6 +3192,21 @@ if test -n "$MOZ_UPDATER"; then
    AC_DEFINE(MOZ_UPDATER)
fi

dnl ========================================================
dnl Tor additions
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(tor-browser-data-outside-app-dir,
[  --enable-tor-browser-data-outside-app-dir
                          Enable Tor Browser data outside of app directory],
    TOR_BROWSER_DATA_OUTSIDE_APP_DIR=1,
    TOR_BROWSER_DATA_OUTSIDE_APP_DIR= )

if test -n "$TOR_BROWSER_DATA_OUTSIDE_APP_DIR"; then
    AC_DEFINE(TOR_BROWSER_DATA_OUTSIDE_APP_DIR)
fi

AC_SUBST(TOR_BROWSER_DATA_OUTSIDE_APP_DIR)

dnl ========================================================
dnl parental controls (for Windows Vista)
dnl ========================================================
+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ profileProblemTitle=%S Profile Problem
profileReadOnly=You cannot run %S from a read-only file system.  Please copy %S to another location before trying to use it.
profileReadOnlyMac=You cannot run %S from a read-only file system.  Please copy %S to your Desktop or Applications folder before trying to use it.
profileAccessDenied=%S does not have permission to access the profile. Please adjust your file system permissions and try again.
profileMigrationFailed=Migration of your existing %S profile failed.\nNew settings will be used.
# Profile manager
# LOCALIZATION NOTE (profileTooltip): First %S is the profile name, second %S is the path to the profile folder.
profileTooltip=Profile: ‘%S’ - Path: ‘%S’
+59 −0
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ const OBSOLETE_PREFERENCES = [
const URI_EXTENSION_STRINGS           = "chrome://mozapps/locale/extensions/extensions.properties";

const DIR_EXTENSIONS                  = "extensions";
const DIR_PREFERENCES                 = "preferences";
const DIR_SYSTEM_ADDONS               = "features";
const DIR_STAGE                       = "staged";
const DIR_TRASH                       = "trash";
@@ -3159,6 +3160,58 @@ var XPIProvider = {
    return addons;
  },

   /**
   * Installs any preference files located in the preferences directory of the
   * application's distribution specific directory into the profile.
   *
   * @return true if any preference files were installed
   */
  installDistributionPreferences: function XPI_installDistributionPreferences() {
    let distroDir;
    try {
      distroDir = FileUtils.getDir(KEY_APP_DISTRIBUTION, [DIR_PREFERENCES]);
    }
    catch (e) {
      return false;
    }

    if (!distroDir.exists() || !distroDir.isDirectory())
      return false;

    let changed = false;
    let prefOverrideDir = Services.dirsvc.get("PrefDOverride", Ci.nsIFile);

    let entries = distroDir.directoryEntries
                           .QueryInterface(Ci.nsIDirectoryEnumerator);
    let entry;
    while ((entry = entries.nextFile)) {
      let fileName = entry.leafName;
      if (!entry.isFile() ||
          fileName.substring(fileName.length - 3).toLowerCase() != ".js") {
        logger.debug("Ignoring distribution preference that isn't a JS file: "
                     + entry.path);
        continue;
      }

      try {
        if (!prefOverrideDir.exists()) {
          prefOverrideDir.create(Ci.nsIFile.DIRECTORY_TYPE,
                                 FileUtils.PERMS_DIRECTORY);
        }

        entry.copyTo(prefOverrideDir, null);
        changed = true;
      } catch (e) {
        logger.debug("Unable to copy " + entry.path + " to " +
                     prefOverrideDir.path);
      }
    }

    entries.close();

    return changed;
  },

  /**
   * Imports the xpinstall permissions from preferences into the permissions
   * manager for the user to change later.
@@ -3253,6 +3306,12 @@ var XPIProvider = {
      if (updated) {
        updateReasons.push("installDistributionAddons");
      }

      // Also copy distribution preferences to the user's profile.
      updated = this.installDistributionPreferences();
      if (updated) {
        updateReasons.push("installDistributionPreferences");
      }
    }

    let haveAnyAddons = (XPIStates.size > 0);
Loading