Closed Bug 252024 Opened 20 years ago Closed 8 years ago

mozilla-xremote-client 'ping()' fails when on a different xdisplay

Categories

(Core Graveyard :: X-remote, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: dave.antliff, Assigned: blizzard)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040714 MultiZilla/1.6.4.0b
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040714 MultiZilla/1.6.4.0b

I have been using this script with Mozilla 1.4, 1.5, 1.6 on a dual head system
without issues:

---
#!/bin/bash
# opens a new tab at selected URL
DISPLAY=localhost:0.0
if mozilla -remote 'ping()'
then
  mozilla -remote "openURL($1, new-tab)"
else
  mozilla `xclip -o`
fi
---

If I invoke this on either head/display, a new tab opens in the existing mozilla
on display/screen 0.

However with 1.7, this seems to be broken. First:

DISPLAY=localhost:0.0 mozilla -remote 'ping()' ; echo $?

This used to return either 0 or 1 if Mozilla was or wasn't running on screen 0
(I don't recall which way around - but the value was certainly different since
the script worked). With Mozilla 1.7, this always returns zero.

$ DISPLAY=localhost:0.0 mozilla -remote 'ping()' ; echo $?
0

$ DISPLAY=localhost:0.1 mozilla -remote 'ping()' ; echo $?
/usr/lib/mozilla/mozilla-xremote-client: Error: Failed to find a running server.
0

Secondly, this command no longer works:

$ DISPLAY=localhost:0.0 mozilla -remote "openURL('http://www.google.com', new-tab)"
/usr/lib/mozilla/mozilla-xremote-client: Error: Failed to send command: 509
internal error
/usr/lib/mozilla/mozilla-xremote-client: Error: Failed to find a running server.
No running windows found

Content Blocker: Registering...

Content Blocker: Registering...
Error: Failed to send command: 509 internal error

Both commands fail in the same manner no matter whether I run them on :0.0 or :0.1

The Mozilla 1.7 GUI does not respond in any way - no new tabs are opened.


I also tried this command (using --display):

$ mozilla --display=localhost:0.0 -remote "openURL('http://www.google.com',
new-tab)"
/usr/lib/mozilla/mozilla-xremote-client: Error: Failed to send command: 509
internal error
Browser doesn't understand command

Content Blocker: Registering...

Content Blocker: Registering...
Error: No running window found.

Note the slightly different error message - "browser does not understand command".

I may be able to test this on the same system but as *single-head* - I'll post a
comment if I do.





Reproducible: Always
Steps to Reproduce:
1. Dual-head system
2. Try to use mozilla -remote commands on either screen fails with error message
3. remote 'ping' command returns wrong error value

Actual Results:  
Error messages are reported and the commands are not executed.

Expected Results:  
Behaviour significantly differs from previous versions of Mozilla.


I have multizilla-1.6.4.0(b) extension installed.

I have repeated this on two separate Gentoo Linux workstations.

This bug disables significant automation achievable through the -remote command.
Summary: Mozilla 1.7 -remote on alternate display fails → Mozilla 1.7 -remote on dual head fails
This command causes the system to attempt to run a new independent instance of
Mozilla (i.e. Mozilla Profile Manager opens and prompts for profile since
Mozilla is already running):

$ mozilla --display=:0.0 -remote 'ping()' ; echo $?

Content Blocker: Registering...

Content Blocker: Registering...
0


This behaviour is incorrect - Mozilla should detect the running instance and the
command should return without trying to run Mozilla.
I tried with single-head X configuration:

With Mozilla not running:
$ mozilla -remote 'ping()' ; echo $?
No running windows found

Content Blocker: Registering...

Content Blocker: Registering...
Error: No running window found.
0
---

With Mozilla running:
$ mozilla -remote 'ping()' ; echo $?
0
---

With Mozilla running:
$ mozilla -remote "openURL('http://www.google.com', new-tab)"
/usr/lib/mozilla/mozilla-xremote-client: Error: Failed to send command: 509
internal error
Browser doesn't understand command

Content Blocker: Registering...

Content Blocker: Registering...
Error: Failed to send command: 509 internal error
---

So I am changing the description of this bug from 'dual head' to something more
general.


Summary: Mozilla 1.7 -remote on dual head fails → Mozilla 1.7 -remote ping() and openURL() fail
Bug 242123 fixed the -remote openORL() issue (spaces around the comma between
arguments).

1.7 also doesn't seem to care for single quotes around the URL, e.g. this fails:
-remote "openURL('http://www.google.com',new-tab)."
Failure with a single-quoted URL is present in the trunk as well (apologies for
the spam).
Additional info for openURL() - I discovered the following odd behaviour.

This works:
  $ mozilla -remote "openURL(http://www.google.com/, new-tab)"


This doesn't work - difference is the final '/' on the URL:
  $ mozilla -remote "openURL(http://www.google.com, new-tab)"
  /usr/lib/mozilla/mozilla-xremote-client: Error: Failed to send command: 509
internal error
  Browser doesn't understand command

This also doesn't work (no http://):
  mozilla -remote "openURL(www.google.com, new-tab)"


It would appear that Mozilla 1.7 has tighter checking of URLs than 1.6. This
could be argued to be undesirable, since URLs are represented in many ways. In
my case, I use a script to open an X selection in Mozilla using this interface.
Unless the URL I select matches these rules, Mozilla fails to open the new tab.

In the meantime, a workaround is to pass the URL through a 'sanitiser' that
ensures the URL is correctly formatted.


dup

*** This bug has been marked as a duplicate of 242123 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
(In reply to comment #6)
> dup
> 
> *** This bug has been marked as a duplicate of 242123 ***

Actually, no, that bug doesn't mention 'ping()' not working for dual head systems...

I might have confused the matter slightly by including two issues that I
originally thought were one and the same. The ping() issue is not covered by 242123.

I'm changing the title appropriately.
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---
Summary: Mozilla 1.7 -remote ping() and openURL() fail → Mozilla 1.7 -remote ping() fails
This affects remote X forwarding over SSH.

I don't know of any application which can handle multiple displays within the
same instance (there may be some floating around in the wild, but not many). 
Additionally, I don't think GTK or Qt handles this quite well either. 
Confirming, but this may be become WONTFIX until we get some better X APIs to
handle this.
Severity: major → normal
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Mozilla 1.7 -remote ping() fails → Mozilla -remote ping() fails when on a different xdisplay
Summary: Mozilla -remote ping() fails when on a different xdisplay → mozilla-xremote-client 'ping()' fails when on a different xdisplay
GTK can do it, but we're not building with the right options (or code for that
matter) to get it.
Notable applications that handle this are emacs/xemacs, and it's very useful. Qt
also handles this (since v3; how well I don't know).
Mass resolving a bunch of old bugs in the x-remote component in preparation for archiving it. If this bug is still valid and useful, please move it to the "Toolkit: Startup and Profile System" component and reopen it.
Status: NEW → RESOLVED
Closed: 20 years ago8 years ago
Resolution: --- → INCOMPLETE
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.