Pier Angelo Vendrame pushed to branch base-browser-115.7.0esr-13.5-1 at The Tor Project / Applications / Tor Browser
Commits: 374f008f by Pier Angelo Vendrame at 2024-02-07T16:38:26+01:00 fixup! Bug 9173: Change the default Firefox profile directory to be relative.
Add a method to query whether the browser is in portable mode.
- - - - - 87805801 by Pier Angelo Vendrame at 2024-02-07T16:38:26+01:00 fixup! Bug 4234: Use the Firefox Update Process for Base Browser.
Allow running the postupdate process and change the update directory for when not running in portable mode.
- - - - -
3 changed files:
- toolkit/mozapps/update/updater/updater.cpp - toolkit/xre/nsIXREDirProvider.idl - toolkit/xre/nsXREDirProvider.cpp
Changes:
===================================== toolkit/mozapps/update/updater/updater.cpp ===================================== @@ -2807,7 +2807,7 @@ int LaunchCallbackAndPostProcessApps(int argc, NS_tchar** argv, #endif
if (argc > callbackIndex) { -#if defined(XP_WIN) && !defined(BASE_BROWSER_UPDATE) +#if defined(XP_WIN) if (gSucceeded) { if (!LaunchWinPostProcess(gInstallDirPath, gPatchDirPath)) { fprintf(stderr, "The post update process was not launched");
===================================== toolkit/xre/nsIXREDirProvider.idl ===================================== @@ -20,4 +20,9 @@ interface nsIXREDirProvider : nsISupports * Gets the hash for the current installation directory. */ AString getInstallHash(); + + /** + * Tells whether the browser has been started in portable mode. + */ + readonly attribute bool isPortableMode; };
===================================== toolkit/xre/nsXREDirProvider.cpp ===================================== @@ -1109,7 +1109,14 @@ nsresult nsXREDirProvider::GetUpdateRootDir(nsIFile** aResult, rv = GetUserDataDirectory(getter_AddRefs(updRoot), false); NS_ENSURE_SUCCESS(rv, rv); # else - rv = GetUserDataDirectoryHome(getter_AddRefs(updRoot), false); + bool isPortable = true; + rv = GetIsPortableMode(&isPortable); + NS_ENSURE_SUCCESS(rv, rv); + if (isPortable) { + rv = GetUserDataDirectoryHome(getter_AddRefs(updRoot), false); + } else { + rv = GetUserDataDirectory(getter_AddRefs(updRoot), true); + } NS_ENSURE_SUCCESS(rv, rv); # endif rv = updRoot->AppendNative("UpdateInfo"_ns); @@ -1324,6 +1331,20 @@ nsresult nsXREDirProvider::GetPortableDataDir(nsIFile** aFile, } #endif
+NS_IMETHODIMP nsXREDirProvider::GetIsPortableMode(bool* aIsPortableMode) { +#ifdef RELATIVE_DATA_DIR + if (gDataDirPortable) { + *aIsPortableMode = *gDataDirPortable; + } else { + nsCOMPtr<nsIFile> dir; + GetPortableDataDir(getter_AddRefs(dir), *aIsPortableMode); + } +#else + *aIsPortableMode = false; +#endif + return NS_OK; +} + nsresult nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, bool aLocal) { // Copied from nsAppFileLocationProvider (more or less)
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/e9d1e58...