Last Comment Bug 783908 - Implement remaining parts of GNOME shell service
: Implement remaining parts of GNOME shell service
Status: RESOLVED FIXED
:
Product: SeaMonkey
Classification: Client Software
Component: OS Integration (show other bugs)
: unspecified
: All Linux
: -- normal (vote)
: seamonkey2.15
Assigned To: neil@parkwaycc.co.uk
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-19 13:07 PDT by neil@parkwaycc.co.uk
Modified: 2012-10-11 02:16 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
fixed


Attachments
Proposed patch (15.79 KB, patch)
2012-08-19 13:30 PDT, neil@parkwaycc.co.uk
no flags Details | Diff | Splinter Review
Updated for bitrot (15.79 KB, patch)
2012-08-25 08:24 PDT, neil@parkwaycc.co.uk
iann_bugzilla: review+
Details | Diff | Splinter Review
Addressed review comments (15.82 KB, patch)
2012-09-02 09:48 PDT, neil@parkwaycc.co.uk
neil: review+
Details | Diff | Splinter Review

Description neil@parkwaycc.co.uk 2012-08-19 13:07:40 PDT
Bug 774130 implemented the desktop background functions but the default client functions have not been implemented yet.
Comment 1 neil@parkwaycc.co.uk 2012-08-19 13:30:56 PDT
Created attachment 653200 [details] [diff] [review]
Proposed patch
Comment 2 Ian Neal 2012-08-25 06:28:01 PDT
(In reply to neil@parkwaycc.co.uk from comment #1)
> Created attachment 653200 [details] [diff] [review]
> Proposed patch

This has bitrotted against current trunk (PRUint16 -> uint16_t and PRInt32 -> int32_t)
Comment 3 neil@parkwaycc.co.uk 2012-08-25 08:24:35 PDT
Created attachment 655321 [details] [diff] [review]
Updated for bitrot
Comment 4 Ian Neal 2012-08-27 07:25:17 PDT
With patch applied I get:
Segmentation fault (core dumped)
Backtrace is:
#0  0x00007fffe9ed6141 in nsACString::Equals (this=<value optimized out>, 
    other=0x0, c=
    0x7fffe9ed610e <nsACString::DefaultComparator(nsACString::char_type const*, nsACString::char_type const*, uint32_t)>)
    at /central/comm-central/mozilla/xpcom/glue/nsStringAPI.cpp:703
#1  0x00007fffe9ed3c45 in nsGNOMEShellService::HandlerMatchesAppName (this=
    0x7fffd7ad2520, aHandler=<value optimized out>)
    at /central/comm-central/suite/shell/src/nsGNOMEShellService.cpp:155
#2  0x00007fffe9ed43a9 in nsGNOMEShellService::IsDefaultClient (this=
    0x7fffd7ad2520, aStartupCheck=<value optimized out>, aApps=2, 
    aIsDefaultClient=0x7fffffff7c20)
    at /central/comm-central/suite/shell/src/nsGNOMEShellService.cpp:192
#3  0x00007ffff4af4ba8 in NS_InvokeByIndex_P (that=<value optimized out>, 
    methodIndex=<value optimized out>, paramCount=<value optimized out>, 
    params=<value optimized out>)
    at /central/comm-central/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_unix.cpp:164
#4  0x00007ffff44ab529 in XPCWrappedNative::CallMethod(XPCCallContext&, XPCWrappedNative::CallMode) ()
   from /central/sm-opt/mozilla/dist/bin/libxul.so
