Last Comment Bug 624338 - Update check for default browser to work the new way (glib >= 2.27.1)
: Update check for default browser to work the new way (glib >= 2.27.1)
Status: RESOLVED FIXED
[fixed in bug 611953]
:
Product: Firefox
Classification: Client Software
Component: Shell Integration (show other bugs)
: Trunk
: All Linux
: -- normal (vote)
: Firefox 6
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on: 611953
Blocks:
  Show dependency treegraph
 
Reported: 2011-01-10 02:17 PST by Vincent Untz
Modified: 2011-05-03 21:17 PDT (History)
6 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Vincent Untz 2011-01-10 02:17:12 PST
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
Comment 1 Wolfgang Rosenauer [:wolfiR] 2011-01-10 02:30:56 PST
I might pick that up in the near future. If anyone else wants to look at it earlier let me know.
Comment 2 Christopher Aillon (sabbatical, not receiving bugmail) 2011-01-11 11:04:33 PST
also see bug 611953
Comment 3 Karl Tomlinson (ni?:karlt) 2011-05-03 21:03:58 PDT
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.

Note You need to log in before you can comment on or make changes to this bug.