Bug 1710137 - Don't run helper to set default from a package. r=mhowell

Differential Revision: https://phabricator.services.mozilla.com/D114662
This commit is contained in:
Adam Gashlin
2021-07-13 20:31:25 +00:00
parent 13ae1f8144
commit e7e5e33613

View File

@@ -306,16 +306,23 @@ nsresult nsWindowsShellService::LaunchHTTPHandlerPane() {
NS_IMETHODIMP
nsWindowsShellService::SetDefaultBrowser(bool aClaimAllTypes,
bool aForAllUsers) {
nsAutoString appHelperPath;
if (NS_FAILED(GetHelperPath(appHelperPath))) return NS_ERROR_FAILURE;
// If running from within a package, don't attempt to set default with
// the helper, as it will not work and will only confuse our package's
// virtualized registry.
nsresult rv = NS_OK;
if (!widget::WinUtils::HasPackageIdentity()) {
nsAutoString appHelperPath;
if (NS_FAILED(GetHelperPath(appHelperPath))) return NS_ERROR_FAILURE;
if (aForAllUsers) {
appHelperPath.AppendLiteral(" /SetAsDefaultAppGlobal");
} else {
appHelperPath.AppendLiteral(" /SetAsDefaultAppUser");
if (aForAllUsers) {
appHelperPath.AppendLiteral(" /SetAsDefaultAppGlobal");
} else {
appHelperPath.AppendLiteral(" /SetAsDefaultAppUser");
}
rv = LaunchHelper(appHelperPath);
}
nsresult rv = LaunchHelper(appHelperPath);
if (NS_SUCCEEDED(rv) && IsWin8OrLater()) {
if (aClaimAllTypes) {
if (IsWin10OrLater()) {