richard pushed to branch mullvad-browser-115.10.0esr-13.5-1 at The Tor Project / Applications / Mullvad Browser
Commits:
-
2b80b110
by Pier Angelo Vendrame at 2024-04-17T18:14:53+00:00
2 changed files:
Changes:
... | ... | @@ -1282,19 +1282,30 @@ nsresult nsXREDirProvider::GetPortableDataDir(nsIFile** aFile, |
1282 | 1282 | }
|
1283 | 1283 | # endif
|
1284 | 1284 | |
1285 | - nsCOMPtr<nsIFile> systemInstallFile;
|
|
1286 | - rv = exeDir->Clone(getter_AddRefs(systemInstallFile));
|
|
1287 | - NS_ENSURE_SUCCESS(rv, rv);
|
|
1288 | - rv = systemInstallFile->AppendNative("system-install"_ns);
|
|
1289 | - NS_ENSURE_SUCCESS(rv, rv);
|
|
1285 | +# if defined(MOZ_WIDGET_GTK)
|
|
1286 | + // On Linux, Firefox supports the is-packaged-app for the .deb distribution.
|
|
1287 | + // We cannot use mozilla::widget::IsPackagedAppFileExists because it relies on
|
|
1288 | + // this service to be initialized, but this function is called during the
|
|
1289 | + // initialization. Therefore, we need to re-implement this check.
|
|
1290 | + nsLiteralCString systemInstallNames[] = {"system-install"_ns,
|
|
1291 | + "is-packaged-app"_ns};
|
|
1292 | +# else
|
|
1293 | + nsLiteralCString systemInstallNames[] = {"system-install"_ns};
|
|
1294 | +# endif
|
|
1295 | + for (const nsLiteralCString& fileName : systemInstallNames) {
|
|
1296 | + nsCOMPtr<nsIFile> systemInstallFile;
|
|
1297 | + rv = exeDir->Clone(getter_AddRefs(systemInstallFile));
|
|
1298 | + NS_ENSURE_SUCCESS(rv, rv);
|
|
1299 | + rv = systemInstallFile->AppendNative(fileName);
|
|
1300 | + NS_ENSURE_SUCCESS(rv, rv);
|
|
1290 | 1301 | |
1291 | - bool exists = false;
|
|
1292 | - rv = systemInstallFile->Exists(&exists);
|
|
1293 | - NS_ENSURE_SUCCESS(rv, rv);
|
|
1294 | - if (exists) {
|
|
1295 | - aIsPortable = false;
|
|
1296 | - gDataDirPortable.emplace(nullptr);
|
|
1297 | - return NS_OK;
|
|
1302 | + bool exists = false;
|
|
1303 | + rv = systemInstallFile->Exists(&exists);
|
|
1304 | + NS_ENSURE_SUCCESS(rv, rv);
|
|
1305 | + if (exists) {
|
|
1306 | + gDataDirPortable.emplace(nullptr);
|
|
1307 | + return NS_OK;
|
|
1308 | + }
|
|
1298 | 1309 | }
|
1299 | 1310 | |
1300 | 1311 | 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) {
|