Conditionally force memory storage according to privacy.thirdparty.isolate; TOR_BUG_9701

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
parent 3
141e0f1194b1
child 9
a63d609f5ebe

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

widget/xpwidgets/nsTransferable.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/widget/xpwidgets/nsTransferable.cpp	Wed Dec 31 07:16:47 2014 +0100
     1.2 +++ b/widget/xpwidgets/nsTransferable.cpp	Tue Jan 06 21:39:09 2015 +0100
     1.3 @@ -14,6 +14,7 @@
     1.4  
     1.5   
     1.6  #include "nsTransferable.h"
     1.7 +#include "mozilla/Preferences.h"
     1.8  #include "nsString.h"
     1.9  #include "nsReadableUtils.h"
    1.10  #include "nsTArray.h"
    1.11 @@ -58,8 +59,11 @@
    1.12  void
    1.13  DataStruct::SetData ( nsISupports* aData, uint32_t aDataLen )
    1.14  {
    1.15 +  // First, prepare for conditional caching according to isolation mode
    1.16 +  int32_t isolationState = mozilla::Preferences::GetInt("privacy.thirdparty.isolate");
    1.17 +
    1.18    // Now, check to see if we consider the data to be "too large"
    1.19 -  if (aDataLen > kLargeDatasetSize) {
    1.20 +  if (aDataLen > kLargeDatasetSize && isolationState == 0) {
    1.21      // if so, cache it to disk instead of memory
    1.22      if ( NS_SUCCEEDED(WriteCache(aData, aDataLen)) )
    1.23        return;

mercurial