Bug 1621913 Don't show the defaultBrowserBox in settings under flatpak; r=settings-reviewers,Gijs

Under Flatpak we cannot determine if the application is set as default handler
for http/https protocols and also the application cannot set the system defaults.
In order to avoid user confusion we hide the defaultBrowserBox which
under flatpak shows always: "Firefox is not your default browser" and the
"Make Default..." button does not make any change to the system.

Differential Revision: https://phabricator.services.mozilla.com/D170590
This commit is contained in:
Jan Horak
2023-03-09 15:14:26 +00:00
parent 8e069d2b8c
commit 7b0bbd4dca
4 changed files with 22 additions and 6 deletions

View File

@@ -1269,7 +1269,9 @@ var gMainPane = {
if (AppConstants.HAVE_SHELL_SERVICE) {
let shellSvc = getShellService();
let defaultBrowserBox = document.getElementById("defaultBrowserBox");
if (!shellSvc) {
let isInFlatpak = gGIOService?.isRunningUnderFlatpak;
// Flatpak does not support setting nor detection of default browser
if (!shellSvc || isInFlatpak) {
defaultBrowserBox.hidden = true;
return;
}
@@ -2454,11 +2456,8 @@ var gMainPane = {
possibleAppMenuItems.push(menuItem);
}
// Add gio handlers
if (Cc["@mozilla.org/gio-service;1"]) {
let gIOSvc = Cc["@mozilla.org/gio-service;1"].getService(
Ci.nsIGIOService
);
var gioApps = gIOSvc.getAppsForURIScheme(handlerInfo.type);
if (gGIOService) {
var gioApps = gGIOService.getAppsForURIScheme(handlerInfo.type);
let possibleHandlers = handlerInfo.possibleApplicationHandlers;
for (let handler of gioApps.enumerate(Ci.nsIHandlerApp)) {
// OS handler share the same name, it's most likely the same app, skipping...