Also, some of the old Torbutton JS components generate "noise" when reviewing this kind of large of change by Mozilla, so we removed several files on one of our branches. If you want to take it, that commit is here:
Somehow we missed that... sorry. We are working on a new patch. Firefox now has two image caches (regular and private browsing). Unfortunately, there does not seem to be a way to clear the contents of the private browsing image cache unless you have access to a document that is part of a private browsing session.
I went ahead and merged this because it is an improvement and will help us test FF24 sooner, but I have the following questions and concerns:
For the image cache stuff: Do we need move that call up to before the point where we try to close any windows? On the one hand, we don't want to miss clearing it if there are no private windows currently open (because we just closed them). On the other hand, we don't want to let any windows load any images after we've cleared the image cache.. I'm also surprised that closing all windows doesn't clear the private browsing data + caches automatically. Shouldn't it?
Related: We're sure there can be only two image caches, right?
For the nsIContentPrefService2 clearing code, do we need to get contexts for both private and non-private windows here too? It sounds like we might?
For your comment about {private: true} above OpenBrowserWindow(), that sounds like it might be our fix for #8400 (moved), yes? If we set that arg based on the torbutton pref extensions.torbutton.block_disk, perhaps that will solve #8400 (moved), right?
I went ahead and merged this because it is an improvement and will help us test FF24 sooner, but I have the following questions and concerns:
For the image cache stuff: Do we need move that call up to before the point where we try to close any windows? On the one hand, we don't want to miss clearing it if there are no private windows currently open (because we just closed them). On the other hand, we don't want to let any windows load any images after we've cleared the image cache.. I'm also surprised that closing all windows doesn't clear the private browsing data + caches automatically. Shouldn't it?
The code in torbutton_close_on_toggle() closes all tabs but opens an about:blank tab in each open window, and it closes all windows except the one that torbutton_do_new_identity() is running in. If the remaining window is a private browsing one, the code in torbutton_clear_image_caches() will take care of clearing the private browsing cache. If the last remaining window is a regular one, then Firefox will have already cleared the private browsing cache by the time torbutton_clear_image_caches() is called.
Related: We're sure there can be only two image caches, right?
For your comment about {private: true} above OpenBrowserWindow(), that sounds like it might be our fix for #8400 (moved), yes? If we set that arg based on the torbutton pref extensions.torbutton.block_disk, perhaps that will solve #8400 (moved), right?
The window created here (during new identity) should have the correct private browsing characteristics (the new window will "follow" the value of browser.privatebrowsing.autostart). Regarding 8400, our reading of the Firefox code indicates that a restart is NOT required -- except existing open windows will retain their old state with respect to private browsing. That means that if someone starts out with "Don't record browsing history" off and then turns it on, the windows that were already open will still be recording history. I suspect that is why Mozilla forces a restart when users toggle browser.privatebrowsing.autostart via the preferences UI.