Backed out changeset 4b41b425c4fa
authorMarco Bonardo <mbonardo@mozilla.com>
Thu, 09 Sep 2010 13:29:56 +0200
changeset 52270 27bf7c34f345da42a53389183514b2f255aa191c
parent 52264 4b41b425c4faf1d0fdd2649120d2bd8d016671f1
child 52271 3351774c6272ece22df3391e495c2254b5b081b8
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone2.0b6pre
backs out4b41b425c4faf1d0fdd2649120d2bd8d016671f1
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
Backed out changeset 4b41b425c4fa
dom/src/storage/nsDOMStorage.cpp
dom/src/storage/nsDOMStorage.h
dom/src/storage/nsDOMStorageDBWrapper.cpp
dom/src/storage/nsDOMStorageDBWrapper.h
dom/src/storage/nsDOMStoragePersistentDB.cpp
dom/src/storage/nsDOMStoragePersistentDB.h
dom/tests/unit/test_domstorage_aboutpages.js
--- a/dom/src/storage/nsDOMStorage.cpp
+++ b/dom/src/storage/nsDOMStorage.cpp
@@ -178,30 +178,26 @@ IsOfflineAllowed(const nsACString &aDoma
 {
   PRInt32 perm = GetOfflinePermission(aDomain);
   return IS_PERMISSION_ALLOWED(perm);
 }
 
 // Returns two quotas - A hard limit for which adding data will be an error,
 // and a limit after which a warning event will be sent to the observer
 // service.  The warn limit may be -1, in which case there will be no warning.
-// If aOverrideQuota is set, the larger offline apps quota is used and no
-// warning is sent.
 static PRUint32
-GetQuota(const nsACString &aDomain, PRInt32 *aQuota, PRInt32 *aWarnQuota,
-         bool aOverrideQuota)
+GetQuota(const nsACString &aDomain, PRInt32 *aQuota, PRInt32 *aWarnQuota)
 {
   PRUint32 perm = GetOfflinePermission(aDomain);
-  if (IS_PERMISSION_ALLOWED(perm) || aOverrideQuota) {
+  if (IS_PERMISSION_ALLOWED(perm)) {
     // This is an offline app, give more space by default.
     *aQuota = ((PRInt32)nsContentUtils::GetIntPref(kOfflineAppQuota,
                                                    DEFAULT_OFFLINE_APP_QUOTA) * 1024);
 
-    if (perm == nsIOfflineCacheUpdateService::ALLOW_NO_WARN ||
-        aOverrideQuota) {
+    if (perm == nsIOfflineCacheUpdateService::ALLOW_NO_WARN) {
       *aWarnQuota = -1;
     } else {
       *aWarnQuota = ((PRInt32)nsContentUtils::GetIntPref(kOfflineAppWarnQuota,
                                                          DEFAULT_OFFLINE_WARN_QUOTA) * 1024);
     }
     return perm;
   }
 
@@ -574,17 +570,16 @@ nsDOMStorage::nsDOMStorage(nsDOMStorage&
   , mDomain(aThat.mDomain)
   , mSessionOnly(PR_TRUE)
   , mStorageType(aThat.mStorageType)
   , mItemsCached(PR_FALSE)
 #ifdef MOZ_STORAGE
   , mScopeDBKey(aThat.mScopeDBKey)
 #endif
   , mEventBroadcaster(nsnull)
-  , mCanUseChromePersist(false)
 {
   mSecurityChecker = this;
   mItems.Init(8);
 
   if (nsDOMStorageManager::gStorageManager)
     nsDOMStorageManager::gStorageManager->AddToStoragesHash(this);
 }
 
@@ -677,25 +672,16 @@ nsDOMStorage::InitAsLocalStorage(nsIPrin
 
   nsDOMStorageDBWrapper::CreateQuotaDomainDBKey(mDomain,
       PR_TRUE, PR_FALSE, mQuotaDomainDBKey);
   nsDOMStorageDBWrapper::CreateQuotaDomainDBKey(mDomain,
       PR_TRUE, PR_TRUE, mQuotaETLDplus1DomainDBKey);
 #endif
 
   mStorageType = LocalStorage;
-
-  nsCOMPtr<nsIURI> URI;
-  if (NS_SUCCEEDED(aPrincipal->GetURI(getter_AddRefs(URI))) && URI) {
-    PRBool isAbout;
-    mCanUseChromePersist =
-      (NS_SUCCEEDED(URI->SchemeIs("moz-safe-about", &isAbout) && isAbout)) ||
-      (NS_SUCCEEDED(URI->SchemeIs("about", &isAbout), && isAbout));
-  }
-
   return NS_OK;
 }
 
 nsresult
 nsDOMStorage::InitAsGlobalStorage(const nsACString &aDomainDemanded)
 {
   mDomain = aDomainDemanded;
 #ifdef MOZ_STORAGE
@@ -819,21 +805,16 @@ nsDOMStorage::CacheStoragePermissions()
 
   nsCOMPtr<nsIPrincipal> subjectPrincipal;
   ssm->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
 
   NS_ASSERTION(mSecurityChecker, "Has non-null mSecurityChecker");
   return mSecurityChecker->CanAccess(subjectPrincipal);
 }
 
-bool
-nsDOMStorage::CanUseChromePersist()
-{
-  return mCanUseChromePersist;
-}
 
 class ItemCounterState
 {
 public:
   ItemCounterState(PRBool aIsCallerSecure)
     : mIsCallerSecure(aIsCallerSecure), mCount(0)
   {
   }
@@ -1266,18 +1247,17 @@ nsDOMStorage::SetDBValue(const nsAString
     return NS_OK;
 
   nsresult rv = InitDB();
   NS_ENSURE_SUCCESS(rv, rv);
 
   PRInt32 offlineAppPermission;
   PRInt32 quota;
   PRInt32 warnQuota;
-  offlineAppPermission = GetQuota(mDomain, &quota, &warnQuota,
-                                  CanUseChromePersist());
+  offlineAppPermission = GetQuota(mDomain, &quota, &warnQuota);
 
   PRInt32 usage;
   rv = gStorageDB->SetKey(this, aKey, aValue, aSecure, quota,
                           !IS_PERMISSION_ALLOWED(offlineAppPermission),
                           &usage);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mItemsCached = PR_FALSE;
@@ -1997,28 +1977,28 @@ nsDOMStorageItem::SetValue(const nsAStri
 
 NS_IMETHODIMP
 nsDOMStorageItem::ToString(nsAString& aStr)
 {
   return GetValue(aStr);
 }
 
 // Cycle collection implementation for nsDOMStorageEvent
-NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMStorageEvent)
-
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMStorageEvent, nsDOMEvent)
-  NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mStorageArea)
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMStorageEvent, nsDOMEvent)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mStorageArea)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-
-NS_IMPL_ADDREF_INHERITED(nsDOMStorageEvent, nsDOMEvent)
-NS_IMPL_RELEASE_INHERITED(nsDOMStorageEvent, nsDOMEvent)
+NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMStorageEvent)
+
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMStorageEvent, nsDOMEvent)
+  NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mStorageArea)
+NS_IMPL_CYCLE_COLLECTION_UNLINK_END
+
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMStorageEvent, nsDOMEvent)
+  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mStorageArea)
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
+
+NS_IMPL_ADDREF_INHERITED(nsDOMStorageEvent, nsDOMEvent)
+NS_IMPL_RELEASE_INHERITED(nsDOMStorageEvent, nsDOMEvent)
 
 DOMCI_DATA(StorageEvent, nsDOMStorageEvent)
 
 // QueryInterface implementation for nsDOMStorageEvent
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMStorageEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMStorageEvent)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(StorageEvent)
 NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
