I have a potential fix for this bug. I hope I have not violated any
coding conventions; I am not familiar with C++ or Firefox, nor have I
ever submitted a patch before.
The patch is based on Iceweasel 2.0.0.13, built from
iceweasel_2.0.0.13.orig.tar.gz, iceweasel_2.0.0.13-0etch1.diff.gz,
iceweasel_2.0.0.13-0etch1.dsc. Many thanks to Yavor Doganov
<yavor AT gnu.org>, without whose help I would not have managed to
build Iceweasel from source.
Based on my understanding of the -a parameter, I have amended
toolkit/xre/nsAppRunner.cpp.
The problem was that every process identified itself with the name
"firefox" as derived from gAppData->name. This is why
iceweasel -new-tab <url>
always connected to the process started first regardless of its profile.
I have modified the code so that
remoteService->Startup
is now parameterized with the <application-id> or "default" if it is
empty. The latter should never happen on Debian when called
via /usr/lib/iceweasel/iceweasel, which always populates
<application-id>. But it should be necessary for Firefox.
====
Test:
1. create 2 profiles p1 and p2
2. iceweasel -P p1 -a a1
3. iceweasel -P p2 -a a2
4. iceweasel -a a2 -new-tab <url>
5. iceweasel -a a2 -remote "openurl(<url>,new-tab)"
Both 4. and 5. work now.
====
If you need to contact me, please, reply to this bug, not to my email
address displayed here. As it gets spammed to hell, I have redirected
it to /dev/null and cc'd myself under a different address.
--- toolkit/xre/nsAppRunner.cpp.ori 2008-05-29 16:39:15.000000000 +0100
+++ toolkit/xre/nsAppRunner.cpp 2008-05-29 16:43:55.000000000 +0100
@@ -259,6 +259,7 @@
int gArgc;
char **gArgv;
+const char *gAppName;
static int gRestartArgc;
static char **gRestartArgv;
@@ -1144,6 +1145,7 @@
return 1;
}
+ /*
const char *temp = nsnull;
ar = CheckArg("a", PR_FALSE, &temp);
if (ar == ARG_BAD) {
@@ -1152,6 +1154,8 @@
} else if (ar == ARG_FOUND) {
program.Assign(temp);
}
+ */
+ program.Assign(gAppName);
ar = CheckArg("u", PR_FALSE, &username);
if (ar == ARG_BAD) {
@@ -1195,6 +1199,7 @@
ToLowerCase(program);
const char *username = getenv("LOGNAME");
+ /*
const char *temp = nsnull;
ar = CheckArg("a", PR_TRUE, &temp);
if (ar == ARG_BAD) {
@@ -1203,6 +1208,8 @@
} else if (ar == ARG_FOUND) {
program.Assign(temp);
}
+ */
+ program.Assign(gAppName);
ar = CheckArg("u", PR_TRUE, &username);
if (ar == ARG_BAD) {
@@ -2473,6 +2480,17 @@
PR_fprintf(PR_STDERR, "Error: -remote requires an argument\n");
return 1;
}
+
+ ArgResult app_ar;
+ PRBool checkOSInt = PR_TRUE;
+ if (ar)
+ checkOSInt = PR_FALSE;
+ app_ar = CheckArg("a", checkOSInt, &gAppName);
+ if (app_ar == ARG_BAD) {
+ PR_fprintf(PR_STDERR, "Error: argument -a requires an application name\n");
+ return 1;
+ }
+
if (ar) {
return HandleRemoteArgument(xremotearg);
}
@@ -2806,7 +2824,9 @@
nsCOMPtr<nsIRemoteService> remoteService;
remoteService = do_GetService("@mozilla.org/toolkit/remote-service;1");
if (remoteService)
- remoteService->Startup(gAppData->name, nsnull);
+ {
+ remoteService->Startup((nsnull == gAppName ? "default" : gAppName), nsnull);
+ }
#endif /* MOZ_ENABLE_XREMOTE */
// enable win32 DDE responses and Mac appleevents responses