Comment 5 Ian Neal 2012-08-27 12:23:10 PDT
With the if (command) inserted as suggested it now doesn't seg fault.
In testing, it allows you to set as default client but the default client recognition doesn't work properly.
STR
1/ Start Firefox and set as default browser client
2/ Restart Firefox, doesn't prompt to be set as default client.
3/ Close Firefox
4/ Start SeaMonkey
5/ Prompts to be set as default client.
6/ Restart SeaMonkey, still prompts to be the default client.
7/ Close SeaMonkey and start Firefox - prompts to be set as default client (but don't set it)
Comment 6 neil@parkwaycc.co.uk 2012-08-27 13:46:01 PDT
(In reply to Ian Neal from comment #5)
> With the if (command) inserted as suggested it now doesn't seg fault.
I'll probably go for command && to match what happens in Init().

> In testing, it allows you to set as default client but the default client
> recognition doesn't work properly.
> STR
> 1/ Start Firefox and set as default browser client
> 2/ Restart Firefox, doesn't prompt to be set as default client.
> 3/ Close Firefox
> 4/ Start SeaMonkey
> 5/ Prompts to be set as default client.
> 6/ Restart SeaMonkey, still prompts to be the default client.
> 7/ Close SeaMonkey and start Firefox - prompts to be set as default client
> (but don't set it)

What happens if you open Preferences and click set as default browser twice in a row?
Comment 7 Ian Neal 2012-08-27 13:53:01 PDT
(In reply to neil@parkwaycc.co.uk from comment #6)
> What happens if you open Preferences and click set as default browser twice
> in a row?
The first time it changes to "SeaMonkey has been set as your default browser" and the button stays enabled. The second time nothing changes. Firefox thinks that it is not the default browser (so I assume SeaMonkey actually is).
Comment 8 neil@parkwaycc.co.uk 2012-08-27 17:03:08 PDT
Do you have a ~/.gconf/desktop/gnome/url-handlers/http/%gconf.xml and/or ~/.local/share/applications/mimeapps.list (and also any relevant .desktop file in the same folder)?
Comment 9 Ian Neal 2012-08-27 17:11:21 PDT
(In reply to neil@parkwaycc.co.uk from comment #8)
> Do you have a ~/.gconf/desktop/gnome/url-handlers/http/%gconf.xml
Yes, but 0 in size
> and/or
> ~/.local/share/applications/mimeapps.list (and also any relevant .desktop
> file in the same folder)?
No mimeapps.list but mimeapps.cache
there is a preferred-web-browser.desktop file that correctly points to seamonkey
Comment 10 Ian Neal 2012-09-02 03:52:57 PDT
Comment on attachment 655321 [details] [diff] [review]
Updated for bitrot

> NS_IMETHODIMP
> nsGNOMEShellService::IsDefaultClient(bool aStartupCheck, uint16_t aApps,
>                                      bool* aIsDefaultClient)
>+
>+        app->GetCommand(handler);
Check if the above line has succeeded, TB uses rv= and then NS_SUCCEEDED(rv) && in the if statement below.
>+        if (!HandlerMatchesAppName(handler.get()))
>+         return NS_OK;
>+      }
>+
>+      if (gconf) {
>+        bool enabled;
>+        gconf->GetAppForProtocol(protocol, &enabled, handler);
Check if the above line has succeeded, TB uses rv= and then NS_SUCCEEDED(rv) && in the if statement below.
>+        if (!enabled || !HandlerMatchesAppName(handler.get()))
>+          return NS_OK;
>+      }

Those changes seem to fix the detection for me.

Both TB and Firefox do gconf first but I see no problem doing it last.

r=me with the succession detection.
Comment 11 Ian Neal 2012-09-02 03:53:32 PDT
s/sion/s/
Comment 12 neil@parkwaycc.co.uk 2012-09-02 09:48:26 PDT
Created attachment 657689 [details] [diff] [review]
Addressed review comments

Fixing the crash as well as the error checking.
Comment 13 neil@parkwaycc.co.uk 2012-09-02 09:51:23 PDT
Pushed comm-central changeset 8cd81ff229eb.
Comment 14 Frank Wein [:mcsmurf] 2012-10-11 02:16:25 PDT
Settings flags to make tracking of fixed easier.

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