Bug 437596

Summary: Firefox needs to register proper name for session restore
Product: [Fedora] Fedora Reporter: Orion Poplawski <orion>
Component: firefoxAssignee: Martin Stransky <stransky>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 10CC: antonio.montagnani, caleb, chkr, florian.fahr, gczarcinski, gecko-bugs-nobody, jamundso, joe.christy, kevin, ltinkl, mcepl, oliver.henshaw, paul, rdieter, rmj, ruslanpisarev, stransky, teke
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-08-06 13:10:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Orion Poplawski 2008-03-15 02:52:14 UTC
Description of problem:

Moved an existing user to a freshly installed rawhide system.  about:plugins was
blank until I ran  mozilla-plugin-config -f -c and then mozilla-plugin-config
-l.   Why does this work without this?  Anything else I can do to help debug?


Version-Release number of selected component (if applicable):
firefox-3.0-0.40.cvs20080312.fc9.i386

Comment 1 Matěj Cepl 2008-03-17 15:59:16 UTC
Did you MOVE the original ~/.mozilla folder from the old system, or did you
start with the fresh (empty) ~/.mozilla?

Comment 2 Orion Poplawski 2008-03-17 16:11:04 UTC
Well, what I'm doing is backing up my home directory, installing the OS, then
restoring by home directory.  Essentially doing an upgrade.  So I'm not starting
with an empty .mozilla.

Comment 3 Matěj Cepl 2008-03-17 17:23:35 UTC
I am afraid, that you just have to ask your sysadmin (which is probably you as
well, right ;-)) to run mozilla-plugin-config -f -c

Comment 4 Orion Poplawski 2008-03-17 17:37:09 UTC
*really* ?  This seems incredibly broken.  What if I were to put
mozilla-plugin-config -f -c into the login scripts?

Comment 5 Matěj Cepl 2008-03-18 13:39:00 UTC
I don't see any problem with that. Your point?

Comment 6 Martin Stransky 2008-03-25 14:15:28 UTC
mozilla-plugin-config -f -c is called when firefox starts. You don't have to run
it by hand.

Comment 7 Orion Poplawski 2008-03-25 15:49:46 UTC
I know what the problem is - my KDE session starts firefox automatically, but
that startup does not trigger a mozilla-plugin-config run.  This is because the
restart command gets registered in .kde/share/config/ksmserverrc as:

restartCommand3=/usr/lib/firefox-3.0b5pre/firefox,--sm-config-prefix,/firefox-ce8bf1/,--sm-client-id,10626f6e61000120645951400000155330012,--screen,0

This problem was fixed somewhere along the line in previous versions of
firefox/KDE to register the startup command as "firefox" so that the shell
wrapper gets run properly.

Comment 8 Matěj Cepl 2008-03-25 17:27:59 UTC
So, here it goes to KDE folks.

Comment 9 Kevin Kofler 2008-03-25 18:16:57 UTC
What can we do in KDE about that? How is the KDE session manager supposed to 
know that /usr/lib/firefox-3.0b5pre/firefox shouldn't be invoked directly? As 
far as it's concerned, that's the executable which is being run.

Comment 10 Rex Dieter 2008-03-25 18:30:04 UTC
highlights that firefox packaging not using (unversioned) /usr/lib/firefox/ is
(at least a little) crack.

Comment 11 Orion Poplawski 2008-03-25 19:25:50 UTC
I disagree with the re-assignment to KDE.  firefox needs to register the proper
restart command with the session manager.  I remember that this was broken for a
while in the early Fedora days, but was fixed.  On F-8 the restart command in
ksmserverrc is "firefox", so it ends up running /usr/bin/firefox.

Comment 12 Christopher Aillon 2008-03-25 20:24:32 UTC
It working in F-8 is probably just luck.  I don't believe there was ever a fix
done for this, but I could be wrong.

In any case, I'm not familiar with what firefox needs to do in order for KDE to
be happy on session restart.  Some guidance would be appreciated.

Comment 13 Orion Poplawski 2008-03-25 22:02:16 UTC
Okay, looks like session management stuff has actually been added to firefox 3
(xulrunner 1.9), and I'm guessing that is what has changed.  See
https://bugzilla.mozilla.org/show_bug.cgi?id=93789 for a bit of history as well.

In xulrunner-1.9/mozilla/toolkit/xre/nsNativeAppSupportUnix.cpp, save_yourself_cb():

    nsCAutoString path;
    char* argv[1];

    // Strip off the -bin suffix to get the shell script we should run; this is
what Breakpad does
    nsCAutoString leafName;
    rv = executablePath->GetNativeLeafName(leafName);
    if (NS_SUCCEEDED(rv) && StringEndsWith(leafName, NS_LITERAL_CSTRING("-bin"))) {
      leafName.SetLength(leafName.Length() - strlen("-bin"));
      executablePath->SetNativeLeafName(leafName);
    }

    executablePath->GetNativePath(path);
    argv[0] = (char*)(path.get());

    gnome_client_set_restart_command(client, 1, argv);


Looks like somewhere along the line, someone decided to add the path to the
command, but this causes the problem.

