After reforking the post viewer64 viewer-release repository, I pulled in all the changes from my viewer64 based viewe64-media-update repository. This repository is the canonical one going forwards

Fri, 19 Jan 2018 15:37:27 -0800

author
callum_linden
date
Fri, 19 Jan 2018 15:37:27 -0800
changeset 55064
5bdd7af0fe93
parent 54608
01ae1b7e0b89
parent 55063
9d1fb4afa637
child 55065
ef56b3cc4359

After reforking the post viewer64 viewer-release repository, I pulled in all the changes from my viewer64 based viewe64-media-update repository. This repository is the canonical one going forwards

indra/llplugin/llplugincookiestore.cpp file | annotate | diff | revisions
indra/llplugin/llplugincookiestore.h file | annotate | diff | revisions
indra/llplugin/tests/llplugincookiestore_test.cpp file | annotate | diff | revisions
     1.1 --- a/autobuild.xml	Tue Jan 16 14:14:27 2018 -0500
     1.2 +++ b/autobuild.xml	Fri Jan 19 15:37:27 2018 -0800
     1.3 @@ -556,9 +556,9 @@
     1.4              <key>archive</key>
     1.5              <map>
     1.6                <key>hash</key>
     1.7 -              <string>bbdea742f2a89bcd6360e61e01d6be93</string>
     1.8 +              <string>a6f1637aaa4008e67bb08a6475fd3b45</string>
     1.9                <key>url</key>
    1.10 -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/8207/32592/dullahan-1.1.820_3.3071.1637.gcb6cf75-darwin64-508196.tar.bz2</string>
    1.11 +              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/12547/74441/dullahan-1.1.1012_3.3239.1723.g071d1c1-darwin64-511947.tar.bz2</string>
    1.12              </map>
    1.13              <key>name</key>
    1.14              <string>darwin64</string>
    1.15 @@ -568,9 +568,9 @@
    1.16              <key>archive</key>
    1.17              <map>
    1.18                <key>hash</key>
    1.19 -              <string>31e11a74e0d3f1e5e4036cb5fea8d944</string>
    1.20 +              <string>0cba7891453cb9d0dca9ea86eef684c2</string>
    1.21                <key>url</key>
    1.22 -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/8209/32599/dullahan-1.1.820_3.3071.1634.g9cc59c8-windows-508196.tar.bz2</string>
    1.23 +              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/12549/74448/dullahan-1.1.1012_3.3239.1723.g071d1c1-windows-511947.tar.bz2</string>
    1.24              </map>
    1.25              <key>name</key>
    1.26              <string>windows</string>
    1.27 @@ -580,16 +580,16 @@
    1.28              <key>archive</key>
    1.29              <map>
    1.30                <key>hash</key>
    1.31 -              <string>f965d244e7921c06ee79b68a4abcea3b</string>
    1.32 +              <string>0615f3e0cd3f4086efdff52da85fe84d</string>
    1.33                <key>url</key>
    1.34 -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/8208/32602/dullahan-1.1.820_3.3071.1634.g9cc59c8-windows64-508196.tar.bz2</string>
    1.35 +              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/12548/74451/dullahan-1.1.1012_3.3239.1723.g071d1c1-windows64-511947.tar.bz2</string>
    1.36              </map>
    1.37              <key>name</key>
    1.38              <string>windows64</string>
    1.39            </map>
    1.40          </map>
    1.41          <key>version</key>
    1.42 -        <string>1.1.820_3.3071.1634.g9cc59c8</string>
    1.43 +        <string>1.1.1012_3.3239.1723.g071d1c1</string>
    1.44        </map>
    1.45        <key>elfio</key>
    1.46        <map>
    1.47 @@ -3287,9 +3287,9 @@
    1.48              <key>archive</key>
    1.49              <map>
    1.50                <key>hash</key>
    1.51 -              <string>c5e6d9440e3a4a12102dd2bbb703963e</string>
    1.52 +              <string>e5635e173c75dc0675b48ab5f5e4868b</string>
    1.53                <key>url</key>
    1.54 -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/2225/4736/vlc_bin-2.2.4.502214-darwin64-502214.tar.bz2</string>
    1.55 +              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/12143/71451/vlc_bin-2.2.8.511703-darwin64-511703.tar.bz2</string>
    1.56              </map>
    1.57              <key>name</key>
    1.58              <string>darwin64</string>
    1.59 @@ -3311,9 +3311,9 @@
    1.60              <key>archive</key>
    1.61              <map>
    1.62                <key>hash</key>
    1.63 -              <string>dc37f7cc77a62891bb9ae46c9e19f95e</string>
    1.64 +              <string>add560654a53cb1c554044a4fac3c718</string>
    1.65                <key>url</key>
    1.66 -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/1219/2834/vlc_bin-2.2.4.501207-windows-501207.tar.bz2</string>
    1.67 +              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/12144/71458/vlc_bin-2.2.8.511703-windows-511703.tar.bz2</string>
    1.68              </map>
    1.69              <key>name</key>
    1.70              <string>windows</string>
    1.71 @@ -3323,16 +3323,16 @@
    1.72              <key>archive</key>
    1.73              <map>
    1.74                <key>hash</key>
    1.75 -              <string>148ee599afeba9794de14ca433389504</string>
    1.76 +              <string>94bf04b49acc1e1bf2c06e2232f8a083</string>
    1.77                <key>url</key>
    1.78 -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/1218/2829/vlc_bin-2.2.4.501207-windows64-501207.tar.bz2</string>
    1.79 +              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/12145/71463/vlc_bin-2.2.8.511703-windows64-511703.tar.bz2</string>
    1.80              </map>
    1.81              <key>name</key>
    1.82              <string>windows64</string>
    1.83            </map>
    1.84          </map>
    1.85          <key>version</key>
    1.86 -        <string>2.2.4.502214</string>
    1.87 +        <string>2.2.8.511703</string>
    1.88        </map>
    1.89        <key>xmlrpc-epi</key>
    1.90        <map>
     2.1 --- a/indra/llplugin/CMakeLists.txt	Tue Jan 16 14:14:27 2018 -0500
     2.2 +++ b/indra/llplugin/CMakeLists.txt	Fri Jan 19 15:37:27 2018 -0800
     2.3 @@ -29,7 +29,6 @@
     2.4  
     2.5  set(llplugin_SOURCE_FILES
     2.6      llpluginclassmedia.cpp
     2.7 -    llplugincookiestore.cpp
     2.8      llplugininstance.cpp
     2.9      llpluginmessage.cpp
    2.10      llpluginmessagepipe.cpp
    2.11 @@ -43,7 +42,6 @@
    2.12  
    2.13      llpluginclassmedia.h
    2.14      llpluginclassmediaowner.h
    2.15 -    llplugincookiestore.h
    2.16      llplugininstance.h
    2.17      llpluginmessage.h
    2.18      llpluginmessageclasses.h
    2.19 @@ -70,20 +68,3 @@
    2.20  
    2.21  add_subdirectory(slplugin)
    2.22  
    2.23 -# Add tests
    2.24 -if (LL_TESTS)
    2.25 -    include(LLAddBuildTest)
    2.26 -    # UNIT TESTS
    2.27 -    SET(llplugin_TEST_SOURCE_FILES
    2.28 -      llplugincookiestore.cpp
    2.29 -      )
    2.30 -
    2.31 -    # llplugincookiestore has a dependency on curl, so we need to link the curl library into the test.
    2.32 -    set_source_files_properties(
    2.33 -      llplugincookiestore.cpp
    2.34 -      PROPERTIES
    2.35 -        LL_TEST_ADDITIONAL_LIBRARIES "${CURL_LIBRARIES};${NGHTTP2_LIBRARIES}"
    2.36 -      )
    2.37 -
    2.38 -    LL_ADD_PROJECT_UNIT_TESTS(llplugin "${llplugin_TEST_SOURCE_FILES}")
    2.39 -endif (LL_TESTS)
     3.1 --- a/indra/llplugin/llpluginclassmedia.cpp	Tue Jan 16 14:14:27 2018 -0500
     3.2 +++ b/indra/llplugin/llpluginclassmedia.cpp	Fri Jan 19 15:37:27 2018 -0800
     3.3 @@ -792,15 +792,22 @@
     3.4  	return result;
     3.5  }
     3.6  
     3.7 -void LLPluginClassMedia::sendPickFileResponse(const std::string &file)
     3.8 +void LLPluginClassMedia::sendPickFileResponse(const std::vector<std::string> files)
     3.9  {
    3.10  	LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "pick_file_response");
    3.11 -	message.setValue("file", file);
    3.12  	if(mPlugin && mPlugin->isBlocked())
    3.13  	{
    3.14  		// If the plugin sent a blocking pick-file request, the response should unblock it.
    3.15  		message.setValueBoolean("blocking_response", true);
    3.16  	}
    3.17 +
    3.18 +	LLSD file_list = LLSD::emptyArray();
    3.19 +	for (std::vector<std::string>::const_iterator in_iter = files.begin(); in_iter != files.end(); ++in_iter)
    3.20 +	{
    3.21 +		file_list.append(LLSD::String(*in_iter));
    3.22 +	}
    3.23 +	message.setValueLLSD("file_list", file_list);
    3.24 +
    3.25  	sendMessage(message);
    3.26  }
    3.27  
    3.28 @@ -1090,6 +1097,7 @@
    3.29  		}
    3.30  		else if(message_name == "pick_file")
    3.31  		{
    3.32 +			mIsMultipleFilePick = message.getValueBoolean("multiple_files");
    3.33  			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_PICK_FILE_REQUEST);
    3.34  		}
    3.35  		else if(message_name == "auth_request")
    3.36 @@ -1151,7 +1159,12 @@
    3.37  		{
    3.38  			mClickURL = message.getValue("uri");
    3.39  			mClickTarget = message.getValue("target");
    3.40 -			mClickUUID = message.getValue("uuid");
    3.41 +
    3.42 +			// need a link to have a UUID that identifies it to a system further
    3.43 +			// upstream - plugin could make it but we have access to LLUUID here
    3.44 +			// so why don't we use it
    3.45 +			mClickUUID = LLUUID::generateNewID().asString();
    3.46 +
    3.47  			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLICK_LINK_HREF);
    3.48  		}
    3.49  		else if(message_name == "click_nofollow")
    3.50 @@ -1166,13 +1179,6 @@
    3.51  			mStatusCode = message.getValueS32("status_code");
    3.52  			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_NAVIGATE_ERROR_PAGE);
    3.53  		}
    3.54 -		else if(message_name == "cookie_set")
    3.55 -		{
    3.56 -			if(mOwner)
    3.57 -			{
    3.58 -				mOwner->handleCookieSet(this, message.getValue("cookie"));
    3.59 -			}
    3.60 -		}
    3.61  		else if(message_name == "close_request")
    3.62  		{
    3.63  			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLOSE_REQUEST);
    3.64 @@ -1287,16 +1293,9 @@
    3.65  	sendMessage(message);
    3.66  }
    3.67  
    3.68 -void LLPluginClassMedia::set_cookies(const std::string &cookies)
    3.69 +void LLPluginClassMedia::cookies_enabled(bool enable)
    3.70  {
    3.71 -	LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "set_cookies");
    3.72 -	message.setValue("cookies", cookies);
    3.73 -	sendMessage(message);
    3.74 -}
    3.75 -
    3.76 -void LLPluginClassMedia::enable_cookies(bool enable)
    3.77 -{
    3.78 -	LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "enable_cookies");
    3.79 +	LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "cookies_enabled");
    3.80  	message.setValueBoolean("enable", enable);
    3.81  	sendMessage(message);
    3.82  }
     4.1 --- a/indra/llplugin/llpluginclassmedia.h	Tue Jan 16 14:14:27 2018 -0500
     4.2 +++ b/indra/llplugin/llpluginclassmedia.h	Fri Jan 19 15:37:27 2018 -0800
     4.3 @@ -176,7 +176,7 @@
     4.4  	
     4.5  	F64 getCPUUsage();
     4.6  	
     4.7 -	void sendPickFileResponse(const std::string &file);
     4.8 +	void sendPickFileResponse(const std::vector<std::string> files);
     4.9  
    4.10  	void sendAuthResponse(bool ok, const std::string &username, const std::string &password);
    4.11  
    4.12 @@ -210,7 +210,7 @@
    4.13  	void clear_cache();
    4.14  	void clear_cookies();
    4.15  	void set_cookies(const std::string &cookies);
    4.16 -	void enable_cookies(bool enable);
    4.17 +	void cookies_enabled(bool enable);
    4.18  	void proxy_setup(bool enable, const std::string &host = LLStringUtil::null, int port = 0);
    4.19  	void browse_stop();
    4.20  	void browse_reload(bool ignore_cache = false);
    4.21 @@ -277,6 +277,9 @@
    4.22  	std::string	getAuthURL() const { return mAuthURL; };
    4.23  	std::string	getAuthRealm() const { return mAuthRealm; };
    4.24  
    4.25 +	// These are valid during MEDIA_EVENT_PICK_FILE_REQUEST
    4.26 +	bool getIsMultipleFilePick() const { return mIsMultipleFilePick; }
    4.27 +
    4.28  	// These are valid during MEDIA_EVENT_LINK_HOVERED
    4.29  	std::string	getHoverText() const { return mHoverText; };
    4.30  	std::string	getHoverLink() const { return mHoverLink; };
    4.31 @@ -435,6 +438,7 @@
    4.32  	std::string		mHoverText;
    4.33  	std::string		mHoverLink;
    4.34  	std::string     mFileDownloadFilename;
    4.35 +	bool			mIsMultipleFilePick;
    4.36  	
    4.37  	/////////////////////////////////////////
    4.38  	// media_time class
     5.1 --- a/indra/llplugin/llpluginclassmediaowner.h	Tue Jan 16 14:14:27 2018 -0500
     5.2 +++ b/indra/llplugin/llpluginclassmediaowner.h	Fri Jan 19 15:37:27 2018 -0800
     5.3 @@ -1,4 +1,4 @@
     5.4 -/** 
     5.5 +/**
     5.6   * @file llpluginclassmediaowner.h
     5.7   * @brief LLPluginClassMedia handles interaction with a plugin which knows about the "media" message class.
     5.8   *
     5.9 @@ -6,21 +6,21 @@
    5.10   * $LicenseInfo:firstyear=2008&license=viewerlgpl$
    5.11   * Second Life Viewer Source Code
    5.12   * Copyright (C) 2010, Linden Research, Inc.
    5.13 - * 
    5.14 + *
    5.15   * This library is free software; you can redistribute it and/or
    5.16   * modify it under the terms of the GNU Lesser General Public
    5.17   * License as published by the Free Software Foundation;
    5.18   * version 2.1 of the License only.
    5.19 - * 
    5.20 + *
    5.21   * This library is distributed in the hope that it will be useful,
    5.22   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.23   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    5.24   * Lesser General Public License for more details.
    5.25 - * 
    5.26 + *
    5.27   * You should have received a copy of the GNU Lesser General Public
    5.28   * License along with this library; if not, write to the Free Software
    5.29   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
    5.30 - * 
    5.31 + *
    5.32   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
    5.33   * $/LicenseInfo$
    5.34   * @endcond
    5.35 @@ -34,18 +34,17 @@
    5.36  #include <queue>
    5.37  
    5.38  class LLPluginClassMedia;
    5.39 -class LLPluginCookieStore;
    5.40  
    5.41  class LLPluginClassMediaOwner
    5.42  {
    5.43  public:
    5.44  	typedef enum
    5.45  	{
    5.46 -		MEDIA_EVENT_CONTENT_UPDATED,		// contents/dirty rect have updated 
    5.47 +		MEDIA_EVENT_CONTENT_UPDATED,		// contents/dirty rect have updated
    5.48  		MEDIA_EVENT_TIME_DURATION_UPDATED,	// current time and/or duration have updated
    5.49  		MEDIA_EVENT_SIZE_CHANGED,			// media size has changed
    5.50  		MEDIA_EVENT_CURSOR_CHANGED,			// plugin has requested a cursor change
    5.51 -		
    5.52 +
    5.53  		MEDIA_EVENT_NAVIGATE_BEGIN,			// browser has begun navigation
    5.54  		MEDIA_EVENT_NAVIGATE_COMPLETE,		// browser has finished navigation
    5.55  		MEDIA_EVENT_PROGRESS_UPDATED,		// browser has updated loading progress
    5.56 @@ -58,8 +57,8 @@
    5.57  		MEDIA_EVENT_CLOSE_REQUEST,			// The plugin requested its window be closed (currently hooked up to javascript window.close in webkit)
    5.58  		MEDIA_EVENT_PICK_FILE_REQUEST,		// The plugin wants the user to pick a file
    5.59  		MEDIA_EVENT_GEOMETRY_CHANGE,		// The plugin requested its window geometry be changed (per the javascript window interface)
    5.60 -	
    5.61 -		MEDIA_EVENT_PLUGIN_FAILED_LAUNCH,	// The plugin failed to launch 
    5.62 +
    5.63 +		MEDIA_EVENT_PLUGIN_FAILED_LAUNCH,	// The plugin failed to launch
    5.64  		MEDIA_EVENT_PLUGIN_FAILED,			// The plugin died unexpectedly
    5.65  
    5.66  		MEDIA_EVENT_AUTH_REQUEST,			// The plugin wants to display an auth dialog
    5.67 @@ -69,9 +68,9 @@
    5.68  		MEDIA_EVENT_DEBUG_MESSAGE,			// plugin sending back debug information for host to process
    5.69  
    5.70  		MEDIA_EVENT_LINK_HOVERED			// Got a "link hovered" event from the plugin
    5.71 -		
    5.72 +
    5.73  	} EMediaEvent;
    5.74 -	
    5.75 +
    5.76  	typedef enum
    5.77  	{
    5.78  		MEDIA_NONE,			// Uninitialized -- no useful state
    5.79 @@ -81,12 +80,11 @@
    5.80  		MEDIA_PLAYING,		// playing (only for time-based media)
    5.81  		MEDIA_PAUSED,		// paused (only for time-based media)
    5.82  		MEDIA_DONE			// finished playing (only for time-based media)
    5.83 -	
    5.84 +
    5.85  	} EMediaStatus;
    5.86 -	
    5.87 +
    5.88  	virtual ~LLPluginClassMediaOwner() {};
    5.89  	virtual void handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent /*event*/) {};
    5.90 -	virtual void handleCookieSet(LLPluginClassMedia* /*self*/, const std::string &/*cookie*/) {};
    5.91  };
    5.92  
    5.93  #endif // LL_LLPLUGINCLASSMEDIAOWNER_H
     6.1 --- a/indra/llplugin/llplugincookiestore.cpp	Tue Jan 16 14:14:27 2018 -0500
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,689 +0,0 @@
     6.4 -/** 
     6.5 - * @file llplugincookiestore.cpp
     6.6 - * @brief LLPluginCookieStore provides central storage for http cookies used by plugins
     6.7 - *
     6.8 - * @cond
     6.9 - * $LicenseInfo:firstyear=2010&license=viewerlgpl$
    6.10 - * Second Life Viewer Source Code
    6.11 - * Copyright (C) 2010, Linden Research, Inc.
    6.12 - * 
    6.13 - * This library is free software; you can redistribute it and/or
    6.14 - * modify it under the terms of the GNU Lesser General Public
    6.15 - * License as published by the Free Software Foundation;
    6.16 - * version 2.1 of the License only.
    6.17 - * 
    6.18 - * This library is distributed in the hope that it will be useful,
    6.19 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.20 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    6.21 - * Lesser General Public License for more details.
    6.22 - * 
    6.23 - * You should have received a copy of the GNU Lesser General Public
    6.24 - * License along with this library; if not, write to the Free Software
    6.25 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
    6.26 - * 
    6.27 - * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
    6.28 - * $/LicenseInfo$
    6.29 - * @endcond
    6.30 - */
    6.31 -
    6.32 -#include "linden_common.h"
    6.33 -#include "llstl.h"
    6.34 -#include "indra_constants.h"
    6.35 -
    6.36 -#include "llplugincookiestore.h"
    6.37 -#include <iostream>
    6.38 -
    6.39 -// for curl_getdate() (apparently parsing RFC 1123 dates is hard)
    6.40 -#include <curl/curl.h>
    6.41 -
    6.42 -LLPluginCookieStore::LLPluginCookieStore():
    6.43 -	mHasChangedCookies(false)
    6.44 -{
    6.45 -}
    6.46 -
    6.47 -
    6.48 -LLPluginCookieStore::~LLPluginCookieStore()
    6.49 -{
    6.50 -	clearCookies();
    6.51 -}
    6.52 -
    6.53 -
    6.54 -LLPluginCookieStore::Cookie::Cookie(const std::string &s, std::string::size_type cookie_start, std::string::size_type cookie_end):
    6.55 -	mCookie(s, cookie_start, cookie_end - cookie_start),
    6.56 -	mNameStart(0), mNameEnd(0),
    6.57 -	mValueStart(0), mValueEnd(0),
    6.58 -	mDomainStart(0), mDomainEnd(0),
    6.59 -	mPathStart(0), mPathEnd(0),
    6.60 -	mDead(false), mChanged(true)
    6.61 -{
    6.62 -}
    6.63 -
    6.64 -LLPluginCookieStore::Cookie *LLPluginCookieStore::Cookie::createFromString(const std::string &s, std::string::size_type cookie_start, std::string::size_type cookie_end, const std::string &host)
    6.65 -{
    6.66 -	Cookie *result = new Cookie(s, cookie_start, cookie_end);
    6.67 -
    6.68 -	if(!result->parse(host))
    6.69 -	{
    6.70 -		delete result;
    6.71 -		result = NULL;
    6.72 -	}
    6.73 -	
    6.74 -	return result;
    6.75 -}
    6.76 -
    6.77 -std::string LLPluginCookieStore::Cookie::getKey() const
    6.78 -{
    6.79 -	std::string result;
    6.80 -	if(mDomainEnd > mDomainStart)
    6.81 -	{
    6.82 -		result += mCookie.substr(mDomainStart, mDomainEnd - mDomainStart);
    6.83 -	}
    6.84 -	result += ';';
    6.85 -	if(mPathEnd > mPathStart)
    6.86 -	{
    6.87 -		result += mCookie.substr(mPathStart, mPathEnd - mPathStart);
    6.88 -	}
    6.89 -	result += ';';
    6.90 -	result += mCookie.substr(mNameStart, mNameEnd - mNameStart);
    6.91 -	return result;
    6.92 -}
    6.93 -
    6.94 -std::string LLPluginCookieStore::Cookie::getDomain() const
    6.95 -{
    6.96 -	std::string result;
    6.97 -	if(mDomainEnd > mDomainStart)
    6.98 -	{
    6.99 -		result += mCookie.substr(mDomainStart, mDomainEnd - mDomainStart);
   6.100 -	}
   6.101 -	return result;
   6.102 -}
   6.103 -
   6.104 -bool LLPluginCookieStore::Cookie::parse(const std::string &host)
   6.105 -{
   6.106 -	bool first_field = true;
   6.107 -
   6.108 -	std::string::size_type cookie_end = mCookie.size();
   6.109 -	std::string::size_type field_start = 0;
   6.110 -
   6.111 -	LL_DEBUGS("CookieStoreParse") << "parsing cookie: " << mCookie << LL_ENDL;
   6.112 -	while(field_start < cookie_end)
   6.113 -	{
   6.114 -		// Finding the start of the next field requires honoring special quoting rules
   6.115 -		// see the definition of 'quoted-string' in rfc2616 for details
   6.116 -		std::string::size_type next_field_start = findFieldEnd(field_start);
   6.117 -
   6.118 -		// The end of this field should not include the terminating ';' or any trailing whitespace
   6.119 -		std::string::size_type field_end = mCookie.find_last_not_of("; ", next_field_start);
   6.120 -		if(field_end == std::string::npos || field_end < field_start)
   6.121 -		{
   6.122 -			// This field was empty or all whitespace.  Set end = start so it shows as empty.
   6.123 -			field_end = field_start;
   6.124 -		}
   6.125 -		else if (field_end < next_field_start)
   6.126 -		{
   6.127 -			// we actually want the index of the char _after_ what 'last not of' found
   6.128 -			++field_end;
   6.129 -		}
   6.130 -		
   6.131 -		// find the start of the actual name (skip separator and possible whitespace)
   6.132 -		std::string::size_type name_start = mCookie.find_first_not_of("; ", field_start);
   6.133 -		if(name_start == std::string::npos || name_start > next_field_start)
   6.134 -		{
   6.135 -			// Again, nothing but whitespace.
   6.136 -			name_start = field_start;
   6.137 -		}
   6.138 -		
   6.139 -		// the name and value are separated by the first equals sign
   6.140 -		std::string::size_type name_value_sep = mCookie.find_first_of("=", name_start);
   6.141 -		if(name_value_sep == std::string::npos || name_value_sep > field_end)
   6.142 -		{
   6.143 -			// No separator found, so this is a field without an = 
   6.144 -			name_value_sep = field_end;
   6.145 -		}
   6.146 -		
   6.147 -		// the name end is before the name-value separator
   6.148 -		std::string::size_type name_end = mCookie.find_last_not_of("= ", name_value_sep);
   6.149 -		if(name_end == std::string::npos || name_end < name_start)
   6.150 -		{
   6.151 -			// I'm not sure how we'd hit this case... it seems like it would have to be an empty name.
   6.152 -			name_end = name_start;
   6.153 -		}
   6.154 -		else if (name_end < name_value_sep)
   6.155 -		{
   6.156 -			// we actually want the index of the char _after_ what 'last not of' found
   6.157 -			++name_end;
   6.158 -		}
   6.159 -		
   6.160 -		// Value is between the name-value sep and the end of the field.
   6.161 -		std::string::size_type value_start = mCookie.find_first_not_of("= ", name_value_sep);
   6.162 -		if(value_start == std::string::npos || value_start > field_end)
   6.163 -		{
   6.164 -			// All whitespace or empty value
   6.165 -			value_start = field_end;
   6.166 -		}
   6.167 -		std::string::size_type value_end = mCookie.find_last_not_of("; ", field_end);
   6.168 -		if(value_end == std::string::npos || value_end < value_start)
   6.169 -		{
   6.170 -			// All whitespace or empty value
   6.171 -			value_end = value_start;
   6.172 -		}
   6.173 -		else if (value_end < field_end)
   6.174 -		{
   6.175 -			// we actually want the index of the char _after_ what 'last not of' found
   6.176 -			++value_end;
   6.177 -		}
   6.178 -
   6.179 -		LL_DEBUGS("CookieStoreParse") 
   6.180 -			<< "    field name: \"" << mCookie.substr(name_start, name_end - name_start) 
   6.181 -			<< "\", value: \"" << mCookie.substr(value_start, value_end - value_start) << "\""
   6.182 -			<< LL_ENDL;
   6.183 -				
   6.184 -		// See whether this field is one we know
   6.185 -		if(first_field)
   6.186 -		{
   6.187 -			// The first field is the name=value pair
   6.188 -			mNameStart = name_start;
   6.189 -			mNameEnd = name_end;
   6.190 -			mValueStart = value_start;
   6.191 -			mValueEnd = value_end;
   6.192 -			first_field = false;
   6.193 -		}
   6.194 -		else
   6.195 -		{
   6.196 -			// Subsequent fields must come from the set in rfc2109
   6.197 -			if(matchName(name_start, name_end, "expires"))
   6.198 -			{
   6.199 -				std::string date_string(mCookie, value_start, value_end - value_start); 
   6.200 -				// If the cookie contains an "expires" field, it MUST contain a parsable date.
   6.201 -				
   6.202 -				// HACK: LLDate apparently can't PARSE an rfc1123-format date, even though it can GENERATE one.
   6.203 -				//  The curl function curl_getdate can do this, but I'm hesitant to unilaterally introduce a curl dependency in LLDate.
   6.204 -#if 1
   6.205 -				time_t date = curl_getdate(date_string.c_str(), NULL );
   6.206 -				mDate.secondsSinceEpoch((F64)date);
   6.207 -				LL_DEBUGS("CookieStoreParse") << "        expire date parsed to: " << mDate.asRFC1123() << LL_ENDL;
   6.208 -#else
   6.209 -				// This doesn't work (rfc1123-format dates cause it to fail)
   6.210 -				if(!mDate.fromString(date_string))
   6.211 -				{
   6.212 -					// Date failed to parse.
   6.213 -					LL_WARNS("CookieStoreParse") << "failed to parse cookie's expire date: " << date << LL_ENDL;
   6.214 -					return false;
   6.215 -				}
   6.216 -#endif
   6.217 -			}
   6.218 -			else if(matchName(name_start, name_end, "domain"))
   6.219 -			{
   6.220 -				mDomainStart = value_start;
   6.221 -				mDomainEnd = value_end;
   6.222 -			}
   6.223 -			else if(matchName(name_start, name_end, "path"))
   6.224 -			{
   6.225 -				mPathStart = value_start;
   6.226 -				mPathEnd = value_end;
   6.227 -			}
   6.228 -			else if(matchName(name_start, name_end, "max-age"))
   6.229 -			{
   6.230 -				// TODO: how should we handle this?
   6.231 -			}
   6.232 -			else if(matchName(name_start, name_end, "secure"))
   6.233 -			{
   6.234 -				// We don't care about the value of this field (yet)
   6.235 -			}
   6.236 -			else if(matchName(name_start, name_end, "version"))
   6.237 -			{
   6.238 -				// We don't care about the value of this field (yet)
   6.239 -			}
   6.240 -			else if(matchName(name_start, name_end, "comment"))
   6.241 -			{
   6.242 -				// We don't care about the value of this field (yet)
   6.243 -			}
   6.244 -			else if(matchName(name_start, name_end, "httponly"))
   6.245 -			{
   6.246 -				// We don't care about the value of this field (yet)
   6.247 -			}
   6.248 -			else
   6.249 -			{
   6.250 -				// An unknown field is a parse failure
   6.251 -				LL_WARNS("CookieStoreParse") << "unexpected field name: " << mCookie.substr(name_start, name_end - name_start) << LL_ENDL;
   6.252 -				return false;
   6.253 -			}
   6.254 -			
   6.255 -		}
   6.256 -
   6.257 -		
   6.258 -		// move on to the next field, skipping this field's separator and any leading whitespace
   6.259 -		field_start = mCookie.find_first_not_of("; ", next_field_start);
   6.260 -	}
   6.261 -		
   6.262 -	// The cookie MUST have a name
   6.263 -	if(mNameEnd <= mNameStart)
   6.264 -		return false;
   6.265 -	
   6.266 -	// If the cookie doesn't have a domain, add the current host as the domain.
   6.267 -	if(mDomainEnd <= mDomainStart)
   6.268 -	{
   6.269 -		if(host.empty())
   6.270 -		{
   6.271 -			// no domain and no current host -- this is a parse failure.
   6.272 -			return false;
   6.273 -		}
   6.274 -		
   6.275 -		// Figure out whether this cookie ended with a ";" or not...
   6.276 -		std::string::size_type last_char = mCookie.find_last_not_of(" ");
   6.277 -		if((last_char != std::string::npos) && (mCookie[last_char] != ';'))
   6.278 -		{
   6.279 -			mCookie += ";";
   6.280 -		}
   6.281 -		
   6.282 -		mCookie += " domain=";
   6.283 -		mDomainStart = mCookie.size();
   6.284 -		mCookie += host;
   6.285 -		mDomainEnd = mCookie.size();
   6.286 -		
   6.287 -		LL_DEBUGS("CookieStoreParse") << "added domain (" << mDomainStart << " to " << mDomainEnd << "), new cookie is: " << mCookie << LL_ENDL;
   6.288 -	}
   6.289 -
   6.290 -	// If the cookie doesn't have a path, add "/".
   6.291 -	if(mPathEnd <= mPathStart)
   6.292 -	{
   6.293 -		// Figure out whether this cookie ended with a ";" or not...
   6.294 -		std::string::size_type last_char = mCookie.find_last_not_of(" ");
   6.295 -		if((last_char != std::string::npos) && (mCookie[last_char] != ';'))
   6.296 -		{
   6.297 -			mCookie += ";";
   6.298 -		}
   6.299 -		
   6.300 -		mCookie += " path=";
   6.301 -		mPathStart = mCookie.size();
   6.302 -		mCookie += "/";
   6.303 -		mPathEnd = mCookie.size();
   6.304 -		
   6.305 -		LL_DEBUGS("CookieStoreParse") << "added path (" << mPathStart << " to " << mPathEnd << "), new cookie is: " << mCookie << LL_ENDL;
   6.306 -	}
   6.307 -	
   6.308 -	
   6.309 -	return true;
   6.310 -}
   6.311 -
   6.312 -std::string::size_type LLPluginCookieStore::Cookie::findFieldEnd(std::string::size_type start, std::string::size_type end)
   6.313 -{
   6.314 -	std::string::size_type result = start;
   6.315 -	
   6.316 -	if(end == std::string::npos)
   6.317 -		end = mCookie.size();
   6.318 -	
   6.319 -	bool in_quotes = false;
   6.320 -	for(; (result < end); result++)
   6.321 -	{
   6.322 -		switch(mCookie[result])
   6.323 -		{
   6.324 -			case '\\':
   6.325 -				if(in_quotes)
   6.326 -					result++; // The next character is backslash-quoted.  Skip over it.
   6.327 -			break;
   6.328 -			case '"':
   6.329 -				in_quotes = !in_quotes;
   6.330 -			break;
   6.331 -			case ';':
   6.332 -				if(!in_quotes)
   6.333 -					return result;
   6.334 -			break;
   6.335 -		}		
   6.336 -	}
   6.337 -	
   6.338 -	// If we got here, no ';' was found.
   6.339 -	return end;
   6.340 -}
   6.341 -
   6.342 -bool LLPluginCookieStore::Cookie::matchName(std::string::size_type start, std::string::size_type end, const char *name)
   6.343 -{
   6.344 -	// NOTE: this assumes 'name' is already in lowercase.  The code which uses it should be able to arrange this...
   6.345 -	
   6.346 -	while((start < end) && (*name != '\0'))
   6.347 -	{
   6.348 -		if(tolower(mCookie[start]) != *name)
   6.349 -			return false;
   6.350 -			
   6.351 -		start++;
   6.352 -		name++;
   6.353 -	}
   6.354 -	
   6.355 -	// iff both strings hit the end at the same time, they're equal.
   6.356 -	return ((start == end) && (*name == '\0'));
   6.357 -}
   6.358 -
   6.359 -std::string LLPluginCookieStore::getAllCookies()
   6.360 -{
   6.361 -	std::stringstream result;
   6.362 -	writeAllCookies(result);
   6.363 -	return result.str();
   6.364 -}
   6.365 -
   6.366 -void LLPluginCookieStore::writeAllCookies(std::ostream& s)
   6.367 -{
   6.368 -	cookie_map_t::iterator iter;
   6.369 -	for(iter = mCookies.begin(); iter != mCookies.end(); iter++)
   6.370 -	{
   6.371 -		// Don't return expired cookies
   6.372 -		if(!iter->second->isDead())
   6.373 -		{
   6.374 -			s << (iter->second->getCookie()) << "\n";
   6.375 -		}
   6.376 -	}
   6.377 -
   6.378 -}
   6.379 -
   6.380 -std::string LLPluginCookieStore::getPersistentCookies()
   6.381 -{
   6.382 -	std::stringstream result;
   6.383 -	writePersistentCookies(result);
   6.384 -	return result.str();
   6.385 -}
   6.386 -
   6.387 -void LLPluginCookieStore::writePersistentCookies(std::ostream& s)
   6.388 -{
   6.389 -	cookie_map_t::iterator iter;
   6.390 -	for(iter = mCookies.begin(); iter != mCookies.end(); iter++)
   6.391 -	{
   6.392 -		// Don't return expired cookies or session cookies
   6.393 -		if(!iter->second->isDead() && !iter->second->isSessionCookie())
   6.394 -		{
   6.395 -			s << iter->second->getCookie() << "\n";
   6.396 -		}
   6.397 -	}
   6.398 -}
   6.399 -
   6.400 -std::string LLPluginCookieStore::getChangedCookies(bool clear_changed)
   6.401 -{
   6.402 -	std::stringstream result;
   6.403 -	writeChangedCookies(result, clear_changed);
   6.404 -	
   6.405 -	return result.str();
   6.406 -}
   6.407 -
   6.408 -void LLPluginCookieStore::writeChangedCookies(std::ostream& s, bool clear_changed)
   6.409 -{
   6.410 -	if(mHasChangedCookies)
   6.411 -	{
   6.412 -		LL_DEBUGS() << "returning changed cookies: " << LL_ENDL;
   6.413 -		cookie_map_t::iterator iter;
   6.414 -		for(iter = mCookies.begin(); iter != mCookies.end(); )
   6.415 -		{
   6.416 -			cookie_map_t::iterator next = iter;
   6.417 -			next++;
   6.418 -			
   6.419 -			// Only return cookies marked as "changed"
   6.420 -			if(iter->second->isChanged())
   6.421 -			{
   6.422 -				s << iter->second->getCookie() << "\n";
   6.423 -
   6.424 -				LL_DEBUGS() << "    " << iter->second->getCookie() << LL_ENDL;
   6.425 -
   6.426 -				// If requested, clear the changed mark
   6.427 -				if(clear_changed)
   6.428 -				{
   6.429 -					if(iter->second->isDead())
   6.430 -					{
   6.431 -						// If this cookie was previously marked dead, it needs to be removed entirely.	
   6.432 -						delete iter->second;
   6.433 -						mCookies.erase(iter);
   6.434 -					}
   6.435 -					else
   6.436 -					{
   6.437 -						// Not dead, just mark as not changed.
   6.438 -						iter->second->setChanged(false);
   6.439 -					}
   6.440 -				}
   6.441 -			}
   6.442 -			
   6.443 -			iter = next;
   6.444 -		}
   6.445 -	}
   6.446 -	
   6.447 -	if(clear_changed)
   6.448 -		mHasChangedCookies = false;
   6.449 -}
   6.450 -
   6.451 -void LLPluginCookieStore::setAllCookies(const std::string &cookies, bool mark_changed)
   6.452 -{
   6.453 -	clearCookies();
   6.454 -	setCookies(cookies, mark_changed);
   6.455 -}
   6.456 -
   6.457 -void LLPluginCookieStore::readAllCookies(std::istream& s, bool mark_changed)
   6.458 -{
   6.459 -	clearCookies();
   6.460 -	readCookies(s, mark_changed);
   6.461 -}
   6.462 -	
   6.463 -void LLPluginCookieStore::setCookies(const std::string &cookies, bool mark_changed)
   6.464 -{
   6.465 -	std::string::size_type start = 0;
   6.466 -
   6.467 -	while(start != std::string::npos)
   6.468 -	{
   6.469 -		std::string::size_type end = cookies.find_first_of("\r\n", start);
   6.470 -		if(end > start)
   6.471 -		{
   6.472 -			// The line is non-empty.  Try to create a cookie from it.
   6.473 -			setOneCookie(cookies, start, end, mark_changed);
   6.474 -		}
   6.475 -		start = cookies.find_first_not_of("\r\n ", end);
   6.476 -	}
   6.477 -}
   6.478 -
   6.479 -void LLPluginCookieStore::setCookiesFromHost(const std::string &cookies, const std::string &host, bool mark_changed)
   6.480 -{
   6.481 -	std::string::size_type start = 0;
   6.482 -
   6.483 -	while(start != std::string::npos)
   6.484 -	{
   6.485 -		std::string::size_type end = cookies.find_first_of("\r\n", start);
   6.486 -		if(end > start)
   6.487 -		{
   6.488 -			// The line is non-empty.  Try to create a cookie from it.
   6.489 -			setOneCookie(cookies, start, end, mark_changed, host);
   6.490 -		}
   6.491 -		start = cookies.find_first_not_of("\r\n ", end);
   6.492 -	}
   6.493 -}
   6.494 -			
   6.495 -void LLPluginCookieStore::readCookies(std::istream& s, bool mark_changed)
   6.496 -{
   6.497 -	std::string line;
   6.498 -	while(s.good() && !s.eof())
   6.499 -	{
   6.500 -		std::getline(s, line);
   6.501 -		if(!line.empty())
   6.502 -		{
   6.503 -			// Try to create a cookie from this line.
   6.504 -			setOneCookie(line, 0, std::string::npos, mark_changed);
   6.505 -		}
   6.506 -	}
   6.507 -}
   6.508 -
   6.509 -std::string LLPluginCookieStore::quoteString(const std::string &s)
   6.510 -{
   6.511 -	std::stringstream result;
   6.512 -	
   6.513 -	result << '"';
   6.514 -	
   6.515 -	for(std::string::size_type i = 0; i < s.size(); ++i)
   6.516 -	{
   6.517 -		char c = s[i];
   6.518 -		switch(c)
   6.519 -		{
   6.520 -			// All these separators need to be quoted in HTTP headers, according to section 2.2 of rfc 2616:
   6.521 -			case '(': case ')': case '<': case '>': case '@':
   6.522 -			case ',': case ';': case ':': case '\\': case '"':
   6.523 -			case '/': case '[': case ']': case '?': case '=':
   6.524 -			case '{': case '}':	case ' ': case '\t':
   6.525 -				result << '\\';
   6.526 -			break;
   6.527 -		}
   6.528 -		
   6.529 -		result << c;
   6.530 -	}
   6.531 -	
   6.532 -	result << '"';
   6.533 -	
   6.534 -	return result.str();
   6.535 -}
   6.536 -
   6.537 -std::string LLPluginCookieStore::unquoteString(const std::string &s)
   6.538 -{
   6.539 -	std::stringstream result;
   6.540 -	
   6.541 -	bool in_quotes = false;
   6.542 -	
   6.543 -	for(std::string::size_type i = 0; i < s.size(); ++i)
   6.544 -	{
   6.545 -		char c = s[i];
   6.546 -		switch(c)
   6.547 -		{
   6.548 -			case '\\':
   6.549 -				if(in_quotes)
   6.550 -				{
   6.551 -					// The next character is backslash-quoted.  Pass it through untouched.
   6.552 -					++i; 
   6.553 -					if(i < s.size())
   6.554 -					{
   6.555 -						result << s[i];
   6.556 -					}
   6.557 -					continue;
   6.558 -				}
   6.559 -			break;
   6.560 -			case '"':
   6.561 -				in_quotes = !in_quotes;
   6.562 -				continue;
   6.563 -			break;
   6.564 -		}
   6.565 -		
   6.566 -		result << c;
   6.567 -	}
   6.568 -	
   6.569 -	return result.str();
   6.570 -}
   6.571 -
   6.572 -// The flow for deleting a cookie is non-obvious enough that I should call it out here...
   6.573 -// Deleting a cookie is done by setting a cookie with the same name, path, and domain, but with an expire timestamp in the past.
   6.574 -// (This is exactly how a web server tells a browser to delete a cookie.)
   6.575 -// When deleting with mark_changed set to true, this replaces the existing cookie in the list with an entry that's marked both dead and changed.
   6.576 -// Some time later when writeChangedCookies() is called with clear_changed set to true, the dead cookie is deleted from the list after being returned, so that the
   6.577 -// delete operation (in the form of the expired cookie) is passed along.
   6.578 -void LLPluginCookieStore::setOneCookie(const std::string &s, std::string::size_type cookie_start, std::string::size_type cookie_end, bool mark_changed, const std::string &host)
   6.579 -{
   6.580 -	Cookie *cookie = Cookie::createFromString(s, cookie_start, cookie_end, host);
   6.581 -	if(cookie)
   6.582 -	{
   6.583 -		LL_DEBUGS("CookieStoreUpdate") << "setting cookie: " << cookie->getCookie() << LL_ENDL;
   6.584 -		
   6.585 -		// Create a key for this cookie
   6.586 -		std::string key = cookie->getKey();
   6.587 -		
   6.588 -		// Check to see whether this cookie should have expired
   6.589 -		if(!cookie->isSessionCookie() && (cookie->getDate() < LLDate::now()))
   6.590 -		{
   6.591 -			// This cookie has expired.
   6.592 -			if(mark_changed)
   6.593 -			{
   6.594 -				// If we're marking cookies as changed, we should keep it anyway since we'll need to send it out with deltas.
   6.595 -				cookie->setDead(true);
   6.596 -				LL_DEBUGS("CookieStoreUpdate") << "    marking dead" << LL_ENDL;
   6.597 -			}
   6.598 -			else
   6.599 -			{
   6.600 -				// If we're not marking cookies as changed, we don't need to keep this cookie at all.
   6.601 -				// If the cookie was already in the list, delete it.
   6.602 -				removeCookie(key);
   6.603 -
   6.604 -				delete cookie;
   6.605 -				cookie = NULL;
   6.606 -
   6.607 -				LL_DEBUGS("CookieStoreUpdate") << "    removing" << LL_ENDL;
   6.608 -			}
   6.609 -		}
   6.610 -		
   6.611 -		if(cookie)
   6.612 -		{
   6.613 -			// If it already exists in the map, replace it.
   6.614 -			cookie_map_t::iterator iter = mCookies.find(key);
   6.615 -			if(iter != mCookies.end())
   6.616 -			{
   6.617 -				if(iter->second->getCookie() == cookie->getCookie())
   6.618 -				{
   6.619 -					// The new cookie is identical to the old -- don't mark as changed.
   6.620 -					// Just leave the old one in the map.
   6.621 -					delete cookie;
   6.622 -					cookie = NULL;
   6.623 -
   6.624 -					LL_DEBUGS("CookieStoreUpdate") << "    unchanged" << LL_ENDL;
   6.625 -				}
   6.626 -				else
   6.627 -				{
   6.628 -					// A matching cookie was already in the map.  Replace it.
   6.629 -					delete iter->second;
   6.630 -					iter->second = cookie;
   6.631 -					
   6.632 -					cookie->setChanged(mark_changed);
   6.633 -					if(mark_changed)
   6.634 -						mHasChangedCookies = true;
   6.635 -
   6.636 -					LL_DEBUGS("CookieStoreUpdate") << "    replacing" << LL_ENDL;
   6.637 -				}
   6.638 -			}
   6.639 -			else
   6.640 -			{
   6.641 -				// The cookie wasn't in the map.  Insert it.
   6.642 -				mCookies.insert(std::make_pair(key, cookie));
   6.643 -				
   6.644 -				cookie->setChanged(mark_changed);
   6.645 -				if(mark_changed)
   6.646 -					mHasChangedCookies = true;
   6.647 -
   6.648 -				LL_DEBUGS("CookieStoreUpdate") << "    adding" << LL_ENDL;
   6.649 -			}
   6.650 -		}
   6.651 -	}
   6.652 -	else
   6.653 -	{
   6.654 -		LL_WARNS("CookieStoreUpdate") << "failed to parse cookie: " << s.substr(cookie_start, cookie_end - cookie_start) << LL_ENDL;
   6.655 -	}
   6.656 -
   6.657 -}
   6.658 -
   6.659 -void LLPluginCookieStore::clearCookies()
   6.660 -{
   6.661 -	std::for_each(mCookies.begin(), mCookies.end(), DeletePairedPointer());
   6.662 -	mCookies.clear();
   6.663 -}
   6.664 -
   6.665 -void LLPluginCookieStore::removeCookie(const std::string &key)
   6.666 -{
   6.667 -	cookie_map_t::iterator iter = mCookies.find(key);
   6.668 -	if(iter != mCookies.end())
   6.669 -	{
   6.670 -		delete iter->second;
   6.671 -		mCookies.erase(iter);
   6.672 -	}
   6.673 -}
   6.674 -
   6.675 -void LLPluginCookieStore::removeCookiesByDomain(const std::string &domain)
   6.676 -{
   6.677 -	cookie_map_t::iterator iter = mCookies.begin();
   6.678 -	while(iter != mCookies.end())
   6.679 -	{ 
   6.680 -		if(iter->second->getDomain() == domain)
   6.681 -		{
   6.682 -            cookie_map_t::iterator doErase = iter;
   6.683 -            iter++;
   6.684 -			delete doErase->second;
   6.685 -			mCookies.erase(doErase);
   6.686 -		}
   6.687 -        else
   6.688 -        {
   6.689 -            iter++;
   6.690 -        }
   6.691 -	}
   6.692 -}
     7.1 --- a/indra/llplugin/llplugincookiestore.h	Tue Jan 16 14:14:27 2018 -0500
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,123 +0,0 @@
     7.4 -/** 
     7.5 - * @file llplugincookiestore.h
     7.6 - * @brief LLPluginCookieStore provides central storage for http cookies used by plugins
     7.7 - *
     7.8 - * @cond
     7.9 - * $LicenseInfo:firstyear=2010&license=viewerlgpl$
    7.10 - * Second Life Viewer Source Code
    7.11 - * Copyright (C) 2010, Linden Research, Inc.
    7.12 - * 
    7.13 - * This library is free software; you can redistribute it and/or
    7.14 - * modify it under the terms of the GNU Lesser General Public
    7.15 - * License as published by the Free Software Foundation;
    7.16 - * version 2.1 of the License only.
    7.17 - * 
    7.18 - * This library is distributed in the hope that it will be useful,
    7.19 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.20 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    7.21 - * Lesser General Public License for more details.
    7.22 - * 
    7.23 - * You should have received a copy of the GNU Lesser General Public
    7.24 - * License along with this library; if not, write to the Free Software
    7.25 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
    7.26 - * 
    7.27 - * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
    7.28 - * $/LicenseInfo$
    7.29 - * @endcond
    7.30 - */
    7.31 -
    7.32 -#ifndef LL_LLPLUGINCOOKIESTORE_H
    7.33 -#define LL_LLPLUGINCOOKIESTORE_H
    7.34 -
    7.35 -#include "lldate.h"
    7.36 -#include <map>
    7.37 -#include <string>
    7.38 -#include <iostream>
    7.39 -
    7.40 -class LLPluginCookieStore
    7.41 -{
    7.42 -	LOG_CLASS(LLPluginCookieStore);
    7.43 -public:
    7.44 -	LLPluginCookieStore();
    7.45 -	~LLPluginCookieStore();
    7.46 -
    7.47 -	// gets all cookies currently in storage -- use when initializing a plugin
    7.48 -	std::string getAllCookies();
    7.49 -	void writeAllCookies(std::ostream& s);
    7.50 -	
    7.51 -	// gets only persistent cookies (i.e. not session cookies) -- use when writing cookies to a file
    7.52 -	std::string getPersistentCookies();
    7.53 -	void writePersistentCookies(std::ostream& s);
    7.54 -	
    7.55 -	// gets cookies which are marked as "changed" -- use when sending periodic updates to plugins
    7.56 -	std::string getChangedCookies(bool clear_changed = true);
    7.57 -	void writeChangedCookies(std::ostream& s, bool clear_changed = true);
    7.58 -	
    7.59 -	// (re)initializes internal data structures and bulk-sets cookies -- use when reading cookies from a file
    7.60 -	void setAllCookies(const std::string &cookies, bool mark_changed = false);
    7.61 -	void readAllCookies(std::istream& s, bool mark_changed = false);
    7.62 -	
    7.63 -	// sets one or more cookies (without reinitializing anything) -- use when receiving cookies from a plugin
    7.64 -	void setCookies(const std::string &cookies, bool mark_changed = true);
    7.65 -	void readCookies(std::istream& s, bool mark_changed = true);
    7.66 -
    7.67 -	// sets one or more cookies (without reinitializing anything), supplying a hostname the cookies came from -- use when setting a cookie manually
    7.68 -	void setCookiesFromHost(const std::string &cookies, const std::string &host, bool mark_changed = true);
    7.69 -
    7.70 -	// quote or unquote a string as per the definition of 'quoted-string' in rfc2616
    7.71 -	static std::string quoteString(const std::string &s);
    7.72 -	static std::string unquoteString(const std::string &s);
    7.73 -
    7.74 -	void removeCookiesByDomain(const std::string &domain);
    7.75 -	
    7.76 -private:
    7.77 -
    7.78 -	void setOneCookie(const std::string &s, std::string::size_type cookie_start, std::string::size_type cookie_end, bool mark_changed, const std::string &host = LLStringUtil::null);
    7.79 -
    7.80 -	class Cookie
    7.81 -	{
    7.82 -	public:
    7.83 -		static Cookie *createFromString(const std::string &s, std::string::size_type cookie_start = 0, std::string::size_type cookie_end = std::string::npos, const std::string &host = LLStringUtil::null);
    7.84 -		
    7.85 -		// Construct a string from the cookie that uniquely represents it, to be used as a key in a std::map.
    7.86 -		std::string getKey() const;
    7.87 -		std::string getDomain() const;
    7.88 -		
    7.89 -		const std::string &getCookie() const { return mCookie; };
    7.90 -		bool isSessionCookie() const { return mDate.isNull(); };
    7.91 -
    7.92 -		bool isDead() const { return mDead; };
    7.93 -		void setDead(bool dead) { mDead = dead; };
    7.94 -		
    7.95 -		bool isChanged() const { return mChanged; };
    7.96 -		void setChanged(bool changed) { mChanged = changed; };
    7.97 -
    7.98 -		const LLDate &getDate() const { return mDate; };
    7.99 -		
   7.100 -	private:
   7.101 -		Cookie(const std::string &s, std::string::size_type cookie_start = 0, std::string::size_type cookie_end = std::string::npos);
   7.102 -		bool parse(const std::string &host);
   7.103 -		std::string::size_type findFieldEnd(std::string::size_type start = 0, std::string::size_type end = std::string::npos);
   7.104 -		bool matchName(std::string::size_type start, std::string::size_type end, const char *name);
   7.105 -		
   7.106 -		std::string mCookie;	// The full cookie, in RFC 2109 string format
   7.107 -		LLDate mDate;			// The expiration date of the cookie.  For session cookies, this will be a null date (mDate.isNull() is true).
   7.108 -		// Start/end indices of various parts of the cookie string.  Stored as indices into the string to save space and time.
   7.109 -		std::string::size_type mNameStart, mNameEnd;
   7.110 -		std::string::size_type mValueStart, mValueEnd;
   7.111 -		std::string::size_type mDomainStart, mDomainEnd;
   7.112 -		std::string::size_type mPathStart, mPathEnd;
   7.113 -		bool mDead;
   7.114 -		bool mChanged;
   7.115 -	};
   7.116 -	
   7.117 -	typedef std::map<std::string, Cookie*> cookie_map_t;
   7.118 -	
   7.119 -	cookie_map_t mCookies;
   7.120 -	bool mHasChangedCookies;
   7.121 -	
   7.122 -	void clearCookies();
   7.123 -	void removeCookie(const std::string &key);
   7.124 -};
   7.125 -
   7.126 -#endif // LL_LLPLUGINCOOKIESTORE_H
     8.1 --- a/indra/llplugin/tests/llplugincookiestore_test.cpp	Tue Jan 16 14:14:27 2018 -0500
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,207 +0,0 @@
     8.4 -/** 
     8.5 - * @file llplugincookiestore_test.cpp
     8.6 - * @brief Unit tests for LLPluginCookieStore.
     8.7 - *
     8.8 - * @cond
     8.9 - * $LicenseInfo:firstyear=2010&license=viewerlgpl$
    8.10 - * Second Life Viewer Source Code
    8.11 - * Copyright (C) 2010, Linden Research, Inc.
    8.12 - * 
    8.13 - * This library is free software; you can redistribute it and/or
    8.14 - * modify it under the terms of the GNU Lesser General Public
    8.15 - * License as published by the Free Software Foundation;
    8.16 - * version 2.1 of the License only.
    8.17 - * 
    8.18 - * This library is distributed in the hope that it will be useful,
    8.19 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.20 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    8.21 - * Lesser General Public License for more details.
    8.22 - * 
    8.23 - * You should have received a copy of the GNU Lesser General Public
    8.24 - * License along with this library; if not, write to the Free Software
    8.25 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
    8.26 - * 
    8.27 - * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
    8.28 - * $/LicenseInfo$
    8.29 - * @endcond
    8.30 - */
    8.31 -
    8.32 -#include "linden_common.h"
    8.33 -#include <list>
    8.34 -#include "../test/lltut.h"
    8.35 -
    8.36 -#include "../llplugincookiestore.h"
    8.37 -
    8.38 -
    8.39 -namespace tut
    8.40 -{
    8.41 -	// Main Setup
    8.42 -	struct LLPluginCookieStoreFixture
    8.43 -	{
    8.44 -		LLPluginCookieStoreFixture()
    8.45 -		{
    8.46 -			// We need dates definitively in the past and the future to properly test cookie expiration.
    8.47 -			LLDate now = LLDate::now(); 
    8.48 -			LLDate past(now.secondsSinceEpoch() - (60.0 * 60.0 * 24.0));	// 1 day in the past
    8.49 -			LLDate future(now.secondsSinceEpoch() + (60.0 * 60.0 * 24.0));	// 1 day in the future
    8.50 -			
    8.51 -			mPastString = past.asRFC1123();
    8.52 -			mFutureString = future.asRFC1123();
    8.53 -		}
    8.54 -		
    8.55 -		std::string mPastString;
    8.56 -		std::string mFutureString;
    8.57 -		LLPluginCookieStore mCookieStore;
    8.58 -		
    8.59 -		// List of cookies used for validation
    8.60 -		std::list<std::string> mCookies;
    8.61 -		
    8.62 -		// This sets up mCookies from a string returned by one of the functions in LLPluginCookieStore
    8.63 -		void setCookies(const std::string &cookies)
    8.64 -		{
    8.65 -			mCookies.clear();
    8.66 -			std::string::size_type start = 0;
    8.67 -
    8.68 -			while(start != std::string::npos)
    8.69 -			{
    8.70 -				std::string::size_type end = cookies.find_first_of("\r\n", start);
    8.71 -				if(end > start)
    8.72 -				{
    8.73 -					std::string line(cookies, start, end - start);
    8.74 -					if(line.find_first_not_of("\r\n\t ") != std::string::npos)
    8.75 -					{
    8.76 -						// The line has some non-whitespace characters.  Save it to the list.
    8.77 -						mCookies.push_back(std::string(cookies, start, end - start));
    8.78 -					}
    8.79 -				}
    8.80 -				start = cookies.find_first_not_of("\r\n ", end);
    8.81 -			}
    8.82 -		}
    8.83 -		
    8.84 -		// This ensures that a cookie matching the one passed is in the list.
    8.85 -		void ensureCookie(const std::string &cookie)
    8.86 -		{
    8.87 -			std::list<std::string>::iterator iter;
    8.88 -			for(iter = mCookies.begin(); iter != mCookies.end(); iter++)
    8.89 -			{
    8.90 -				if(*iter == cookie)
    8.91 -				{
    8.92 -					// Found the cookie
    8.93 -					// TODO: this should do a smarter equality comparison on the two cookies, instead of just a string compare.
    8.94 -					return;
    8.95 -				}
    8.96 -			}
    8.97 -			
    8.98 -			// Didn't find this cookie
    8.99 -			std::string message = "cookie not found: ";
   8.100 -			message += cookie;
   8.101 -			ensure(message, false);
   8.102 -		}
   8.103 -		
   8.104 -		// This ensures that the number of cookies in the list matches what's expected.
   8.105 -		void ensureSize(const std::string &message, size_t size)
   8.106 -		{
   8.107 -			if(mCookies.size() != size)
   8.108 -			{
   8.109 -				std::stringstream full_message;
   8.110 -				
   8.111 -				full_message << message << " (expected " << size << ", actual " << mCookies.size() << ")";
   8.112 -				ensure(full_message.str(), false);
   8.113 -			}
   8.114 -		}
   8.115 -	};
   8.116 -	
   8.117 -	typedef test_group<LLPluginCookieStoreFixture> factory;
   8.118 -	typedef factory::object object;
   8.119 -	factory tf("LLPluginCookieStore");
   8.120 -
   8.121 -	// Tests
   8.122 -	template<> template<>
   8.123 -	void object::test<1>()
   8.124 -	{
   8.125 -		// Test 1: cookie uniqueness and update lists.
   8.126 -		// Valid, distinct cookies:
   8.127 -		
   8.128 -		std::string cookie01 = "cookieA=value; domain=example.com; path=/";
   8.129 -		std::string cookie02 = "cookieB=value; Domain=example.com; Path=/; Max-Age=10; Secure; Version=1; Comment=foo!; HTTPOnly"; // cookie with every supported field, in different cases.
   8.130 -		std::string cookie03 = "cookieA=value; domain=foo.example.com; path=/"; // different domain
   8.131 -		std::string cookie04 = "cookieA=value; domain=example.com; path=/bar/"; // different path
   8.132 -		std::string cookie05 = "cookieC; domain=example.com; path=/"; // empty value
   8.133 -		std::string cookie06 = "cookieD=value; domain=example.com; path=/; expires="; // different name, persistent cookie
   8.134 -		cookie06 += mFutureString;
   8.135 -		
   8.136 -		mCookieStore.setCookies(cookie01);
   8.137 -		mCookieStore.setCookies(cookie02);
   8.138 -		mCookieStore.setCookies(cookie03);
   8.139 -		mCookieStore.setCookies(cookie04);
   8.140 -		mCookieStore.setCookies(cookie05);
   8.141 -		mCookieStore.setCookies(cookie06);
   8.142 -		
   8.143 -		// Invalid cookies (these will get parse errors and not be added to the store)
   8.144 -
   8.145 -		std::string badcookie01 = "cookieD=value; domain=example.com; path=/; foo=bar"; // invalid field name
   8.146 -		std::string badcookie02 = "cookieE=value; path=/"; // no domain
   8.147 -
   8.148 -		mCookieStore.setCookies(badcookie01);
   8.149 -		mCookieStore.setCookies(badcookie02);
   8.150 -		
   8.151 -		// All cookies added so far should have been marked as "changed"
   8.152 -		setCookies(mCookieStore.getChangedCookies());
   8.153 -		ensureSize("count of changed cookies", 6);
   8.154 -		ensureCookie(cookie01);
   8.155 -		ensureCookie(cookie02);
   8.156 -		ensureCookie(cookie03);
   8.157 -		ensureCookie(cookie04);
   8.158 -		ensureCookie(cookie05);
   8.159 -		ensureCookie(cookie06);
   8.160 -		
   8.161 -		// Save off the current state of the cookie store (we'll restore it later)
   8.162 -		std::string savedCookies = mCookieStore.getAllCookies();
   8.163 -		
   8.164 -		// Test replacing cookies
   8.165 -		std::string cookie01a = "cookieA=newvalue; domain=example.com; path=/";	// updated value
   8.166 -		std::string cookie02a = "cookieB=newvalue; domain=example.com; path=/; expires="; // remove cookie (by setting an expire date in the past)
   8.167 -		cookie02a += mPastString;
   8.168 -		
   8.169 -		mCookieStore.setCookies(cookie01a);
   8.170 -		mCookieStore.setCookies(cookie02a);
   8.171 -
   8.172 -		// test for getting changed cookies
   8.173 -		setCookies(mCookieStore.getChangedCookies());
   8.174 -		ensureSize("count of updated cookies", 2);
   8.175 -		ensureCookie(cookie01a);
   8.176 -		ensureCookie(cookie02a);
   8.177 -		
   8.178 -		// and for the state of the store after getting changed cookies
   8.179 -		setCookies(mCookieStore.getAllCookies());
   8.180 -		ensureSize("count of valid cookies", 5);
   8.181 -		ensureCookie(cookie01a);
   8.182 -		ensureCookie(cookie03);
   8.183 -		ensureCookie(cookie04);
   8.184 -		ensureCookie(cookie05);
   8.185 -		ensureCookie(cookie06);
   8.186 -
   8.187 -		// Check that only the persistent cookie is returned here
   8.188 -		setCookies(mCookieStore.getPersistentCookies());
   8.189 -		ensureSize("count of persistent cookies", 1);
   8.190 -		ensureCookie(cookie06);
   8.191 -
   8.192 -		// Restore the cookie store to a previous state and verify
   8.193 -		mCookieStore.setAllCookies(savedCookies);
   8.194 -		
   8.195 -		// Since setAllCookies defaults to not marking cookies as changed, this list should be empty.
   8.196 -		setCookies(mCookieStore.getChangedCookies());
   8.197 -		ensureSize("count of changed cookies after restore", 0);
   8.198 -
   8.199 -		// Verify that the restore worked as it should have.
   8.200 -		setCookies(mCookieStore.getAllCookies());
   8.201 -		ensureSize("count of restored cookies", 6);
   8.202 -		ensureCookie(cookie01);
   8.203 -		ensureCookie(cookie02);
   8.204 -		ensureCookie(cookie03);
   8.205 -		ensureCookie(cookie04);
   8.206 -		ensureCookie(cookie05);
   8.207 -		ensureCookie(cookie06);
   8.208 -	}
   8.209 -
   8.210 -}
     9.1 --- a/indra/media_plugins/cef/media_plugin_cef.cpp	Tue Jan 16 14:14:27 2018 -0500
     9.2 +++ b/indra/media_plugins/cef/media_plugin_cef.cpp	Fri Jan 19 15:37:27 2018 -0800
     9.3 @@ -38,6 +38,7 @@
     9.4  #include "media_plugin_base.h"
     9.5  
     9.6  #include <functional>
     9.7 +#include <chrono>
     9.8  
     9.9  #include "dullahan.h"
    9.10  
    9.11 @@ -64,12 +65,12 @@
    9.12  	void onLoadStartCallback();
    9.13  	void onRequestExitCallback();
    9.14  	void onLoadEndCallback(int httpStatusCode);
    9.15 +	void onLoadError(int status, const std::string error_text);
    9.16  	void onAddressChangeCallback(std::string url);
    9.17  	void onNavigateURLCallback(std::string url, std::string target);
    9.18  	bool onHTTPAuthCallback(const std::string host, const std::string realm, std::string& username, std::string& password);
    9.19  	void onCursorChangedCallback(dullahan::ECursorType type);
    9.20 -	void onFileDownloadCallback(std::string filename);
    9.21 -	const std::string onFileDialogCallback();
    9.22 +	const std::vector<std::string> onFileDialog(dullahan::EFileDialogType dialog_type, const std::string dialog_title, const std::string default_file, const std::string dialog_accept_filter, bool& use_default);
    9.23  
    9.24  	void postDebugMessage(const std::string& msg);
    9.25  	void authResponse(LLPluginMessage &message);
    9.26 @@ -95,7 +96,7 @@
    9.27  	bool mCanPaste;
    9.28  	std::string mCachePath;
    9.29  	std::string mCookiePath;
    9.30 -	std::string mPickedFile;
    9.31 +	std::vector<std::string> mPickedFiles;
    9.32  	VolumeCatcher mVolumeCatcher;
    9.33  	F32 mCurVolume;
    9.34  	dullahan* mCEFLib;
    9.35 @@ -115,7 +116,7 @@
    9.36  	mCookiesEnabled = true;
    9.37  	mPluginsEnabled = false;
    9.38  	mJavascriptEnabled = true;
    9.39 -	mDisableGPU = true;
    9.40 +	mDisableGPU = false;
    9.41  	mUserAgentSubtring = "";
    9.42  	mAuthUsername = "";
    9.43  	mAuthPassword = "";
    9.44 @@ -125,7 +126,7 @@
    9.45  	mCanPaste = false;
    9.46  	mCachePath = "";
    9.47  	mCookiePath = "";
    9.48 -	mPickedFile = "";
    9.49 +	mPickedFiles.clear();
    9.50  	mCurVolume = 0.0;
    9.51  
    9.52  	mCEFLib = new dullahan();
    9.53 @@ -166,6 +167,10 @@
    9.54  		{
    9.55  			memcpy(mPixels, pixels, mWidth * mHeight * mDepth);
    9.56  		}
    9.57 +		else
    9.58 +		{
    9.59 +			mCEFLib->setSize(mWidth, mHeight);
    9.60 +		}
    9.61  		setDirty(0, 0, mWidth, mHeight);
    9.62  	}
    9.63  }
    9.64 @@ -208,6 +213,21 @@
    9.65  	sendMessage(message);
    9.66  }
    9.67  
    9.68 +/////////////////////////////////////////////////////////////////////////////////
    9.69 +//
    9.70 +void MediaPluginCEF::onLoadError(int status, const std::string error_text)
    9.71 +{
    9.72 +	std::stringstream msg;
    9.73 +
    9.74 +	msg << "<b>Loading error!</b>";
    9.75 +	msg << "<p>";
    9.76 +	msg << "Message: " << error_text;
    9.77 +	msg << "<br>";
    9.78 +	msg << "Code: " << status;
    9.79 +
    9.80 +	mCEFLib->showBrowserMessage(msg.str());
    9.81 +}
    9.82 +
    9.83  ////////////////////////////////////////////////////////////////////////////////
    9.84  //
    9.85  void MediaPluginCEF::onRequestExitCallback()
    9.86 @@ -246,7 +266,6 @@
    9.87  	LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "click_href");
    9.88  	message.setValue("uri", url);
    9.89  	message.setValue("target", target);
    9.90 -	message.setValue("uuid", "");	// not used right now
    9.91  	sendMessage(message);
    9.92  }
    9.93  
    9.94 @@ -285,30 +304,52 @@
    9.95  
    9.96  ////////////////////////////////////////////////////////////////////////////////
    9.97  //
    9.98 -void MediaPluginCEF::onFileDownloadCallback(const std::string filename)
    9.99 +const std::vector<std::string> MediaPluginCEF::onFileDialog(dullahan::EFileDialogType dialog_type, const std::string dialog_title, const std::string default_file, std::string dialog_accept_filter, bool& use_default)
   9.100  {
   9.101 -	mAuthOK = false;
   9.102 +	// do not use the default CEF file picker
   9.103 +	use_default = false;
   9.104  
   9.105 -	LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "file_download");
   9.106 -	message.setValue("filename", filename);
   9.107 +	if (dialog_type == dullahan::FD_OPEN_FILE)
   9.108 +	{
   9.109 +		mPickedFiles.clear();
   9.110  
   9.111 -	sendMessage(message);
   9.112 +		LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "pick_file");
   9.113 +		message.setValueBoolean("blocking_request", true);
   9.114 +		message.setValueBoolean("multiple_files", false);
   9.115 +
   9.116 +		sendMessage(message);
   9.117 +
   9.118 +		return mPickedFiles;
   9.119 +	}
   9.120 +	else if (dialog_type == dullahan::FD_OPEN_MULTIPLE_FILES)
   9.121 +	{
   9.122 +		mPickedFiles.clear();
   9.123 +
   9.124 +		LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "pick_file");
   9.125 +		message.setValueBoolean("blocking_request", true);
   9.126 +		message.setValueBoolean("multiple_files", true);
   9.127 +
   9.128 +		sendMessage(message);
   9.129 +
   9.130 +		return mPickedFiles;
   9.131 +	}
   9.132 +	else if (dialog_type == dullahan::FD_SAVE_FILE)
   9.133 +	{
   9.134 +		mAuthOK = false;
   9.135 +
   9.136 +		LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "file_download");
   9.137 +		message.setValue("filename", default_file);
   9.138 +
   9.139 +		sendMessage(message);
   9.140 +
   9.141 +		return std::vector<std::string>();
   9.142 +	}
   9.143 +
   9.144 +	return std::vector<std::string>();
   9.145  }
   9.146  
   9.147  ////////////////////////////////////////////////////////////////////////////////
   9.148  //
   9.149 -const std::string MediaPluginCEF::onFileDialogCallback()
   9.150 -{
   9.151 -	mPickedFile.clear();
   9.152 -
   9.153 -	LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "pick_file");
   9.154 -	message.setValueBoolean("blocking_request", true);
   9.155 -
   9.156 -	sendMessage(message);
   9.157 -
   9.158 -	return mPickedFile;
   9.159 -}
   9.160 -
   9.161  void MediaPluginCEF::onCursorChangedCallback(dullahan::ECursorType type)
   9.162  {
   9.163  	std::string name = "";
   9.164 @@ -341,6 +382,8 @@
   9.165  	sendMessage(message);
   9.166  }
   9.167  
   9.168 +////////////////////////////////////////////////////////////////////////////////
   9.169 +//
   9.170  void MediaPluginCEF::authResponse(LLPluginMessage &message)
   9.171  {
   9.172  	mAuthOK = message.getValueBoolean("ok");
   9.173 @@ -439,11 +482,11 @@
   9.174  				mCEFLib->setOnTitleChangeCallback(std::bind(&MediaPluginCEF::onTitleChangeCallback, this, std::placeholders::_1));
   9.175  				mCEFLib->setOnLoadStartCallback(std::bind(&MediaPluginCEF::onLoadStartCallback, this));
   9.176  				mCEFLib->setOnLoadEndCallback(std::bind(&MediaPluginCEF::onLoadEndCallback, this, std::placeholders::_1));
   9.177 +				mCEFLib->setOnLoadErrorCallback(std::bind(&MediaPluginCEF::onLoadError, this, std::placeholders::_1, std::placeholders::_2));
   9.178  				mCEFLib->setOnAddressChangeCallback(std::bind(&MediaPluginCEF::onAddressChangeCallback, this, std::placeholders::_1));
   9.179  				mCEFLib->setOnNavigateURLCallback(std::bind(&MediaPluginCEF::onNavigateURLCallback, this, std::placeholders::_1, std::placeholders::_2));
   9.180  				mCEFLib->setOnHTTPAuthCallback(std::bind(&MediaPluginCEF::onHTTPAuthCallback, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
   9.181 -				mCEFLib->setOnFileDownloadCallback(std::bind(&MediaPluginCEF::onFileDownloadCallback, this, std::placeholders::_1));
   9.182 -				mCEFLib->setOnFileDialogCallback(std::bind(&MediaPluginCEF::onFileDialogCallback, this));
   9.183 +				mCEFLib->setOnFileDialogCallback(std::bind(&MediaPluginCEF::onFileDialog, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5));
   9.184  				mCEFLib->setOnCursorChangedCallback(std::bind(&MediaPluginCEF::onCursorChangedCallback, this, std::placeholders::_1));
   9.185  				mCEFLib->setOnRequestExitCallback(std::bind(&MediaPluginCEF::onRequestExitCallback, this));
   9.186  
   9.187 @@ -520,11 +563,11 @@
   9.188  
   9.189  						mTextureWidth = texture_width;
   9.190  						mTextureHeight = texture_height;
   9.191 +
   9.192 +						mCEFLib->setSize(mWidth, mHeight);
   9.193  					};
   9.194  				};
   9.195  
   9.196 -				mCEFLib->setSize(mWidth, mHeight);
   9.197 -
   9.198  				LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_response");
   9.199  				message.setValue("name", name);
   9.200  				message.setValueS32("width", width);
   9.201 @@ -650,7 +693,14 @@
   9.202  			}
   9.203  			if (message_name == "pick_file_response")
   9.204  			{
   9.205 -				mPickedFile = message_in.getValue("file");
   9.206 +				LLSD file_list_llsd = message_in.getValueLLSD("file_list");
   9.207 +
   9.208 +				LLSD::array_const_iterator iter = file_list_llsd.beginArray();
   9.209 +				LLSD::array_const_iterator end = file_list_llsd.endArray();
   9.210 +				for (; iter != end; ++iter)
   9.211 +				{
   9.212 +					mPickedFiles.push_back(((*iter).asString()));
   9.213 +				}
   9.214  			}
   9.215  			if (message_name == "auth_response")
   9.216  			{
   9.217 @@ -697,6 +747,10 @@
   9.218  			{
   9.219  				mCookiesEnabled = message_in.getValueBoolean("enable");
   9.220  			}
   9.221 +			else if (message_name == "clear_cookies")
   9.222 +			{
   9.223 +				mCEFLib->deleteAllCookies();
   9.224 +			}
   9.225  			else if (message_name == "set_user_agent")
   9.226  			{
   9.227  				mUserAgentSubtring = message_in.getValue("user_agent");
    10.1 --- a/indra/newview/llappviewer.cpp	Tue Jan 16 14:14:27 2018 -0500
    10.2 +++ b/indra/newview/llappviewer.cpp	Fri Jan 19 15:37:27 2018 -0800
    10.3 @@ -1940,8 +1940,6 @@
    10.4  
    10.5  	LLAvatarIconIDCache::getInstance()->save();
    10.6  	
    10.7 -	LLViewerMedia::saveCookieFile();
    10.8 -
    10.9  	// Stop the plugin read thread if it's running.
   10.10  	LLPluginProcessParent::setUseReadThread(false);
   10.11  
   10.12 @@ -3178,8 +3176,14 @@
   10.13  	cef_ver_codec << " / CEF: ";
   10.14  	cef_ver_codec << CEF_VERSION;
   10.15  
   10.16 -	cef_ver_codec << " / Chrome: ";
   10.17 +	cef_ver_codec << " / Chromium: ";
   10.18  	cef_ver_codec << CHROME_VERSION_MAJOR;
   10.19 +	cef_ver_codec << ".";
   10.20 +	cef_ver_codec << CHROME_VERSION_MINOR;
   10.21 +	cef_ver_codec << ".";
   10.22 +	cef_ver_codec << CHROME_VERSION_BUILD;
   10.23 +	cef_ver_codec << ".";
   10.24 +	cef_ver_codec << CHROME_VERSION_PATCH;
   10.25  
   10.26  	info["LIBCEF_VERSION"] = cef_ver_codec.str();
   10.27  #else
    11.1 --- a/indra/newview/llfloaterfacebook.cpp	Tue Jan 16 14:14:27 2018 -0500
    11.2 +++ b/indra/newview/llfloaterfacebook.cpp	Fri Jan 19 15:37:27 2018 -0800
    11.3 @@ -1,4 +1,4 @@
    11.4 -/** 
    11.5 +/**
    11.6  * @file llfloaterfacebook.cpp
    11.7  * @brief Implementation of llfloaterfacebook
    11.8  * @author Gilbert@lindenlab.com
    11.9 @@ -41,7 +41,6 @@
   11.10  #include "llresmgr.h"		// LLLocale
   11.11  #include "llsdserialize.h"
   11.12  #include "llloadingindicator.h"
   11.13 -#include "llplugincookiestore.h"
   11.14  #include "llslurl.h"
   11.15  #include "lltrans.h"
   11.16  #include "llsnapshotlivepreview.h"
   11.17 @@ -296,16 +295,11 @@
   11.18  void LLFacebookStatusPanel::onConnect()
   11.19  {
   11.20      LLFacebookConnect::instance().checkConnectionToFacebook(true);
   11.21 -
   11.22 -    //Clear only the facebook browser cookies so that the facebook login screen appears
   11.23 -    LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com");
   11.24  }
   11.25  
   11.26  void LLFacebookStatusPanel::onDisconnect()
   11.27  {
   11.28      LLFacebookConnect::instance().disconnectFromFacebook();
   11.29 -
   11.30 -    LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com");
   11.31  }
   11.32  
   11.33  void LLFacebookStatusPanel::clearAndClose()
   11.34 @@ -810,7 +804,7 @@
   11.35      LLAgentUI::buildSLURL(slurl);
   11.36      std::string slurl_string = slurl.getSLURLString();
   11.37  
   11.38 -    // Use a valid http:// URL if the scheme is secondlife:// 
   11.39 +    // Use a valid http:// URL if the scheme is secondlife://
   11.40      LLURI slurl_uri(slurl_string);
   11.41      if (slurl_uri.scheme() == LLSLURL::SLURL_SECONDLIFE_SCHEME)
   11.42      {
    12.1 --- a/indra/newview/llfloaterflickr.cpp	Tue Jan 16 14:14:27 2018 -0500
    12.2 +++ b/indra/newview/llfloaterflickr.cpp	Fri Jan 19 15:37:27 2018 -0800
    12.3 @@ -40,7 +40,6 @@
    12.4  #include "llresmgr.h"		// LLLocale
    12.5  #include "llsdserialize.h"
    12.6  #include "llloadingindicator.h"
    12.7 -#include "llplugincookiestore.h"
    12.8  #include "llslurl.h"
    12.9  #include "lltrans.h"
   12.10  #include "llsnapshotlivepreview.h"
   12.11 @@ -660,16 +659,11 @@
   12.12  void LLFlickrAccountPanel::onConnect()
   12.13  {
   12.14  	LLFlickrConnect::instance().checkConnectionToFlickr(true);
   12.15 -
   12.16 -	//Clear only the flickr browser cookies so that the flickr login screen appears
   12.17 -	LLViewerMedia::getCookieStore()->removeCookiesByDomain(".flickr.com"); 
   12.18  }
   12.19  
   12.20  void LLFlickrAccountPanel::onDisconnect()
   12.21  {
   12.22  	LLFlickrConnect::instance().disconnectFromFlickr();
   12.23 -
   12.24 -	LLViewerMedia::getCookieStore()->removeCookiesByDomain(".flickr.com"); 
   12.25  }
   12.26  
   12.27  ////////////////////////
    13.1 --- a/indra/newview/llfloatertwitter.cpp	Tue Jan 16 14:14:27 2018 -0500
    13.2 +++ b/indra/newview/llfloatertwitter.cpp	Fri Jan 19 15:37:27 2018 -0800
    13.3 @@ -41,7 +41,6 @@
    13.4  #include "llresmgr.h"		// LLLocale
    13.5  #include "llsdserialize.h"
    13.6  #include "llloadingindicator.h"
    13.7 -#include "llplugincookiestore.h"
    13.8  #include "llslurl.h"
    13.9  #include "lltrans.h"
   13.10  #include "llsnapshotlivepreview.h"
   13.11 @@ -684,16 +683,11 @@
   13.12  void LLTwitterAccountPanel::onConnect()
   13.13  {
   13.14  	LLTwitterConnect::instance().checkConnectionToTwitter(true);
   13.15 -
   13.16 -	//Clear only the twitter browser cookies so that the twitter login screen appears
   13.17 -	LLViewerMedia::getCookieStore()->removeCookiesByDomain(".twitter.com"); 
   13.18  }
   13.19  
   13.20  void LLTwitterAccountPanel::onDisconnect()
   13.21  {
   13.22  	LLTwitterConnect::instance().disconnectFromTwitter();
   13.23 -
   13.24 -	LLViewerMedia::getCookieStore()->removeCookiesByDomain(".twitter.com"); 
   13.25  }
   13.26  
   13.27  ////////////////////////
    14.1 --- a/indra/newview/llmediactrl.cpp	Tue Jan 16 14:14:27 2018 -0500
    14.2 +++ b/indra/newview/llmediactrl.cpp	Fri Jan 19 15:37:27 2018 -0800
    14.3 @@ -1022,7 +1022,7 @@
    14.4  			// try as slurl first
    14.5  			if (!LLURLDispatcher::dispatch(url, "clicked", NULL, mTrusted))
    14.6  			{
    14.7 -				LLWeb::loadURL(url, target, std::string());
    14.8 +				LLWeb::loadURL(url, target, uuid);
    14.9  			}
   14.10  
   14.11  			// CP: removing this code because we no longer support popups so this breaks the flow.
    15.1 --- a/indra/newview/llstartup.cpp	Tue Jan 16 14:14:27 2018 -0500
    15.2 +++ b/indra/newview/llstartup.cpp	Fri Jan 19 15:37:27 2018 -0800
    15.3 @@ -965,9 +965,6 @@
    15.4  		// Load Avatars icons cache
    15.5  		LLAvatarIconIDCache::getInstance()->load();
    15.6  		
    15.7 -		// Load media plugin cookies
    15.8 -		LLViewerMedia::loadCookieFile();
    15.9 -
   15.10  		LLRenderMuteList::getInstance()->loadFromFile();
   15.11  
   15.12  		//-------------------------------------------------
    16.1 --- a/indra/newview/llviewermedia.cpp	Tue Jan 16 14:14:27 2018 -0500
    16.2 +++ b/indra/newview/llviewermedia.cpp	Fri Jan 19 15:37:27 2018 -0800
    16.3 @@ -50,7 +50,6 @@
    16.4  #include "llpanelprofile.h"
    16.5  #include "llparcel.h"
    16.6  #include "llpluginclassmedia.h"
    16.7 -#include "llplugincookiestore.h"
    16.8  #include "llurldispatcher.h"
    16.9  #include "lluuid.h"
   16.10  #include "llversioninfo.h"
   16.11 @@ -154,7 +153,6 @@
   16.12  }
   16.13  
   16.14  
   16.15 -LLPluginCookieStore *LLViewerMedia::sCookieStore = NULL;
   16.16  LLURL LLViewerMedia::sOpenIDURL;
   16.17  std::string LLViewerMedia::sOpenIDCookie;
   16.18  LLPluginClassMedia* LLViewerMedia::sSpareBrowserMediaSource = NULL;
   16.19 @@ -169,8 +167,6 @@
   16.20  static bool sAnyMediaShowing = false;
   16.21  static bool sAnyMediaPlaying = false;
   16.22  static boost::signals2::connection sTeleportFinishConnection;
   16.23 -static std::string sUpdatedCookies;
   16.24 -static const char *PLUGIN_COOKIE_FILE_NAME = "plugin_cookies.txt";
   16.25  
   16.26  //////////////////////////////////////////////////////////////////////////////////////////
   16.27  static void add_media_impl(LLViewerMediaImpl* media)
   16.28 @@ -610,12 +606,6 @@
   16.29  
   16.30  	sAnyMediaShowing = false;
   16.31  	sAnyMediaPlaying = false;
   16.32 -	sUpdatedCookies = getCookieStore()->getChangedCookies();
   16.33 -	if(!sUpdatedCookies.empty())
   16.34 -	{
   16.35 -		LL_DEBUGS() << "updated cookies will be sent to all loaded plugins: " << LL_ENDL;
   16.36 -		LL_DEBUGS() << sUpdatedCookies << LL_ENDL;
   16.37 -	}
   16.38  
   16.39  	impl_list::iterator iter = sViewerMediaImplList.begin();
   16.40  	impl_list::iterator end = sViewerMediaImplList.end();
   16.41 @@ -1048,64 +1038,6 @@
   16.42  			pimpl->mMediaSource->clear_cookies();
   16.43  		}
   16.44  	}
   16.45 -
   16.46 -	// Clear all cookies from the cookie store
   16.47 -	getCookieStore()->setAllCookies("");
   16.48 -
   16.49 -	// FIXME: this may not be sufficient, since the on-disk cookie file won't get written until some browser instance exits cleanly.
   16.50 -	// 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.
   16.51 -	// Until such time as we can centralize cookie storage, the following hack should cover these cases:
   16.52 -
   16.53 -	// HACK: Look for cookie files in all possible places and delete them.
   16.54 -	// 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)
   16.55 -
   16.56 -	// Places that cookie files can be:
   16.57 -	// <getOSUserAppDir>/browser_profile/cookies
   16.58 -	// <getOSUserAppDir>/first_last/browser_profile/cookies  (note that there may be any number of these!)
   16.59 -	// <getOSUserAppDir>/first_last/plugin_cookies.txt  (note that there may be any number of these!)
   16.60 -
   16.61 -	std::string base_dir = gDirUtilp->getOSUserAppDir() + gDirUtilp->getDirDelimiter();
   16.62 -	std::string target;
   16.63 -	std::string filename;
   16.64 -
   16.65 -	LL_DEBUGS() << "base dir = " << base_dir << LL_ENDL;
   16.66 -
   16.67 -	// The non-logged-in version is easy
   16.68 -	target = base_dir;
   16.69 -	target += "browser_profile";
   16.70 -	target += gDirUtilp->getDirDelimiter();
   16.71 -	target += "cookies";
   16.72 -	LL_DEBUGS() << "target = " << target << LL_ENDL;
   16.73 -	if(LLFile::isfile(target))
   16.74 -	{
   16.75 -		LLFile::remove(target);
   16.76 -	}
   16.77 -
   16.78 -	// the hard part: iterate over all user directories and delete the cookie file from each one
   16.79 -	LLDirIterator dir_iter(base_dir, "*_*");
   16.80 -	while (dir_iter.next(filename))
   16.81 -	{
   16.82 -		target = gDirUtilp->add(base_dir, filename);
   16.83 -		gDirUtilp->append(target, "browser_profile");
   16.84 -		gDirUtilp->append(target, "cookies");
   16.85 -		LL_DEBUGS() << "target = " << target << LL_ENDL;
   16.86 -		if(LLFile::isfile(target))
   16.87 -		{
   16.88 -			LLFile::remove(target);
   16.89 -		}
   16.90 -
   16.91 -		// Other accounts may have new-style cookie files too -- delete them as well
   16.92 -		target = gDirUtilp->add(base_dir, filename);
   16.93 -		gDirUtilp->append(target, PLUGIN_COOKIE_FILE_NAME);
   16.94 -		LL_DEBUGS() << "target = " << target << LL_ENDL;
   16.95 -		if(LLFile::isfile(target))
   16.96 -		{
   16.97 -			LLFile::remove(target);
   16.98 -		}
   16.99 -	}
  16.100 -
  16.101 -	// If we have an OpenID cookie, re-add it to the cookie store.
  16.102 -	setOpenIDCookie(std::string());
  16.103  }
  16.104  
  16.105  /////////////////////////////////////////////////////////////////////////////////////////
  16.106 @@ -1134,7 +1066,7 @@
  16.107  		LLViewerMediaImpl* pimpl = *iter;
  16.108  		if(pimpl->mMediaSource)
  16.109  		{
  16.110 -			pimpl->mMediaSource->enable_cookies(enabled);
  16.111 +			pimpl->mMediaSource->cookies_enabled(enabled);
  16.112  		}
  16.113  	}
  16.114  }
  16.115 @@ -1159,127 +1091,7 @@
  16.116  /////////////////////////////////////////////////////////////////////////////////////////
  16.117  // static
  16.118  /////////////////////////////////////////////////////////////////////////////////////////
  16.119 -// static
  16.120 -LLPluginCookieStore *LLViewerMedia::getCookieStore()
  16.121 -{
  16.122 -	if(sCookieStore == NULL)
  16.123 -	{
  16.124 -		sCookieStore = new LLPluginCookieStore;
  16.125 -	}
  16.126 -
  16.127 -	return sCookieStore;
  16.128 -}
  16.129 -
  16.130 -/////////////////////////////////////////////////////////////////////////////////////////
  16.131 -// static
  16.132 -void LLViewerMedia::loadCookieFile()
  16.133 -{
  16.134 -	// build filename for each user
  16.135 -	std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PLUGIN_COOKIE_FILE_NAME);
  16.136 -
  16.137 -	if (resolved_filename.empty())
  16.138 -	{
  16.139 -		LL_INFOS() << "can't get path to plugin cookie file - probably not logged in yet." << LL_ENDL;
  16.140 -		return;
  16.141 -	}
  16.142 -
  16.143 -	// open the file for reading
  16.144 -	llifstream file(resolved_filename.c_str());
  16.145 -	if (!file.is_open())
  16.146 -	{
  16.147 -		LL_WARNS() << "can't load plugin cookies from file \"" << PLUGIN_COOKIE_FILE_NAME << "\"" << LL_ENDL;
  16.148 -		return;
  16.149 -	}
  16.150 -
  16.151 -	getCookieStore()->readAllCookies(file, true);
  16.152 -
  16.153 -	file.close();
  16.154 -
  16.155 -	// send the clear_cookies message to all loaded plugins
  16.156 -	impl_list::iterator iter = sViewerMediaImplList.begin();
  16.157 -	impl_list::iterator end = sViewerMediaImplList.end();
  16.158 -	for (; iter != end; iter++)
  16.159 -	{
  16.160 -		LLViewerMediaImpl* pimpl = *iter;
  16.161 -		if(pimpl->mMediaSource)
  16.162 -		{
  16.163 -			pimpl->mMediaSource->clear_cookies();
  16.164 -		}
  16.165 -	}
  16.166 -
  16.167 -	// If we have an OpenID cookie, re-add it to the cookie store.
  16.168 -	setOpenIDCookie(std::string());
  16.169 -}
  16.170 -
  16.171 -
  16.172 -/////////////////////////////////////////////////////////////////////////////////////////
  16.173 -// static
  16.174 -void LLViewerMedia::saveCookieFile()
  16.175 -{
  16.176 -	// build filename for each user
  16.177 -	std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PLUGIN_COOKIE_FILE_NAME);
  16.178 -
  16.179 -	if (resolved_filename.empty())
  16.180 -	{
  16.181 -		LL_INFOS() << "can't get path to plugin cookie file - probably not logged in yet." << LL_ENDL;
  16.182 -		return;
  16.183 -	}
  16.184 -
  16.185 -	// open a file for writing
  16.186 -	llofstream file(resolved_filename.c_str());
  16.187 -	if (!file.is_open())
  16.188 -	{
  16.189 -		LL_WARNS() << "can't open plugin cookie file \"" << PLUGIN_COOKIE_FILE_NAME << "\" for writing" << LL_ENDL;
  16.190 -		return;
  16.191 -	}
  16.192 -
  16.193 -	getCookieStore()->writePersistentCookies(file);
  16.194 -
  16.195 -	file.close();
  16.196 -}
  16.197 -
  16.198 -/////////////////////////////////////////////////////////////////////////////////////////
  16.199 -// static
  16.200 -void LLViewerMedia::addCookie(const std::string &name, const std::string &value, const std::string &domain, const LLDate &expires, const std::string &path, bool secure)
  16.201 -{
  16.202 -	std::stringstream cookie;
  16.203 -
  16.204 -	cookie << name << "=" << LLPluginCookieStore::quoteString(value);
  16.205 -
  16.206 -	if(expires.notNull())
  16.207 -	{
  16.208 -		cookie << "; expires=" << expires.asRFC1123();
  16.209 -	}
  16.210 -
  16.211 -	cookie << "; domain=" << domain;
  16.212 -
  16.213 -	cookie << "; path=" << path;
  16.214 -
  16.215 -	if(secure)
  16.216 -	{
  16.217 -		cookie << "; secure";
  16.218 -	}
  16.219 -
  16.220 -	getCookieStore()->setCookies(cookie.str());
  16.221 -}
  16.222 -
  16.223 -/////////////////////////////////////////////////////////////////////////////////////////
  16.224 -// static
  16.225 -void LLViewerMedia::addSessionCookie(const std::string &name, const std::string &value, const std::string &domain, const std::string &path, bool secure)
  16.226 -{
  16.227 -	// A session cookie just has a NULL date.
  16.228 -	addCookie(name, value, domain, LLDate(), path, secure);
  16.229 -}
  16.230 -
  16.231 -/////////////////////////////////////////////////////////////////////////////////////////
  16.232 -// static
  16.233 -void LLViewerMedia::removeCookie(const std::string &name, const std::string &domain, const std::string &path )
  16.234 -{
  16.235 -	// To remove a cookie, add one with the same name, domain, and path that expires in the past.
  16.236 -
  16.237 -	addCookie(name, "", domain, LLDate(LLDate::now().secondsSinceEpoch() - 1.0), path);
  16.238 -}
  16.239 -
  16.240 +//// static
  16.241  
  16.242  LLSD LLViewerMedia::getHeaders()
  16.243  {
  16.244 @@ -1384,8 +1196,6 @@
  16.245          hostEnd = authority.size();
  16.246      }
  16.247  
  16.248 -    getCookieStore()->setCookiesFromHost(sOpenIDCookie, authority.substr(hostStart, hostEnd - hostStart));
  16.249 -
  16.250  	if (url.length())
  16.251  	{
  16.252  		LLMediaCtrl* media_instance = LLFloaterReg::getInstance("destinations")->getChild<LLMediaCtrl>("destination_guide_contents");
  16.253 @@ -1423,7 +1233,6 @@
  16.254      httpHeaders->append(HTTP_OUT_HEADER_COOKIE, sOpenIDCookie);
  16.255      httpHeaders->append(HTTP_OUT_HEADER_USER_AGENT, getCurrentUserAgent());
  16.256  
  16.257 -
  16.258      LL_DEBUGS("MediaAuth") << "Requesting " << url << LL_ENDL;
  16.259      LL_DEBUGS("MediaAuth") << "sOpenIDCookie = [" << sOpenIDCookie << "]" << LL_ENDL;
  16.260      
  16.261 @@ -1448,13 +1257,9 @@
  16.262      const std::string& cookie = resultHeaders[HTTP_IN_HEADER_SET_COOKIE].asStringRef();
  16.263      LL_DEBUGS("MediaAuth") << "cookie = " << cookie << LL_ENDL;
  16.264  
  16.265 -    // *TODO: What about bad status codes?  Does this destroy previous cookies?
  16.266 -    LLViewerMedia::getCookieStore()->setCookiesFromHost(cookie, hostAuth);
  16.267 -
  16.268      // Set cookie for snapshot publishing.
  16.269      std::string authCookie = cookie.substr(0, cookie.find(";")); // strip path
  16.270      LLWebProfile::setAuthCookie(authCookie);
  16.271 -
  16.272  }
  16.273  
  16.274  /////////////////////////////////////////////////////////////////////////////////////////
  16.275 @@ -1649,12 +1454,6 @@
  16.276  		delete sSpareBrowserMediaSource;
  16.277  		sSpareBrowserMediaSource = NULL;
  16.278  	}
  16.279 -
  16.280 -	if (sCookieStore != NULL)
  16.281 -	{
  16.282 -		delete sCookieStore;
  16.283 -		sCookieStore = NULL;
  16.284 -	}
  16.285  }
  16.286  
  16.287  //////////////////////////////////////////////////////////////////////////////////////////
  16.288 @@ -1922,7 +1721,7 @@
  16.289  
  16.290  			// collect 'cookies enabled' setting from prefs and send to embedded browser
  16.291  			bool cookies_enabled = gSavedSettings.getBOOL( "CookiesEnabled" );
  16.292 -			media_source->enable_cookies( cookies_enabled || clean_browser);
  16.293 +			media_source->cookies_enabled( cookies_enabled || clean_browser);
  16.294  
  16.295  			// collect 'plugins enabled' setting from prefs and send to embedded browser
  16.296  			bool plugins_enabled = gSavedSettings.getBOOL( "BrowserPluginsEnabled" );
  16.297 @@ -2031,17 +1830,6 @@
  16.298  			media_source->clear_cache();
  16.299  		}
  16.300  
  16.301 -		// TODO: Only send cookies to plugins that need them
  16.302 -		//  Ideally, the plugin should tell us whether it handles cookies or not -- either via the init response or through a separate message.
  16.303 -		//  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,
  16.304 -		//  which could cause odd race conditions.
  16.305 -		std::string all_cookies = LLViewerMedia::getCookieStore()->getAllCookies();
  16.306 -		LL_DEBUGS() << "setting cookies: " << all_cookies << LL_ENDL;
  16.307 -		if(!all_cookies.empty())
  16.308 -		{
  16.309 -			media_source->set_cookies(all_cookies);
  16.310 -		}
  16.311 -
  16.312  		mMediaSource = media_source;
  16.313  		mMediaSource->setDeleteOK(false) ;
  16.314  		updateVolume();
  16.315 @@ -2983,14 +2771,10 @@
  16.316  		updateVolume();
  16.317  
  16.318  		// TODO: this is updated every frame - is this bad?
  16.319 -		updateJavascriptObject();
  16.320 -
  16.321 -		// If we didn't just create the impl, it may need to get cookie updates.
  16.322 -		if(!sUpdatedCookies.empty())
  16.323 -		{
  16.324 -			// TODO: Only send cookies to plugins that need them
  16.325 -			mMediaSource->set_cookies(sUpdatedCookies);
  16.326 -		}
  16.327 +		// Removing this as part of the post viewer64 media update
  16.328 +		// Removed as not implemented in CEF embedded browser
  16.329 +		// See MAINT-8194 for a more fuller description
  16.330 +		// updateJavascriptObject();
  16.331  	}
  16.332  
  16.333  
  16.334 @@ -3480,22 +3264,40 @@
  16.335  
  16.336  		case LLViewerMediaObserver::MEDIA_EVENT_PICK_FILE_REQUEST:
  16.337  		{
  16.338 -			// Display a file picker
  16.339 -			std::string response;
  16.340 -
  16.341  			LLFilePicker& picker = LLFilePicker::instance();
  16.342 -			if (!picker.getOpenFile(LLFilePicker::FFLOAD_ALL))
  16.343 +			std::vector<std::string> responses;
  16.344 +
  16.345 +			bool pick_multiple_files = plugin->getIsMultipleFilePick();
  16.346 +			if (pick_multiple_files == false)
  16.347  			{
  16.348 -				// The user didn't pick a file -- the empty response string will indicate this.
  16.349 +				picker.getOpenFile(LLFilePicker::FFLOAD_ALL);
  16.350 +
  16.351 +				std::string filename = picker.getFirstFile();
  16.352 +				responses.push_back(filename);
  16.353  			}
  16.354 -
  16.355 -			response = picker.getFirstFile();
  16.356 -
  16.357 -			plugin->sendPickFileResponse(response);
  16.358 +			else
  16.359 +			{
  16.360 +				if (picker.getMultipleOpenFiles())
  16.361 +				{
  16.362 +					std::string filename = picker.getFirstFile();
  16.363 +
  16.364 +					responses.push_back(filename);
  16.365 +
  16.366 +					while (!filename.empty())
  16.367 +					{
  16.368 +						filename = picker.getNextFile();
  16.369 +
  16.370 +						if (!filename.empty())
  16.371 +						{
  16.372 +							responses.push_back(filename);
  16.373 +						}
  16.374 +					}
  16.375 +				}
  16.376 +			}
  16.377 +			plugin->sendPickFileResponse(responses);
  16.378  		}
  16.379  		break;
  16.380  
  16.381 -
  16.382  		case LLViewerMediaObserver::MEDIA_EVENT_AUTH_REQUEST:
  16.383  		{
  16.384  			LLNotification::Params auth_request_params;
  16.385 @@ -3565,13 +3367,6 @@
  16.386  
  16.387  ////////////////////////////////////////////////////////////////////////////////
  16.388  // virtual
  16.389 -void LLViewerMediaImpl::handleCookieSet(LLPluginClassMedia* self, const std::string &cookie)
  16.390 -{
  16.391 -	LLViewerMedia::getCookieStore()->setCookies(cookie);
  16.392 -}
  16.393 -
  16.394 -////////////////////////////////////////////////////////////////////////////////
  16.395 -// virtual
  16.396  void
  16.397  LLViewerMediaImpl::cut()
  16.398  {
    17.1 --- a/indra/newview/llviewermedia.h	Tue Jan 16 14:14:27 2018 -0500
    17.2 +++ b/indra/newview/llviewermedia.h	Fri Jan 19 15:37:27 2018 -0800
    17.3 @@ -50,7 +50,6 @@
    17.4  class LLMediaEntry;
    17.5  class LLVOVolume;
    17.6  class LLMimeDiscoveryResponder;
    17.7 -class LLPluginCookieStore;
    17.8  
    17.9  typedef LLPointer<LLViewerMediaImpl> viewer_media_t;
   17.10  ///////////////////////////////////////////////////////////////////////////////
   17.11 @@ -149,13 +148,6 @@
   17.12  	// Set the proxy config for all loaded plugins
   17.13  	static void setProxyConfig(bool enable, const std::string &host, int port);
   17.14  	
   17.15 -	static LLPluginCookieStore *getCookieStore();
   17.16 -	static void loadCookieFile();
   17.17 -	static void saveCookieFile();
   17.18 -	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 );
   17.19 -	static void addSessionCookie(const std::string &name, const std::string &value, const std::string &domain, const std::string &path = std::string("/"), bool secure = false );
   17.20 -	static void removeCookie(const std::string &name, const std::string &domain, const std::string &path = std::string("/") );
   17.21 -
   17.22  	static void openIDSetup(const std::string &openid_url, const std::string &openid_token);
   17.23  	static void openIDCookieResponse(const std::string& url, const std::string &cookie);
   17.24  	
   17.25 @@ -178,7 +170,6 @@
   17.26      static void openIDSetupCoro(std::string openidUrl, std::string openidToken);
   17.27      static void getOpenIDCookieCoro(std::string url);
   17.28  
   17.29 -	static LLPluginCookieStore *sCookieStore;
   17.30  	static LLURL sOpenIDURL;
   17.31  	static std::string sOpenIDCookie;
   17.32  	static LLPluginClassMedia* sSpareBrowserMediaSource;
   17.33 @@ -337,7 +328,6 @@
   17.34  
   17.35  	// Inherited from LLPluginClassMediaOwner
   17.36  	/*virtual*/ void handleMediaEvent(LLPluginClassMedia* plugin, LLPluginClassMediaOwner::EMediaEvent);
   17.37 -	/*virtual*/ void handleCookieSet(LLPluginClassMedia* self, const std::string &cookie);
   17.38  
   17.39  	// LLEditMenuHandler overrides
   17.40  	/*virtual*/ void	cut();
    18.1 --- a/indra/newview/llwebprofile.cpp	Tue Jan 16 14:14:27 2018 -0500
    18.2 +++ b/indra/newview/llwebprofile.cpp	Fri Jan 19 15:37:27 2018 -0800
    18.3 @@ -31,7 +31,6 @@
    18.4  // libs
    18.5  #include "llbufferstream.h"
    18.6  #include "llimagepng.h"
    18.7 -#include "llplugincookiestore.h"
    18.8  
    18.9  #include "llsdserialize.h"
   18.10  
    19.1 --- a/indra/newview/skins/default/xui/en/floater_about.xml	Tue Jan 16 14:14:27 2018 -0500
    19.2 +++ b/indra/newview/skins/default/xui/en/floater_about.xml	Fri Jan 19 15:37:27 2018 -0800
    19.3 @@ -8,14 +8,14 @@
    19.4   help_topic="floater_about"
    19.5   save_rect="true"
    19.6   title="ABOUT [CAPITALIZED_APP_NAME]"
    19.7 - width="470">
    19.8 + width="500">
    19.9    
   19.10    <tab_container
   19.11      follows="all" 
   19.12      top="25"
   19.13      left="10"
   19.14      height="405" 
   19.15 -    width="450" 
   19.16 +    width="480" 
   19.17      name="about_tab"
   19.18      tab_position="top">
   19.19      <panel
   19.20 @@ -33,7 +33,7 @@
   19.21         max_length="65536"
   19.22         name="support_editor"
   19.23         top="5"
   19.24 -       width="435"
   19.25 +       width="465"
   19.26         word_wrap="true" />
   19.27        <button
   19.28          follows="left|top" 
   19.29 @@ -56,7 +56,7 @@
   19.30            left="5"
   19.31            name="linden_intro"
   19.32            top="10"
   19.33 -          width="435"
   19.34 +          width="465"
   19.35            wrap="true">
   19.36  Second Life is brought to you by the Lindens, 
   19.37  with open source contributions from:
   19.38 @@ -71,7 +71,7 @@
   19.39         max_length="65536"
   19.40         name="contrib_names"
   19.41         top_pad="10"
   19.42 -       width="435"
   19.43 +       width="465"
   19.44         word_wrap="true">
   19.45  Dummy Name replaced at run time
   19.46        </text_editor>
   19.47 @@ -91,7 +91,7 @@
   19.48         max_length="65536"
   19.49         name="licenses_editor"
   19.50         top="5"
   19.51 -       width="435"
   19.52 +       width="465"
   19.53         word_wrap="true">
   19.54          3Dconnexion SDK Copyright (C) 1992-2009 3Dconnexion
   19.55          APR Copyright (C) 2011 The Apache Software Foundation

mercurial