From 15fbfa5ae1164a5c2ddce5f2890b02645f7a04d6 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 9 Dec 2009 10:31:50 -0800 Subject: rename LL_PATH_MOZILLA_PROFILE to LL_PATH_BROWSER_PROFILE --- indra/llvfs/lldir.cpp | 2 +- indra/llvfs/lldir.h | 2 +- indra/llvfs/lldir_linux.cpp | 4 ++-- indra/llvfs/lldir_solaris.cpp | 4 ++-- indra/llvfs/lldir_win32.cpp | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp index c0c6e592d5..7d1ccf5580 100644 --- a/indra/llvfs/lldir.cpp +++ b/indra/llvfs/lldir.cpp @@ -394,7 +394,7 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd prefix += "local_assets"; break; - case LL_PATH_MOZILLA_PROFILE: + case LL_PATH_BROWSER_PROFILE: prefix = getOSUserAppDir(); prefix += mDirDelimiter; prefix += "browser_profile"; diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h index 07c814769e..bf4209390f 100644 --- a/indra/llvfs/lldir.h +++ b/indra/llvfs/lldir.h @@ -54,7 +54,7 @@ typedef enum ELLPath LL_PATH_TOP_SKIN = 10, LL_PATH_CHAT_LOGS = 11, LL_PATH_PER_ACCOUNT_CHAT_LOGS = 12, - LL_PATH_MOZILLA_PROFILE = 13, + LL_PATH_BROWSER_PROFILE = 13, LL_PATH_USER_SKIN = 14, LL_PATH_LOCAL_ASSETS = 15, // LL_PATH_HTML = 16, diff --git a/indra/llvfs/lldir_linux.cpp b/indra/llvfs/lldir_linux.cpp index 08c993ed2a..495e06e514 100644 --- a/indra/llvfs/lldir_linux.cpp +++ b/indra/llvfs/lldir_linux.cpp @@ -225,12 +225,12 @@ void LLDir_Linux::initAppDirs(const std::string &app_name, } } - res = LLFile::mkdir(getExpandedFilename(LL_PATH_MOZILLA_PROFILE,"")); + res = LLFile::mkdir(getExpandedFilename(LL_PATH_BROWSER_PROFILE,"")); if (res == -1) { if (errno != EEXIST) { - llwarns << "Couldn't create LL_PATH_MOZILLA_PROFILE dir " << getExpandedFilename(LL_PATH_MOZILLA_PROFILE,"") << llendl; + llwarns << "Couldn't create LL_PATH_BROWSER_PROFILE dir " << getExpandedFilename(LL_PATH_BROWSER_PROFILE,"") << llendl; } } diff --git a/indra/llvfs/lldir_solaris.cpp b/indra/llvfs/lldir_solaris.cpp index a21f3ca0ab..561c011db0 100644 --- a/indra/llvfs/lldir_solaris.cpp +++ b/indra/llvfs/lldir_solaris.cpp @@ -244,12 +244,12 @@ void LLDir_Solaris::initAppDirs(const std::string &app_name, } } - res = LLFile::mkdir(getExpandedFilename(LL_PATH_MOZILLA_PROFILE,"")); + res = LLFile::mkdir(getExpandedFilename(LL_PATH_BROWSER_PROFILE,"")); if (res == -1) { if (errno != EEXIST) { - llwarns << "Couldn't create LL_PATH_MOZILLA_PROFILE dir " << getExpandedFilename(LL_PATH_MOZILLA_PROFILE,"") << llendl; + llwarns << "Couldn't create LL_PATH_BROWSER_PROFILE dir " << getExpandedFilename(LL_PATH_BROWSER_PROFILE,"") << llendl; } } diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp index 4c376f11a5..b5754be6d6 100644 --- a/indra/llvfs/lldir_win32.cpp +++ b/indra/llvfs/lldir_win32.cpp @@ -212,12 +212,12 @@ void LLDir_Win32::initAppDirs(const std::string &app_name, } } - res = LLFile::mkdir(getExpandedFilename(LL_PATH_MOZILLA_PROFILE,"")); + res = LLFile::mkdir(getExpandedFilename(LL_PATH_BROWSER_PROFILE,"")); if (res == -1) { if (errno != EEXIST) { - llwarns << "Couldn't create LL_PATH_MOZILLA_PROFILE dir " << getExpandedFilename(LL_PATH_MOZILLA_PROFILE,"") << llendl; + llwarns << "Couldn't create LL_PATH_BROWSER_PROFILE dir " << getExpandedFilename(LL_PATH_BROWSER_PROFILE,"") << llendl; } } res = LLFile::mkdir(getExpandedFilename(LL_PATH_USER_SKIN,"")); -- cgit v1.2.3 From 197de032e1f66894f595a3a1ba46b36f45f8e8f5 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 9 Dec 2009 12:57:10 -0800 Subject: DEV-43948 viewer2 is writing session data into the 'read-only' installation tree (mostly media stuff) propagate the parent app's OSUserAppDir (i.e. ~/.secondlife/) all the way down to plugins, if they need persistant user data/settings (like the webkit plugin needs a place to put its cache). --- indra/llplugin/llpluginclassmedia.cpp | 5 +++-- indra/llplugin/llpluginclassmedia.h | 2 +- indra/llplugin/llpluginprocesschild.cpp | 9 +++++++-- indra/llplugin/llpluginprocesschild.h | 2 ++ indra/llplugin/llpluginprocessparent.cpp | 4 +++- indra/llplugin/llpluginprocessparent.h | 4 +++- indra/media_plugins/webkit/media_plugin_webkit.cpp | 10 +++++++--- indra/newview/llviewermedia.cpp | 7 +++---- 8 files changed, 29 insertions(+), 14 deletions(-) (limited to 'indra') diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index 70d770ef7e..1a382643da 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -63,14 +63,15 @@ LLPluginClassMedia::~LLPluginClassMedia() reset(); } -bool LLPluginClassMedia::init(const std::string &launcher_filename, const std::string &plugin_filename, bool debug) +bool LLPluginClassMedia::init(const std::string &launcher_filename, const std::string &plugin_filename, bool debug, const std::string &user_data_path) { LL_DEBUGS("Plugin") << "launcher: " << launcher_filename << LL_ENDL; LL_DEBUGS("Plugin") << "plugin: " << plugin_filename << LL_ENDL; + LL_DEBUGS("Plugin") << "user_data_path: " << user_data_path << LL_ENDL; mPlugin = new LLPluginProcessParent(this); mPlugin->setSleepTime(mSleepTime); - mPlugin->init(launcher_filename, plugin_filename, debug); + mPlugin->init(launcher_filename, plugin_filename, debug, user_data_path); return true; } diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h index 6b64688718..b58067733b 100644 --- a/indra/llplugin/llpluginclassmedia.h +++ b/indra/llplugin/llpluginclassmedia.h @@ -49,7 +49,7 @@ public: virtual ~LLPluginClassMedia(); // local initialization, called by the media manager when creating a source - virtual bool init(const std::string &launcher_filename, const std::string &plugin_filename, bool debug = false); + virtual bool init(const std::string &launcher_filename, const std::string &plugin_filename, bool debug, const std::string &user_data_path); // undoes everything init() didm called by the media manager when destroying a source virtual void reset(); diff --git a/indra/llplugin/llpluginprocesschild.cpp b/indra/llplugin/llpluginprocesschild.cpp index 55cf11c620..ccf6dab942 100644 --- a/indra/llplugin/llpluginprocesschild.cpp +++ b/indra/llplugin/llpluginprocesschild.cpp @@ -145,8 +145,12 @@ void LLPluginProcessChild::idle(void) break; case STATE_PLUGIN_LOADED: - setState(STATE_PLUGIN_INITIALIZING); - sendMessageToPlugin(LLPluginMessage("base", "init")); + { + setState(STATE_PLUGIN_INITIALIZING); + LLPluginMessage message("base", "init"); + message.setValue("user_data_path", mUserDataPath); + sendMessageToPlugin(message); + } break; case STATE_PLUGIN_INITIALIZING: @@ -310,6 +314,7 @@ void LLPluginProcessChild::receiveMessageRaw(const std::string &message) if(message_name == "load_plugin") { mPluginFile = parsed.getValue("file"); + mUserDataPath = parsed.getValue("user_data_path"); } else if(message_name == "shm_add") { diff --git a/indra/llplugin/llpluginprocesschild.h b/indra/llplugin/llpluginprocesschild.h index f5c57c3d49..1cfd9dcaf9 100644 --- a/indra/llplugin/llpluginprocesschild.h +++ b/indra/llplugin/llpluginprocesschild.h @@ -96,6 +96,8 @@ private: LLSocket::ptr_t mSocket; std::string mPluginFile; + + std::string mUserDataPath; LLPluginInstance *mInstance; diff --git a/indra/llplugin/llpluginprocessparent.cpp b/indra/llplugin/llpluginprocessparent.cpp index 332ce288d7..f60838b1e7 100644 --- a/indra/llplugin/llpluginprocessparent.cpp +++ b/indra/llplugin/llpluginprocessparent.cpp @@ -99,12 +99,13 @@ void LLPluginProcessParent::errorState(void) setState(STATE_ERROR); } -void LLPluginProcessParent::init(const std::string &launcher_filename, const std::string &plugin_filename, bool debug) +void LLPluginProcessParent::init(const std::string &launcher_filename, const std::string &plugin_filename, bool debug, const std::string &user_data_path) { mProcess.setExecutable(launcher_filename); mPluginFile = plugin_filename; mCPUUsage = 0.0f; mDebug = debug; + mUserDataPath = user_data_path; setState(STATE_INITIALIZED); } @@ -362,6 +363,7 @@ void LLPluginProcessParent::idle(void) { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "load_plugin"); message.setValue("file", mPluginFile); + message.setValue("user_data_path", mUserDataPath); sendMessage(message); } diff --git a/indra/llplugin/llpluginprocessparent.h b/indra/llplugin/llpluginprocessparent.h index 25669f5d78..6d661a6960 100644 --- a/indra/llplugin/llpluginprocessparent.h +++ b/indra/llplugin/llpluginprocessparent.h @@ -58,7 +58,7 @@ public: LLPluginProcessParent(LLPluginProcessParentOwner *owner); ~LLPluginProcessParent(); - void init(const std::string &launcher_filename, const std::string &plugin_filename, bool debug = false); + void init(const std::string &launcher_filename, const std::string &plugin_filename, bool debug, const std::string &user_data_path); void idle(void); // returns true if the plugin is on its way to steady state @@ -139,6 +139,8 @@ private: std::string mPluginFile; + std::string mUserDataPath; + LLPluginProcessParentOwner *mOwner; typedef std::map sharedMemoryRegionsType; diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 25f4c8720a..1ead310754 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -76,6 +76,8 @@ public: private: + std::string mProfileDir; + enum { INIT_STATE_UNINITIALIZED, // Browser instance hasn't been set up yet @@ -187,7 +189,6 @@ private: #else std::string component_dir = application_dir; #endif - std::string profileDir = application_dir + "/" + "browser_profile"; // cross platform? // window handle - needed on Windows and must be app window. #if LL_WINDOWS @@ -199,7 +200,7 @@ private: #endif // main browser initialization - bool result = LLQtWebKit::getInstance()->init( application_dir, component_dir, profileDir, native_window_handle ); + bool result = LLQtWebKit::getInstance()->init( application_dir, component_dir, mProfileDir, native_window_handle ); if ( result ) { // create single browser window @@ -576,7 +577,7 @@ MediaPluginWebKit::~MediaPluginWebKit() void MediaPluginWebKit::receiveMessage(const char *message_string) { -// std::cerr << "MediaPluginWebKit::receiveMessage: received message: \"" << message_string << "\"" << std::endl; + std::cerr << "MediaPluginWebKit::receiveMessage: received message: \"" << message_string << "\"" << std::endl; LLPluginMessage message_in; if(message_in.parse(message_string) >= 0) @@ -587,6 +588,9 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) { if(message_name == "init") { + std::string user_data_path = message_in.getValue("user_data_path"); // n.b. always has trailing platform-specific dir-delimiter + mProfileDir = user_data_path + "browser_profile"; + LLPluginMessage message("base", "init_response"); LLSD versions = LLSD::emptyMap(); versions[LLPLUGIN_MESSAGE_CLASS_BASE] = LLPLUGIN_MESSAGE_CLASS_BASE_VERSION; diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 952de00272..ef8f63484e 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -988,11 +988,10 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ } else { - std::string plugins_path = gDirUtilp->getLLPluginDir(); - plugins_path += gDirUtilp->getDirDelimiter(); - std::string launcher_name = gDirUtilp->getLLPluginLauncher(); std::string plugin_name = gDirUtilp->getLLPluginFilename(plugin_basename); + std::string user_data_path = gDirUtilp->getOSUserAppDir(); + user_data_path += gDirUtilp->getDirDelimiter(); // See if the plugin executable exists llstat s; @@ -1008,7 +1007,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ { LLPluginClassMedia* media_source = new LLPluginClassMedia(owner); media_source->setSize(default_width, default_height); - if (media_source->init(launcher_name, plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins"))) + if (media_source->init(launcher_name, plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins"), user_data_path)) { return media_source; } -- cgit v1.2.3 From 2af183c51d8911a7242b838394863e2606ed3fe7 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 9 Dec 2009 13:20:25 -0800 Subject: remove LL_PATH_BROWSER_PROFILE it really has no point now - it's not used by the viewer, and the webkit plugin's private space should be opaque to the viewer. --- indra/llvfs/lldir.cpp | 6 ------ indra/llvfs/lldir.h | 4 +--- indra/llvfs/lldir_linux.cpp | 9 --------- indra/llvfs/lldir_solaris.cpp | 9 --------- indra/llvfs/lldir_win32.cpp | 8 -------- 5 files changed, 1 insertion(+), 35 deletions(-) (limited to 'indra') diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp index 7d1ccf5580..b2b17fdd56 100644 --- a/indra/llvfs/lldir.cpp +++ b/indra/llvfs/lldir.cpp @@ -394,12 +394,6 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd prefix += "local_assets"; break; - case LL_PATH_BROWSER_PROFILE: - prefix = getOSUserAppDir(); - prefix += mDirDelimiter; - prefix += "browser_profile"; - break; - case LL_PATH_EXECUTABLE: prefix = getExecutableDir(); break; diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h index bf4209390f..206e3223e3 100644 --- a/indra/llvfs/lldir.h +++ b/indra/llvfs/lldir.h @@ -38,7 +38,7 @@ #define MAX_PATH MAXPATHLEN #endif -// these numbers *may* get serialized, so we need to be explicit +// these numbers *may* get serialized (really??), so we need to be explicit typedef enum ELLPath { LL_PATH_NONE = 0, @@ -54,10 +54,8 @@ typedef enum ELLPath LL_PATH_TOP_SKIN = 10, LL_PATH_CHAT_LOGS = 11, LL_PATH_PER_ACCOUNT_CHAT_LOGS = 12, - LL_PATH_BROWSER_PROFILE = 13, LL_PATH_USER_SKIN = 14, LL_PATH_LOCAL_ASSETS = 15, -// LL_PATH_HTML = 16, LL_PATH_EXECUTABLE = 16, LL_PATH_DEFAULT_SKIN = 17, LL_PATH_FONTS = 18, diff --git a/indra/llvfs/lldir_linux.cpp b/indra/llvfs/lldir_linux.cpp index 495e06e514..ee902d1de7 100644 --- a/indra/llvfs/lldir_linux.cpp +++ b/indra/llvfs/lldir_linux.cpp @@ -225,15 +225,6 @@ void LLDir_Linux::initAppDirs(const std::string &app_name, } } - res = LLFile::mkdir(getExpandedFilename(LL_PATH_BROWSER_PROFILE,"")); - if (res == -1) - { - if (errno != EEXIST) - { - llwarns << "Couldn't create LL_PATH_BROWSER_PROFILE dir " << getExpandedFilename(LL_PATH_BROWSER_PROFILE,"") << llendl; - } - } - mCAFile = getExpandedFilename(LL_PATH_APP_SETTINGS, "CA.pem"); } diff --git a/indra/llvfs/lldir_solaris.cpp b/indra/llvfs/lldir_solaris.cpp index 561c011db0..a8fad8e5bd 100644 --- a/indra/llvfs/lldir_solaris.cpp +++ b/indra/llvfs/lldir_solaris.cpp @@ -244,15 +244,6 @@ void LLDir_Solaris::initAppDirs(const std::string &app_name, } } - res = LLFile::mkdir(getExpandedFilename(LL_PATH_BROWSER_PROFILE,"")); - if (res == -1) - { - if (errno != EEXIST) - { - llwarns << "Couldn't create LL_PATH_BROWSER_PROFILE dir " << getExpandedFilename(LL_PATH_BROWSER_PROFILE,"") << llendl; - } - } - mCAFile = getExpandedFilename(LL_PATH_APP_SETTINGS, "CA.pem"); } diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp index b5754be6d6..4eb10c842b 100644 --- a/indra/llvfs/lldir_win32.cpp +++ b/indra/llvfs/lldir_win32.cpp @@ -212,14 +212,6 @@ void LLDir_Win32::initAppDirs(const std::string &app_name, } } - res = LLFile::mkdir(getExpandedFilename(LL_PATH_BROWSER_PROFILE,"")); - if (res == -1) - { - if (errno != EEXIST) - { - llwarns << "Couldn't create LL_PATH_BROWSER_PROFILE dir " << getExpandedFilename(LL_PATH_BROWSER_PROFILE,"") << llendl; - } - } res = LLFile::mkdir(getExpandedFilename(LL_PATH_USER_SKIN,"")); if (res == -1) { -- cgit v1.2.3 From 204ae550d8b70cdae29f5d4504cc35406682c336 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 9 Dec 2009 13:59:51 -0800 Subject: blindly fix-up llmediaplugintest.cpp with respect to the recent API change. --- indra/test_apps/llplugintest/llmediaplugintest.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/test_apps/llplugintest/llmediaplugintest.cpp b/indra/test_apps/llplugintest/llmediaplugintest.cpp index 27cb52a507..c6df77f9a4 100644 --- a/indra/test_apps/llplugintest/llmediaplugintest.cpp +++ b/indra/test_apps/llplugintest/llmediaplugintest.cpp @@ -1529,7 +1529,17 @@ void LLMediaPluginTest::addMediaPanel( std::string url ) #elif LL_WINDOWS std::string launcher_name( "SLPlugin.exe" ); #endif - media_source->init( launcher_name, plugin_name ); + + // for this test app, use the cwd as the user data path (ugh). + char cwd[ FILENAME_MAX ]; + if (NULL == getcwd( cwd, FILENAME_MAX - 1 )) + { + std::cerr << "Couldn't get cwd - probably too long - failing to init." << llendl; + return; + } + std::string user_data_path = std::string( cwd ) + "/"; + + media_source->init( launcher_name, plugin_name, false, user_data_path ); media_source->setDisableTimeout(mDisableTimeout); // make a new panel and save parameters -- cgit v1.2.3 From 05e0d9d24ac4ec1c0b18326e97a0c9ab705f5948 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 9 Dec 2009 14:36:45 -0800 Subject: Re-disable a very spewy debug spew in the webkit plugin. Mea culpa. --- indra/media_plugins/webkit/media_plugin_webkit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 1ead310754..276ad39dfb 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -577,7 +577,7 @@ MediaPluginWebKit::~MediaPluginWebKit() void MediaPluginWebKit::receiveMessage(const char *message_string) { - std::cerr << "MediaPluginWebKit::receiveMessage: received message: \"" << message_string << "\"" << std::endl; +// std::cerr << "MediaPluginWebKit::receiveMessage: received message: \"" << message_string << "\"" << std::endl; LLPluginMessage message_in; if(message_in.parse(message_string) >= 0) -- cgit v1.2.3