Bug 777639 - Part 1: Remove unused code from Sanitizer. r=mfinkle
authorBrian Nicholson <bnicholson@mozilla.com>
Tue, 05 Feb 2013 16:08:01 -0800
changeset 130844 2ffeac43b95e356c3d655ae347033829f3f8f7c5
parent 130843 a7f93cfc074e467aa8488de6da01b3ad6d112f4d
child 130845 997812c6023df5fb91e8cd965d0c4c03df17a8cb
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs777639
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 777639 - Part 1: Remove unused code from Sanitizer. r=mfinkle
content/media/MediaStreamGraph.cpp
dom/telephony/Makefile.in
dom/telephony/nsIDOMNavigatorTelephony.idl
mobile/android/chrome/content/sanitize.js
--- a/mobile/android/chrome/content/sanitize.js
+++ b/mobile/android/chrome/content/sanitize.js
@@ -7,58 +7,16 @@ function Sanitizer() {}
 Sanitizer.prototype = {
   // warning to the caller: this one may raise an exception (e.g. bug #265028)
   clearItem: function (aItemName)
   {
     if (this.items[aItemName].canClear)
       this.items[aItemName].clear();
   },
 
-  canClearItem: function (aItemName)
-  {
-    return this.items[aItemName].canClear;
-  },
-
-  _prefDomain: "privacy.item.",
-  getNameFromPreference: function (aPreferenceName)
-  {
-    return aPreferenceName.substr(this._prefDomain.length);
-  },
-
-  /**
-   * Deletes privacy sensitive data in a batch, according to user preferences
-   *
-   * @returns  null if everything's fine;  an object in the form
-   *           { itemName: error, ... } on (partial) failure
-   */
-  sanitize: function ()
-  {
-    var branch = Services.prefs.getBranch(this._prefDomain);
-    var errors = null;
-    for (var itemName in this.items) {
-      var item = this.items[itemName];
-      if ("clear" in item && item.canClear && branch.getBoolPref(itemName)) {
-        // Some of these clear() may raise exceptions (see bug #265028)
-        // to sanitize as much as possible, we catch and store them,
-        // rather than fail fast.
-        // Callers should check returned errors and give user feedback
-        // about items that could not be sanitized
-        try {
-          item.clear();
-        } catch(er) {
-          if (!errors)
-            errors = {};
-          errors[itemName] = er;
-          dump("Error sanitizing " + itemName + ": " + er + "\n");
-        }
-      }
-    }
-    return errors;
-  },
-
   items: {
     cache: {
       clear: function ()
       {
         var cacheService = Cc["@mozilla.org/network/cache-service;1"].getService(Ci.nsICacheService);
         try {
           cacheService.evictEntries(Ci.nsICache.STORE_ANYWHERE);
         } catch(er) {}
@@ -224,60 +182,8 @@ Sanitizer.prototype = {
       get canClear()
       {
         return true;
       }
     }
   }
 };
 
-
-// "Static" members
-Sanitizer.prefDomain          = "privacy.sanitize.";
-Sanitizer.prefShutdown        = "sanitizeOnShutdown";
-Sanitizer.prefDidShutdown     = "didShutdownSanitize";
-
-Sanitizer._prefs = null;
-Sanitizer.__defineGetter__("prefs", function()
-{
-  return Sanitizer._prefs ? Sanitizer._prefs
-    : Sanitizer._prefs = Cc["@mozilla.org/preferences-service;1"]
-                         .getService(Ci.nsIPrefService)
-                         .getBranch(Sanitizer.prefDomain);
-});
-
-/**
- * Deletes privacy sensitive data in a batch, optionally showing the
- * sanitize UI, according to user preferences
- *
- * @returns  null if everything's fine
- *           an object in the form { itemName: error, ... } on (partial) failure
- */
-Sanitizer.sanitize = function()
-{
-  return new Sanitizer().sanitize();
-};
-
-Sanitizer.onStartup = function()
-{
-  // we check for unclean exit with pending sanitization
-  Sanitizer._checkAndSanitize();
-};
-
-Sanitizer.onShutdown = function()
-{
-  // we check if sanitization is needed and perform it
-  Sanitizer._checkAndSanitize();
-};
-
-// this is called on startup and shutdown, to perform pending sanitizations
-Sanitizer._checkAndSanitize = function()
-{
-  const prefs = Sanitizer.prefs;
-  if (prefs.getBoolPref(Sanitizer.prefShutdown) &&
-      !prefs.prefHasUserValue(Sanitizer.prefDidShutdown)) {
-    // this is a shutdown or a startup after an unclean exit
-    Sanitizer.sanitize() || // sanitize() returns null on full success
-      prefs.setBoolPref(Sanitizer.prefDidShutdown, true);
-  }
-};
-
-