Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 7b21c41

Browse files
committed
Bug 1710137 - Don't run helper to set default from a package. r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D114662
1 parent 9b75bb1 commit 7b21c41

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

browser/components/shell/nsWindowsShellService.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -306,16 +306,23 @@ nsresult nsWindowsShellService::LaunchHTTPHandlerPane() {
306306
NS_IMETHODIMP
307307
nsWindowsShellService::SetDefaultBrowser(bool aClaimAllTypes,
308308
bool aForAllUsers) {
309-
nsAutoString appHelperPath;
310-
if (NS_FAILED(GetHelperPath(appHelperPath))) return NS_ERROR_FAILURE;
309+
// If running from within a package, don't attempt to set default with
310+
// the helper, as it will not work and will only confuse our package's
311+
// virtualized registry.
312+
nsresult rv = NS_OK;
313+
if (!widget::WinUtils::HasPackageIdentity()) {
314+
nsAutoString appHelperPath;
315+
if (NS_FAILED(GetHelperPath(appHelperPath))) return NS_ERROR_FAILURE;
316+
317+
if (aForAllUsers) {
318+
appHelperPath.AppendLiteral(" /SetAsDefaultAppGlobal");
319+
} else {
320+
appHelperPath.AppendLiteral(" /SetAsDefaultAppUser");
321+
}
311322

312-
if (aForAllUsers) {
313-
appHelperPath.AppendLiteral(" /SetAsDefaultAppGlobal");
314-
} else {
315-
appHelperPath.AppendLiteral(" /SetAsDefaultAppUser");
323+
rv = LaunchHelper(appHelperPath);
316324
}
317325

318-
nsresult rv = LaunchHelper(appHelperPath);
319326
if (NS_SUCCEEDED(rv) && IsWin8OrLater()) {
320327
if (aClaimAllTypes) {
321328
if (IsWin10OrLater()) {

0 commit comments

Comments
 (0)