Headless: filter out empty arguments
Users might specify an empty argument by mistake and it gets then treated as a file path resulting in an unexpected internal page with unexpected console messages. It probably makes sense to default to about:blank if no file path was explicitly provided (similar to no args). Bug: none Change-Id: Iad93561de8da0249c23c9fbbd23f8fe2b2ba56bf Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5155468 Auto-Submit: Alex Rudenko <alexrudenko@chromium.org> Reviewed-by: Peter Kvitek <kvitekp@chromium.org> Commit-Queue: Peter Kvitek <kvitekp@chromium.org> Cr-Commit-Position: refs/heads/main@{#1243333}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
70adcbd20b
commit
241dc6c661
@ -119,6 +119,10 @@ void HeadlessShell::OnBrowserStart(HeadlessBrowser* browser) {
|
||||
// driven by a debugger.
|
||||
base::CommandLine::StringVector args =
|
||||
base::CommandLine::ForCurrentProcess()->GetArgs();
|
||||
args.erase(
|
||||
std::remove(args.begin(), args.end(), base::CommandLine::StringType()),
|
||||
args.end());
|
||||
|
||||
if (args.empty() && !devtools_enabled) {
|
||||
args.push_back(kAboutBlank);
|
||||
}
|
||||
|
Reference in New Issue
Block a user