Webkit plugin updates

Updated the webkit plugin with the latest features
Fixed SSL support in webkit
Other minor cleanup
This commit is contained in:
Drake Arconis
2012-07-06 11:35:07 +00:00
parent b40a9c7a06
commit 525e9d9a8e
21 changed files with 399 additions and 90 deletions

View File

@@ -52,15 +52,16 @@ LLPluginClassBasic::~LLPluginClassBasic()
delete mPlugin;
}
bool LLPluginClassBasic::init(std::string const& launcher_filename, std::string const& plugin_filename, bool debug)
bool LLPluginClassBasic::init(std::string const& launcher_filename, std::string const& plugin_dir, std::string const& plugin_filename, bool debug)
{
LL_DEBUGS("Plugin") << "launcher: " << launcher_filename << LL_ENDL;
LL_DEBUGS("Plugin") << "dir: " << plugin_dir << LL_ENDL;
LL_DEBUGS("Plugin") << "plugin: " << plugin_filename << LL_ENDL;
mPlugin = new LLPluginProcessParent(this);
mPlugin->setSleepTime(mSleepTime);
mPlugin->init(launcher_filename, plugin_filename, debug);
mPlugin->init(launcher_filename, plugin_dir, plugin_filename, debug);
return init_impl();
}

View File

@@ -53,7 +53,10 @@ public:
virtual ~LLPluginClassBasic();
// Local initialization, called when creating a plugin process. Return true if successful.
bool init(std::string const& launcher_filename, std::string const& plugin_filename, bool debug);
bool init(std::string const& launcher_filename,
std::string const& plugin_dir,
std::string const& plugin_filename,
bool debug);
// Undoes everything init did. Called when destroying a plugin process.
void reset(void);

View File

@@ -484,6 +484,7 @@ void LLPluginClassMedia::jsAgentMaturityEvent( const std::string& maturity )
message.setValue( "maturity", maturity );
sendMessage( message );
}
void LLPluginClassMedia::mouseEvent(EMouseEventType type, int button, int x, int y, MASK modifiers)
{
if(type == MOUSE_EVENT_MOVE)
@@ -573,7 +574,15 @@ bool LLPluginClassMedia::keyEvent(EKeyEventType type, int key_code, MASK modifie
}
break;
}
#if LL_DARWIN
if(modifiers & MASK_ALT)
{
// Option-key modified characters should be handled by the unicode input path instead of this one.
result = false;
}
#endif
if(result)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "key_event");
@@ -731,6 +740,14 @@ void LLPluginClassMedia::setJavascriptEnabled(const bool enabled)
sendMessage(message);
}
void LLPluginClassMedia::enableMediaPluginDebugging( bool enable )
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "enable_media_plugin_debugging");
message.setValueBoolean( "enable", enable );
sendMessage( message );
}
void LLPluginClassMedia::setTarget(const std::string &target)
{
mTarget = target;
@@ -795,7 +812,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
mDirtyRect.unionWith(newDirtyRect);
}
LL_DEBUGS("PluginUpdated") << "adjusted incoming rect is: ("
LL_DEBUGS("PluginUpdated") << "adjusted incoming rect is: ("
<< newDirtyRect.mLeft << ", "
<< newDirtyRect.mTop << ", "
<< newDirtyRect.mRight << ", "
@@ -958,6 +975,12 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
mAuthURL = message.getValue("url");
mAuthRealm = message.getValue("realm");
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_AUTH_REQUEST);
}
else if(message_name == "debug_message")
{
mDebugMessageText = message.getValue("message_text");
mDebugMessageLevel = message.getValue("message_level");
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_DEBUG_MESSAGE);
}
else
{
@@ -1103,6 +1126,14 @@ void LLPluginClassMedia::focus(bool focused)
sendMessage(message);
}
void LLPluginClassMedia::set_page_zoom_factor( double factor )
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "set_page_zoom_factor");
message.setValueReal("factor", factor);
sendMessage(message);
}
void LLPluginClassMedia::clear_cache()
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "clear_cache");
@@ -1186,6 +1217,13 @@ void LLPluginClassMedia::setBrowserUserAgent(const std::string& user_agent)
sendMessage(message);
}
void LLPluginClassMedia::showWebInspector( bool show )
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "show_web_inspector");
message.setValueBoolean("show", true); // only open for now - closed manually by user
sendMessage(message);
}
void LLPluginClassMedia::proxyWindowOpened(const std::string &target, const std::string &uuid)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "proxy_window_opened");

View File

@@ -112,6 +112,9 @@ public:
void scrollEvent(int x, int y, MASK modifiers);
// enable/disable media plugin debugging messages and info spam
void enableMediaPluginDebugging( bool enable );
// Javascript <-> viewer events
void jsEnableObject( bool enable );
void jsAgentLocationEvent( double x, double y, double z );
@@ -167,6 +170,7 @@ public:
bool pluginSupportsMediaBrowser(void);
void focus(bool focused);
void set_page_zoom_factor( double factor );
void clear_cache();
void clear_cookies();
void set_cookies(const std::string &cookies);
@@ -178,6 +182,7 @@ public:
void browse_back();
void set_status_redirect(int code, const std::string &url);
void setBrowserUserAgent(const std::string& user_agent);
void showWebInspector( bool show );
void proxyWindowOpened(const std::string &target, const std::string &uuid);
void proxyWindowClosed(const std::string &uuid);
void ignore_ssl_cert_errors(bool ignore);
@@ -213,6 +218,10 @@ public:
// This is valid during MEDIA_EVENT_CLICK_LINK_HREF and MEDIA_EVENT_GEOMETRY_CHANGE
std::string getClickUUID() const { return mClickUUID; };
// These are valid during MEDIA_EVENT_DEBUG_MESSAGE
std::string getDebugMessageText() const { return mDebugMessageText; };
std::string getDebugMessageLevel() const { return mDebugMessageLevel; };
// This is valid after MEDIA_EVENT_NAVIGATE_ERROR_PAGE
S32 getStatusCode() const { return mStatusCode; };
@@ -271,7 +280,7 @@ protected:
protected:
LLPluginClassMediaOwner *mOwner;
bool mTextureParamsReceived; // the mRequestedTexture* fields are only valid when this is true
S32 mRequestedTextureDepth;
LLGLenum mRequestedTextureInternalFormat;
@@ -358,6 +367,8 @@ protected:
std::string mClickNavType;
std::string mClickTarget;
std::string mClickUUID;
std::string mDebugMessageText;
std::string mDebugMessageLevel;
S32 mGeometryX;
S32 mGeometryY;
S32 mGeometryWidth;

View File

@@ -71,6 +71,8 @@ public:
MEDIA_EVENT_AUTH_REQUEST, // The plugin wants to display an auth dialog
MEDIA_EVENT_DEBUG_MESSAGE, // plugin sending back debug information for host to process
MEDIA_EVENT_LINK_HOVERED // Got a "link hovered" event from the plugin
} EMediaEvent;

View File

