richard pushed to branch tor-browser-115.10.0esr-13.5-1 at The Tor Project / Applications / Tor Browser
Commits:
-
795d4d37
by Pier Angelo Vendrame at 2024-04-17T17:59:38+00:00
2 changed files:
Changes:
... | ... | @@ -1285,19 +1285,30 @@ nsresult nsXREDirProvider::GetPortableDataDir(nsIFile** aFile, |
1285 | 1285 | }
|
1286 | 1286 | # endif
|
1287 | 1287 | |
1288 | - nsCOMPtr<nsIFile> systemInstallFile;
|
|
1289 | - rv = exeDir->Clone(getter_AddRefs(systemInstallFile));
|
|
1290 | - NS_ENSURE_SUCCESS(rv, rv);
|
|
1291 | - rv = systemInstallFile->AppendNative("system-install"_ns);
|
|
1292 | - NS_ENSURE_SUCCESS(rv, rv);
|
|
1288 | +# if defined(MOZ_WIDGET_GTK)
|
|
1289 | + // On Linux, Firefox supports the is-packaged-app for the .deb distribution.
|
|
1290 | + // We cannot use mozilla::widget::IsPackagedAppFileExists because it relies on
|
|
1291 | + // this service to be initialized, but this function is called during the
|
|
1292 | + // initialization. Therefore, we need to re-implement this check.
|
|
1293 | + nsLiteralCString systemInstallNames[] = {"system-install"_ns,
|
|
1294 | + "is-packaged-app"_ns};
|
|
1295 | +# else
|
|
1296 | + nsLiteralCString systemInstallNames[] = {"system-install"_ns};
|
|
1297 | +# endif
|
|
1298 | + for (const nsLiteralCString& fileName : systemInstallNames) {
|
|
1299 | + nsCOMPtr<nsIFile> systemInstallFile;
|
|
1300 | + rv = exeDir->Clone(getter_AddRefs(systemInstallFile));
|
|
1301 | + NS_ENSURE_SUCCESS(rv, rv);
|
|
1302 | + rv = systemInstallFile->AppendNative(fileName);
|
|
1303 | + NS_ENSURE_SUCCESS(rv, rv);
|
|
1293 | 1304 | |
1294 | - bool exists = false;
|
|
1295 | - rv = systemInstallFile->Exists(&exists);
|
|
1296 | - NS_ENSURE_SUCCESS(rv, rv);
|
|
1297 | - if (exists) {
|
|
1298 | - aIsPortable = false;
|
|
1299 | - gDataDirPortable.emplace(nullptr);
|
|
1300 | - return NS_OK;
|
|
1305 | + bool exists = false;
|
|
1306 | + rv = systemInstallFile->Exists(&exists);
|
|
1307 | + NS_ENSURE_SUCCESS(rv, rv);
|
|
1308 | + if (exists) {
|
|
1309 | + gDataDirPortable.emplace(nullptr);
|
|
1310 | + return NS_OK;
|
|
1311 | + }
|
|
1301 | 1312 | }
|
1302 | 1313 | |
1303 | 1314 | nsCOMPtr<nsIFile> localDir = exeDir;
|
... | ... | @@ -195,18 +195,27 @@ static nsresult SetupPortableMode(nsIFile** aDirectory, bool aLocal, |
195 | 195 | }
|
196 | 196 | # endif
|
197 | 197 | |
198 | - nsCOMPtr<nsIFile> systemInstallFile;
|
|
199 | - rv = exeDir->Clone(getter_AddRefs(systemInstallFile));
|
|
200 | - NS_ENSURE_SUCCESS(rv, rv);
|
|
201 | - rv = systemInstallFile->AppendNative("system-install"_ns);
|
|
202 | - NS_ENSURE_SUCCESS(rv, rv);
|
|
198 | +# if defined(MOZ_WIDGET_GTK)
|
|
199 | + // On Linux, Firefox supports the is-packaged-app for the .deb distribution.
|
|
200 | + nsLiteralCString systemInstallNames[] = {"system-install"_ns,
|
|
201 | + "is-packaged-app"_ns};
|
|
202 | +# else
|
|
203 | + nsLiteralCString systemInstallNames[] = {"system-install"_ns};
|
|
204 | +# endif
|
|
205 | + for (const nsLiteralCString& fileName : systemInstallNames) {
|
|
206 | + nsCOMPtr<nsIFile> systemInstallFile;
|
|
207 | + rv = exeDir->Clone(getter_AddRefs(systemInstallFile));
|
|
208 | + NS_ENSURE_SUCCESS(rv, rv);
|
|
209 | + rv = systemInstallFile->AppendNative(fileName);
|
|
210 | + NS_ENSURE_SUCCESS(rv, rv);
|
|
203 | 211 | |
204 | - bool exists = false;
|
|
205 | - rv = systemInstallFile->Exists(&exists);
|
|
206 | - NS_ENSURE_SUCCESS(rv, rv);
|
|
207 | - if (exists) {
|
|
208 | - aIsPortable = false;
|
|
209 | - return NS_OK;
|
|
212 | + bool exists = false;
|
|
213 | + rv = systemInstallFile->Exists(&exists);
|
|
214 | + NS_ENSURE_SUCCESS(rv, rv);
|
|
215 | + if (exists) {
|
|
216 | + aIsPortable = false;
|
|
217 | + return NS_OK;
|
|
218 | + }
|
|
210 | 219 | }
|
211 | 220 | |
212 | 221 | nsCOMPtr<nsIFile> localDir = exeDir;
|
... | ... | @@ -226,6 +235,7 @@ static nsresult SetupPortableMode(nsIFile** aDirectory, bool aLocal, |
226 | 235 | NS_ENSURE_SUCCESS(rv, rv);
|
227 | 236 | }
|
228 | 237 | |
238 | + bool exists = false;
|
|
229 | 239 | rv = localDir->Exists(&exists);
|
230 | 240 | NS_ENSURE_SUCCESS(rv, rv);
|
231 | 241 | if (!exists) {
|