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

@@ -2189,38 +2189,16 @@
<key>Value</key>
<string>http://www.singularityviewer.org</string>
</map>
<key>BrowserCookiesEnabled</key>
<key>BrowserIgnoreSSLCertErrors</key>
<map>
<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>
<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 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>
<integer>0</integer>
</map>
<key>PluginAttachDebuggerToPlugins</key>
<map>
@@ -3927,6 +3905,28 @@
<key>Value</key>
<integer>1</integer>
</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>
<map>
<key>Comment</key>
@@ -8196,6 +8196,17 @@
<key>Value</key>
<integer>0</integer>
</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>
<map>
<key>Comment</key>
@@ -8260,7 +8271,7 @@
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
<integer>0</integer>
</map>
<key>MemoryPrivatePoolSize</key>
<map>

View File

@@ -345,6 +345,10 @@ BOOL LLMediaCtrl::postBuild ()
return true;
}
void LLMediaCtrl::onOpenWebInspector()
if (mMediaSource && mMediaSource->hasMedia())
mMediaSource->getMediaPlugin()->showWebInspector( true );
}
////////////////////////////////////////////////////////////////////////////////
//
BOOL LLMediaCtrl::handleKeyHere( KEY key, MASK mask )
@@ -947,6 +951,12 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
};
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:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << self->getClickTarget() << "\", uri is " << self->getClickURL() << LL_ENDL;
@@ -978,31 +988,25 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAME_CHANGED" << LL_ENDL;
};
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:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLOSE_REQUEST" << LL_ENDL;
};
break;
case MEDIA_EVENT_PICK_FILE_REQUEST:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PICK_FILE_REQUEST" << LL_ENDL;
};
break;
case MEDIA_EVENT_GEOMETRY_CHANGE:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_GEOMETRY_CHANGE" << LL_ENDL;
};
break;
case MEDIA_EVENT_AUTH_REQUEST:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_AUTH_REQUEST" << LL_ENDL;
@@ -1014,6 +1018,12 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_LINK_HOVERED" << LL_ENDL;
};
break;
case MEDIA_EVENT_DEBUG_MESSAGE:
{
LL_INFOS("media") << self->getDebugMessageText() << LL_ENDL;
};
break;
default:
{

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)
void onClickLinkHref( LLPluginClassMedia* self );
void onClickLinkNoFollow( LLPluginClassMedia* self );
// right click debugging item
void onOpenWebInspector();
protected:
void convertInputCoords(S32& x, S32& y);

View File

@@ -34,6 +34,7 @@
#include "llviewerprecompiledheaders.h"
#include "llmimetypes.h"
#include "lltrans.h"
#include "lluictrlfactory.h"
@@ -48,6 +49,7 @@ std::string sDefaultImpl;
// Returned when we don't know what impl to use
std::string sXMLFilename;
// 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
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);
if(it != sWidgetMap.end())
{
@@ -238,6 +240,18 @@ std::string LLMIMETypes::findDefaultMimeType(const std::string& widget_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
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);
// 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);
// 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());
// 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 );
// collect 'plugins enabled' setting from prefs and send to embedded browser
@@ -421,8 +421,12 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
// collect 'javascript enabled' setting from prefs and send to embedded browser
bool javascript_enabled = gSavedSettings.getBOOL( "BrowserJavascriptEnabled" );
media_source->setJavascriptEnabled( javascript_enabled );
bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging");
media_source->enableMediaPluginDebugging( media_plugin_debugging_enabled );
if (media_source->init(launcher_name, plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")))
const std::string plugin_dir = gDirUtilp->getLLPluginDir();
if (media_source->init(launcher_name, plugin_dir, plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")))
{
return media_source;
}
@@ -433,8 +437,8 @@ 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;
args["MIME_TYPE"] = media_type;
LLNotificationsUtil::add("NoPlugin", args);
@@ -467,8 +471,36 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type)
media_source->setLoop(mMediaLoop);
media_source->setAutoScale(mMediaAutoScale);
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;
return true;
}

View File

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

View File

@@ -77,7 +77,8 @@ LLPluginClassBasic* LLViewerPluginManager::createPlugin(T* user_data)
{
// Always delete the old plugin first.
destroyPlugin();
std::string plugin_dir = gDirUtilp->getLLPluginDir();
std::string plugin_name = gDirUtilp->getLLPluginFilename(PLUGIN_TYPE::plugin_basename());
// See if the plugin executable exists.
@@ -93,7 +94,7 @@ LLPluginClassBasic* LLViewerPluginManager::createPlugin(T* user_data)
else
{
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;
}

View File

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