mozilla launching script proposed xremote fix

Warren Togami wtogami at redhat.com
Thu Jan 29 01:55:44 UTC 2004


Below describes two broken xremote functions that our current 
/usr/bin/mozilla script relies upon, and a method to fix the script for 
equivalent functionality so that it works for mozilla-1.6+ and 
MozillaFirebird-0.8+ while Thunderbird is running.  If you are running 
an earlier mozilla or Firebird, then you must run 
/usr/lib/thunderbird/mozilla-xremote-client rather than the browser's 
own client or the browser will fail.

Please help to verify these findings and suggested patch to mozilla-1.6. 
  Verify that there are no regressions in behavior, and it behaves 
equivalently to before the patch both with and without 
MozillaThunderbird-0.4 running.

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=114524
Tracking this proposal within this report

Christopher Blizzard wrote:
 > Warren Togami wrote:
 >> Blizzard,
 >>
 >> Can we improve the /usr/bin/mozilla script to make it possible to
 >> launch while Thunderbird is running? It is currently impossible to do
 >> so with the current /usr/bin/mozilla script. This may severely hinder
 >> adoption of Thunderbird for Linux in the future.
 >>
 >> Do you already have a recipe to make this possible for
 >> /usr/bin/mozilla?
 >
 > If we're talking about the problem that I think we're talking about,
 > Mozilla 1.6 should fix it.  The client in 1.6 (along with thunderbird
 > 0.4, I believe) include the code changes required to allow the client
 > to keep looking for a server that will support its request.
 >
 > --Chris
 >

I did testing with mozilla-1.6-0 and fedora.us MozillaThunderbird-0.4, 
and it appears that xremote behaviors are broken in several ways that 
still make the /usr/bin/mozilla script fail while Thunderbird is running 
with this thunderbird pop-up dialog:

Alert
Error launching browser window:TypeError:
Components.classes['@mozilla.org/appshell/component/browser/instance;1'] 
has no properties

There is a slight improvement over mozilla-1.4.1 and MozillaFirebird-0.7 
though, in that you no longer need to run thunderbird's xremote client 
rather than the browser's xremote
  in order to send the browser a signal.  This improvement is 
unfortunately unrelated to the remaining xremote brokenness, which 
currently make it impossible for the /usr/bin/mozilla script of 1.6 to 
launch while Thunderbird-0.4 is running.

http://www.mozilla.org/unix/remote.html
Of the xremote commands listed on this page, these two commands in 
mozilla-1.6 seem to be broken while Thunderbird is running:
ping()
xfeDoCommand (openBrowser)


function check_running() {
     $MOZ_CLIENT_PROGRAM 'ping()' 2>/dev/null >/dev/null
     RETURN_VAL=$?
     if [ "$RETURN_VAL" -eq "2" ]; then
       echo 0
       return 0
     else
       echo 1
       return 1
     fi
}

xremote's ping() functionality never works properly while Thunderbird is 
running.  It normally returns "2" if Mozilla is not running, or "0" if 
it is running.  While Thunderbird is running, ping() always returns "0". 
  This leads the /usr/bin/mozilla script to think it needs to use 
xremote rather than launch mozilla.

# check to see if there's an already running instance or not
ALREADY_RUNNING=`check_running`



# If there is no command line argument at all then try to open a new
# window in an already running instance.
if [ "${ALREADY_RUNNING}" -eq "1" ] && [ -z "$1" ]; then
   exec $MOZ_CLIENT_PROGRAM "xfeDoCommand(openBrowser)" 2>/dev/null 
 >/dev/null
fi


The xremote xfeDoCommand(openBrowser) option is what causes the pop-up 
error dialog from Thunderbird mentioned near the top of this report.  It 
seems that xfeDoCommand(openBrowser) is completely inoperable with 
either Thunderbird's or mozilla-1.6's xremote client binary.

Since ping() is broken, we no longer have a functional way in which to 
test for a running browser.  What other distributions have done to 
workaround this problem are shell snippets like this:

$MOZ_CLIENT_PROGRAM "openURL($1,new-window)" && exit 0
# If the script reaches this line, then assume xremote failed
# launch mozilla directly

Unfortunately I have found that some programs like xchat call the 
/usr/bin/mozilla script directly with parameters like "-remote 
openURL(%s,new-window)", so the above snippet fails in that case.  Below 
is a minimal patch to /usr/bin/mozilla that should work.

--- mozilla.orig        2004-01-21 06:50:01.633665318 -1000
+++ mozilla     2004-01-22 00:08:39.492016912 -1000
@@ -164,14 +164,18 @@
  # set our JVM vars
  set_jvm_vars

-# check to see if there's an already running instance or not
-ALREADY_RUNNING=`check_running`
-
-# If there is no command line argument at all then try to open a new
-# window in an already running instance.
-if [ "${ALREADY_RUNNING}" -eq "1" ] && [ -z "$1" ]; then
-  exec $MOZ_CLIENT_PROGRAM "xfeDoCommand(openBrowser)" 2>/dev/null 
 >/dev/null
+if [ "$1" == "-remote" ]; then
+    $MOZ_CLIENT_PROGRAM "$2" && exit 0
+else
+    URL="$1"
+    if [ -z $1 ]; then
+        URL="about:blank"
+    fi
+    $MOZ_CLIENT_PROGRAM "openURL($1,new-window)" && exit 0
  fi
+ALREADY_RUNNING=0
+# xremote failed, indicating that a browser is not already running
+# attempt to launch new browser

  # check system locale
  MOZARGS=


In my testing this patch behaves identically to the previous 
/usr/bin/mozilla script, with the exception of fixing this 
launching/xremote behavior of course.

Your thoughts?

Warren Togami
wtogami at redhat.com





More information about the fedora-devel-list mailing list