Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(951)

Unified Diff: mojo/shell/desktop/mojo_main.cc

Issue 735863002: Emit an error log line when attempting to connect to an app at an invalid URL. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/application_manager/application_manager.cc ('k') | mojo/shell/dynamic_application_loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/desktop/mojo_main.cc
diff --git a/mojo/shell/desktop/mojo_main.cc b/mojo/shell/desktop/mojo_main.cc
index 02be823e8ef4475412f11d99d1cf8c7a6c6e1591..937dd61997c47c8d0aa670f01ab5ad6c54062dbd 100644
--- a/mojo/shell/desktop/mojo_main.cc
+++ b/mojo/shell/desktop/mojo_main.cc
@@ -57,6 +57,9 @@ GURL GetAppURLAndSetArgs(const base::CommandLine::StringType& app_url_and_args,
if (argv.empty())
return GURL::EmptyGURL();
GURL app_url(argv[0]);
+ if (!app_url.is_valid()) {
+ LOG(ERROR) << "Error: invalid URL: " << argv[0];
Aaron Boodman 2014/11/20 22:16:02 Add a return here. We don't want to set any args f
azani 2014/11/20 22:18:00 Done.
+ }
if (argv.size() > 1)
context->application_manager()->SetArgsForURL(argv, app_url);
return app_url;
@@ -64,8 +67,12 @@ GURL GetAppURLAndSetArgs(const base::CommandLine::StringType& app_url_and_args,
void RunApps(mojo::shell::Context* context) {
const auto& command_line = *base::CommandLine::ForCurrentProcess();
- for (const auto& arg : command_line.GetArgs())
- context->Run(GetAppURLAndSetArgs(arg, context));
+ for (const auto& arg : command_line.GetArgs()) {
+ GURL url = GetAppURLAndSetArgs(arg, context);
+ if (!url.is_valid())
+ return;
+ context->Run(url);
+ }
}
void Usage() {
« no previous file with comments | « mojo/application_manager/application_manager.cc ('k') | mojo/shell/dynamic_application_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698