From 32369d763913881d4afbab0ef8c6c769d22cad96 Mon Sep 17 00:00:00 2001 From: "thomasvl@chromium.org" Date: Tue, 24 Aug 2010 20:50:06 +0000 Subject: [Mac] Enforce proper usage of main app bundle and helper app bundle. - Add a check to make sure the helper isn't used without --type - Add a check to make sure the main app isn't used with --type. - Make inproc browser tests invoke the helper that is within the app bundle on disk to recreate the real world environment. BUG=23645,52858 TEST=green tree, invoking the main app with --type fails, and invoking the helper without it fails. Review URL: http://codereview.chromium.org/3171027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57231 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/app/chrome_dll_main.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'chrome/app') diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc index 487d781..d65908c 100644 --- a/chrome/app/chrome_dll_main.cc +++ b/chrome/app/chrome_dll_main.cc @@ -648,6 +648,26 @@ int ChromeMain(int argc, char** argv) { } } +#if defined(OS_MACOSX) + // 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 + // mac_util::IsBackgroundOnlyProcess(), so there is no change in + // startup/initialization order. + + // The helper's Info.plist marks it as a background only app. + if (mac_util::IsBackgroundOnlyProcess()) { + CHECK(parsed_command_line.HasSwitch(switches::kProcessType)) + << "Helper application requires --type."; + } else { + CHECK(!parsed_command_line.HasSwitch(switches::kProcessType)) + << "Main application forbids --type, saw \"" << process_type << "\"."; + } +#endif // defined(OS_MACOSX) + if (IsCrashReporterEnabled()) InitCrashProcessInfo(); #endif // OS_MACOSX -- cgit v1.1