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; 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") << "launcher: " << launcher_filename << LL_ENDL;
LL_DEBUGS("Plugin") << "dir: " << plugin_dir << LL_ENDL;
LL_DEBUGS("Plugin") << "plugin: " << plugin_filename << LL_ENDL; LL_DEBUGS("Plugin") << "plugin: " << plugin_filename << LL_ENDL;
mPlugin = new LLPluginProcessParent(this); mPlugin = new LLPluginProcessParent(this);
mPlugin->setSleepTime(mSleepTime); mPlugin->setSleepTime(mSleepTime);
mPlugin->init(launcher_filename, plugin_filename, debug); mPlugin->init(launcher_filename, plugin_dir, plugin_filename, debug);
return init_impl(); return init_impl();
} }

View File

@@ -53,7 +53,10 @@ public:
virtual ~LLPluginClassBasic(); virtual ~LLPluginClassBasic();
// Local initialization, called when creating a plugin process. Return true if successful. // 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. // Undoes everything init did. Called when destroying a plugin process.
void reset(void); void reset(void);

View File

@@ -484,6 +484,7 @@ void LLPluginClassMedia::jsAgentMaturityEvent( const std::string& maturity )
message.setValue( "maturity", maturity ); message.setValue( "maturity", maturity );
sendMessage( message ); sendMessage( message );
} }
void LLPluginClassMedia::mouseEvent(EMouseEventType type, int button, int x, int y, MASK modifiers) void LLPluginClassMedia::mouseEvent(EMouseEventType type, int button, int x, int y, MASK modifiers)
{ {
if(type == MOUSE_EVENT_MOVE) if(type == MOUSE_EVENT_MOVE)
@@ -574,6 +575,14 @@ bool LLPluginClassMedia::keyEvent(EKeyEventType type, int key_code, MASK modifie
break; 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) if(result)
{ {
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "key_event"); LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "key_event");
@@ -731,6 +740,14 @@ void LLPluginClassMedia::setJavascriptEnabled(const bool enabled)
sendMessage(message); 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) void LLPluginClassMedia::setTarget(const std::string &target)
{ {
mTarget = target; mTarget = target;
@@ -959,6 +976,12 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
mAuthRealm = message.getValue("realm"); mAuthRealm = message.getValue("realm");
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_AUTH_REQUEST); 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 else
{ {
LL_WARNS("Plugin") << "Unknown " << message_name << " class message: " << message_name << LL_ENDL; LL_WARNS("Plugin") << "Unknown " << message_name << " class message: " << message_name << LL_ENDL;
@@ -1103,6 +1126,14 @@ void LLPluginClassMedia::focus(bool focused)
sendMessage(message); 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() void LLPluginClassMedia::clear_cache()
{ {
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "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); 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) void LLPluginClassMedia::proxyWindowOpened(const std::string &target, const std::string &uuid)
{ {
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "proxy_window_opened"); 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); void scrollEvent(int x, int y, MASK modifiers);
// enable/disable media plugin debugging messages and info spam
void enableMediaPluginDebugging( bool enable );
// Javascript <-> viewer events // Javascript <-> viewer events
void jsEnableObject( bool enable ); void jsEnableObject( bool enable );
void jsAgentLocationEvent( double x, double y, double z ); void jsAgentLocationEvent( double x, double y, double z );
@@ -167,6 +170,7 @@ public:
bool pluginSupportsMediaBrowser(void); bool pluginSupportsMediaBrowser(void);
void focus(bool focused); void focus(bool focused);
void set_page_zoom_factor( double factor );
void clear_cache(); void clear_cache();
void clear_cookies(); void clear_cookies();
void set_cookies(const std::string &cookies); void set_cookies(const std::string &cookies);
@@ -178,6 +182,7 @@ public:
void browse_back(); void browse_back();
void set_status_redirect(int code, const std::string &url); void set_status_redirect(int code, const std::string &url);
void setBrowserUserAgent(const std::string& user_agent); void setBrowserUserAgent(const std::string& user_agent);
void showWebInspector( bool show );
void proxyWindowOpened(const std::string &target, const std::string &uuid); void proxyWindowOpened(const std::string &target, const std::string &uuid);
void proxyWindowClosed(const std::string &uuid); void proxyWindowClosed(const std::string &uuid);
void ignore_ssl_cert_errors(bool ignore); 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 // This is valid during MEDIA_EVENT_CLICK_LINK_HREF and MEDIA_EVENT_GEOMETRY_CHANGE
std::string getClickUUID() const { return mClickUUID; }; 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 // This is valid after MEDIA_EVENT_NAVIGATE_ERROR_PAGE
S32 getStatusCode() const { return mStatusCode; }; S32 getStatusCode() const { return mStatusCode; };
@@ -358,6 +367,8 @@ protected:
std::string mClickNavType; std::string mClickNavType;
std::string mClickTarget; std::string mClickTarget;
std::string mClickUUID; std::string mClickUUID;
std::string mDebugMessageText;
std::string mDebugMessageLevel;
S32 mGeometryX; S32 mGeometryX;
S32 mGeometryY; S32 mGeometryY;
S32 mGeometryWidth; S32 mGeometryWidth;

View File

@@ -71,6 +71,8 @@ public:
MEDIA_EVENT_AUTH_REQUEST, // The plugin wants to display an auth dialog 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 MEDIA_EVENT_LINK_HOVERED // Got a "link hovered" event from the plugin
} EMediaEvent; } EMediaEvent;

View File

@@ -40,8 +40,13 @@
#include "linden_common.h" #include "linden_common.h"
#include "llplugininstance.h" #include "llplugininstance.h"
#include "llaprpool.h" #include "llaprpool.h"
#if LL_WINDOWS
#include "direct.h" // needed for _chdir()
#endif
/** Virtual destructor. */ /** Virtual destructor. */
LLPluginInstanceMessageListener::~LLPluginInstanceMessageListener() 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 * @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. * @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; 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) #if LL_LINUX && defined(LL_STANDALONE)
void *dso_handle = dlopen(plugin_file.c_str(), RTLD_NOW | RTLD_GLOBAL); void *dso_handle = dlopen(plugin_file.c_str(), RTLD_NOW | RTLD_GLOBAL);
int result = (!dso_handle)?APR_EDSOOPEN:apr_os_dso_handle_put(&mDSOHandle, 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 // 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. // 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. // Sends a message to the plugin.
void sendMessage(const std::string &message); void sendMessage(const std::string &message);

View File

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

View File

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

View File

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

View File

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

View File

@@ -2189,38 +2189,16 @@
<key>Value</key> <key>Value</key>
<string>http://www.singularityviewer.org</string> <string>http://www.singularityviewer.org</string>
</map> </map>
<key>BrowserCookiesEnabled</key> <key>BrowserIgnoreSSLCertErrors</key>
<map> <map>
<key>Comment</key> <key>Comment</key>
<string>Enable Cookes in WebKit</string> <string>FOR TESTING ONLY: Tell the built-in web browser to ignore SSL cert errors.</string>
<key>Persist</key> <key>Persist</key>
<integer>1</integer> <integer>1</integer>
<key>Type</key> <key>Type</key>
<string>Boolean</string> <string>Boolean</string>
<key>Value</key> <key>Value</key>
<integer>1</integer> <integer>0</integer>
</map>
<key>BrowserPluginsEnabled</key>
<map>
<key>Comment</key>
<string>Enable Mozilla Plug-Ins in WebKit</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>BrowserJavascriptEnabled</key>
<map>
<key>Comment</key>
<string>Enable JavaScript execution in WebKit</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map> </map>
<key>PluginAttachDebuggerToPlugins</key> <key>PluginAttachDebuggerToPlugins</key>
<map> <map>
@@ -3927,6 +3905,28 @@
<key>Value</key> <key>Value</key>
<integer>1</integer> <integer>1</integer>
</map> </map>
<key>BrowserJavascriptEnabled</key>
<map>
<key>Comment</key>
<string>Enable Javascript in the built-in Web browser?</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>BrowserPluginsEnabled</key>
<map>
<key>Comment</key>
<string>Enable Web plugins in the built-in Web browser?</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>CreateToolCopyCenters</key> <key>CreateToolCopyCenters</key>
<map> <map>
<key>Comment</key> <key>Comment</key>
@@ -8196,6 +8196,17 @@
<key>Value</key> <key>Value</key>
<integer>0</integer> <integer>0</integer>
</map> </map>
<key>MediaPluginDebugging</key>
<map>
<key>Comment</key>
<string>Turn on debugging messages that may help diagnosing media issues (WARNING: May reduce performance).</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>MediaControlFadeTime</key> <key>MediaControlFadeTime</key>
<map> <map>
<key>Comment</key> <key>Comment</key>
@@ -8260,7 +8271,7 @@
<key>Type</key> <key>Type</key>
<string>Boolean</string> <string>Boolean</string>
<key>Value</key> <key>Value</key>
<integer>0</integer> <integer>0</integer>
</map> </map>
<key>MemoryPrivatePoolSize</key> <key>MemoryPrivatePoolSize</key>
<map> <map>

View File

@@ -345,6 +345,10 @@ BOOL LLMediaCtrl::postBuild ()
return true; return true;
} }
void LLMediaCtrl::onOpenWebInspector()
if (mMediaSource && mMediaSource->hasMedia())
mMediaSource->getMediaPlugin()->showWebInspector( true );
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
BOOL LLMediaCtrl::handleKeyHere( KEY key, MASK mask ) BOOL LLMediaCtrl::handleKeyHere( KEY key, MASK mask )
@@ -947,6 +951,12 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
}; };
break; break;
case MEDIA_EVENT_NAVIGATE_ERROR_PAGE:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_ERROR_PAGE" << LL_ENDL;
};
break;
case MEDIA_EVENT_CLICK_LINK_HREF: case MEDIA_EVENT_CLICK_LINK_HREF:
{ {
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << self->getClickTarget() << "\", uri is " << self->getClickURL() << LL_ENDL; LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << self->getClickTarget() << "\", uri is " << self->getClickURL() << LL_ENDL;
@@ -979,12 +989,6 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
}; };
break; break;
case MEDIA_EVENT_NAVIGATE_ERROR_PAGE:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_ERROR_PAGE" << LL_ENDL;
};
break;
case MEDIA_EVENT_CLOSE_REQUEST: case MEDIA_EVENT_CLOSE_REQUEST:
{ {
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLOSE_REQUEST" << LL_ENDL; LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLOSE_REQUEST" << LL_ENDL;
@@ -1015,6 +1019,12 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
}; };
break; break;
case MEDIA_EVENT_DEBUG_MESSAGE:
{
LL_INFOS("media") << self->getDebugMessageText() << LL_ENDL;
};
break;
default: default:
{ {
LL_WARNS("Media") << "Media event: unknown event type" << LL_ENDL; LL_WARNS("Media") << "Media event: unknown event type" << LL_ENDL;

View File

@@ -144,8 +144,12 @@ class LLMediaCtrl :
// handlers for individual events (could be done inside the switch in handleMediaEvent, they're just individual functions for clarity) // handlers for individual events (could be done inside the switch in handleMediaEvent, they're just individual functions for clarity)
void onClickLinkHref( LLPluginClassMedia* self ); void onClickLinkHref( LLPluginClassMedia* self );
void onClickLinkNoFollow( LLPluginClassMedia* self ); void onClickLinkNoFollow( LLPluginClassMedia* self );
// right click debugging item
void onOpenWebInspector();
protected: protected:
void convertInputCoords(S32& x, S32& y); void convertInputCoords(S32& x, S32& y);

View File

@@ -34,6 +34,7 @@
#include "llviewerprecompiledheaders.h" #include "llviewerprecompiledheaders.h"
#include "llmimetypes.h" #include "llmimetypes.h"
#include "lltrans.h"
#include "lluictrlfactory.h" #include "lluictrlfactory.h"
@@ -48,6 +49,7 @@ std::string sDefaultImpl;
// Returned when we don't know what impl to use // Returned when we don't know what impl to use
std::string sXMLFilename; std::string sXMLFilename;
// Squirrel away XML filename so we know how to reset // Squirrel away XML filename so we know how to reset
std::string DEFAULT_MIME_TYPE = "none/none";
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -229,7 +231,7 @@ std::string LLMIMETypes::findIcon(const std::string& mime_type)
// static // static
std::string LLMIMETypes::findDefaultMimeType(const std::string& widget_type) std::string LLMIMETypes::findDefaultMimeType(const std::string& widget_type)
{ {
std::string mime_type = "none/none"; std::string mime_type = getDefaultMimeType();
mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type); mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type);
if(it != sWidgetMap.end()) if(it != sWidgetMap.end())
{ {
@@ -238,6 +240,18 @@ std::string LLMIMETypes::findDefaultMimeType(const std::string& widget_type)
return mime_type; return mime_type;
} }
// static
const std::string& LLMIMETypes::getDefaultMimeType()
{
return DEFAULT_MIME_TYPE;
}
const std::string& LLMIMETypes::getDefaultMimeTypeTranslation()
{
static std::string mime_type = LLTrans::getString("DefaultMimeType");
return mime_type;
}
// static // static
std::string LLMIMETypes::findToolTip(const std::string& mime_type) std::string LLMIMETypes::findToolTip(const std::string& mime_type)
{ {

View File

@@ -66,6 +66,10 @@ public:
static std::string findDefaultMimeType(const std::string& widget_type); static std::string findDefaultMimeType(const std::string& widget_type);
// Canonical mime type associated with this widget set // Canonical mime type associated with this widget set
static const std::string& getDefaultMimeType();
static const std::string& getDefaultMimeTypeTranslation();
static bool findAllowResize(const std::string& mime_type); static bool findAllowResize(const std::string& mime_type);
// accessor for flag to enable/disable media size edit fields // accessor for flag to enable/disable media size edit fields

View File

@@ -411,7 +411,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
media_source->setLanguageCode(LLUI::getLanguage()); media_source->setLanguageCode(LLUI::getLanguage());
// collect 'cookies enabled' setting from prefs and send to embedded browser // collect 'cookies enabled' setting from prefs and send to embedded browser
bool cookies_enabled = gSavedSettings.getBOOL( "BrowserCookiesEnabled" ); bool cookies_enabled = gSavedSettings.getBOOL( "CookiesEnabled" );
media_source->enable_cookies( cookies_enabled ); media_source->enable_cookies( cookies_enabled );
// collect 'plugins enabled' setting from prefs and send to embedded browser // collect 'plugins enabled' setting from prefs and send to embedded browser
@@ -422,7 +422,11 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
bool javascript_enabled = gSavedSettings.getBOOL( "BrowserJavascriptEnabled" ); bool javascript_enabled = gSavedSettings.getBOOL( "BrowserJavascriptEnabled" );
media_source->setJavascriptEnabled( javascript_enabled ); media_source->setJavascriptEnabled( javascript_enabled );
if (media_source->init(launcher_name, plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins"))) bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging");
media_source->enableMediaPluginDebugging( media_plugin_debugging_enabled );
const std::string plugin_dir = gDirUtilp->getLLPluginDir();
if (media_source->init(launcher_name, plugin_dir, plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")))
{ {
return media_source; return media_source;
} }
@@ -434,7 +438,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
} }
} }
LL_WARNS("Plugin") << "plugin intialization failed for mime type: " << media_type << LL_ENDL; LL_WARNS_ONCE("Plugin") << "plugin initialization failed for mime type: " << media_type << LL_ENDL;
LLSD args; LLSD args;
args["MIME_TYPE"] = media_type; args["MIME_TYPE"] = media_type;
LLNotificationsUtil::add("NoPlugin", args); LLNotificationsUtil::add("NoPlugin", args);
@@ -468,7 +472,35 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type)
media_source->setAutoScale(mMediaAutoScale); media_source->setAutoScale(mMediaAutoScale);
media_source->setBrowserUserAgent(LLViewerMedia::getCurrentUserAgent()); media_source->setBrowserUserAgent(LLViewerMedia::getCurrentUserAgent());
if(gSavedSettings.getBOOL("BrowserIgnoreSSLCertErrors"))
{
media_source->ignore_ssl_cert_errors(true);
}
// start by assuming the default CA file will be used
std::string ca_path = gDirUtilp->getExpandedFilename( LL_PATH_APP_SETTINGS, "CA.pem" );
// default turned off so pick up the user specified path
if( ! gSavedSettings.getBOOL("BrowserUseDefaultCAFile"))
{
ca_path = gSavedSettings.getString("BrowserCAFilePath");
}
// set the path to the CA.pem file
media_source->addCertificateFilePath( ca_path );
// TODO: Only send cookies to plugins that need them
// Ideally, the plugin should tell us whether it handles cookies or not -- either via the init response or through a separate message.
// Due to the ordering of messages, it's possible we wouldn't get that information back in time to send cookies before sending a navigate message,
// which could cause odd race conditions.
std::string all_cookies = LLViewerMedia::getCookieStore()->getAllCookies();
lldebugs << "setting cookies: " << all_cookies << llendl;
if(!all_cookies.empty())
{
media_source->set_cookies(all_cookies);
}
mPluginBase = media_source; mPluginBase = media_source;
return true; return true;
} }