--- a/dom/src/storage/nsDOMStorage.h
+++ b/dom/src/storage/nsDOMStorage.h
@@ -170,20 +170,16 @@ public:
   PRBool UseDB() {
     return mUseDB;
   }
 
   PRBool SessionOnly() {
     return mSessionOnly;
   }
 
-  // Some privileged internal pages can use a persistent storage even in
-  // session-only or private-browsing modes.
-  bool CanUseChromePersist();
-
   // Check whether storage may be used by the caller, and whether it
   // is session only.  Returns true if storage may be used.
   static PRBool
   CanUseStorage(PRPackedBool* aSessionOnly);
 
   // Check whether storage may be used.  Updates mSessionOnly based on
   // the result of CanUseStorage.
   PRBool
@@ -265,18 +261,16 @@ protected:
   nsCString mScopeDBKey;
   nsCString mQuotaETLDplus1DomainDBKey;
   nsCString mQuotaDomainDBKey;
 
   friend class nsIDOMStorage2;
   nsPIDOMStorage* mSecurityChecker;
   nsPIDOMStorage* mEventBroadcaster;
 
-  bool mCanUseChromePersist;
-
 public:
   // e.g. "moc.rab.oof.:" or "moc.rab.oof.:http:80" depending
   // on association with a domain (globalStorage) or
   // an origin (localStorage).
   nsCString& GetScopeDBKey() {return mScopeDBKey;}
 
   // e.g. "moc.rab.%" - reversed eTLD+1 subpart of the domain or
   // reversed offline application allowed domain.
--- a/dom/src/storage/nsDOMStorageDBWrapper.cpp
+++ b/dom/src/storage/nsDOMStorageDBWrapper.cpp
@@ -69,53 +69,46 @@ void ReverseString(const nsCSubstring& s
   }
 }
 
 nsresult
 nsDOMStorageDBWrapper::Init()
 {
   nsresult rv;
 
-  rv = mPersistentDB.Init(NS_LITERAL_STRING("webappsstore.sqlite"));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = mChromePersistentDB.Init(NS_LITERAL_STRING("chromeappsstore.sqlite"));
+  rv = mPersistentDB.Init();
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = mSessionOnlyDB.Init(&mPersistentDB);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = mPrivateBrowsingDB.Init();
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
 nsresult
 nsDOMStorageDBWrapper::GetAllKeys(nsDOMStorage* aStorage,
                                   nsTHashtable<nsSessionStorageEntry>* aKeys)
 {
-  if (aStorage->CanUseChromePersist())
-    return mChromePersistentDB.GetAllKeys(aStorage, aKeys);
   if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode())
     return mPrivateBrowsingDB.GetAllKeys(aStorage, aKeys);
   if (aStorage->SessionOnly())
     return mSessionOnlyDB.GetAllKeys(aStorage, aKeys);
 
   return mPersistentDB.GetAllKeys(aStorage, aKeys);
 }
 
 nsresult
 nsDOMStorageDBWrapper::GetKeyValue(nsDOMStorage* aStorage,
                                    const nsAString& aKey,
                                    nsAString& aValue,
                                    PRBool* aSecure)
 {
-  if (aStorage->CanUseChromePersist())
-    return mChromePersistentDB.GetKeyValue(aStorage, aKey, aValue, aSecure);
   if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode())
     return mPrivateBrowsingDB.GetKeyValue(aStorage, aKey, aValue, aSecure);
   if (aStorage->SessionOnly())
     return mSessionOnlyDB.GetKeyValue(aStorage, aKey, aValue, aSecure);
 
   return mPersistentDB.GetKeyValue(aStorage, aKey, aValue, aSecure);
 }
 
@@ -123,66 +116,57 @@ nsresult
 nsDOMStorageDBWrapper::SetKey(nsDOMStorage* aStorage,
                               const nsAString& aKey,
                               const nsAString& aValue,
                               PRBool aSecure,
                               PRInt32 aQuota,
                               PRBool aExcludeOfflineFromUsage,
                               PRInt32 *aNewUsage)
 {
-  if (aStorage->CanUseChromePersist())
-    return mChromePersistentDB.SetKey(aStorage, aKey, aValue, aSecure,
-                                          aQuota, aExcludeOfflineFromUsage, aNewUsage);
   if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode())
     return mPrivateBrowsingDB.SetKey(aStorage, aKey, aValue, aSecure,
                                           aQuota, aExcludeOfflineFromUsage, aNewUsage);
   if (aStorage->SessionOnly())
     return mSessionOnlyDB.SetKey(aStorage, aKey, aValue, aSecure,
                                       aQuota, aExcludeOfflineFromUsage, aNewUsage);
 
   return mPersistentDB.SetKey(aStorage, aKey, aValue, aSecure,
                                    aQuota, aExcludeOfflineFromUsage, aNewUsage);
 }
 
 nsresult
 nsDOMStorageDBWrapper::SetSecure(nsDOMStorage* aStorage,
                                  const nsAString& aKey,
                                  const PRBool aSecure)
 {
-  if (aStorage->CanUseChromePersist())
-    return mChromePersistentDB.SetSecure(aStorage, aKey, aSecure);
   if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode())
     return mPrivateBrowsingDB.SetSecure(aStorage, aKey, aSecure);
   if (aStorage->SessionOnly())
     return mSessionOnlyDB.SetSecure(aStorage, aKey, aSecure);
 
   return mPersistentDB.SetSecure(aStorage, aKey, aSecure);
 }
 
 nsresult
 nsDOMStorageDBWrapper::RemoveKey(nsDOMStorage* aStorage,
                                  const nsAString& aKey,
                                  PRBool aExcludeOfflineFromUsage,
                                  PRInt32 aKeyUsage)
 {
-  if (aStorage->CanUseChromePersist())
-    return mChromePersistentDB.RemoveKey(aStorage, aKey, aExcludeOfflineFromUsage, aKeyUsage);
   if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode())
     return mPrivateBrowsingDB.RemoveKey(aStorage, aKey, aExcludeOfflineFromUsage, aKeyUsage);
   if (aStorage->SessionOnly())
     return mSessionOnlyDB.RemoveKey(aStorage, aKey, aExcludeOfflineFromUsage, aKeyUsage);
 
   return mPersistentDB.RemoveKey(aStorage, aKey, aExcludeOfflineFromUsage, aKeyUsage);
 }
 
 nsresult
 nsDOMStorageDBWrapper::ClearStorage(nsDOMStorage* aStorage)
 {
-  if (aStorage->CanUseChromePersist())
-    return mChromePersistentDB.ClearStorage(aStorage);
   if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode())
     return mPrivateBrowsingDB.ClearStorage(aStorage);
   if (aStorage->SessionOnly())
     return mSessionOnlyDB.ClearStorage(aStorage);
 
   return mPersistentDB.ClearStorage(aStorage);
 }
 
