Commit 3df4216b authored by Mike Perry's avatar Mike Perry
Browse files

Bug 15781: Remove the sessionstore filter

It is now obsolete. Firefox now properly disables session store if private
browsing mode is enabled.
parent 8839242f
......@@ -141,9 +141,6 @@ contract;1 {3da0269f-fc29-4e9e-a678-c3b1cafcf13f}
contract;1 {3da0269f-fc29-4e9e-a678-c3b1cafcf13f}
contract;1 {3da0269f-fc29-4e9e-a678-c3b1cafcf13f}
component {aef08952-b003-4697-b935-a392367e214f} components/tbSessionStore.js
contract;1 {aef08952-b003-4697-b935-a392367e214f}
component {06322def-6fde-4c06-aef6-47ae8e799629} components/startup-observer.js
contract;1 {06322def-6fde-4c06-aef6-47ae8e799629}
......@@ -163,6 +160,5 @@ component {e33fd6d4-270f-475f-a96f-ff3140279f68} components/domain-isolator.js
contract;1 {e33fd6d4-270f-475f-a96f-ff3140279f68}
category profile-after-change CookieJarSelector;1
category profile-after-change TBSessionBlocker;1
category profile-after-change StartupObserver;1
category profile-after-change DomainIsolator;1
// Bug 1506 P4: This code blocks the session store from being written to
// disk. It is fairly important, but only one small piece is needed. Search
// this file for 1506 for more details.
* Torbutton Session Store Control
* Uses the new Firefox 3.5+ session store APIs to prevent writing
* of tor-loaded tabs to disk.
// Module specific constants
const kMODULE_NAME = "Torbutton Session Store Blocker";
const kMODULE_CONTRACTID = ";1";
const kMODULE_CID = Components.ID("aef08952-b003-4697-b935-a392367e214f");
const Cr = Components.results;
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
function TBSessionBlocker() {
this.logger = Components.classes[";1"]
this.logger.log(3, "Torbutton Session Store Blocker initialized");
var obsSvc = Components.classes[";1"]
obsSvc.addObserver(this, "sessionstore-state-write", false);
this.prefs = Components.classes[";1"]
this.wrappedJSObject = this;
TBSessionBlocker.prototype =
QueryInterface: function(iid) {
if (!iid.equals(Ci.nsIClassInfo) &&
!iid.equals(Ci.nsIObserver) &&
!iid.equals(Ci.nsISupports)) {
Components.returnCode = Cr.NS_ERROR_NO_INTERFACE;
return null;
return this;
wrappedJSObject: null, // Initialized by constructor
// make this an nsIClassInfo object
flags: Ci.nsIClassInfo.DOM_OBJECT,
// method of nsIClassInfo
classDescription: kMODULE_NAME,
// Hack to get us registered early enough to observe the session store.
_xpcom_categories: [{category:"profile-after-change"}],
// method of nsIClassInfo
getInterfaces: function(count) {
var interfaceList = [Ci.nsIClassInfo];
count.value = interfaceList.length;
return interfaceList;
// method of nsIClassInfo
getHelperForLanguage: function(count) { return null; },
_walkObj: function(soFar, obj) {
for (let m in obj) {
this.logger.log(2, soFar+"."+m);
if (obj[m] != obj)
this._walkObj(soFar+"."+m, obj[m]);
// observer interface implementation
// topic: what event occurred
// subject: what nsIPrefBranch we're observing
// data: which pref has been changed (relative to subject)
observe: function(subject, topic, data)
if (topic != "sessionstore-state-write") return;
this.logger.log(3, "Got Session Store observe: "+topic);
// In ESR 31 |subject| is |null| in non-private browsing mode. Thus, we
// are not able to clean anything. In Private Browsing Mode nothing is
// written in the first place and therefore no |sessionstore-state-write|
// notification is emitted.
try {
subject = subject.QueryInterface(Ci.nsISupportsString);
} catch (e) {
this.logger.log(3, "We got no data to clean");
// Bug 1506: This is the only important bit, other than
// the registration goop. You don't even need the JSON
// garbage...
// Simply block sessionstore writes entirely in Tor Browser
try {
if (this.prefs.getBoolPref("extensions.torbutton.block_disk")) {
this.logger.log(3, "Blocking SessionStore write in Tor Browser"); = null;
} catch(e) {
this.logger.log(5, "Error blocking SessionStore write in Tor Browser: "+e);
* XPCOMUtils.generateNSGetFactory was introduced in Mozilla 2 (Firefox 4).
* XPCOMUtils.generateNSGetModule is for Mozilla 1.9.2 (Firefox 3.6).
// XXX: This won't work for FF3... We need to not register ourselves here..
if (XPCOMUtils.generateNSGetFactory)
var NSGetFactory = XPCOMUtils.generateNSGetFactory([TBSessionBlocker]);
var NSGetModule = XPCOMUtils.generateNSGetModule([TBSessionBlocker]);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment