forked from mirrors/gecko-dev
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:
parent
1ffcde03df
commit
e42200263f
4 changed files with 22 additions and 6 deletions
|
|
@ -1269,7 +1269,9 @@ var gMainPane = {
|
||||||
if (AppConstants.HAVE_SHELL_SERVICE) {
|
if (AppConstants.HAVE_SHELL_SERVICE) {
|
||||||
let shellSvc = getShellService();
|
let shellSvc = getShellService();
|
||||||
let defaultBrowserBox = document.getElementById("defaultBrowserBox");
|
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;
|
defaultBrowserBox.hidden = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -2454,11 +2456,8 @@ var gMainPane = {
|
||||||
possibleAppMenuItems.push(menuItem);
|
possibleAppMenuItems.push(menuItem);
|
||||||
}
|
}
|
||||||
// Add gio handlers
|
// Add gio handlers
|
||||||
if (Cc["@mozilla.org/gio-service;1"]) {
|
if (gGIOService) {
|
||||||
let gIOSvc = Cc["@mozilla.org/gio-service;1"].getService(
|
var gioApps = gGIOService.getAppsForURIScheme(handlerInfo.type);
|
||||||
Ci.nsIGIOService
|
|
||||||
);
|
|
||||||
var gioApps = gIOSvc.getAppsForURIScheme(handlerInfo.type);
|
|
||||||
let possibleHandlers = handlerInfo.possibleApplicationHandlers;
|
let possibleHandlers = handlerInfo.possibleApplicationHandlers;
|
||||||
for (let handler of gioApps.enumerate(Ci.nsIHandlerApp)) {
|
for (let handler of gioApps.enumerate(Ci.nsIHandlerApp)) {
|
||||||
// OS handler share the same name, it's most likely the same app, skipping...
|
// OS handler share the same name, it's most likely the same app, skipping...
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,17 @@ XPCOMUtils.defineLazyServiceGetters(this, {
|
||||||
gMIMEService: ["@mozilla.org/mime;1", "nsIMIMEService"],
|
gMIMEService: ["@mozilla.org/mime;1", "nsIMIMEService"],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (Cc["@mozilla.org/gio-service;1"]) {
|
||||||
|
XPCOMUtils.defineLazyServiceGetter(
|
||||||
|
this,
|
||||||
|
"gGIOService",
|
||||||
|
"@mozilla.org/gio-service;1",
|
||||||
|
"nsIGIOService"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.gGIOService = null;
|
||||||
|
}
|
||||||
|
|
||||||
ChromeUtils.defineESModuleGetters(this, {
|
ChromeUtils.defineESModuleGetters(this, {
|
||||||
BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs",
|
BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs",
|
||||||
ContextualIdentityService:
|
ContextualIdentityService:
|
||||||
|
|
|
||||||
|
|
@ -702,6 +702,11 @@ nsresult nsGIOService::LaunchFile(const nsACString& aPath) {
|
||||||
return LaunchPath(aPath);
|
return LaunchPath(aPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult nsGIOService::GetIsRunningUnderFlatpak(bool* aResult) {
|
||||||
|
*aResult = mozilla::widget::IsRunningUnderFlatpak();
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static nsresult RevealDirectory(nsIFile* aFile, bool aForce) {
|
static nsresult RevealDirectory(nsIFile* aFile, bool aForce) {
|
||||||
nsAutoCString path;
|
nsAutoCString path;
|
||||||
if (bool isDir; NS_SUCCEEDED(aFile->IsDirectory(&isDir)) && isDir) {
|
if (bool isDir; NS_SUCCEEDED(aFile->IsDirectory(&isDir)) && isDir) {
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ interface nsIGIOService : nsISupports
|
||||||
AUTF8String getDescriptionForMimeType(in AUTF8String mimeType);
|
AUTF8String getDescriptionForMimeType(in AUTF8String mimeType);
|
||||||
|
|
||||||
/*** Misc. methods ***/
|
/*** Misc. methods ***/
|
||||||
|
[infallible] readonly attribute boolean isRunningUnderFlatpak;
|
||||||
|
|
||||||
/* Open the given URI in the default application */
|
/* Open the given URI in the default application */
|
||||||
[noscript] void showURI(in nsIURI uri);
|
[noscript] void showURI(in nsIURI uri);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue