Closed Bug 783908 Opened 7 years ago Closed 7 years ago

Implement remaining parts of GNOME shell service

Categories

(SeaMonkey :: OS Integration, defect)

All
Linux
defect
Not set

Tracking

(seamonkey2.15 fixed)

RESOLVED FIXED
seamonkey2.15
Tracking Status
seamonkey2.15 --- fixed

People

(Reporter: neil, Assigned: neil)

Details

Attachments

(1 file, 2 obsolete files)

Bug 774130 implemented the desktop background functions but the default client functions have not been implemented yet.
Attached patch Proposed patch (obsolete) — Splinter Review
Assignee: nobody → neil
Status: NEW → ASSIGNED
Attachment #653200 - Flags: review?(iann_bugzilla)
(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)
Attached patch Updated for bitrot (obsolete) — Splinter Review
Attachment #653200 - Attachment is obsolete: true
Attachment #653200 - Flags: review?(iann_bugzilla)
Attachment #655321 - Flags: review?(iann_bugzilla)
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
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)
(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?
(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).
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)?
(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 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.
Attachment #655321 - Flags: review?(iann_bugzilla) → review+
s/sion/s/
Fixing the crash as well as the error checking.
Attachment #655321 - Attachment is obsolete: true
Attachment #657689 - Flags: review+
Pushed comm-central changeset 8cd81ff229eb.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Settings flags to make tracking of fixed easier.
Target Milestone: --- → seamonkey2.15
You need to log in before you can comment on or make changes to this bug.