[tbb-commits] [torbutton/master] Bug 15781: Remove the sessionstore filter
mikeperry at torproject.org
mikeperry at torproject.org
Wed Jul 22 01:41:37 UTC 2015
commit 3df4216be7d681a000546ede7558801e42a40f57
Author: Mike Perry <mikeperry-git at torproject.org>
Date: Tue Jul 21 18:38:03 2015 -0700
Bug 15781: Remove the sessionstore filter
It is now obsolete. Firefox now properly disables session store if private
browsing mode is enabled.
---
src/chrome.manifest | 4 --
src/components/tbSessionStore.js | 126 --------------------------------------
2 files changed, 130 deletions(-)
diff --git a/src/chrome.manifest b/src/chrome.manifest
index 4dc08da..8323e66 100644
--- a/src/chrome.manifest
+++ b/src/chrome.manifest
@@ -141,9 +141,6 @@ contract @mozilla.org/mime;1 {3da0269f-fc29-4e9e-a678-c3b1cafcf13f}
contract @mozilla.org/uriloader/external-protocol-service;1 {3da0269f-fc29-4e9e-a678-c3b1cafcf13f}
contract @mozilla.org/uriloader/external-helper-app-service;1 {3da0269f-fc29-4e9e-a678-c3b1cafcf13f}
-component {aef08952-b003-4697-b935-a392367e214f} components/tbSessionStore.js
-contract @torproject.org/torbutton-ss-blocker;1 {aef08952-b003-4697-b935-a392367e214f}
-
component {06322def-6fde-4c06-aef6-47ae8e799629} components/startup-observer.js
contract @torproject.org/startup-observer;1 {06322def-6fde-4c06-aef6-47ae8e799629}
@@ -163,6 +160,5 @@ component {e33fd6d4-270f-475f-a96f-ff3140279f68} components/domain-isolator.js
contract @torproject.org/domain-isolator;1 {e33fd6d4-270f-475f-a96f-ff3140279f68}
category profile-after-change CookieJarSelector @torproject.org/cookie-jar-selector;1
-category profile-after-change TBSessionBlocker @torproject.org/torbutton-ss-blocker;1
category profile-after-change StartupObserver @torproject.org/startup-observer;1
category profile-after-change DomainIsolator @torproject.org/domain-isolator;1
diff --git a/src/components/tbSessionStore.js b/src/components/tbSessionStore.js
deleted file mode 100644
index 7281bcf..0000000
--- a/src/components/tbSessionStore.js
+++ /dev/null
@@ -1,126 +0,0 @@
-// 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 = "@torproject.org/torbutton-ss-blocker;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["@torproject.org/torbutton-logger;1"]
- .getService(Components.interfaces.nsISupports).wrappedJSObject;
- this.logger.log(3, "Torbutton Session Store Blocker initialized");
-
- var obsSvc = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Ci.nsIObserverService);
- obsSvc.addObserver(this, "sessionstore-state-write", false);
- this.prefs = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
-
- 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,
- classID: kMODULE_CID,
- contractID: kMODULE_CONTRACTID,
-
- // 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");
- subject.data = null;
- return;
- }
- } catch(e) {
- this.logger.log(5, "Error blocking SessionStore write in Tor Browser: "+e);
- }
-
- return;
- }
-
-};
-
-/**
-* XPCOMUtils.generateNSGetFactory was introduced in Mozilla 2 (Firefox 4).
-* XPCOMUtils.generateNSGetModule is for Mozilla 1.9.2 (Firefox 3.6).
-*/
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-// XXX: This won't work for FF3... We need to not register ourselves here..
-if (XPCOMUtils.generateNSGetFactory)
- var NSGetFactory = XPCOMUtils.generateNSGetFactory([TBSessionBlocker]);
-else
- var NSGetModule = XPCOMUtils.generateNSGetModule([TBSessionBlocker]);
More information about the tbb-commits
mailing list