@@ -260,18 +244,16 @@ nsDOMStorageDBWrapper::RemoveAll()
 
   return rv;
 }
 
 nsresult
 nsDOMStorageDBWrapper::GetUsage(nsDOMStorage* aStorage,
                                 PRBool aExcludeOfflineFromUsage, PRInt32 *aUsage)
 {
-  if (aStorage->CanUseChromePersist())
-    return mChromePersistentDB.GetUsage(aStorage, aExcludeOfflineFromUsage, aUsage);    
   if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode())
     return mPrivateBrowsingDB.GetUsage(aStorage, aExcludeOfflineFromUsage, aUsage);
   if (aStorage->SessionOnly())
     return mSessionOnlyDB.GetUsage(aStorage, aExcludeOfflineFromUsage, aUsage);
 
   return mPersistentDB.GetUsage(aStorage, aExcludeOfflineFromUsage, aUsage);
 }
 
--- a/dom/src/storage/nsDOMStorageDBWrapper.h
+++ b/dom/src/storage/nsDOMStorageDBWrapper.h
@@ -212,15 +212,14 @@ public:
   static nsresult CreateQuotaDomainDBKey(const nsACString& aAsciiDomain,
                                          PRBool aIncludeSubDomains, PRBool aETLDplus1Only,
                                          nsACString& aKey);
 
   static nsresult GetDomainFromScopeKey(const nsACString& aScope,
                                          nsACString& aDomain);
 
 protected:
-  nsDOMStoragePersistentDB mChromePersistentDB;
   nsDOMStoragePersistentDB mPersistentDB;
   nsDOMStorageMemoryDB mSessionOnlyDB;
   nsDOMStorageMemoryDB mPrivateBrowsingDB;
 };
 
 #endif /* nsDOMStorageDB_h___ */
--- a/dom/src/storage/nsDOMStoragePersistentDB.cpp
+++ b/dom/src/storage/nsDOMStoragePersistentDB.cpp
@@ -119,25 +119,25 @@ nsIsOfflineSQLFunction::OnFunctionCall(
   NS_ENSURE_SUCCESS(rv, rv);
 
   *aResult = outVar.get();
   outVar.forget();
   return NS_OK;
 }
 
 nsresult
-nsDOMStoragePersistentDB::Init(const nsString& aDatabaseName)
+nsDOMStoragePersistentDB::Init()
 {
   nsresult rv;
 
   nsCOMPtr<nsIFile> storageFile;
   rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
                               getter_AddRefs(storageFile));
   NS_ENSURE_SUCCESS(rv, rv);
