Cookies.
Enabled use of the cookie store.
This commit is contained in:
@@ -1655,6 +1655,7 @@ bool LLAppViewer::cleanup()
|
|||||||
|
|
||||||
writeDebugInfo();
|
writeDebugInfo();
|
||||||
|
|
||||||
|
LLViewerMedia::saveCookieFile();
|
||||||
// Stop the plugin read thread if it's running.
|
// Stop the plugin read thread if it's running.
|
||||||
LLPluginProcessParent::setUseReadThread(false);
|
LLPluginProcessParent::setUseReadThread(false);
|
||||||
|
|
||||||
|
|||||||
@@ -1094,12 +1094,14 @@ bool idle_startup()
|
|||||||
// END TODO
|
// END TODO
|
||||||
LLPanelLogin::close();
|
LLPanelLogin::close();
|
||||||
}
|
}
|
||||||
|
|
||||||
//For HTML parsing in text boxes.
|
//For HTML parsing in text boxes.
|
||||||
LLTextEditor::setLinkColor( gSavedSettings.getColor4("HTMLLinkColor") );
|
LLTextEditor::setLinkColor( gSavedSettings.getColor4("HTMLLinkColor") );
|
||||||
|
|
||||||
// Load URL History File
|
// Load URL History File
|
||||||
LLURLHistory::loadFile("url_history.xml");
|
LLURLHistory::loadFile("url_history.xml");
|
||||||
|
// Load media plugin cookies
|
||||||
|
LLViewerMedia::loadCookieFile();
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// Handle startup progress screen
|
// Handle startup progress screen
|
||||||
|
|||||||
@@ -33,21 +33,29 @@
|
|||||||
#include "llviewerprecompiledheaders.h"
|
#include "llviewerprecompiledheaders.h"
|
||||||
|
|
||||||
#include "llviewermedia.h"
|
#include "llviewermedia.h"
|
||||||
#include "llviewermediafocus.h"
|
|
||||||
#include "llhoverview.h"
|
|
||||||
#include "llmimetypes.h"
|
|
||||||
#include "llviewercontrol.h"
|
|
||||||
#include "llviewerwindow.h"
|
|
||||||
#include "llviewertexturelist.h"
|
|
||||||
//#include "viewerversion.h"
|
|
||||||
|
|
||||||
#include "llpluginclassmedia.h"
|
#include "llappviewer.h"
|
||||||
|
#include "lldir.h"
|
||||||
#include "llnotifications.h"
|
#include "lldiriterator.h"
|
||||||
#include "llevent.h" // LLSimpleListener
|
#include "llevent.h" // LLSimpleListener
|
||||||
#include "llnotificationsutil.h"
|
#include "llhoverview.h"
|
||||||
#include "lluuid.h"
|
|
||||||
#include "llkeyboard.h"
|
#include "llkeyboard.h"
|
||||||
|
#include "llmimetypes.h"
|
||||||
|
#include "llnotifications.h"
|
||||||
|
#include "llnotificationsutil.h"
|
||||||
|
#include "llpluginclassmedia.h"
|
||||||
|
#include "llplugincookiestore.h"
|
||||||
|
#include "llurldispatcher.h"
|
||||||
|
#include "lluuid.h"
|
||||||
|
#include "llviewermediafocus.h"
|
||||||
|
#include "llviewercontrol.h"
|
||||||
|
#include "llviewertexture.h"
|
||||||
|
#include "llviewertexturelist.h"
|
||||||
|
#include "llviewerwindow.h"
|
||||||
|
#include "llvieweraudio.h"
|
||||||
|
#include "llweb.h"
|
||||||
|
|
||||||
|
//#include "viewerversion.h"
|
||||||
|
|
||||||
// Merov: Temporary definitions while porting the new viewer media code to Snowglobe
|
// Merov: Temporary definitions while porting the new viewer media code to Snowglobe
|
||||||
const int LEFT_BUTTON = 0;
|
const int LEFT_BUTTON = 0;
|
||||||
@@ -98,6 +106,9 @@ public:
|
|||||||
};
|
};
|
||||||
typedef std::list<LLViewerMediaImpl*> impl_list;
|
typedef std::list<LLViewerMediaImpl*> impl_list;
|
||||||
static impl_list sViewerMediaImplList;
|
static impl_list sViewerMediaImplList;
|
||||||
|
LLPluginCookieStore *LLViewerMedia::sCookieStore = NULL;
|
||||||
|
static std::string sUpdatedCookies;
|
||||||
|
static const char *PLUGIN_COOKIE_FILE_NAME = "plugin_cookies.txt";
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// LLViewerMedia
|
// LLViewerMedia
|
||||||
@@ -105,10 +116,12 @@ static impl_list sViewerMediaImplList;
|
|||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// static
|
// static
|
||||||
viewer_media_t LLViewerMedia::newMediaImpl(const std::string& media_url,
|
viewer_media_t LLViewerMedia::newMediaImpl(const std::string& media_url,
|
||||||
const LLUUID& texture_id,
|
const LLUUID& texture_id,
|
||||||
S32 media_width, S32 media_height, U8 media_auto_scale,
|
S32 media_width,
|
||||||
U8 media_loop,
|
S32 media_height,
|
||||||
std::string mime_type)
|
U8 media_auto_scale,
|
||||||
|
U8 media_loop,
|
||||||
|
std::string mime_type)
|
||||||
{
|
{
|
||||||
LLViewerMediaImpl* media_impl = getMediaImplFromTextureID(texture_id);
|
LLViewerMediaImpl* media_impl = getMediaImplFromTextureID(texture_id);
|
||||||
if(media_impl == NULL || texture_id.isNull())
|
if(media_impl == NULL || texture_id.isNull())
|
||||||
@@ -255,7 +268,8 @@ void LLViewerMedia::setVolume(F32 volume)
|
|||||||
for(; iter != end; iter++)
|
for(; iter != end; iter++)
|
||||||
{
|
{
|
||||||
LLViewerMediaImpl* pimpl = *iter;
|
LLViewerMediaImpl* pimpl = *iter;
|
||||||
pimpl->setVolume(volume);
|
LLPluginClassMedia* plugin = pimpl->getMediaPlugin();
|
||||||
|
plugin->setVolume(volume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,6 +277,13 @@ void LLViewerMedia::setVolume(F32 volume)
|
|||||||
// static
|
// static
|
||||||
void LLViewerMedia::updateMedia()
|
void LLViewerMedia::updateMedia()
|
||||||
{
|
{
|
||||||
|
sUpdatedCookies = getCookieStore()->getChangedCookies();
|
||||||
|
if(!sUpdatedCookies.empty())
|
||||||
|
{
|
||||||
|
lldebugs << "updated cookies will be sent to all loaded plugins: " << llendl;
|
||||||
|
lldebugs << sUpdatedCookies << llendl;
|
||||||
|
}
|
||||||
|
|
||||||
impl_list::iterator iter = sViewerMediaImplList.begin();
|
impl_list::iterator iter = sViewerMediaImplList.begin();
|
||||||
impl_list::iterator end = sViewerMediaImplList.end();
|
impl_list::iterator end = sViewerMediaImplList.end();
|
||||||
|
|
||||||
@@ -273,6 +294,235 @@ void LLViewerMedia::updateMedia()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// static
|
||||||
|
void LLViewerMedia::clearAllCookies()
|
||||||
|
{
|
||||||
|
// Clear all cookies for all plugins
|
||||||
|
impl_list::iterator iter = sViewerMediaImplList.begin();
|
||||||
|
impl_list::iterator end = sViewerMediaImplList.end();
|
||||||
|
for (; iter != end; iter++)
|
||||||
|
{
|
||||||
|
LLViewerMediaImpl* pimpl = *iter;
|
||||||
|
LLPluginClassMedia* plugin = pimpl->getMediaPlugin();
|
||||||
|
if(plugin)
|
||||||
|
{
|
||||||
|
plugin->clear_cookies();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear all cookies from the cookie store
|
||||||
|
getCookieStore()->setAllCookies("");
|
||||||
|
|
||||||
|
// FIXME: this may not be sufficient, since the on-disk cookie file won't get written until some browser instance exits cleanly.
|
||||||
|
// It also won't clear cookies for other accounts, or for any account if we're not logged in, and won't do anything at all if there are no webkit plugins loaded.
|
||||||
|
// Until such time as we can centralize cookie storage, the following hack should cover these cases:
|
||||||
|
|
||||||
|
// HACK: Look for cookie files in all possible places and delete them.
|
||||||
|
// NOTE: this assumes knowledge of what happens inside the webkit plugin (it's what adds 'browser_profile' to the path and names the cookie file)
|
||||||
|
|
||||||
|
// Places that cookie files can be:
|
||||||
|
// <getOSUserAppDir>/browser_profile/cookies
|
||||||
|
// <getOSUserAppDir>/first_last/browser_profile/cookies (note that there may be any number of these!)
|
||||||
|
// <getOSUserAppDir>/first_last/plugin_cookies.txt (note that there may be any number of these!)
|
||||||
|
|
||||||
|
std::string base_dir = gDirUtilp->getOSUserAppDir() + gDirUtilp->getDirDelimiter();
|
||||||
|
std::string target;
|
||||||
|
std::string filename;
|
||||||
|
|
||||||
|
lldebugs << "base dir = " << base_dir << llendl;
|
||||||
|
|
||||||
|
// The non-logged-in version is easy
|
||||||
|
target = base_dir;
|
||||||
|
target += "browser_profile";
|
||||||
|
target += gDirUtilp->getDirDelimiter();
|
||||||
|
target += "cookies";
|
||||||
|
lldebugs << "target = " << target << llendl;
|
||||||
|
if(LLFile::isfile(target))
|
||||||
|
{
|
||||||
|
LLFile::remove(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
// the hard part: iterate over all user directories and delete the cookie file from each one
|
||||||
|
LLDirIterator dir_iter(base_dir, "*_*");
|
||||||
|
while (dir_iter.next(filename))
|
||||||
|
{
|
||||||
|
target = base_dir;
|
||||||
|
target += filename;
|
||||||
|
target += gDirUtilp->getDirDelimiter();
|
||||||
|
target += "browser_profile";
|
||||||
|
target += gDirUtilp->getDirDelimiter();
|
||||||
|
target += "cookies";
|
||||||
|
lldebugs << "target = " << target << llendl;
|
||||||
|
if(LLFile::isfile(target))
|
||||||
|
{
|
||||||
|
LLFile::remove(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Other accounts may have new-style cookie files too -- delete them as well
|
||||||
|
target = base_dir;
|
||||||
|
target += filename;
|
||||||
|
target += gDirUtilp->getDirDelimiter();
|
||||||
|
target += PLUGIN_COOKIE_FILE_NAME;
|
||||||
|
lldebugs << "target = " << target << llendl;
|
||||||
|
if(LLFile::isfile(target))
|
||||||
|
{
|
||||||
|
LLFile::remove(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// static
|
||||||
|
void LLViewerMedia::clearAllCaches()
|
||||||
|
{
|
||||||
|
// Clear all plugins' caches
|
||||||
|
impl_list::iterator iter = sViewerMediaImplList.begin();
|
||||||
|
impl_list::iterator end = sViewerMediaImplList.end();
|
||||||
|
for (; iter != end; iter++)
|
||||||
|
{
|
||||||
|
LLViewerMediaImpl* pimpl = *iter;
|
||||||
|
pimpl->clearCache();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// static
|
||||||
|
void LLViewerMedia::setCookiesEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
// Set the "cookies enabled" flag for all loaded plugins
|
||||||
|
impl_list::iterator iter = sViewerMediaImplList.begin();
|
||||||
|
impl_list::iterator end = sViewerMediaImplList.end();
|
||||||
|
for (; iter != end; iter++)
|
||||||
|
{
|
||||||
|
LLViewerMediaImpl* pimpl = *iter;
|
||||||
|
LLPluginClassMedia* plugin = pimpl->getMediaPlugin();
|
||||||
|
if(plugin)
|
||||||
|
{
|
||||||
|
plugin->enable_cookies(enabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// static
|
||||||
|
LLPluginCookieStore *LLViewerMedia::getCookieStore()
|
||||||
|
{
|
||||||
|
if(sCookieStore == NULL)
|
||||||
|
{
|
||||||
|
sCookieStore = new LLPluginCookieStore;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sCookieStore;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// static
|
||||||
|
void LLViewerMedia::loadCookieFile()
|
||||||
|
{
|
||||||
|
// build filename for each user
|
||||||
|
std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PLUGIN_COOKIE_FILE_NAME);
|
||||||
|
|
||||||
|
if (resolved_filename.empty())
|
||||||
|
{
|
||||||
|
llinfos << "can't get path to plugin cookie file - probably not logged in yet." << llendl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// open the file for reading
|
||||||
|
llifstream file(resolved_filename);
|
||||||
|
if (!file.is_open())
|
||||||
|
{
|
||||||
|
llwarns << "can't load plugin cookies from file \"" << PLUGIN_COOKIE_FILE_NAME << "\"" << llendl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getCookieStore()->readAllCookies(file, true);
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
// send the clear_cookies message to all loaded plugins
|
||||||
|
impl_list::iterator iter = sViewerMediaImplList.begin();
|
||||||
|
impl_list::iterator end = sViewerMediaImplList.end();
|
||||||
|
for (; iter != end; iter++)
|
||||||
|
{
|
||||||
|
LLViewerMediaImpl* pimpl = *iter;
|
||||||
|
LLPluginClassMedia* plugin = pimpl->getMediaPlugin();
|
||||||
|
if(plugin)
|
||||||
|
{
|
||||||
|
plugin->clear_cookies();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// static
|
||||||
|
void LLViewerMedia::saveCookieFile()
|
||||||
|
{
|
||||||
|
// build filename for each user
|
||||||
|
std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PLUGIN_COOKIE_FILE_NAME);
|
||||||
|
|
||||||
|
if (resolved_filename.empty())
|
||||||
|
{
|
||||||
|
llinfos << "can't get path to plugin cookie file - probably not logged in yet." << llendl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// open a file for writing
|
||||||
|
llofstream file (resolved_filename);
|
||||||
|
if (!file.is_open())
|
||||||
|
{
|
||||||
|
llwarns << "can't open plugin cookie file \"" << PLUGIN_COOKIE_FILE_NAME << "\" for writing" << llendl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getCookieStore()->writePersistentCookies(file);
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// static
|
||||||
|
void LLViewerMedia::addCookie(const std::string &name, const std::string &value, const std::string &domain, const LLDate &expires, const std::string &path, bool secure)
|
||||||
|
{
|
||||||
|
std::stringstream cookie;
|
||||||
|
|
||||||
|
cookie << name << "=" << LLPluginCookieStore::quoteString(value);
|
||||||
|
|
||||||
|
if(expires.notNull())
|
||||||
|
{
|
||||||
|
cookie << "; expires=" << expires.asRFC1123();
|
||||||
|
}
|
||||||
|
|
||||||
|
cookie << "; domain=" << domain;
|
||||||
|
|
||||||
|
cookie << "; path=" << path;
|
||||||
|
|
||||||
|
if(secure)
|
||||||
|
{
|
||||||
|
cookie << "; secure";
|
||||||
|
}
|
||||||
|
|
||||||
|
getCookieStore()->setCookies(cookie.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// static
|
||||||
|
void LLViewerMedia::addSessionCookie(const std::string &name, const std::string &value, const std::string &domain, const std::string &path, bool secure)
|
||||||
|
{
|
||||||
|
// A session cookie just has a NULL date.
|
||||||
|
addCookie(name, value, domain, LLDate(), path, secure);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// static
|
||||||
|
void LLViewerMedia::removeCookie(const std::string &name, const std::string &domain, const std::string &path )
|
||||||
|
{
|
||||||
|
// To remove a cookie, add one with the same name, domain, and path that expires in the past.
|
||||||
|
|
||||||
|
addCookie(name, "", domain, LLDate(LLDate::now().secondsSinceEpoch() - 1.0), path);
|
||||||
|
}
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// static
|
// static
|
||||||
void LLViewerMedia::cleanupClass()
|
void LLViewerMedia::cleanupClass()
|
||||||
@@ -309,7 +559,8 @@ LLViewerMediaImpl::LLViewerMediaImpl(const std::string& media_url,
|
|||||||
mTextureUsedWidth(0),
|
mTextureUsedWidth(0),
|
||||||
mTextureUsedHeight(0),
|
mTextureUsedHeight(0),
|
||||||
mSuspendUpdates(false),
|
mSuspendUpdates(false),
|
||||||
mVisible(true)
|
mVisible(true),
|
||||||
|
mClearCache(false)
|
||||||
{
|
{
|
||||||
createMediaSource();
|
createMediaSource();
|
||||||
}
|
}
|
||||||
@@ -379,7 +630,7 @@ void LLViewerMediaImpl::setMediaType(const std::string& media_type)
|
|||||||
LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height)
|
LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height)
|
||||||
{
|
{
|
||||||
std::string plugin_basename = LLMIMETypes::implType(media_type);
|
std::string plugin_basename = LLMIMETypes::implType(media_type);
|
||||||
|
|
||||||
if(plugin_basename.empty())
|
if(plugin_basename.empty())
|
||||||
{
|
{
|
||||||
LL_WARNS("Media") << "Couldn't find plugin for media type " << media_type << LL_ENDL;
|
LL_WARNS("Media") << "Couldn't find plugin for media type " << media_type << LL_ENDL;
|
||||||
@@ -391,6 +642,19 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
|
|||||||
std::string user_data_path = gDirUtilp->getOSUserAppDir();
|
std::string user_data_path = gDirUtilp->getOSUserAppDir();
|
||||||
user_data_path += gDirUtilp->getDirDelimiter();
|
user_data_path += gDirUtilp->getDirDelimiter();
|
||||||
|
|
||||||
|
// Fix for EXT-5960 - make browser profile specific to user (cache, cookies etc.)
|
||||||
|
// If the linden username returned is blank, that can only mean we are
|
||||||
|
// at the login page displaying login Web page or Web browser test via Develop menu.
|
||||||
|
// In this case we just use whatever gDirUtilp->getOSUserAppDir() gives us (this
|
||||||
|
// is what we always used before this change)
|
||||||
|
std::string linden_user_dir = gDirUtilp->getLindenUserDir();
|
||||||
|
if ( ! linden_user_dir.empty() )
|
||||||
|
{
|
||||||
|
// gDirUtilp->getLindenUserDir() is whole path, not just Linden name
|
||||||
|
user_data_path = linden_user_dir;
|
||||||
|
user_data_path += gDirUtilp->getDirDelimiter();
|
||||||
|
};
|
||||||
|
|
||||||
// See if the plugin executable exists
|
// See if the plugin executable exists
|
||||||
llstat s;
|
llstat s;
|
||||||
if(LLFile::stat(launcher_name, &s))
|
if(LLFile::stat(launcher_name, &s))
|
||||||
@@ -421,7 +685,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
|
|||||||
// collect 'javascript enabled' setting from prefs and send to embedded browser
|
// collect 'javascript enabled' setting from prefs and send to embedded browser
|
||||||
bool javascript_enabled = gSavedSettings.getBOOL( "BrowserJavascriptEnabled" );
|
bool javascript_enabled = gSavedSettings.getBOOL( "BrowserJavascriptEnabled" );
|
||||||
media_source->setJavascriptEnabled( javascript_enabled );
|
media_source->setJavascriptEnabled( javascript_enabled );
|
||||||
|
|
||||||
bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging");
|
bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging");
|
||||||
media_source->enableMediaPluginDebugging( media_plugin_debugging_enabled );
|
media_source->enableMediaPluginDebugging( media_plugin_debugging_enabled );
|
||||||
|
|
||||||
@@ -463,7 +727,7 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type)
|
|||||||
// and unconditionally set the mime type
|
// and unconditionally set the mime type
|
||||||
mMimeType = media_type;
|
mMimeType = media_type;
|
||||||
|
|
||||||
LLPluginClassMedia* media_source = newSourceFromMediaType(media_type, this, mMediaWidth, mMediaHeight);
|
LLPluginClassMedia* media_source = newSourceFromMediaType(mMimeType, this, mMediaWidth, mMediaHeight);
|
||||||
|
|
||||||
if (media_source)
|
if (media_source)
|
||||||
{
|
{
|
||||||
@@ -484,6 +748,23 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type)
|
|||||||
std::string ca_path = gDirUtilp->getExpandedFilename( LL_PATH_APP_SETTINGS, "CA.pem" );
|
std::string ca_path = gDirUtilp->getExpandedFilename( LL_PATH_APP_SETTINGS, "CA.pem" );
|
||||||
media_source->addCertificateFilePath( ca_path );
|
media_source->addCertificateFilePath( ca_path );
|
||||||
|
|
||||||
|
if(mClearCache)
|
||||||
|
{
|
||||||
|
mClearCache = false;
|
||||||
|
media_source->clear_cache();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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;
|
||||||
@@ -600,6 +881,19 @@ void LLViewerMediaImpl::focus(bool focus)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void LLViewerMediaImpl::clearCache()
|
||||||
|
{
|
||||||
|
LLPluginClassMedia* plugin = getMediaPlugin();
|
||||||
|
if(plugin)
|
||||||
|
{
|
||||||
|
plugin->clear_cache();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mClearCache = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
void LLViewerMediaImpl::mouseDown(S32 x, S32 y)
|
void LLViewerMediaImpl::mouseDown(S32 x, S32 y)
|
||||||
{
|
{
|
||||||
@@ -883,6 +1177,16 @@ void LLViewerMediaImpl::updateMovieImage(const LLUUID& uuid, BOOL active)
|
|||||||
void LLViewerMediaImpl::update()
|
void LLViewerMediaImpl::update()
|
||||||
{
|
{
|
||||||
LLPluginClassMedia* plugin = getMediaPlugin();
|
LLPluginClassMedia* plugin = getMediaPlugin();
|
||||||
|
|
||||||
|
if(plugin)
|
||||||
|
{
|
||||||
|
// If we didn't just create the impl, it may need to get cookie updates.
|
||||||
|
if(!sUpdatedCookies.empty())
|
||||||
|
{
|
||||||
|
// TODO: Only send cookies to plugins that need them
|
||||||
|
plugin->set_cookies(sUpdatedCookies);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!plugin)
|
if (!plugin)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -1154,6 +1458,12 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* self, LLPluginClass
|
|||||||
// Just chain the event to observers.
|
// Just chain the event to observers.
|
||||||
emitEvent(self, event);
|
emitEvent(self, event);
|
||||||
}
|
}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// virtual
|
||||||
|
void LLViewerMediaImpl::handleCookieSet(LLPluginClassMedia* self, const std::string &cookie)
|
||||||
|
{
|
||||||
|
LLViewerMedia::getCookieStore()->setCookies(cookie);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// virtual
|
// virtual
|
||||||
|
|||||||
@@ -33,15 +33,19 @@
|
|||||||
#ifndef LLVIEWERMEDIA_H
|
#ifndef LLVIEWERMEDIA_H
|
||||||
#define LLVIEWERMEDIA_H
|
#define LLVIEWERMEDIA_H
|
||||||
|
|
||||||
#include "llviewermediaeventemitter.h"
|
|
||||||
#include "llviewerpluginmanager.h"
|
|
||||||
#include "llfocusmgr.h"
|
#include "llfocusmgr.h"
|
||||||
#include "llpanel.h"
|
#include "llpanel.h"
|
||||||
|
#include "llviewermediaeventemitter.h"
|
||||||
|
#include "llviewerpluginmanager.h"
|
||||||
|
#include "llpluginclassmedia.h"
|
||||||
|
#include "v4color.h"
|
||||||
|
#include "llurl.h"
|
||||||
|
|
||||||
class LLViewerMediaImpl;
|
class LLViewerMediaImpl;
|
||||||
class LLUUID;
|
class LLUUID;
|
||||||
class LLSD;
|
class LLSD;
|
||||||
class LLViewerTexture;
|
class LLViewerTexture;
|
||||||
|
class LLPluginCookieStore;
|
||||||
|
|
||||||
typedef LLPointer<LLViewerMediaImpl> viewer_media_t;
|
typedef LLPointer<LLViewerMediaImpl> viewer_media_t;
|
||||||
|
|
||||||
@@ -72,6 +76,24 @@ class LLViewerMedia
|
|||||||
|
|
||||||
static void cleanupClass();
|
static void cleanupClass();
|
||||||
|
|
||||||
|
// Clear all cookies for all plugins
|
||||||
|
static void clearAllCookies();
|
||||||
|
|
||||||
|
// Clear all plugins' caches
|
||||||
|
static void clearAllCaches();
|
||||||
|
|
||||||
|
// Set the "cookies enabled" flag for all loaded plugins
|
||||||
|
static void setCookiesEnabled(bool enabled);
|
||||||
|
|
||||||
|
static LLPluginCookieStore *getCookieStore();
|
||||||
|
static void loadCookieFile();
|
||||||
|
static void saveCookieFile();
|
||||||
|
static void addCookie(const std::string &name, const std::string &value, const std::string &domain, const LLDate &expires, const std::string &path = std::string("/"), bool secure = false );
|
||||||
|
static void addSessionCookie(const std::string &name, const std::string &value, const std::string &domain, const std::string &path = std::string("/"), bool secure = false );
|
||||||
|
static void removeCookie(const std::string &name, const std::string &domain, const std::string &path = std::string("/") );
|
||||||
|
|
||||||
|
private:
|
||||||
|
static LLPluginCookieStore *sCookieStore;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implementation functions not exported into header file
|
// Implementation functions not exported into header file
|
||||||
@@ -81,6 +103,9 @@ class LLViewerMediaImpl
|
|||||||
LOG_CLASS(LLViewerMediaImpl);
|
LOG_CLASS(LLViewerMediaImpl);
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
friend class LLViewerMedia;
|
||||||
|
friend class LLMimeDiscoveryResponder;
|
||||||
|
|
||||||
LLViewerMediaImpl(const std::string& media_url,
|
LLViewerMediaImpl(const std::string& media_url,
|
||||||
const LLUUID& texture_id,
|
const LLUUID& texture_id,
|
||||||
S32 media_width,
|
S32 media_width,
|
||||||
@@ -124,6 +149,7 @@ public:
|
|||||||
std::string getMediaURL() { return mMediaURL; }
|
std::string getMediaURL() { return mMediaURL; }
|
||||||
std::string getHomeURL() { return mHomeURL; }
|
std::string getHomeURL() { return mHomeURL; }
|
||||||
void setHomeURL(const std::string& home_url) { mHomeURL = home_url; }
|
void setHomeURL(const std::string& home_url) { mHomeURL = home_url; }
|
||||||
|
void clearCache();
|
||||||
std::string getMimeType() { return mMimeType; }
|
std::string getMimeType() { return mMimeType; }
|
||||||
void getTextureSize(S32 *texture_width, S32 *texture_height);
|
void getTextureSize(S32 *texture_width, S32 *texture_height);
|
||||||
void scaleMouse(S32 *mouse_x, S32 *mouse_y);
|
void scaleMouse(S32 *mouse_x, S32 *mouse_y);
|
||||||
@@ -174,6 +200,7 @@ public:
|
|||||||
|
|
||||||
// Inherited from LLPluginClassMediaOwner
|
// Inherited from LLPluginClassMediaOwner
|
||||||
/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, LLPluginClassMediaOwner::EMediaEvent);
|
/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, LLPluginClassMediaOwner::EMediaEvent);
|
||||||
|
/*virtual*/ void handleCookieSet(LLPluginClassMedia* self, const std::string &cookie);
|
||||||
|
|
||||||
// LLEditMenuHandler overrides
|
// LLEditMenuHandler overrides
|
||||||
/*virtual*/ void cut();
|
/*virtual*/ void cut();
|
||||||
@@ -184,8 +211,9 @@ public:
|
|||||||
|
|
||||||
/*virtual*/ void paste();
|
/*virtual*/ void paste();
|
||||||
/*virtual*/ BOOL canPaste() const;
|
/*virtual*/ BOOL canPaste() const;
|
||||||
|
|
||||||
public:
|
bool mNeedsNewTexture;
|
||||||
|
private:
|
||||||
// a single media url with some data and an impl.
|
// a single media url with some data and an impl.
|
||||||
LLUUID mTextureId;
|
LLUUID mTextureId;
|
||||||
bool mMovieImageHasMips;
|
bool mMovieImageHasMips;
|
||||||
@@ -198,11 +226,11 @@ public:
|
|||||||
S32 mMediaHeight;
|
S32 mMediaHeight;
|
||||||
bool mMediaAutoScale;
|
bool mMediaAutoScale;
|
||||||
bool mMediaLoop;
|
bool mMediaLoop;
|
||||||
bool mNeedsNewTexture;
|
|
||||||
S32 mTextureUsedWidth;
|
S32 mTextureUsedWidth;
|
||||||
S32 mTextureUsedHeight;
|
S32 mTextureUsedHeight;
|
||||||
bool mSuspendUpdates;
|
bool mSuspendUpdates;
|
||||||
bool mVisible;
|
bool mVisible;
|
||||||
|
bool mClearCache;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/*LLViewerMediaTexture*/LLViewerTexture *updatePlaceholderImage();
|
/*LLViewerMediaTexture*/LLViewerTexture *updatePlaceholderImage();
|
||||||
|
|||||||
Reference in New Issue
Block a user