[tbb-commits] [tor-browser/tor-browser-31.4.0esr-4.5-1] Bug #9701: Prevent ClipBoardCache from writing to disk.

brade at torproject.org brade at torproject.org
Mon Jan 19 21:12:42 UTC 2015


commit 453b4ee4b2cd1c3dd22ee2040b38f09d26e8a60f
Author: Michael Schloh von Bennewitz <michael at schloh.com>
Date:   Mon Jan 19 16:04:36 2015 -0500

    Bug #9701: Prevent ClipBoardCache from writing to disk.
    
    Do not write clipboard data to disk when private browsing mode is on.
---
 widget/xpwidgets/nsTransferable.cpp |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/widget/xpwidgets/nsTransferable.cpp b/widget/xpwidgets/nsTransferable.cpp
index 094836b..1a0e96e 100644
--- a/widget/xpwidgets/nsTransferable.cpp
+++ b/widget/xpwidgets/nsTransferable.cpp
@@ -56,19 +56,20 @@ DataStruct::~DataStruct()
 
 //-------------------------------------------------------------------------
 void
-DataStruct::SetData ( nsISupports* aData, uint32_t aDataLen )
+DataStruct::SetData ( nsISupports* aData, uint32_t aDataLen, bool aIsPrivBrowsing )
 {
   // Now, check to see if we consider the data to be "too large"
-  if (aDataLen > kLargeDatasetSize) {
+  // as well as ensuring that private browsing mode is disabled
+  if (aDataLen > kLargeDatasetSize && !aIsPrivBrowsing) {
     // if so, cache it to disk instead of memory
     if ( NS_SUCCEEDED(WriteCache(aData, aDataLen)) )
       return;
     else
-			NS_WARNING("Oh no, couldn't write data to the cache file");   
-  } 
+      NS_WARNING("Oh no, couldn't write data to the cache file");
+  }
 
   mData    = aData;
-  mDataLen = aDataLen;  
+  mDataLen = aDataLen;
 }
 
 
@@ -401,7 +402,7 @@ nsTransferable::SetTransferData(const char *aFlavor, nsISupports *aData, uint32_
   for (i = 0; i < mDataArray.Length(); ++i) {
     DataStruct& data = mDataArray.ElementAt(i);
     if ( data.GetFlavor().Equals(aFlavor) ) {
-      data.SetData ( aData, aDataLen );
+      data.SetData ( aData, aDataLen, mPrivateData );
       return NS_OK;
     }
   }
@@ -417,7 +418,7 @@ nsTransferable::SetTransferData(const char *aFlavor, nsISupports *aData, uint32_
         nsCOMPtr<nsISupports> ConvertedData;
         uint32_t ConvertedLen;
         mFormatConv->Convert(aFlavor, aData, aDataLen, data.GetFlavor().get(), getter_AddRefs(ConvertedData), &ConvertedLen);
-        data.SetData(ConvertedData, ConvertedLen);
+        data.SetData(ConvertedData, ConvertedLen, mPrivateData);
         return NS_OK;
       }
     }



More information about the tbb-commits mailing list