-  rv = storageFile->Append(aDatabaseName);
+  rv = storageFile->Append(NS_LITERAL_STRING("webappsstore.sqlite"));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<mozIStorageService> service;
 
   service = do_GetService(MOZ_STORAGE_SERVICE_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = service->OpenDatabase(storageFile, getter_AddRefs(mConnection));
   if (rv == NS_ERROR_FILE_CORRUPTED) {
--- a/dom/src/storage/nsDOMStoragePersistentDB.h
+++ b/dom/src/storage/nsDOMStoragePersistentDB.h
@@ -49,17 +49,17 @@ class nsSessionStorageEntry;
 
 class nsDOMStoragePersistentDB
 {
 public:
   nsDOMStoragePersistentDB() {}
   ~nsDOMStoragePersistentDB() {}
 
   nsresult
-  Init(const nsString& aDatabaseName);
+  Init();
 
   /**
    * Retrieve a list of all the keys associated with a particular domain.
    */
   nsresult
   GetAllKeys(nsDOMStorage* aStorage,
              nsTHashtable<nsSessionStorageEntry>* aKeys);
 
--- a/dom/tests/unit/test_domstorage_aboutpages.js
+++ b/dom/tests/unit/test_domstorage_aboutpages.js
@@ -8,104 +8,25 @@ Components.utils.import("resource://gre/
 function run_test()
 {
   // Needs a profile folder for the database.
   do_get_profile();
   testURI(Services.io.newURI("about:mozilla", null, null));
   testURI(Services.io.newURI("moz-safe-about:rights", null, null));
 }
 
-function testURI(aURI)
-{
+function testURI(aURI) {
   print("Testing: " + aURI.spec);
-  let storage = getStorageForURI(aURI);
-  storage.setItem("test-item", "test-value");
-  print("Check that our value has been correctly stored.");
-  do_check_eq(storage.length, 1);
-  do_check_eq(storage.key(0), "test-item");
-  do_check_eq(storage.getItem("test-item"), "test-value");
-
-  print("Check that our value is correctly removed.");
-  storage.removeItem("test-item");
-  do_check_eq(storage.length, 0);
-  do_check_eq(storage.getItem("test-item"), null);
-
-  testURIWithPrivateBrowsing(aURI);
-
-  testURIWithClearCookies(aURI);
-}
-
-function testURIWithPrivateBrowsing(aURI) {
-  print("Testing with private browsing: " + aURI.spec);
-  // Skip test if PB mode is not supported.
-  if (!("@mozilla.org/privatebrowsing;1" in Components.classes)) {
-    print("Skipped.");
-    return;
-  }
-
-  let storage = getStorageForURI(aURI);
-  storage.setItem("test-item", "test-value");
-  print("Check that our value has been correctly stored.");
-  do_check_eq(storage.length, 1);
-  do_check_eq(storage.key(0), "test-item");
-  do_check_eq(storage.getItem("test-item"), "test-value");
-  togglePBMode(true);
-  do_check_eq(storage.length, 1);
-  do_check_eq(storage.key(0), "test-item");
-  do_check_eq(storage.getItem("test-item"), "test-value");
-
-  print("Check that our value is correctly removed.");
-  storage.removeItem("test-item");
-  do_check_eq(storage.length, 0);
-  do_check_eq(storage.getItem("test-item"), null);
-  togglePBMode(false);
-  do_check_eq(storage.length, 0);
-  do_check_eq(storage.getItem("test-item"), null);
-}
-
-function testURIWithClearCookies(aURI) {
-  let storage = getStorageForURI(aURI);
-  storage.setItem("test-item", "test-value");
-  print("Check that our value has been correctly stored.");
-  do_check_eq(storage.length, 1);
-  do_check_eq(storage.key(0), "test-item");
-  do_check_eq(storage.getItem("test-item"), "test-value");
-
-  let dsm = Components.classes["@mozilla.org/dom/storagemanager;1"].
-        getService(Components.interfaces.nsIObserver);
-  dsm.observe(null, "cookie-changed", "cleared");
-
-  print("Check that our value is still stored.");
-  do_check_eq(storage.length, 1);
-  do_check_eq(storage.key(0), "test-item");
-  do_check_eq(storage.getItem("test-item"), "test-value");
-
-  print("Check that we can explicitly clear value.");
-  storage.clear();
-  do_check_eq(storage.length, 0);
-  do_check_eq(storage.getItem("test-item"), null);
-}
-
-function getStorageForURI(aURI)
-{
+  do_check_true(/about$/.test(aURI.scheme));
   let principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"].
                   getService(Components.interfaces.nsIScriptSecurityManager).
                   getCodebasePrincipal(aURI);
   let dsm = Components.classes["@mozilla.org/dom/storagemanager;1"].
             getService(Components.interfaces.nsIDOMStorageManager);
-  return dsm.getLocalStorageForPrincipal(principal, "");
+  let storage = dsm.getLocalStorageForPrincipal(principal, "");
+  storage.setItem("test-item", "test-value");
+  print("Check that our value has been correctly stored.");
+  do_check_eq(storage.getItem("test-item"), "test-value");
+  storage.removeItem("test-item");
+  print("Check that our value has been correctly removed.");
+  do_check_eq(storage.getItem("test-item"), null);
 }
 
-function togglePBMode(aEnable)
-{
-  let pb = Components.classes["@mozilla.org/privatebrowsing;1"].
-           getService(Components.interfaces.nsIPrivateBrowsingService);
-  if (aEnable) {
-    Services.prefs.setBoolPref("browser.privatebrowsing.keep_current_session",
-                               true);
-    pb.privateBrowsingEnabled = true;
-  } else {
-    try {
-      prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
-    } catch (ex) {}
-    pb.privateBrowsingEnabled = false;
-  }
-}