diff --git a/libcef/browser/context.cc b/libcef/browser/context.cc index 35cae5bb1..b6f441796 100644 --- a/libcef/browser/context.cc +++ b/libcef/browser/context.cc @@ -96,6 +96,9 @@ int RunAsCrashpadHandler(const base::CommandLine& command_line) { }), argv.end()); + // HandlerMain expects the first argument to be the program name. + argv.insert(argv.begin(), command_line.GetProgram().value()); + std::unique_ptr argv_as_utf8(new char*[argv.size() + 1]); std::vector storage; storage.reserve(argv.size()); diff --git a/libcef/common/crash_reporting.cc b/libcef/common/crash_reporting.cc index 65cdcebfc..f785e69a8 100644 --- a/libcef/common/crash_reporting.cc +++ b/libcef/common/crash_reporting.cc @@ -59,24 +59,26 @@ void InitCrashReporter(const base::CommandLine& command_line, // framework dylib is even loaded, to catch potential early crashes. crash_reporter::InitializeCrashpad(process_type.empty(), process_type); - // Mac Chrome is packaged with a main app bundle and a helper app bundle. - // The main app bundle should only be used for the browser process, so it - // should never see a --type switch (switches::kProcessType). Likewise, - // the helper should always have a --type switch. - // - // This check is done this late so there is already a call to - // base::mac::IsBackgroundOnlyProcess(), so there is no change in - // startup/initialization order. + if (base::mac::AmIBundled()) { + // Mac Chrome is packaged with a main app bundle and a helper app bundle. + // The main app bundle should only be used for the browser process, so it + // should never see a --type switch (switches::kProcessType). Likewise, + // the helper should always have a --type switch. + // + // This check is done this late so there is already a call to + // base::mac::IsBackgroundOnlyProcess(), so there is no change in + // startup/initialization order. - // The helper's Info.plist marks it as a background only app. - if (base::mac::IsBackgroundOnlyProcess()) { - CHECK(command_line.HasSwitch(switches::kProcessType) && - !process_type.empty()) - << "Helper application requires --type."; - } else { - CHECK(!command_line.HasSwitch(switches::kProcessType) && - process_type.empty()) - << "Main application forbids --type, saw " << process_type; + // The helper's Info.plist marks it as a background only app. + if (base::mac::IsBackgroundOnlyProcess()) { + CHECK(command_line.HasSwitch(switches::kProcessType) && + !process_type.empty()) + << "Helper application requires --type."; + } else { + CHECK(!command_line.HasSwitch(switches::kProcessType) && + process_type.empty()) + << "Main application forbids --type, saw " << process_type; + } } g_crash_reporting_enabled = true; diff --git a/libcef/common/main_delegate.cc b/libcef/common/main_delegate.cc index cb870d965..f8bff50ea 100644 --- a/libcef/common/main_delegate.cc +++ b/libcef/common/main_delegate.cc @@ -91,16 +91,16 @@ void OverrideFrameworkBundlePath() { } void OverrideChildProcessPath() { - // ChildProcessHost::GetChildPath() requires either kBrowserSubprocessPath or - // CHILD_PROCESS_EXE but not both. - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kBrowserSubprocessPath)) { - return; + base::FilePath child_process_path = + base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( + switches::kBrowserSubprocessPath); + + if (child_process_path.empty()) { + child_process_path = util_mac::GetChildProcessPath(); + DCHECK(!child_process_path.empty()); } - base::FilePath child_process_path = util_mac::GetChildProcessPath(); - DCHECK(!child_process_path.empty()); - + // Used by ChildProcessHost::GetChildPath and PlatformCrashpadInitialization. PathService::Override(content::CHILD_PROCESS_EXE, child_process_path); }