Comment 14 Kevin Kofler 2008-03-25 22:08:46 UTC
So maybe adding:

if (getenv("KDE_FULL_SESSION"))
  argv[0] = "/usr/bin/firefox"
else {
...
}
gnome_client_set_restart_command(client, 1, argv);

around it is enough to make it work? Or even just replace the whole block with:

argv[0] = "/usr/bin/firefox"
gnome_client_set_restart_command(client, 1, argv);

?

Comment 15 Orion Poplawski 2008-03-25 22:22:50 UTC
I would imagine that having the /usr/lib/firefox.. path would break things under
any desktop, not just KDE.  I just don't think firefox starts up well without
going through the scripts to set the various environment variables (unless
something else is trying to save/restore those - but I don't think so).  I think
"firefox" would be the proper upstream solution (which won't know where it gets
installed), but someone there felt it necessary to add a path for some reason.

Comment 16 Orion Poplawski 2008-03-25 22:41:55 UTC
Path was added because of this bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=262258

There used to be a shell script in the firefox directory called "firefox" that
ran "firefox-bin".  But now "firefox" is the binary itself.  /usr/bin/firefox
calls /usr/lib/firefox<ver>/run-mozilla.sh which runs /usr/lib/firefox<ver>/firefox.

Oh joy.

Comment 17 Bug Zapper 2008-05-14 06:04:25 UTC
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 18 Rex Dieter 2008-09-04 14:13:56 UTC
*** Bug 455975 has been marked as a duplicate of this bug. ***

Comment 19 Rex Dieter 2008-09-04 14:15:46 UTC
*** Bug 448895 has been marked as a duplicate of this bug. ***

Comment 20 Rex Dieter 2008-09-04 14:17:11 UTC
kde upstream has been notified of this issue too, http://bugs.kde.org/167373

Comment 21 Rex Dieter 2008-10-24 18:02:39 UTC
*** Bug 452200 has been marked as a duplicate of this bug. ***

Comment 22 Matěj Cepl 2008-12-05 21:20:34 UTC
Bug 474871 is a reproducer for F10.

Comment 23 Matěj Cepl 2008-12-05 21:21:08 UTC
*** Bug 474871 has been marked as a duplicate of this bug. ***

Comment 24 Matěj Cepl 2008-12-20 13:41:30 UTC
*** Bug 477276 has been marked as a duplicate of this bug. ***

Comment 25 Roderick Johnstone 2009-01-06 14:54:20 UTC
As far as I can see nothing has happened upstream as in #20. Last comment there posted July 2008. I have put a comment on  http://bugs.kde.org/167373

Comment 26 Matěj Cepl 2009-02-06 22:19:15 UTC
*** Bug 484456 has been marked as a duplicate of this bug. ***

Comment 27 Matěj Cepl 2009-04-15 04:51:40 UTC
*** Bug 495316 has been marked as a duplicate of this bug. ***

Comment 28 ruslan 2009-04-28 05:08:35 UTC
Rawhide,

firefox-3.1-0.11.beta3.fc11.i586,

KDE-4.2.2

If firefox starts when start my session kde, then now it work flash.
Thanks. Good work!

Comment 29 Matěj Cepl 2009-05-27 21:06:29 UTC
*** Bug 502865 has been marked as a duplicate of this bug. ***

Comment 30 Matěj Cepl 2009-06-17 19:25:35 UTC
*** Bug 502865 has been marked as a duplicate of this bug. ***

Comment 31 Matěj Cepl 2009-06-17 19:28:49 UTC
*** Bug 502865 has been marked as a duplicate of this bug. ***

Comment 32 Oliver Henshaw 2009-07-23 17:33:34 UTC
If I read the upstream bug correctly, the fix isn't actually in firefox yet - right? For whatever reason, the flash plugin now always works on session restore on F11. But nspluginwrapper doesn't always work - sometimes flash is running in-process, sometimes in npviewer.bin.

$ grep firefox .kde/share/config/ksmserverrc
program6=firefox
restartCommand6=/usr/lib/firefox-3.5/firefox,--sm-config-prefix,/firefox-675RhC/,--sm-client-id,10d6dd7374000124818871600000019730025,--screen,0

Also, since updating to F11, I often see "Firefox is having trouble recovering your windows and tabs. This is usually caused by a recently opened web page." on session restore. If I confirm "Restore", firefox  appears to successfully bring up all tabs in all windows.

Comment 33 Martin Stransky 2009-07-23 18:50:06 UTC
The fix has been committed to a firefox devel branch and I've asked for inclusion to 3.5.x line.

Comment 34 Martin Stransky 2009-07-23 18:51:20 UTC
Anyway, reopened as we need to fix our part in /usr/bin/firefox launcher script.

Comment 35 Martin Stransky 2009-08-06 13:03:24 UTC
*** Bug 489641 has been marked as a duplicate of this bug. ***

Comment 36 Martin Stransky 2009-08-06 13:03:39 UTC
*** Bug 505929 has been marked as a duplicate of this bug. ***

Comment 37 Martin Stransky 2009-08-06 13:10:57 UTC
Fix added to firefox-3.5.2-3.fc11 & firefox-3.5.2-2.fc12.