Skip to content

Commit

Permalink
Bug 557225 - Load the plugin-container from the App Bundle. r=cjones
Browse files Browse the repository at this point in the history
  • Loading branch information
bgirard committed Jul 19, 2010
1 parent 0effa57 commit d5759ec
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 4 deletions.
1 change: 1 addition & 0 deletions ipc/app/defs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
# ***** END LICENSE BLOCK *****

MOZ_CHILD_PROCESS_NAME := plugin-container$(BIN_SUFFIX)
MOZ_CHILD_PROCESS_BUNDLE := plugin-container.app/Contents/MacOS/
2 changes: 2 additions & 0 deletions ipc/app/macbuild/Contents/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@
<string>1.0</string>
<key>LSMinimumSystemVersion</key>
<string>10.5</string>
<key>LSUIElement</key>
<string>1</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ipc/chromium/src/base/process_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ bool LaunchApp(const std::vector<std::string>& argv,
const file_handle_mapping_vector& fds_to_remap,
bool wait, ProcessHandle* process_handle);

#if defined(CHROMIUM_MOZILLA_BUILD) && defined(OS_LINUX)
#if defined(CHROMIUM_MOZILLA_BUILD) && (defined(OS_LINUX) || defined(OS_MACOSX))
typedef std::map<std::string, std::string> environment_map;
bool LaunchApp(const std::vector<std::string>& argv,
const file_handle_mapping_vector& fds_to_remap,
Expand Down
20 changes: 20 additions & 0 deletions ipc/chromium/src/base/process_util_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,21 @@

namespace base {

#if defined(CHROMIUM_MOZILLA_BUILD)
bool LaunchApp(const std::vector<std::string>& argv,
const file_handle_mapping_vector& fds_to_remap,
bool wait, ProcessHandle* process_handle) {
return LaunchApp(argv, fds_to_remap, environment_map(),
wait, process_handle);
}
#endif

bool LaunchApp(const std::vector<std::string>& argv,
const file_handle_mapping_vector& fds_to_remap,
#if defined(CHROMIUM_MOZILLA_BUILD)
const environment_map& env_vars_to_set,
#endif
bool wait, ProcessHandle* process_handle) {
bool retval = true;

char* argv_copy[argv.size() + 1];
Expand All @@ -36,6 +48,14 @@ bool LaunchApp(const std::vector<std::string>& argv,
// as close-on-exec.
SetAllFDsToCloseOnExec();

#if defined(CHROMIUM_MOZILLA_BUILD)
for (environment_map::const_iterator it = env_vars_to_set.begin();
it != env_vars_to_set.end(); ++it) {
if (setenv(it->first.c_str(), it->second.c_str(), 1/*overwrite*/))
exit(127);
}
#endif

posix_spawn_file_actions_t file_actions;
if (posix_spawn_file_actions_init(&file_actions) != 0) {
return false;
Expand Down
13 changes: 11 additions & 2 deletions ipc/glue/GeckoChildProcessHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ GeckoChildProcessHost::PerformAsyncLaunch(std::vector<std::string> aExtraOpts)
// we split the logic here.

FilePath exePath;
#ifdef OS_LINUX
#if defined(OS_LINUX) || defined(OS_MACOSX)
base::environment_map newEnvVars;
#endif

Expand All @@ -235,6 +235,8 @@ GeckoChildProcessHost::PerformAsyncLaunch(std::vector<std::string> aExtraOpts)
path += "/lib";
#endif
newEnvVars["LD_LIBRARY_PATH"] = path.get();
#elif OS_MACOSX
newEnvVars["DYLD_LIBRARY_PATH"] = path.get();
#endif
#ifdef MOZ_OMNIJAR
// Make sure the child process can find the omnijar
Expand All @@ -249,6 +251,13 @@ GeckoChildProcessHost::PerformAsyncLaunch(std::vector<std::string> aExtraOpts)
exePath = FilePath(CommandLine::ForCurrentProcess()->argv()[0]);
exePath = exePath.DirName();
}

#ifdef OS_MACOSX
// We need to use an App Bundle on OS X so that we can hide
// the dock icon. See Bug 557225
exePath = exePath.AppendASCII(MOZ_CHILD_PROCESS_BUNDLE);
#endif

exePath = exePath.AppendASCII(MOZ_CHILD_PROCESS_NAME);

#ifdef ANDROID
Expand Down Expand Up @@ -297,7 +306,7 @@ GeckoChildProcessHost::PerformAsyncLaunch(std::vector<std::string> aExtraOpts)
#endif

base::LaunchApp(childArgv, mFileMap,
#ifdef OS_LINUX
#if defined(OS_LINUX) || defined(OS_MACOSX)
newEnvVars,
#endif
false, &process);
Expand Down
3 changes: 2 additions & 1 deletion ipc/glue/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ CPPSRCS += SharedMemory_posix.cpp
endif

include $(topsrcdir)/ipc/app/defs.mk
DEFINES += -DMOZ_CHILD_PROCESS_NAME="\"$(MOZ_CHILD_PROCESS_NAME)\""
DEFINES += -DMOZ_CHILD_PROCESS_NAME=\"$(MOZ_CHILD_PROCESS_NAME)\"
DEFINES += -DMOZ_CHILD_PROCESS_BUNDLE=\"$(MOZ_CHILD_PROCESS_BUNDLE)\"

include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
Expand Down

0 comments on commit d5759ec

Please sign in to comment.