Closed Bug 303138 Opened 19 years ago Closed 19 years ago

xremote interferes with profile-related operations

Categories

(Toolkit :: Startup and Profile System, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 289383

People

(Reporter: logan+mozilla-bmo, Unassigned)

Details

When another instance of firefox is running, subsequent calls to the firefox
script with -profile, -ProfileManager, or -P result in a new window being
created from the running instance rather than performing the profile-related
request.

A special case could be added to the 'firefox' script which tests for the above
and sets MOZ_NO_REMOTE accordingly, but that's a bit ugly...

while [ $# -gt 0 ]
do
...
    -profile | -P)
      export MOZ_NO_REMOTE=1
      moreargs="$moreargs $1 $2"
      shift 2
      ;;
    -ProfileManager)
      export MOZ_NO_REMOTE=1
      moreargs="$moreargs $1"
      shift 1
      ;;
...

*** This bug has been marked as a duplicate of 289383 ***
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
Bug 289383 talks about adding the MOZ_NO_REMOTE check, but I'm asking about
setting this automatically whenever someone passes a profile-related switch to
the script. Forcing the user to set an environment variable to perform an
operation firefox lists in the usage doesn't seem right to me. Maybe I'm just
not understanding something?
I really don't have the machine to compile mozilla, but I think this should be ok:

--- nsAppRunner.cpp.orig        2005-08-02 15:44:06.000000000 -0500
+++ nsAppRunner.cpp     2005-08-02 16:34:28.000000000 -0500
@@ -2058,7 +2058,21 @@
     return HandleRemoteArgument(xremotearg);
   }
 
-  if (!PR_GetEnv("MOZ_NO_REMOTE")) {
+  PRBool noRemote = PR_GetEnv("MOZ_NO_REMOTE") ? PR_TRUE : PR_FALSE;
+
+  if (!noRemote) {
+    int i;
+
+    for(i = 0; i < argc; i++)
+      if (strimatch("-profile", argv[i]) ||
+          strimatch("-profilemanager", argv[i]) ||
+          strimatch("-p", argv[i])) {
+        noRemote = PR_TRUE;
+        break;
+      }
+  }
+
+  if (!noRemote) {
     // Try to remote the entire command line. If this fails, start up normally.
     if (RemoteCommandLine())
       return 0;

I like this alot more than screwing with the firefox script. CheckArg() modifies
arg{c,v}, so I didn't want to use that here and try to maintain some global
profile variable, figured this would be the least intrusive solution.
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.