summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorcallum_linden <none@none>2018-01-17 16:13:19 -0800
committercallum_linden <none@none>2018-01-17 16:13:19 -0800
commitd3f544d39d204c60c6112f0ba4abd906ac28481a (patch)
tree97a2c7c1685dae832e2be76891332abbae5293ae /indra/newview
parente84e4a1adf29b3a807c9d0c0e4841b5f12ea9756 (diff)
Fixes for 'MAINT-8196 Remove LLPluginCookieStore from the viewer' and 'MAINT-8194 Remove per-frame calls to updateJavascriptObject()'
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewer.cpp2
-rw-r--r--indra/newview/llfloaterfacebook.cpp10
-rw-r--r--indra/newview/llfloaterflickr.cpp6
-rw-r--r--indra/newview/llfloatertwitter.cpp6
-rw-r--r--indra/newview/llstartup.cpp3
-rw-r--r--indra/newview/llviewermedia.cpp237
-rw-r--r--indra/newview/llviewermedia.h10
-rw-r--r--indra/newview/llwebprofile.cpp1
8 files changed, 9 insertions, 266 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index e827a728ae..d22d0dcf59 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1940,8 +1940,6 @@ bool LLAppViewer::cleanup()
LLAvatarIconIDCache::getInstance()->save();
- LLViewerMedia::saveCookieFile();
-
// Stop the plugin read thread if it's running.
LLPluginProcessParent::setUseReadThread(false);
diff --git a/indra/newview/llfloaterfacebook.cpp b/indra/newview/llfloaterfacebook.cpp
index b1d6d8be82..e84cbc289f 100644
--- a/indra/newview/llfloaterfacebook.cpp
+++ b/indra/newview/llfloaterfacebook.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterfacebook.cpp
* @brief Implementation of llfloaterfacebook
* @author Gilbert@lindenlab.com
@@ -41,7 +41,6 @@
#include "llresmgr.h" // LLLocale
#include "llsdserialize.h"
#include "llloadingindicator.h"
-#include "llplugincookiestore.h"
#include "llslurl.h"
#include "lltrans.h"
#include "llsnapshotlivepreview.h"
@@ -296,16 +295,11 @@ void LLFacebookStatusPanel::showConnectedLayout()
void LLFacebookStatusPanel::onConnect()
{
LLFacebookConnect::instance().checkConnectionToFacebook(true);
-
- //Clear only the facebook browser cookies so that the facebook login screen appears
- LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com");
}
void LLFacebookStatusPanel::onDisconnect()
{
LLFacebookConnect::instance().disconnectFromFacebook();
-
- LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com");
}
void LLFacebookStatusPanel::clearAndClose()
@@ -810,7 +804,7 @@ void LLFacebookCheckinPanel::sendCheckin()
LLAgentUI::buildSLURL(slurl);
std::string slurl_string = slurl.getSLURLString();
- // Use a valid http:// URL if the scheme is secondlife://
+ // Use a valid http:// URL if the scheme is secondlife://
LLURI slurl_uri(slurl_string);
if (slurl_uri.scheme() == LLSLURL::SLURL_SECONDLIFE_SCHEME)
{
diff --git a/indra/newview/llfloaterflickr.cpp b/indra/newview/llfloaterflickr.cpp
index 15b7c7fafa..69a92b2b54 100644
--- a/indra/newview/llfloaterflickr.cpp
+++ b/indra/newview/llfloaterflickr.cpp
@@ -40,7 +40,6 @@
#include "llresmgr.h" // LLLocale
#include "llsdserialize.h"
#include "llloadingindicator.h"
-#include "llplugincookiestore.h"
#include "llslurl.h"
#include "lltrans.h"
#include "llsnapshotlivepreview.h"
@@ -660,16 +659,11 @@ void LLFlickrAccountPanel::showConnectedLayout()
void LLFlickrAccountPanel::onConnect()
{
LLFlickrConnect::instance().checkConnectionToFlickr(true);
-
- //Clear only the flickr browser cookies so that the flickr login screen appears
- LLViewerMedia::getCookieStore()->removeCookiesByDomain(".flickr.com");
}
void LLFlickrAccountPanel::onDisconnect()
{
LLFlickrConnect::instance().disconnectFromFlickr();
-
- LLViewerMedia::getCookieStore()->removeCookiesByDomain(".flickr.com");
}
////////////////////////
diff --git a/indra/newview/llfloatertwitter.cpp b/indra/newview/llfloatertwitter.cpp
index 4bab89ace2..a351921d8d 100644
--- a/indra/newview/llfloatertwitter.cpp
+++ b/indra/newview/llfloatertwitter.cpp
@@ -41,7 +41,6 @@
#include "llresmgr.h" // LLLocale
#include "llsdserialize.h"
#include "llloadingindicator.h"
-#include "llplugincookiestore.h"
#include "llslurl.h"
#include "lltrans.h"
#include "llsnapshotlivepreview.h"
@@ -684,16 +683,11 @@ void LLTwitterAccountPanel::showConnectedLayout()
void LLTwitterAccountPanel::onConnect()
{
LLTwitterConnect::instance().checkConnectionToTwitter(true);
-
- //Clear only the twitter browser cookies so that the twitter login screen appears
- LLViewerMedia::getCookieStore()->removeCookiesByDomain(".twitter.com");
}
void LLTwitterAccountPanel::onDisconnect()
{
LLTwitterConnect::instance().disconnectFromTwitter();
-
- LLViewerMedia::getCookieStore()->removeCookiesByDomain(".twitter.com");
}
////////////////////////
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index ad9a554ef5..358fb80af7 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -965,9 +965,6 @@ bool idle_startup()
// Load Avatars icons cache
LLAvatarIconIDCache::getInstance()->load();
- // Load media plugin cookies
- LLViewerMedia::loadCookieFile();
-
LLRenderMuteList::getInstance()->loadFromFile();
//-------------------------------------------------
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 9dd8b00ef6..1d4079289a 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -50,7 +50,6 @@
#include "llpanelprofile.h"
#include "llparcel.h"
#include "llpluginclassmedia.h"
-#include "llplugincookiestore.h"
#include "llurldispatcher.h"
#include "lluuid.h"
#include "llversioninfo.h"
@@ -154,7 +153,6 @@ LLViewerMediaObserver::~LLViewerMediaObserver()
}
-LLPluginCookieStore *LLViewerMedia::sCookieStore = NULL;
LLURL LLViewerMedia::sOpenIDURL;
std::string LLViewerMedia::sOpenIDCookie;
LLPluginClassMedia* LLViewerMedia::sSpareBrowserMediaSource = NULL;
@@ -169,8 +167,6 @@ static F64 sLowestLoadableImplInterest = 0.0f;
static bool sAnyMediaShowing = false;
static bool sAnyMediaPlaying = false;
static boost::signals2::connection sTeleportFinishConnection;
-static std::string sUpdatedCookies;
-static const char *PLUGIN_COOKIE_FILE_NAME = "plugin_cookies.txt";
//////////////////////////////////////////////////////////////////////////////////////////
static void add_media_impl(LLViewerMediaImpl* media)
@@ -610,12 +606,6 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
sAnyMediaShowing = false;
sAnyMediaPlaying = false;
- sUpdatedCookies = getCookieStore()->getChangedCookies();
- if(!sUpdatedCookies.empty())
- {
- LL_DEBUGS() << "updated cookies will be sent to all loaded plugins: " << LL_ENDL;
- LL_DEBUGS() << sUpdatedCookies << LL_ENDL;
- }
impl_list::iterator iter = sViewerMediaImplList.begin();
impl_list::iterator end = sViewerMediaImplList.end();
@@ -1048,64 +1038,6 @@ void LLViewerMedia::clearAllCookies()
pimpl->mMediaSource->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;
-
- LL_DEBUGS() << "base dir = " << base_dir << LL_ENDL;
-
- // The non-logged-in version is easy
- target = base_dir;
- target += "browser_profile";
- target += gDirUtilp->getDirDelimiter();
- target += "cookies";
- LL_DEBUGS() << "target = " << target << LL_ENDL;
- 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 = gDirUtilp->add(base_dir, filename);
- gDirUtilp->append(target, "browser_profile");
- gDirUtilp->append(target, "cookies");
- LL_DEBUGS() << "target = " << target << LL_ENDL;
- if(LLFile::isfile(target))
- {
- LLFile::remove(target);
- }
-
- // Other accounts may have new-style cookie files too -- delete them as well
- target = gDirUtilp->add(base_dir, filename);
- gDirUtilp->append(target, PLUGIN_COOKIE_FILE_NAME);
- LL_DEBUGS() << "target = " << target << LL_ENDL;
- if(LLFile::isfile(target))
- {
- LLFile::remove(target);
- }
- }
-
- // If we have an OpenID cookie, re-add it to the cookie store.
- setOpenIDCookie(std::string());
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1134,7 +1066,7 @@ void LLViewerMedia::setCookiesEnabled(bool enabled)
LLViewerMediaImpl* pimpl = *iter;
if(pimpl->mMediaSource)
{
- pimpl->mMediaSource->enable_cookies(enabled);
+ pimpl->mMediaSource->cookies_enabled(enabled);
}
}
}
@@ -1159,127 +1091,7 @@ void LLViewerMedia::setProxyConfig(bool enable, const std::string &host, int por
/////////////////////////////////////////////////////////////////////////////////////////
// static
/////////////////////////////////////////////////////////////////////////////////////////
-// 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())
- {
- LL_INFOS() << "can't get path to plugin cookie file - probably not logged in yet." << LL_ENDL;
- return;
- }
-
- // open the file for reading
- llifstream file(resolved_filename.c_str());
- if (!file.is_open())
- {
- LL_WARNS() << "can't load plugin cookies from file \"" << PLUGIN_COOKIE_FILE_NAME << "\"" << LL_ENDL;
- 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;
- if(pimpl->mMediaSource)
- {
- pimpl->mMediaSource->clear_cookies();
- }
- }
-
- // If we have an OpenID cookie, re-add it to the cookie store.
- setOpenIDCookie(std::string());
-}
-
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// 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())
- {
- LL_INFOS() << "can't get path to plugin cookie file - probably not logged in yet." << LL_ENDL;
- return;
- }
-
- // open a file for writing
- llofstream file(resolved_filename.c_str());
- if (!file.is_open())
- {
- LL_WARNS() << "can't open plugin cookie file \"" << PLUGIN_COOKIE_FILE_NAME << "\" for writing" << LL_ENDL;
- 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
LLSD LLViewerMedia::getHeaders()
{
@@ -1384,8 +1196,6 @@ void LLViewerMedia::getOpenIDCookieCoro(std::string url)
hostEnd = authority.size();
}
- getCookieStore()->setCookiesFromHost(sOpenIDCookie, authority.substr(hostStart, hostEnd - hostStart));
-
if (url.length())
{
LLMediaCtrl* media_instance = LLFloaterReg::getInstance("destinations")->getChild<LLMediaCtrl>("destination_guide_contents");
@@ -1423,7 +1233,6 @@ void LLViewerMedia::getOpenIDCookieCoro(std::string url)
httpHeaders->append(HTTP_OUT_HEADER_COOKIE, sOpenIDCookie);
httpHeaders->append(HTTP_OUT_HEADER_USER_AGENT, getCurrentUserAgent());
-
LL_DEBUGS("MediaAuth") << "Requesting " << url << LL_ENDL;
LL_DEBUGS("MediaAuth") << "sOpenIDCookie = [" << sOpenIDCookie << "]" << LL_ENDL;
@@ -1448,13 +1257,9 @@ void LLViewerMedia::getOpenIDCookieCoro(std::string url)
const std::string& cookie = resultHeaders[HTTP_IN_HEADER_SET_COOKIE].asStringRef();
LL_DEBUGS("MediaAuth") << "cookie = " << cookie << LL_ENDL;
- // *TODO: What about bad status codes? Does this destroy previous cookies?
- LLViewerMedia::getCookieStore()->setCookiesFromHost(cookie, hostAuth);
-
// Set cookie for snapshot publishing.
std::string authCookie = cookie.substr(0, cookie.find(";")); // strip path
LLWebProfile::setAuthCookie(authCookie);
-
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1649,12 +1454,6 @@ void LLViewerMedia::cleanupClass()
delete sSpareBrowserMediaSource;
sSpareBrowserMediaSource = NULL;
}
-
- if (sCookieStore != NULL)
- {
- delete sCookieStore;
- sCookieStore = NULL;
- }
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -1922,7 +1721,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
// collect 'cookies enabled' setting from prefs and send to embedded browser
bool cookies_enabled = gSavedSettings.getBOOL( "CookiesEnabled" );
- media_source->enable_cookies( cookies_enabled || clean_browser);
+ media_source->cookies_enabled( cookies_enabled || clean_browser);
// collect 'plugins enabled' setting from prefs and send to embedded browser
bool plugins_enabled = gSavedSettings.getBOOL( "BrowserPluginsEnabled" );
@@ -2031,17 +1830,6 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type)
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();
- LL_DEBUGS() << "setting cookies: " << all_cookies << LL_ENDL;
- if(!all_cookies.empty())
- {
- media_source->set_cookies(all_cookies);
- }
-
mMediaSource = media_source;
mMediaSource->setDeleteOK(false) ;
updateVolume();
@@ -2983,14 +2771,10 @@ void LLViewerMediaImpl::update()
updateVolume();
// TODO: this is updated every frame - is this bad?
- updateJavascriptObject();
-
- // 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
- mMediaSource->set_cookies(sUpdatedCookies);
- }
+ // Removing this as part of the post viewer64 media update
+ // Removed as not implemented in CEF embedded browser
+ // See MAINT-8194 for a more fuller description
+ // updateJavascriptObject();
}
@@ -3583,13 +3367,6 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
////////////////////////////////////////////////////////////////////////////////
// virtual
-void LLViewerMediaImpl::handleCookieSet(LLPluginClassMedia* self, const std::string &cookie)
-{
- LLViewerMedia::getCookieStore()->setCookies(cookie);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// virtual
void
LLViewerMediaImpl::cut()
{
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h
index 0212bf88bf..6e18c4fecb 100644
--- a/indra/newview/llviewermedia.h
+++ b/indra/newview/llviewermedia.h
@@ -50,7 +50,6 @@ class LLViewerMediaTexture;
class LLMediaEntry;
class LLVOVolume;
class LLMimeDiscoveryResponder;
-class LLPluginCookieStore;
typedef LLPointer<LLViewerMediaImpl> viewer_media_t;
///////////////////////////////////////////////////////////////////////////////
@@ -149,13 +148,6 @@ public:
// Set the proxy config for all loaded plugins
static void setProxyConfig(bool enable, const std::string &host, int port);
- 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("/") );
-
static void openIDSetup(const std::string &openid_url, const std::string &openid_token);
static void openIDCookieResponse(const std::string& url, const std::string &cookie);
@@ -178,7 +170,6 @@ private:
static void openIDSetupCoro(std::string openidUrl, std::string openidToken);
static void getOpenIDCookieCoro(std::string url);
- static LLPluginCookieStore *sCookieStore;
static LLURL sOpenIDURL;
static std::string sOpenIDCookie;
static LLPluginClassMedia* sSpareBrowserMediaSource;
@@ -337,7 +328,6 @@ public:
// Inherited from LLPluginClassMediaOwner
/*virtual*/ void handleMediaEvent(LLPluginClassMedia* plugin, LLPluginClassMediaOwner::EMediaEvent);
- /*virtual*/ void handleCookieSet(LLPluginClassMedia* self, const std::string &cookie);
// LLEditMenuHandler overrides
/*virtual*/ void cut();
diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp
index 06ce497510..81d4e30a7a 100644
--- a/indra/newview/llwebprofile.cpp
+++ b/indra/newview/llwebprofile.cpp
@@ -31,7 +31,6 @@
// libs
#include "llbufferstream.h"
#include "llimagepng.h"
-#include "llplugincookiestore.h"
#include "llsdserialize.h"