Skip to content

Commit

Permalink
Revert "win: keep single-argument when converting cmdline to string"
Browse files Browse the repository at this point in the history
This reverts commit bb75c8b.

Reason for revert: crbug.com/1383469 - regresses rendezvous case

Original change's description:
> win: keep single-argument when converting cmdline to string
>
> When Chrome is launched with --single-argument, but rendezvous's with
> an already running instance of Chrome, this CL makes it so we pass the
> --single-argument switch to the running instance of Chrome. This helps
> us record the right launch mode metric, and fixes a potential instance
> of https://crbug.com/937179 for the rendezvous case.
>
> Bug: 1366137, 937179
> Change-Id: Ibec82bb4237c7de88140c81bec2a279121d72db7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3984458
> Reviewed-by: Jesse McKenna <jessemckenna@google.com>
> Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
> Commit-Queue: David Bienvenu <davidbienvenu@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1065496}

(cherry picked from commit 8916a44)

Bug: 1366137, 937179
Change-Id: I1e27b5a85255917182d646090c5134154fb98f02
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4025894
Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
Commit-Queue: David Bienvenu <davidbienvenu@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1071081}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4025901
Reviewed-by: Lei Zhang <thestig@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/5414@{#50}
Cr-Branched-From: 4417ee5-refs/heads/main@{#1070088}
  • Loading branch information
David Bienvenu authored and Chromium LUCI CQ committed Nov 15, 2022
1 parent 41b9b85 commit 64ea83f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
12 changes: 0 additions & 12 deletions base/command_line.cc
Expand Up @@ -554,10 +554,6 @@ CommandLine::StringType CommandLine::GetArgumentsStringInternal(
StringType params;
// Append switches and arguments.
bool parse_switches = true;
#if BUILDFLAG(IS_WIN)
bool appended_single_argument_switch = false;
#endif

for (size_t i = 1; i < argv_.size(); ++i) {
StringType arg = argv_[i];
StringType switch_string;
Expand All @@ -576,14 +572,6 @@ CommandLine::StringType CommandLine::GetArgumentsStringInternal(
}
} else {
#if BUILDFLAG(IS_WIN)
if (has_single_argument_switch_) {
// Check that we don't have multiple arguments when
// `has_single_argument_switch_` is true.
DCHECK(!appended_single_argument_switch);
appended_single_argument_switch = true;
params.append(base::StrCat(
{kSwitchPrefixes[0], kSingleArgument, FILE_PATH_LITERAL(" ")}));
}
arg = QuoteForCommandLineToArgvW(arg, allow_unsafe_insert_sequences);
#endif
params.append(arg);
Expand Down
9 changes: 0 additions & 9 deletions base/command_line_unittest.cc
Expand Up @@ -338,15 +338,6 @@ TEST(CommandLineTest, HasSingleArgument) {
EXPECT_TRUE(cl_for_shell.HasSingleArgumentSwitch());
}

// Test that creating a new command line from the string version of a single
// argument command line maintains the single argument switch.
TEST(CommandLineTest, MaintainSingleArgument) {
CommandLine cl = CommandLine::FromString(
FILE_PATH_LITERAL("program --switch --single-argument foo.html"));
CommandLine cl_for_shell = CommandLine::FromString(cl.GetCommandLineString());
EXPECT_TRUE(cl_for_shell.HasSingleArgumentSwitch());
}

#endif // BUILDFLAG(IS_WIN)

// Tests that when AppendArguments is called that the program is set correctly
Expand Down

0 comments on commit 64ea83f

Please sign in to comment.