Update check for default browser to work the new way (glib >= 2.27.1)

RESOLVED FIXED in Firefox 6

Status

()

Firefox
Shell Integration
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: Vincent Untz, Unassigned)

Tracking

Trunk
Firefox 6
All
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [fixed in bug 611953])

(Reporter)

Description

6 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; fr-fr) AppleWebKit/534.7+ (KHTML, like Gecko) Version/5.0 Safari/534.7+ SUSE/11.4 (2.30.6-97.5) Epiphany/2.30.6
Build Identifier: 

Starting with glib 2.27.1, the way for an app to declare that it supports opening a URI scheme has changed: it used to be something living in gconf, and now we use the mime system with a mime type like x-scheme-handler/http. The old way doesn't work anymore.

glib 2.27/2.28 will be used in all distributions releasing in spring 2011.

See https://bugzilla.gnome.org/show_bug.cgi?id=631433 and the first part of http://www.hadess.net/2010/10/new-control-center-and-you.html for some more background.

So Firefox needs to be updated for this:

a) appProtocols (http://mxr.mozilla.org/mozilla-central/source/browser/components/shell/src/nsGNOMEShellService.cpp#82) should have mime types for each of the protocol. It's always something like x-scheme-handler/http.

b) nsGNOMEShellService::IsDefaultBrowser (from http://mxr.mozilla.org/mozilla-central/source/browser/components/shell/src/nsGNOMEShellService.cpp#166) needs to use g_app_info_get_default_for_type() (http://library.gnome.org/devel/gio/stable/GAppInfo.html#g-app-info-get-default-for-type) with x-scheme-handler/http and others to know what's the default app. You can then use g_app_info_get_executable() (http://library.gnome.org/devel/gio/stable/GAppInfo.html#g-app-info-get-executable) to see if the app matches argv[0].

c) nsGNOMEShellService::SetDefaultBrowser (from http://mxr.mozilla.org/mozilla-central/source/browser/components/shell/src/nsGNOMEShellService.cpp#208) needs to also be updated. Instead of calling gconf->SetAppForProtocol(), you can simply call appInfo->SetAsDefaultForMimeType() for x-scheme-handler/http, like you do later for the usual mime types.

It's worth pointing out that shipping a desktop file with Firefox (say MozillaFirefox.desktop) would make things a bit cleaner. Instead of using g_app_info_get_executable() and checking the name of the binary, you could use g_app_info_get_id() and check that it returns MozillaFirefox.desktop. You also wouldn't need to create a GAppInfo from nothing with giovfs->CreateAppFromCommand in nsGNOMEShellService::SetDefaultBrowser(). You could instead just create it with g_desktop_app_info_new().

Reproducible: Always
I might pick that up in the near future. If anyone else wants to look at it earlier let me know.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Hardware: x86 → All
Version: unspecified → Trunk
Depends on: 624530
also see bug 611953
This should be addressed by
http://hg.mozilla.org/mozilla-central/rev/fdd8cf56674f

That implementation used g_app_info_get_default_for_uri_scheme instead of g_app_info_get_default_for_type.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Depends on: 611953
No longer depends on: 624530
Resolution: --- → FIXED
Whiteboard: [fixed in bug 611953]
Target Milestone: --- → Firefox 6
You need to log in before you can comment on or make changes to this bug.