diff options
| author | Rick Pasetto <rick@lindenlab.com> | 2009-11-09 18:17:42 -0800 | 
|---|---|---|
| committer | Rick Pasetto <rick@lindenlab.com> | 2009-11-09 18:17:42 -0800 | 
| commit | f4186b6d3d45259c83fa1b13db25abcd34f227a9 (patch) | |
| tree | d5830f8cea2dc4932140cd245539c1a6c2161995 /indra/newview | |
| parent | ebbb468a795d503a8869467d642d5f4962a3d7bf (diff) | |
PARTIAL FIX (workaround) DEV-41949: LLMediaEntry::setWhitelist() and LLMediaEntry::asLLSD() have a contract conflict
Review #31
So, here's what was happening, briefly:
- LLMediaEntry::setWhitelist() would be a no-op if given an LLSD that did not have a WHITELIST_KEY
- LLMediaEntry::asLLSD() would render the LLMediaEntry *without* a WHITELIST_KEY if the whitelist was empty
Therefore, when the viewer marshalled an LLMediaEntry for the server, it would send it without a WHITELIST_KEY. When the server got it, it would not erase the last value.
This is actually a workaround: it patches asLLSD() with an LLSD::emptyArray() if the key is not there. However, this should be fixed on the server: in either or both of the following ways:
1) LLMediaEntry::setWhitelist() should not be a no-op if the LLSD has no WHITELIST_KEY: it should erase the whitelist
2) LLMediaEntry::asLLSD() should render an empty whitelist in WHITELIST_KEY as an empty array
Note that both could be done and still work.
A unit test should and will be written next.
Diffstat (limited to 'indra/newview')
| -rw-r--r-- | indra/newview/llpanelmediasettingssecurity.cpp | 4 | ||||
| -rw-r--r-- | indra/newview/llvovolume.cpp | 5 | 
2 files changed, 8 insertions, 1 deletions
| diff --git a/indra/newview/llpanelmediasettingssecurity.cpp b/indra/newview/llpanelmediasettingssecurity.cpp index 611293f3e2..bec2494eac 100644 --- a/indra/newview/llpanelmediasettingssecurity.cpp +++ b/indra/newview/llpanelmediasettingssecurity.cpp @@ -215,7 +215,9 @@ void LLPanelMediaSettingsSecurity::getValues( LLSD &fill_me_in )      // iterate over white list and extract items
      std::vector< LLScrollListItem* > white_list_items = mWhiteListList->getAllData();
      std::vector< LLScrollListItem* >::iterator iter = white_list_items.begin();
 -    fill_me_in.erase(LLMediaEntry::WHITELIST_KEY);
 +	// *NOTE: need actually set the key to be an emptyArray(), or the merge
 +	// we do with this LLSD will think there's nothing to change.
 +    fill_me_in[LLMediaEntry::WHITELIST_KEY] = LLSD::emptyArray();
      while( iter != white_list_items.end() )
      {
          std::string white_list_url = (*iter)->getValue().asString();
 diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 021fc74648..3803c65e74 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -108,6 +108,11 @@ public:  				if (te->getMediaData() != NULL)  				{  					result = te->getMediaData()->asLLSD(); +					// XXX HACK: workaround bug in asLLSD() where whitelist is not set properly +					if (!result.has(LLMediaEntry::WHITELIST_KEY)) +					{ +						result[LLMediaEntry::WHITELIST_KEY] = LLSD::emptyArray(); +					}  				}  			}  			return result; | 
