Closed Bug 1410564 Opened 4 years ago Closed 4 years ago

support --arg on Windows in nsCommandLine for consistency with CheckArgs

Categories

(Toolkit :: Startup and Profile System, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: myk, Assigned: myk)

Details

Attachments

(3 files)

There's an inconsistency in command-line argument handling on Windows.  CheckArg in nsAppRunner.cpp supports both --arg and -arg variants (plus the Windows-specific /arg), while nsCommandLine supports only the -arg variant, since it looks for -arg when you findFlag("arg") but doesn't convert --arg to -arg in nsCommandLine::Init on Windows like it does on other platforms (and as a side effect also doesn't support --arg=value, which it only splits when converting --arg to -arg).

Thus flags that are handled via CheckArg (profile, ProfileManager, etc.) support both --arg and -arg, while those that are handled via nsICommandLine (preferences, jsconsole, headless, etc.) only support -arg.

jryans suggested on IRC that there's been conversation about this in the past on a mailing list, although he wasn't able to find it.

In any case, it seems like we should make nsCommandLine consistent with CheckArgs and support both --arg and -arg on Windows (unless there's some subtle reason why we don't want to support --arg on Windows, in which case we should presumably not support it for CheckArg-handled args either).
This patch makes Windows behave the same as other platforms with regard to --arg handling.  I tested it in conjunction with the fix for bug 1406590, and it makes all of the tests in that patch succeed on Windows.

Here's a tryserver run for browser-chrome:

https://treeherder.mozilla.org/#/jobs?repo=try&revision=024057d95182c33a231ad1970f972717025d6295

I'm unsure if there's another test suite I should also try.  It seems unlikely for this to cause anything to fail, unless there's something that depends on --arg being treated as a raw argument rather than a flag on Windows.  That would be unfortunate.
Assignee: nobody → myk
Status: NEW → ASSIGNED
Attachment #8920747 - Flags: review?(dtownsend)
Attachment #8920747 - Flags: review?(dtownsend) → review+
This followup patch, which applies on top of the patch in bug 1406590, enables the tests added by that bug on Windows.
Attachment #8921141 - Flags: review?(dtownsend)
Attachment #8921141 - Flags: review?(dtownsend) → review+
Pushed by myk@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/b201e296ff57
support double-dash args on Windows in nsCommandLine; r=mossop
https://hg.mozilla.org/integration/mozilla-inbound/rev/2417dd5bd9cc
enable headless screenshot tests on Windows; r=mossop
https://hg.mozilla.org/mozilla-central/rev/b201e296ff57
https://hg.mozilla.org/mozilla-central/rev/2417dd5bd9cc
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
When I re-enabled the tests on Windows, I forgot to remove the comment about them being disabled.  Here's the comment-only change that fixes that problem.
Attachment #8921567 - Flags: review?(dtownsend)
Attachment #8921567 - Flags: review?(dtownsend) → review+
Pushed by myk@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d027c2da35f0
remove obsolete comment about Windows tests being disabled; r=mossop
You need to log in before you can comment on or make changes to this bug.