View File

@@ -34,6 +34,8 @@
#include "llviewerparcelmedia.h" #include "llviewerparcelmedia.h"
#include "llagent.h" #include "llagent.h"
#include "llaudioengine.h"
#include "llmimetypes.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llviewermedia.h" #include "llviewermedia.h"
#include "llviewerregion.h" #include "llviewerregion.h"
@@ -323,12 +325,14 @@ LLViewerMediaImpl::EMediaStatus LLViewerParcelMedia::getStatus()
// static // static
std::string LLViewerParcelMedia::getMimeType() std::string LLViewerParcelMedia::getMimeType()
{ {
return sMediaImpl.notNull() ? sMediaImpl->getMimeType() : "none/none"; return sMediaImpl.notNull() ? sMediaImpl->getMimeType() : LLMIMETypes::getDefaultMimeType();
} }
viewer_media_t LLViewerParcelMedia::getParcelMedia() viewer_media_t LLViewerParcelMedia::getParcelMedia()
{ {
return sMediaImpl; return sMediaImpl;
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// static // static
void LLViewerParcelMedia::processParcelMediaCommandMessage( LLMessageSystem *msg, void ** ) void LLViewerParcelMedia::processParcelMediaCommandMessage( LLMessageSystem *msg, void ** )
@@ -478,6 +482,12 @@ void LLViewerParcelMedia::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent
{ {
switch(event) switch(event)
{ {
case MEDIA_EVENT_DEBUG_MESSAGE:
{
// LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_DEBUG_MESSAGE " << LL_ENDL;
};
break;
case MEDIA_EVENT_CONTENT_UPDATED: case MEDIA_EVENT_CONTENT_UPDATED:
{ {
// LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CONTENT_UPDATED " << LL_ENDL; // LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CONTENT_UPDATED " << LL_ENDL;
@@ -532,6 +542,12 @@ void LLViewerParcelMedia::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent
}; };
break; break;
case MEDIA_EVENT_NAVIGATE_ERROR_PAGE:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_ERROR_PAGE" << LL_ENDL;
};
break;
case MEDIA_EVENT_CLICK_LINK_HREF: case MEDIA_EVENT_CLICK_LINK_HREF:
{ {
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << self->getClickTarget() << "\", uri is " << self->getClickURL() << LL_ENDL; LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << self->getClickTarget() << "\", uri is " << self->getClickURL() << LL_ENDL;
@@ -562,12 +578,6 @@ void LLViewerParcelMedia::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent
}; };
break; break;
case MEDIA_EVENT_NAVIGATE_ERROR_PAGE:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_ERROR_PAGE" << LL_ENDL;
};
break;
case MEDIA_EVENT_CLOSE_REQUEST: case MEDIA_EVENT_CLOSE_REQUEST:
{ {
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLOSE_REQUEST" << LL_ENDL; LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLOSE_REQUEST" << LL_ENDL;
@@ -582,7 +592,7 @@ void LLViewerParcelMedia::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent
case MEDIA_EVENT_GEOMETRY_CHANGE: case MEDIA_EVENT_GEOMETRY_CHANGE:
{ {
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_GEOMETRY_CHANGE" << LL_ENDL; LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_GEOMETRY_CHANGE" << LL_ENDL;
}; };
break; break;

View File

@@ -78,6 +78,7 @@ LLPluginClassBasic* LLViewerPluginManager::createPlugin(T* user_data)
// Always delete the old plugin first. // Always delete the old plugin first.
destroyPlugin(); destroyPlugin();
std::string plugin_dir = gDirUtilp->getLLPluginDir();
std::string plugin_name = gDirUtilp->getLLPluginFilename(PLUGIN_TYPE::plugin_basename()); std::string plugin_name = gDirUtilp->getLLPluginFilename(PLUGIN_TYPE::plugin_basename());
// See if the plugin executable exists. // See if the plugin executable exists.
@@ -93,7 +94,7 @@ LLPluginClassBasic* LLViewerPluginManager::createPlugin(T* user_data)
else else
{ {
LLPluginClassBasic* plugin = new PLUGIN_TYPE(user_data); LLPluginClassBasic* plugin = new PLUGIN_TYPE(user_data);
if (plugin->init(PLUGIN_TYPE::launcher_name(), plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins"))) if (plugin->init(PLUGIN_TYPE::launcher_name(), plugin_dir, plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")))
{ {
mPluginBase = plugin; mPluginBase = plugin;
} }

View File

@@ -1956,6 +1956,8 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
<string name="Chat">Chat</string> <string name="Chat">Chat</string>
<string name="DefaultMimeType">none/none</string>
<!-- External editor status codes --> <!-- External editor status codes -->
<string name="ExternalEditorNotSet">Select an editor using the ExternalEditor setting.</string> <string name="ExternalEditorNotSet">Select an editor using the ExternalEditor setting.</string>
<string name="ExternalEditorNotFound">Cannot find the external editor you specified. <string name="ExternalEditorNotFound">Cannot find the external editor you specified.

159
indra/plugins/webkit/media_plugin_webkit.cpp Executable file → Normal file
View File

@@ -90,6 +90,7 @@ private:
bool mCookiesEnabled; bool mCookiesEnabled;
bool mJavascriptEnabled; bool mJavascriptEnabled;
bool mPluginsEnabled; bool mPluginsEnabled;
bool mEnableMediaPluginDebugging;
enum enum
{ {
@@ -116,9 +117,24 @@ private:
F32 mBackgroundG; F32 mBackgroundG;
F32 mBackgroundB; F32 mBackgroundB;
std::string mTarget; std::string mTarget;
LLTimer mElapsedTime;
VolumeCatcher mVolumeCatcher; VolumeCatcher mVolumeCatcher;
void postDebugMessage( const std::string& msg )
{
if ( mEnableMediaPluginDebugging )
{
std::stringstream str;
str << "@Media Msg> " << "[" << (double)mElapsedTime.getElapsedTimeF32() << "] -- " << msg;
LLPluginMessage debug_message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "debug_message");
debug_message.setValue("message_text", str.str());
debug_message.setValue("message_level", "info");
sendMessage(debug_message);
}
}
void setInitState(int state) void setInitState(int state)
{ {
// std::cerr << "changing init state to " << state << std::endl; // std::cerr << "changing init state to " << state << std::endl;
@@ -228,7 +244,7 @@ private:
#endif #endif
#if LL_WINDOWS #if LL_WINDOWS
// *NOTE:Mani - On windows, at least, the component path is the //*NOTE:Mani - On windows, at least, the component path is the
// location of this dll's image file. // location of this dll's image file.
std::string component_dir; std::string component_dir;
char dll_path[_MAX_PATH]; char dll_path[_MAX_PATH];
@@ -252,6 +268,9 @@ private:
std::string component_dir = application_dir; std::string component_dir = application_dir;
#endif #endif
// debug spam sent to viewer and displayed in the log as usual
postDebugMessage( "Component dir set to: " + component_dir );
// window handle - needed on Windows and must be app window. // window handle - needed on Windows and must be app window.
#if LL_WINDOWS #if LL_WINDOWS
char window_title[ MAX_PATH ]; char window_title[ MAX_PATH ];
@@ -267,9 +286,15 @@ private:
{ {
mInitState = INIT_STATE_INITIALIZED; mInitState = INIT_STATE_INITIALIZED;
// debug spam sent to viewer and displayed in the log as usual
postDebugMessage( "browser initialized okay" );
return true; return true;
}; };
// debug spam sent to viewer and displayed in the log as usual
postDebugMessage( "browser nOT initialized." );
return false; return false;
}; };
@@ -292,6 +317,7 @@ private:
if(!mHostLanguage.empty()) if(!mHostLanguage.empty())
{ {
LLQtWebKit::getInstance()->setHostLanguage(mHostLanguage); LLQtWebKit::getInstance()->setHostLanguage(mHostLanguage);
postDebugMessage( "Setting language to " + mHostLanguage );
} }
// turn on/off cookies based on what host app tells us // turn on/off cookies based on what host app tells us
@@ -307,8 +333,17 @@ private:
LLQtWebKit::getInstance()->enableJavascript( mJavascriptEnabled ); LLQtWebKit::getInstance()->enableJavascript( mJavascriptEnabled );
#endif #endif
std::stringstream str;
str << "Cookies enabled = " << mCookiesEnabled << ", plugins enabled = " << mPluginsEnabled << ", Javascript enabled = " << mJavascriptEnabled;
postDebugMessage( str.str() );
// create single browser window // create single browser window
mBrowserWindowId = LLQtWebKit::getInstance()->createBrowserWindow(mWidth, mHeight, mTarget); mBrowserWindowId = LLQtWebKit::getInstance()->createBrowserWindow( mWidth, mHeight, mTarget);
str.str("");
str.clear();
str << "Setting browser window size to " << mWidth << " x " << mHeight;
postDebugMessage( str.str() );
// tell LLQtWebKit about the size of the browser window // tell LLQtWebKit about the size of the browser window
LLQtWebKit::getInstance()->setSize( mBrowserWindowId, mWidth, mHeight ); LLQtWebKit::getInstance()->setSize( mBrowserWindowId, mWidth, mHeight );
@@ -318,6 +353,7 @@ private:
// append details to agent string // append details to agent string
LLQtWebKit::getInstance()->setBrowserAgentId( mUserAgent ); LLQtWebKit::getInstance()->setBrowserAgentId( mUserAgent );
postDebugMessage( "Updating user agent with " + mUserAgent );
#if !LL_QTWEBKIT_USES_PIXMAPS #if !LL_QTWEBKIT_USES_PIXMAPS
// don't flip bitmap // don't flip bitmap
@@ -345,7 +381,17 @@ private:
url << std::setfill('0') << std::setw(2) << std::hex << int(mBackgroundB * 255.0f); url << std::setfill('0') << std::setw(2) << std::hex << int(mBackgroundB * 255.0f);
url << "%22%3E%3C/body%3E%3C/html%3E"; url << "%22%3E%3C/body%3E%3C/html%3E";
lldebugs << "data url is: " << url.str() << llendl; //lldebugs << "data url is: " << url.str() << llendl;
// always display loading overlay now
#if LLQTWEBKIT_API_VERSION >= 16
LLQtWebKit::getInstance()->enableLoadingOverlay(mBrowserWindowId, true);
#else
llwarns << "Ignoring enableLoadingOverlay() call (llqtwebkit version is too old)." << llendl;
#endif
str.clear();
str << "Loading overlay enabled = " << mEnableMediaPluginDebugging << " for mBrowserWindowId = " << mBrowserWindowId;
postDebugMessage( str.str() );
LLQtWebKit::getInstance()->navigateTo( mBrowserWindowId, url.str() ); LLQtWebKit::getInstance()->navigateTo( mBrowserWindowId, url.str() );
// LLQtWebKit::getInstance()->navigateTo( mBrowserWindowId, "about:blank" ); // LLQtWebKit::getInstance()->navigateTo( mBrowserWindowId, "about:blank" );
@@ -413,9 +459,11 @@ private:
message.setValue("uri", event.getEventUri()); message.setValue("uri", event.getEventUri());
message.setValueBoolean("history_back_available", LLQtWebKit::getInstance()->userActionIsEnabled( mBrowserWindowId, LLQtWebKit::UA_NAVIGATE_BACK)); message.setValueBoolean("history_back_available", LLQtWebKit::getInstance()->userActionIsEnabled( mBrowserWindowId, LLQtWebKit::UA_NAVIGATE_BACK));
message.setValueBoolean("history_forward_available", LLQtWebKit::getInstance()->userActionIsEnabled( mBrowserWindowId, LLQtWebKit::UA_NAVIGATE_FORWARD)); message.setValueBoolean("history_forward_available", LLQtWebKit::getInstance()->userActionIsEnabled( mBrowserWindowId, LLQtWebKit::UA_NAVIGATE_FORWARD));
sendMessage(message); sendMessage(message);
// debug spam sent to viewer and displayed in the log as usual
postDebugMessage( "Navigate begin event at: " + event.getEventUri() );
setStatus(STATUS_LOADING); setStatus(STATUS_LOADING);
} }
@@ -457,6 +505,8 @@ private:
setInitState(INIT_STATE_NAVIGATE_COMPLETE); setInitState(INIT_STATE_NAVIGATE_COMPLETE);
} }
// debug spam sent to viewer and displayed in the log as usual
postDebugMessage( "Navigate complete event at: " + event.getEventUri() );
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@@ -541,6 +591,7 @@ private:
sendMessage(message); sendMessage(message);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// virtual // virtual
void onCookieChanged(const EventType& event) void onCookieChanged(const EventType& event)
@@ -550,10 +601,14 @@ private:
// These could be passed through as well, but aren't really needed. // These could be passed through as well, but aren't really needed.
// message.setValue("uri", event.getEventUri()); // message.setValue("uri", event.getEventUri());
// message.setValueBoolean("dead", (event.getIntValue() != 0)) // message.setValueBoolean("dead", (event.getIntValue() != 0))
// debug spam
postDebugMessage( "Sending cookie_set message from plugin: " + event.getStringValue() );
sendMessage(message); sendMessage(message);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// virtual // virtual
void onWindowCloseRequested(const EventType& event) void onWindowCloseRequested(const EventType& event)
{ {
@@ -801,7 +856,10 @@ MediaPluginWebKit::MediaPluginWebKit(LLPluginInstance::sendMessageFunction send_
mHostLanguage = "en"; // default to english mHostLanguage = "en"; // default to english
mJavascriptEnabled = true; // default to on mJavascriptEnabled = true; // default to on
mPluginsEnabled = true; // default to on mPluginsEnabled = true; // default to on
mEnableMediaPluginDebugging = false;
mUserAgent = "LLPluginMedia Web Browser"; mUserAgent = "LLPluginMedia Web Browser";
mElapsedTime.reset();
} }
MediaPluginWebKit::~MediaPluginWebKit() MediaPluginWebKit::~MediaPluginWebKit()
@@ -828,8 +886,6 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
{ {
if(message_name == "init") if(message_name == "init")
{ {
mTarget = message_in.getValue("target");
LLPluginMessage message("base", "init_response"); LLPluginMessage message("base", "init_response");
LLSD versions = LLSD::emptyMap(); LLSD versions = LLSD::emptyMap();
versions[LLPLUGIN_MESSAGE_CLASS_BASE] = LLPLUGIN_MESSAGE_CLASS_BASE_VERSION; versions[LLPLUGIN_MESSAGE_CLASS_BASE] = LLPLUGIN_MESSAGE_CLASS_BASE_VERSION;
@@ -909,7 +965,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
{ {
if(message_name == "set_volume") if(message_name == "set_volume")
{ {
F32 volume = message_in.getValueReal("volume"); F32 volume = (F32)message_in.getValueReal("volume");
setVolume(volume); setVolume(volume);
} }
} }
@@ -917,6 +973,8 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
{ {
if(message_name == "init") if(message_name == "init")
{ {
mTarget = message_in.getValue("target");
// This is the media init message -- all necessary data for initialization should have been received. // This is the media init message -- all necessary data for initialization should have been received.
if(initBrowser()) if(initBrowser())
{ {
@@ -1141,6 +1199,77 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
authResponse(message_in); authResponse(message_in);
} }
else else
if(message_name == "enable_media_plugin_debugging")
{
mEnableMediaPluginDebugging = message_in.getValueBoolean( "enable" );
}
else
if(message_name == "js_enable_object")
{
#if LLQTWEBKIT_API_VERSION >= 9
bool enable = message_in.getValueBoolean( "enable" );
LLQtWebKit::getInstance()->setSLObjectEnabled( enable );
#endif
}
else
if(message_name == "js_agent_location")
{
#if LLQTWEBKIT_API_VERSION >= 9
F32 x = (F32)message_in.getValueReal("x");
F32 y = (F32)message_in.getValueReal("y");
F32 z = (F32)message_in.getValueReal("z");
LLQtWebKit::getInstance()->setAgentLocation( x, y, z );
LLQtWebKit::getInstance()->emitLocation();
#endif
}
else
if(message_name == "js_agent_global_location")
{
#if LLQTWEBKIT_API_VERSION >= 9
F32 x = (F32)message_in.getValueReal("x");
F32 y = (F32)message_in.getValueReal("y");
F32 z = (F32)message_in.getValueReal("z");
LLQtWebKit::getInstance()->setAgentGlobalLocation( x, y, z );
LLQtWebKit::getInstance()->emitLocation();
#endif
}
else
if(message_name == "js_agent_orientation")
{
#if LLQTWEBKIT_API_VERSION >= 9
F32 angle = (F32)message_in.getValueReal("angle");
LLQtWebKit::getInstance()->setAgentOrientation( angle );
LLQtWebKit::getInstance()->emitLocation();
#endif
}
else
if(message_name == "js_agent_region")
{
#if LLQTWEBKIT_API_VERSION >= 9
const std::string& region = message_in.getValue("region");
LLQtWebKit::getInstance()->setAgentRegion( region );
LLQtWebKit::getInstance()->emitLocation();
#endif
}
else
if(message_name == "js_agent_maturity")
{
#if LLQTWEBKIT_API_VERSION >= 9
const std::string& maturity = message_in.getValue("maturity");
LLQtWebKit::getInstance()->setAgentMaturity( maturity );
LLQtWebKit::getInstance()->emitMaturity();
#endif
}
else
if(message_name == "js_agent_language")
{
#if LLQTWEBKIT_API_VERSION >= 9
const std::string& language = message_in.getValue("language");
LLQtWebKit::getInstance()->setAgentLanguage( language );
LLQtWebKit::getInstance()->emitLanguage();
#endif
}
else
{ {
// std::cerr << "MediaPluginWebKit::receiveMessage: unknown media message: " << message_string << std::endl; // std::cerr << "MediaPluginWebKit::receiveMessage: unknown media message: " << message_string << std::endl;
} }
@@ -1161,6 +1290,15 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
mFirstFocus = false; mFirstFocus = false;
} }
} }
else if(message_name == "set_page_zoom_factor")
{
#if LLQTWEBKIT_API_VERSION >= 15
F32 factor = (F32)message_in.getValueReal("factor");
LLQtWebKit::getInstance()->setPageZoomFactor(factor);
#else
llwarns << "Ignoring setPageZoomFactor message (llqtwebkit version is too old)." << llendl;
#endif
}
else if(message_name == "clear_cache") else if(message_name == "clear_cache")
{ {
LLQtWebKit::getInstance()->clearCache(); LLQtWebKit::getInstance()->clearCache();
@@ -1187,6 +1325,9 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
else if(message_name == "set_cookies") else if(message_name == "set_cookies")
{ {
LLQtWebKit::getInstance()->setCookies(message_in.getValue("cookies")); LLQtWebKit::getInstance()->setCookies(message_in.getValue("cookies"));
// debug spam
postDebugMessage( "Plugin setting cookie: " + message_in.getValue("cookies") );
} }
else if(message_name == "proxy_setup") else if(message_name == "proxy_setup")
{ {
@@ -1248,7 +1389,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
else if(message_name == "add_certificate_file_path") else if(message_name == "add_certificate_file_path")
{ {
#if LLQTWEBKIT_API_VERSION >= 6 #if LLQTWEBKIT_API_VERSION >= 6
LLQtWebKit::getInstance()->addCAFile( message_in.getValue("path") ); LLQtWebKit::getInstance()->setCAFile( message_in.getValue("path") );
#else #else
llwarns << "Ignoring add_certificate_file_path message (llqtwebkit version is too old)." << llendl; llwarns << "Ignoring add_certificate_file_path message (llqtwebkit version is too old)." << llendl;
#endif #endif