@@ -40,8 +40,13 @@
#include "linden_common.h"
#include "llplugininstance.h"
#include "llaprpool.h"
#if LL_WINDOWS
#include "direct.h" // needed for _chdir()
#endif
/** Virtual destructor. */
LLPluginInstanceMessageListener::~LLPluginInstanceMessageListener()
{
@@ -83,10 +88,24 @@ LLPluginInstance::~LLPluginInstance()
* @param[in] plugin_file Name of plugin dll/dylib/so. TODO:DOC is this correct? see .h
* @return 0 if successful, APR error code or error code from the plugin's init function on failure.
*/
int LLPluginInstance::load(std::string &plugin_file)
int LLPluginInstance::load(const std::string& plugin_dir, std::string &plugin_file)
{
pluginInitFunction init_function = NULL;
if ( plugin_dir.length() )
{
#if LL_WINDOWS
// VWR-21275:
// *SOME* Windows systems fail to load the Qt plugins if the current working
// directory is not the same as the directory with the Qt DLLs in.
// This should not cause any run time issues since we are changing the cwd for the
// plugin shell process and not the viewer.
// Changing back to the previous directory is not necessary since the plugin shell
// quits once the plugin exits.
_chdir( plugin_dir.c_str() );
#endif
};
#if LL_LINUX && defined(LL_STANDALONE)
void *dso_handle = dlopen(plugin_file.c_str(), RTLD_NOW | RTLD_GLOBAL);
int result = (!dso_handle)?APR_EDSOOPEN:apr_os_dso_handle_put(&mDSOHandle,

View File

@@ -64,7 +64,7 @@ public:
// Load a plugin dll/dylib/so
// Returns 0 if successful, APR error code or error code returned from the plugin's init function on failure.
int load(std::string &plugin_file);
int load(const std::string& plugin_dir, std::string &plugin_file);
// Sends a message to the plugin.
void sendMessage(const std::string &message);

View File

@@ -146,7 +146,7 @@ void LLPluginProcessChild::idle(void)
if(!mPluginFile.empty())
{
mInstance = new LLPluginInstance(this);
if(mInstance->load(mPluginFile) == 0)
if(mInstance->load(mPluginDir, mPluginFile) == 0)
{
mHeartbeat.start();
mHeartbeat.setTimerExpirySec(HEARTBEAT_SECONDS);
@@ -372,6 +372,7 @@ void LLPluginProcessChild::receiveMessageRaw(const std::string &message)
if(message_name == "load_plugin")
{
mPluginFile = parsed.getValue("file");
mPluginDir = parsed.getValue("dir");
}
else if(message_name == "shm_add")
{

View File

@@ -101,6 +101,7 @@ private:
LLSocket::ptr_t mSocket;
std::string mPluginFile;
std::string mPluginDir;
LLPluginInstance *mInstance;

View File

@@ -114,7 +114,6 @@ LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner)
// Don't start the timer here -- start it when we actually launch the plugin process.
mHeartbeat.stop();
// Don't add to the global list until fully constructed.
{
@@ -173,10 +172,12 @@ 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_dir, const std::string &plugin_filename, bool debug)
{
mProcess.setExecutable(launcher_filename);
mProcess.setWorkingDirectory(plugin_dir);
mPluginFile = plugin_filename;
mPluginDir = plugin_dir;
mCPUUsage = 0.0f;
mDebug = debug;
setState(STATE_INITIALIZED);
@@ -483,6 +484,7 @@ void LLPluginProcessParent::idle(void)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "load_plugin");
message.setValue("file", mPluginFile);
message.setValue("dir", mPluginDir);
sendMessage(message);
}

View File

@@ -67,6 +67,7 @@ public:
~LLPluginProcessParent();
void init(const std::string &launcher_filename,
const std::string &plugin_dir,
const std::string &plugin_filename,
bool debug);
@@ -166,12 +167,13 @@ private:
LLProcessLauncher mProcess;
std::string mPluginFile;
std::string mPluginDir;
LLPluginProcessParentOwner *mOwner;
typedef std::map<std::string, LLPluginSharedMemory*> sharedMemoryRegionsType;
sharedMemoryRegionsType mSharedMemoryRegions;
LLSD mMessageClassVersions;
std::string mPluginVersionString;
@@ -194,7 +196,7 @@ private:
apr_pollfd_t mPollFD;
LLAPRPool mPollFDPool;
static apr_pollset_t *sPollSet;
static LLAPRPool sPollSetPool;
static LLAPRPool sPollSetPool;
static bool sPollsetNeedsRebuild;
static LLMutex *sInstancesMutex;
static std::list<LLPluginProcessParent*> sInstances;