Bug 776416 - Remove exceptions to 5MB quota rule in localStorage. r=honzab
authorJonas Sicking <jonas@sicking.cc>
Thu, 13 Sep 2012 20:46:50 +0200
changeset 106990 fd824db5b0df24831b3d970ab549dae91c31a148
parent 106989 0ec10e895d42536076c6d3825f9c101559249cfe
child 106991 e564016b9de9311ab5dfdd265343fa15c2a90314
push id14806
push userJan.Varga@gmail.com
push dateThu, 13 Sep 2012 18:47:58 +0000
treeherdermozilla-inbound@bef84aa5ce69 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershonzab
bugs776416
milestone18.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 776416 - Remove exceptions to 5MB quota rule in localStorage. r=honzab
browser/base/content/browser.js
dom/interfaces/storage/nsIDOMStorageManager.idl
dom/src/storage/PStorage.ipdl
dom/src/storage/StorageChild.cpp
dom/src/storage/StorageChild.h
dom/src/storage/StorageParent.cpp
dom/src/storage/StorageParent.h
dom/src/storage/nsDOMStorage.cpp
dom/src/storage/nsDOMStorage.h
dom/src/storage/nsDOMStorageBaseDB.cpp
dom/src/storage/nsDOMStorageBaseDB.h
dom/src/storage/nsDOMStorageDBWrapper.cpp
dom/src/storage/nsDOMStorageDBWrapper.h
dom/src/storage/nsDOMStorageMemoryDB.cpp
dom/src/storage/nsDOMStorageMemoryDB.h
dom/src/storage/nsDOMStoragePersistentDB.cpp
dom/src/storage/nsDOMStoragePersistentDB.h
dom/tests/mochitest/localstorage/Makefile.in
dom/tests/mochitest/localstorage/test_localStorageQuota.html
dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly.html
dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly2.html
dom/tests/mochitest/localstorage/test_removeOwnersAPI.html
dom/tests/mochitest/localstorage/test_removeOwnersAPISessionOnly.html
layout/build/nsLayoutStatics.cpp
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -5682,23 +5682,21 @@ var BrowserOffline = {
   }
 };
 
 var OfflineApps = {
   /////////////////////////////////////////////////////////////////////////////
   // OfflineApps Public Methods
   init: function ()
   {
-    Services.obs.addObserver(this, "dom-storage-warn-quota-exceeded", false);
     Services.obs.addObserver(this, "offline-cache-update-completed", false);
   },
 
   uninit: function ()
   {
-    Services.obs.removeObserver(this, "dom-storage-warn-quota-exceeded");
     Services.obs.removeObserver(this, "offline-cache-update-completed");
   },
 
   handleEvent: function(event) {
     if (event.type == "MozApplicationManifest") {
       this.offlineAppRequested(event.originalTarget.defaultView);
     }
   },
@@ -5930,29 +5928,17 @@ var OfflineApps = {
                         getService(Ci.nsIOfflineCacheUpdateService);
     updateService.scheduleUpdate(manifestURI, aDocument.documentURIObject, window);
   },
 
   /////////////////////////////////////////////////////////////////////////////
   // nsIObserver
   observe: function (aSubject, aTopic, aState)
   {
-    if (aTopic == "dom-storage-warn-quota-exceeded") {
-      if (aSubject) {
-        var uri = makeURI(aSubject.location.href);
-
-        if (OfflineApps._checkUsage(uri)) {
-          var browserWindow =
-            this._getBrowserWindowForContentWindow(aSubject);
-          var browser = this._getBrowserForContentWindow(browserWindow,
-                                                         aSubject);
-          OfflineApps._warnUsage(browser, uri);
-        }
-      }
-    } else if (aTopic == "offline-cache-update-completed") {
+    if (aTopic == "offline-cache-update-completed") {
       var cacheUpdate = aSubject.QueryInterface(Ci.nsIOfflineCacheUpdate);
 
       var uri = cacheUpdate.manifestURI;
       if (OfflineApps._checkUsage(uri)) {
         var browser = this._getBrowserForCacheUpdate(cacheUpdate);
         if (browser) {
           OfflineApps._warnUsage(browser, cacheUpdate.manifestURI);
         }
--- a/dom/interfaces/storage/nsIDOMStorageManager.idl
+++ b/dom/interfaces/storage/nsIDOMStorageManager.idl
@@ -3,36 +3,30 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
 interface nsIDOMStorage;
 interface nsIPrincipal;
 
-[scriptable, uuid(1541da6c-a9fb-4a8f-af9d-4493c981491d)]
+[scriptable, uuid(b16b207c-d883-43f5-a27e-548e7f2f5c20)]
 interface nsIDOMStorageManager : nsISupports
 {
   /**
    * Return the amount of disk space used by a domain.  Usage is checked
    * against the domain of the page that set the key (the owner domain), not
    * the domain of the storage object.
    *
    * @param aOwnerDomain The domain to check.
    * @returns the space usage of the domain, in bytes.
    */
   long getUsage(in AString aOwnerDomain);
 
   /**
-   * Clear keys owned by offline applications.  All data owned by a domain
-   * with the "offline-app" permission will be removed from the database.
-   */
-  void clearOfflineApps();
-
-  /**
    * Returns instance of localStorage object for aURI's origin.
    * This method ensures there is always only a single instance
    * for a single origin.
    */
   nsIDOMStorage getLocalStorageForPrincipal(in nsIPrincipal aPrincipal,
                                             in DOMString aDocumentURI,
                                             [optional] in bool aPrivate);
 };
--- a/dom/src/storage/PStorage.ipdl
+++ b/dom/src/storage/PStorage.ipdl
@@ -30,18 +30,18 @@ union StorageItem
 // arguments for any given call to the parent, and returns the result.
 sync protocol PStorage
 {
   manager PContent;
 
 parent:
   __delete__();
 
-  Init(bool useDB, bool canUseChromePersist, bool sessionOnly, bool isPrivate,
-       nsCString domain, nsCString scopeDBKey, nsCString quotaDomainDBKey,
+  Init(bool useDB, bool sessionOnly, bool isPrivate,
+       nsCString domain, nsCString scopeDBKey,
        nsCString quotaETLDplus1DomainDBKey, uint32_t storageType);
   
   sync GetKeys(bool callerSecure)
       returns (nsString[] keys);
   sync GetLength(bool callerSecure, bool sessionOnly)
       returns (uint32_t length, nsresult rv);
   sync GetKey(bool callerSecure, bool sessionOnly, uint32_t index)
       returns (nsString key, nsresult rv);
--- a/dom/src/storage/StorageChild.cpp
+++ b/dom/src/storage/StorageChild.cpp
@@ -78,31 +78,31 @@ StorageChild::CacheStoragePermissions()
 }
 
 void
 StorageChild::InitRemote()
 {
   ContentChild* child = ContentChild::GetSingleton();
   AddIPDLReference();
   child->SendPStorageConstructor(this, null_t());
-  SendInit(mUseDB, mCanUseChromePersist, mSessionOnly, mInPrivateBrowsing, mDomain, mScopeDBKey,
-           mQuotaDomainDBKey, mQuotaETLDplus1DomainDBKey, mStorageType);
+  SendInit(mUseDB, mSessionOnly, mInPrivateBrowsing, mDomain, mScopeDBKey,
+           mQuotaETLDplus1DomainDBKey, mStorageType);
 }
 
 void
 StorageChild::InitAsSessionStorage(nsIURI* aDomainURI, bool aPrivate)
 {
   DOMStorageBase::InitAsSessionStorage(aDomainURI, aPrivate);
   InitRemote();
 }
 
 void
-StorageChild::InitAsLocalStorage(nsIURI* aDomainURI, bool aCanUseChromePersist, bool aPrivate)
+StorageChild::InitAsLocalStorage(nsIURI* aDomainURI, bool aPrivate)
 {
-  DOMStorageBase::InitAsLocalStorage(aDomainURI, aCanUseChromePersist, aPrivate);
+  DOMStorageBase::InitAsLocalStorage(aDomainURI, aPrivate);
   InitRemote();
 }
 
 nsTArray<nsString>*
 StorageChild::GetKeys(bool aCallerSecure)
 {
   InfallibleTArray<nsString> remoteKeys;
   SendGetKeys(aCallerSecure, &remoteKeys);
@@ -191,22 +191,16 @@ StorageChild::Clear(bool aCallerSecure, 
   int32_t oldCount;
   SendClear(aCallerSecure, mSessionOnly, &oldCount, &rv);
   if (NS_FAILED(rv))
     return rv;
   *aOldCount = oldCount;
   return NS_OK;
 }
 
-bool
-StorageChild::CanUseChromePersist()
-{
-  return mCanUseChromePersist;
-}
-
 nsresult
 StorageChild::GetDBValue(const nsAString& aKey, nsAString& aValue,
                          bool* aSecure)
 {
   nsresult rv;
   nsString value;
   SendGetDBValue(nsString(aKey), &value, aSecure, &rv);
   aValue = value;
@@ -234,18 +228,18 @@ StorageChild::SetSecure(const nsAString&
 nsresult
 StorageChild::CloneFrom(bool aCallerSecure, DOMStorageBase* aThat)
 {
   StorageChild* other = static_cast<StorageChild*>(aThat);
   ContentChild* child = ContentChild::GetSingleton();
   StorageClone clone(nullptr, other, aCallerSecure);
   AddIPDLReference();
   child->SendPStorageConstructor(this, clone);
-  SendInit(mUseDB, mCanUseChromePersist, mSessionOnly, mInPrivateBrowsing, mDomain,
-           mScopeDBKey, mQuotaDomainDBKey, mQuotaETLDplus1DomainDBKey, mStorageType);
+  SendInit(mUseDB, mSessionOnly, mInPrivateBrowsing, mDomain,
+           mScopeDBKey, mQuotaETLDplus1DomainDBKey, mStorageType);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 StorageChild::PrivateModeChanged(bool enabled)
 {
   mInPrivateBrowsing = enabled;
   SendUpdatePrivateState(enabled);
--- a/dom/src/storage/StorageChild.h
+++ b/dom/src/storage/StorageChild.h
@@ -22,33 +22,31 @@ public:
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(StorageChild, nsIPrivacyTransitionObserver)
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_NSIPRIVACYTRANSITIONOBSERVER
   
   StorageChild(nsDOMStorage* aOwner);
   StorageChild(nsDOMStorage* aOwner, StorageChild& aOther);
 
   virtual void InitAsSessionStorage(nsIURI* aDomainURI, bool aPrivate);
-  virtual void InitAsLocalStorage(nsIURI* aDomainURI, bool aCanUseChromePersist, bool aPrivate);
+  virtual void InitAsLocalStorage(nsIURI* aDomainURI, bool aPrivate);
 
   virtual bool CacheStoragePermissions();
   
   virtual nsTArray<nsString>* GetKeys(bool aCallerSecure);
   virtual nsresult GetLength(bool aCallerSecure, uint32_t* aLength);
   virtual nsresult GetKey(bool aCallerSecure, uint32_t aIndex, nsAString& aKey);
   virtual nsIDOMStorageItem* GetValue(bool aCallerSecure, const nsAString& aKey,
                                       nsresult* rv);
   virtual nsresult SetValue(bool aCallerSecure, const nsAString& aKey,
                             const nsAString& aData, nsAString& aOldValue);
   virtual nsresult RemoveValue(bool aCallerSecure, const nsAString& aKey,
                                nsAString& aOldValue);
   virtual nsresult Clear(bool aCallerSecure, int32_t* aOldCount);
 
-  virtual bool CanUseChromePersist();
-
   virtual nsresult GetDBValue(const nsAString& aKey,
                               nsAString& aValue,
                               bool* aSecure);
   virtual nsresult SetDBValue(const nsAString& aKey,
                               const nsAString& aValue,
                               bool aSecure);
   virtual nsresult SetSecure(const nsAString& aKey, bool aSecure);
 
--- a/dom/src/storage/StorageParent.cpp
+++ b/dom/src/storage/StorageParent.cpp
@@ -23,27 +23,25 @@ StorageParent::StorageParent(const Stora
     StorageParent* other = static_cast<StorageParent*>(clone.actorParent());
     mStorage = new DOMStorageImpl(nullptr, *other->mStorage.get());
     mStorage->CloneFrom(clone.callerSecure(), other->mStorage);
   }
 }
 
 bool
 StorageParent::RecvInit(const bool& aUseDB,
-                        const bool& aCanUseChromePersist,
                         const bool& aSessionOnly,
                         const bool& aPrivate,
                         const nsCString& aDomain,
                         const nsCString& aScopeDBKey,
-                        const nsCString& aQuotaDomainDBKey,
                         const nsCString& aQuotaETLDplus1DomainDBKey,
                         const uint32_t& aStorageType)
 {
-  mStorage->InitFromChild(aUseDB, aCanUseChromePersist, aSessionOnly, aPrivate, aDomain,
-                          aScopeDBKey, aQuotaDomainDBKey, aQuotaETLDplus1DomainDBKey,
+  mStorage->InitFromChild(aUseDB, aSessionOnly, aPrivate, aDomain,
+                          aScopeDBKey, aQuotaETLDplus1DomainDBKey,
                           aStorageType);
   return true;
 }
 
 bool
 StorageParent::RecvUpdatePrivateState(const bool& aEnabled)
 {
   mStorage->PrivateModeChanged(aEnabled);
--- a/dom/src/storage/StorageParent.h
+++ b/dom/src/storage/StorageParent.h
@@ -38,22 +38,20 @@ private:
 
   bool RecvGetDBValue(const nsString& aKey, nsString* aValue, bool* aSecure,
                       nsresult* rv);
   bool RecvSetDBValue(const nsString& aKey, const nsString& aValue,
                       const bool& aSecure, nsresult* rv);
   bool RecvSetSecure(const nsString& aKey, const bool& aSecure, nsresult* rv);
 
   bool RecvInit(const bool& aUseDB,
-                const bool& aCanUseChromePersist,
                 const bool& aSessionOnly,
                 const bool& aPrivate,
                 const nsCString& aDomain,
                 const nsCString& aScopeDBKey,
-                const nsCString& aQuotaDomainDBKey,
                 const nsCString& aQuotaETLDplus1DomainDBKey,
                 const uint32_t& aStorageType);
 
   bool RecvUpdatePrivateState(const bool& aEnabled);
 
   nsRefPtr<DOMStorageImpl> mStorage;
 };
 
--- a/dom/src/storage/nsDOMStorage.cpp
+++ b/dom/src/storage/nsDOMStorage.cpp
@@ -24,17 +24,16 @@ using mozilla::dom::ContentChild;
 #include "nsIURI.h"
 #include "nsReadableUtils.h"
 #include "nsIObserverService.h"
 #include "nsNetUtil.h"
 #include "nsICookiePermission.h"
 #include "nsIPermission.h"
 #include "nsIPermissionManager.h"
 #include "nsCycleCollectionParticipant.h"
-#include "nsIOfflineCacheUpdate.h"
 #include "nsIJSContextStack.h"
 #include "nsIPrivateBrowsingService.h"
 #include "nsDOMString.h"
 #include "nsNetCID.h"
 #include "mozilla/Preferences.h"
 #include "nsThreadUtils.h"
 #include "mozilla/Telemetry.h"
 #include "DictionaryHelpers.h"
@@ -47,33 +46,24 @@ using mozilla::dom::ContentChild;
 #define NS_DOMSTORAGE_FLUSH_FORCE_TOPIC "domstorage-flush-force"
 
 using namespace mozilla;
 
 static const uint32_t ASK_BEFORE_ACCEPT = 1;
 static const uint32_t ACCEPT_SESSION = 2;
 static const uint32_t BEHAVIOR_REJECT = 2;
 
-static const uint32_t DEFAULT_QUOTA = 5 * 1024;
-// Be generous with offline apps by default...
-static const uint32_t DEFAULT_OFFLINE_APP_QUOTA = 200 * 1024;
-// ... but warn if it goes over this amount
-static const uint32_t DEFAULT_OFFLINE_WARN_QUOTA = 50 * 1024;
-
 // Intervals to flush the temporary table after in seconds
 #define NS_DOMSTORAGE_MAXIMUM_TEMPTABLE_INACTIVITY_TIME (5)
 #define NS_DOMSTORAGE_MAXIMUM_TEMPTABLE_AGE (30)
 
 static const char kPermissionType[] = "cookie";
 static const char kStorageEnabled[] = "dom.storage.enabled";
-static const char kDefaultQuota[] = "dom.storage.default_quota";
 static const char kCookiesBehavior[] = "network.cookie.cookieBehavior";
 static const char kCookiesLifetimePolicy[] = "network.cookie.lifetimePolicy";
-static const char kOfflineAppWarnQuota[] = "offline-apps.quota.warn";
-static const char kOfflineAppQuota[] = "offline-apps.quota.max";
 
 // The URI returned is the innermost URI that should be used for
 // security-check-like stuff.  aHost is its hostname, correctly canonicalized.
 static nsresult
 GetPrincipalURIAndHost(nsIPrincipal* aPrincipal, nsIURI** aURI, nsCString& aHost)
 {
   nsresult rv = aPrincipal->GetDomain(aURI);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -135,75 +125,16 @@ IsCallerSecure()
   }
 
   bool isHttps = false;
   rv = innerUri->SchemeIs("https", &isHttps);
 
   return NS_SUCCEEDED(rv) && isHttps;
 }
 
-uint32_t
-GetOfflinePermission(const nsACString &aDomain)
-{
-  // Fake a URI for the permission manager
-  nsCOMPtr<nsIURI> uri;
-  NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("http://") + aDomain);
-
-  uint32_t perm;
-  if (uri) {
-    nsCOMPtr<nsIPermissionManager> permissionManager =
-      do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
-
-    if (permissionManager &&
-        NS_SUCCEEDED(permissionManager->TestPermission(uri, "offline-app", &perm)))
-        return perm;
-  }
-
-  return nsIPermissionManager::UNKNOWN_ACTION;
-}
-
-bool
-IsOfflineAllowed(const nsACString &aDomain)
-{
-  int32_t 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 uint32_t
-GetQuota(const nsACString &aDomain, int32_t *aQuota, int32_t *aWarnQuota,
-         bool aOverrideQuota)
-{
-  uint32_t perm = GetOfflinePermission(aDomain);
-  if (IS_PERMISSION_ALLOWED(perm) || aOverrideQuota) {
-    // This is an offline app, give more space by default.
-    *aQuota = Preferences::GetInt(kOfflineAppQuota,
-                                  DEFAULT_OFFLINE_APP_QUOTA) * 1024;
-
-    if (perm == nsIOfflineCacheUpdateService::ALLOW_NO_WARN ||
-        aOverrideQuota) {
-      *aWarnQuota = -1;
-    } else {
-      *aWarnQuota = Preferences::GetInt(kOfflineAppWarnQuota,
-                                        DEFAULT_OFFLINE_WARN_QUOTA) * 1024;
-    }
-    return perm;
-  }
-
-  // FIXME: per-domain quotas?
-  *aQuota = Preferences::GetInt(kDefaultQuota, DEFAULT_QUOTA) * 1024;
-  *aWarnQuota = -1;
-
-  return perm;
-}
-
 nsSessionStorageEntry::nsSessionStorageEntry(KeyTypePointer aStr)
   : nsStringHashKey(aStr), mItem(nullptr)
 {
 }
 
 nsSessionStorageEntry::nsSessionStorageEntry(const nsSessionStorageEntry& aToCopy)
   : nsStringHashKey(aToCopy), mItem(nullptr)
 {
@@ -246,18 +177,16 @@ nsDOMStorageManager::Initialize()
 
   nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
   if (!os)
     return NS_OK;
 
   nsresult rv;
   rv = os->AddObserver(gStorageManager, "cookie-changed", true);
   NS_ENSURE_SUCCESS(rv, rv);
-  rv = os->AddObserver(gStorageManager, "offline-app-removed", true);
-  NS_ENSURE_SUCCESS(rv, rv);
   rv = os->AddObserver(gStorageManager, "profile-after-change", true);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = os->AddObserver(gStorageManager, "perm-changed", true);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = os->AddObserver(gStorageManager, "browser:purge-domain-data", true);
   NS_ENSURE_SUCCESS(rv, rv);
   // Used for temporary table flushing
   rv = os->AddObserver(gStorageManager, "profile-before-change", true);
@@ -310,81 +239,30 @@ ClearStorageIfDomainMatches(nsDOMStorage
 {
   nsAutoCString* aKey = static_cast<nsAutoCString*> (userArg);
   if (StringBeginsWith(aEntry->mStorage->GetScopeDBKey(), *aKey)) {
     aEntry->mStorage->ClearAll();
   }
   return PL_DHASH_REMOVE;
 }
 
-static nsresult
-GetOfflineDomains(nsTArray<nsString>& aDomains)
-{
-  nsCOMPtr<nsIPermissionManager> permissionManager =
-    do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
-  if (permissionManager) {
-    nsCOMPtr<nsISimpleEnumerator> enumerator;
-    nsresult rv = permissionManager->GetEnumerator(getter_AddRefs(enumerator));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    bool hasMore;
-    while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) && hasMore) {
-      nsCOMPtr<nsISupports> supp;
-      rv = enumerator->GetNext(getter_AddRefs(supp));
-      NS_ENSURE_SUCCESS(rv, rv);
-
-      nsCOMPtr<nsIPermission> perm(do_QueryInterface(supp, &rv));
-      NS_ENSURE_SUCCESS(rv, rv);
-
-      uint32_t capability;
-      rv = perm->GetCapability(&capability);
-      NS_ENSURE_SUCCESS(rv, rv);
-      if (capability != nsIPermissionManager::DENY_ACTION) {
-        nsAutoCString type;
-        rv = perm->GetType(type);
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        if (type.EqualsLiteral("offline-app")) {
-          nsAutoCString host;
-          rv = perm->GetHost(host);
-          NS_ENSURE_SUCCESS(rv, rv);
-
-          aDomains.AppendElement(NS_ConvertUTF8toUTF16(host));
-        }
-      }
-    }
-  }
-
-  return NS_OK;
-}
-
 nsresult
 nsDOMStorageManager::Observe(nsISupports *aSubject,
                              const char *aTopic,
                              const PRUnichar *aData)
 {
   if (!strcmp(aTopic, "profile-after-change")) {
-  }
-  else if (!strcmp(aTopic, "offline-app-removed")) {
-    nsresult rv = DOMStorageImpl::InitDB();
-    NS_ENSURE_SUCCESS(rv, rv);
-    return DOMStorageImpl::gStorageDB->RemoveOwner(NS_ConvertUTF16toUTF8(aData),
-                                                   true);
   } else if (!strcmp(aTopic, "cookie-changed") &&
              !nsCRT::strcmp(aData, NS_LITERAL_STRING("cleared").get())) {
     mStorages.EnumerateEntries(ClearStorage, nullptr);
 
     nsresult rv = DOMStorageImpl::InitDB();
     NS_ENSURE_SUCCESS(rv, rv);
 
-    // Remove global storage for domains that aren't marked for offline use.
-    nsTArray<nsString> domains;
-    rv = GetOfflineDomains(domains);
-    NS_ENSURE_SUCCESS(rv, rv);
-    return DOMStorageImpl::gStorageDB->RemoveOwners(domains, true, false);
+    return DOMStorageImpl::gStorageDB->RemoveAll();
   } else if (!strcmp(aTopic, "perm-changed")) {
     // Check for cookie permission change
     nsCOMPtr<nsIPermission> perm(do_QueryInterface(aSubject));
     if (perm) {
       nsAutoCString type;
       perm->GetType(type);
       if (type != NS_LITERAL_CSTRING("cookie"))
         return NS_OK;
@@ -429,17 +307,17 @@ nsDOMStorageManager::Observe(nsISupports
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Clear the storage entries for matching domains
     mStorages.EnumerateEntries(ClearStorageIfDomainMatches, &key);
 
     rv = DOMStorageImpl::InitDB();
     NS_ENSURE_SUCCESS(rv, rv);
 
-    DOMStorageImpl::gStorageDB->RemoveOwner(aceDomain, true);
+    DOMStorageImpl::gStorageDB->RemoveOwner(aceDomain);
   } else if (!strcmp(aTopic, "profile-before-change")) {
     if (DOMStorageImpl::gStorageDB) {
       DebugOnly<nsresult> rv =
         DOMStorageImpl::gStorageDB->FlushAndDeleteTemporaryTables(true);
       NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
                        "DOMStorage: temporary table commit failed");
       DOMStorageImpl::gStorageDB->Close();
       nsDOMStorageManager::ShutdownDB();
@@ -470,29 +348,17 @@ nsDOMStorageManager::Observe(nsISupports
 NS_IMETHODIMP
 nsDOMStorageManager::GetUsage(const nsAString& aDomain,
                               int32_t *aUsage)
 {
   nsresult rv = DOMStorageImpl::InitDB();
   NS_ENSURE_SUCCESS(rv, rv);
 
   return DOMStorageImpl::gStorageDB->GetUsage(NS_ConvertUTF16toUTF8(aDomain),
-                                              false, aUsage, false);
-}
-
-NS_IMETHODIMP
-nsDOMStorageManager::ClearOfflineApps()
-{
-    nsresult rv = DOMStorageImpl::InitDB();
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsTArray<nsString> domains;
-    rv = GetOfflineDomains(domains);
-    NS_ENSURE_SUCCESS(rv, rv);
-    return DOMStorageImpl::gStorageDB->RemoveOwners(domains, true, true);
+                                              aUsage, false);
 }
 
 NS_IMETHODIMP
 nsDOMStorageManager::GetLocalStorageForPrincipal(nsIPrincipal *aPrincipal,
                                                  const nsSubstring &aDocumentURI,
                                                  bool aPrivate,
                                                  nsIDOMStorage **aResult)
 {
@@ -581,54 +447,49 @@ NS_NewDOMStorage2(nsISupports* aOuter, R
   nsDOMStorage2* storage = new nsDOMStorage2();
   return storage->QueryInterface(aIID, aResult);
 }
 
 DOMStorageBase::DOMStorageBase()
   : mStorageType(nsPIDOMStorage::Unknown)
   , mUseDB(false)
   , mSessionOnly(true)
-  , mCanUseChromePersist(false)
   , mInPrivateBrowsing(false)
 {
 }
 
 DOMStorageBase::DOMStorageBase(DOMStorageBase& aThat)
   : mStorageType(aThat.mStorageType)
   , mUseDB(false) // Clones don't use the DB
   , mSessionOnly(true)
   , mDomain(aThat.mDomain)
   , mScopeDBKey(aThat.mScopeDBKey)
   , mQuotaETLDplus1DomainDBKey(aThat.mQuotaETLDplus1DomainDBKey)
-  , mQuotaDomainDBKey(aThat.mQuotaDomainDBKey)
-  , mCanUseChromePersist(aThat.mCanUseChromePersist)
   , mInPrivateBrowsing(aThat.mInPrivateBrowsing)
 {
 }
 
 void
 DOMStorageBase::InitAsSessionStorage(nsIURI* aDomainURI, bool aPrivate)
 {
   // No need to check for a return value. If this would fail we would not get
   // here as we call GetPrincipalURIAndHost (nsDOMStorage.cpp:88) from
   // nsDOMStorage::CanUseStorage before we query the storage manager for a new
   // sessionStorage. It calls GetAsciiHost on innermost URI. If it fails, we
   // won't get to InitAsSessionStorage.
   aDomainURI->GetAsciiHost(mDomain);
 
   mUseDB = false;
   mScopeDBKey.Truncate();
-  mQuotaDomainDBKey.Truncate();
   mStorageType = nsPIDOMStorage::SessionStorage;
   mInPrivateBrowsing = aPrivate;
 }
 
 void
 DOMStorageBase::InitAsLocalStorage(nsIURI* aDomainURI,
-                                   bool aCanUseChromePersist,
                                    bool aPrivate)
 {
   // No need to check for a return value. If this would fail we would not get
   // here as we call GetPrincipalURIAndHost (nsDOMStorage.cpp:88) from
   // nsDOMStorage::CanUseStorage before we query the storage manager for a new
   // localStorage. It calls GetAsciiHost on innermost URI. If it fails, we won't
   // get to InitAsLocalStorage. Actually, mDomain will get replaced with
   // mPrincipal in bug 455070. It is not even used for localStorage.
@@ -638,20 +499,17 @@ DOMStorageBase::InitAsLocalStorage(nsIUR
 
   // XXX Bug 357323, we have to solve the issue how to define
   // origin for file URLs. In that case CreateOriginScopeDBKey
   // fails (the result is empty) and we must avoid database use
   // in that case because it produces broken entries w/o owner.
   mUseDB = !mScopeDBKey.IsEmpty();
 
   nsDOMStorageDBWrapper::CreateQuotaDomainDBKey(mDomain,
-                                                true, false, mQuotaDomainDBKey);
-  nsDOMStorageDBWrapper::CreateQuotaDomainDBKey(mDomain,
-                                                true, true, mQuotaETLDplus1DomainDBKey);
-  mCanUseChromePersist = aCanUseChromePersist;
+                                                mQuotaETLDplus1DomainDBKey);
   mStorageType = nsPIDOMStorage::LocalStorage;
   mInPrivateBrowsing = aPrivate;
 }
 
 PLDHashOperator
 SessionStorageTraverser(nsSessionStorageEntry* aEntry, void* userArg) {
   nsCycleCollectionTraversalCallback *cb = 
       static_cast<nsCycleCollectionTraversalCallback*>(userArg);
@@ -726,31 +584,28 @@ DOMStorageImpl::InitDB()
       return rv;
     }
   }
 
   return NS_OK;
 }
 
 void
-DOMStorageImpl::InitFromChild(bool aUseDB, bool aCanUseChromePersist,
+DOMStorageImpl::InitFromChild(bool aUseDB,
                               bool aSessionOnly, bool aPrivate,
                               const nsACString& aDomain,
                               const nsACString& aScopeDBKey,
-                              const nsACString& aQuotaDomainDBKey,
                               const nsACString& aQuotaETLDplus1DomainDBKey,
                               uint32_t aStorageType)
 {
   mUseDB = aUseDB;
-  mCanUseChromePersist = aCanUseChromePersist;
   mSessionOnly = aSessionOnly;
   mInPrivateBrowsing = aPrivate;
   mDomain = aDomain;
   mScopeDBKey = aScopeDBKey;
-  mQuotaDomainDBKey = aQuotaDomainDBKey;
   mQuotaETLDplus1DomainDBKey = aQuotaETLDplus1DomainDBKey;
   mStorageType = static_cast<nsPIDOMStorage::nsDOMStorageType>(aStorageType);
 }
 
 void
 DOMStorageImpl::SetSessionOnly(bool aSessionOnly)
 {
   mSessionOnly = aSessionOnly;
@@ -759,40 +614,33 @@ DOMStorageImpl::SetSessionOnly(bool aSes
 void
 DOMStorageImpl::InitAsSessionStorage(nsIURI* aDomainURI, bool aPrivate)
 {
   DOMStorageBase::InitAsSessionStorage(aDomainURI, aPrivate);
 }
 
 void
 DOMStorageImpl::InitAsLocalStorage(nsIURI* aDomainURI,
-                                   bool aCanUseChromePersist,
                                    bool aPrivate)
 {
-  DOMStorageBase::InitAsLocalStorage(aDomainURI, aCanUseChromePersist, aPrivate);
+  DOMStorageBase::InitAsLocalStorage(aDomainURI, aPrivate);
 }
 
 bool
 DOMStorageImpl::CacheStoragePermissions()
 {
   // If this is a cross-process situation, we don't have a real storage owner.
   // All the correct checks have been done on the child, so we just need to
   // make sure that our session-only status is correctly updated.
   if (!mOwner)
     return CanUseStorage();
   
   return mOwner->CacheStoragePermissions();
 }
 
-bool
-DOMStorageImpl::CanUseChromePersist()
-{
-  return mCanUseChromePersist;
-}
-
 nsresult
 DOMStorageImpl::GetCachedValue(const nsAString& aKey, nsAString& aValue,
                                bool* aSecure)
 {
   aValue.Truncate();
   *aSecure = false;
 
   nsSessionStorageEntry *entry = mItems.GetEntry(aKey);
@@ -838,49 +686,21 @@ DOMStorageImpl::SetDBValue(const nsAStri
                            bool aSecure)
 {
   if (!UseDB())
     return NS_OK;
 
   nsresult rv = InitDB();
   NS_ENSURE_SUCCESS(rv, rv);
 
-  int32_t offlineAppPermission;
-  int32_t quota;
-  int32_t warnQuota;
-  offlineAppPermission = GetQuota(mDomain, &quota, &warnQuota,
-                                  CanUseChromePersist());
-
   CacheKeysFromDB();
 
-  int32_t usage;
-  rv = gStorageDB->SetKey(this, aKey, aValue, aSecure, quota,
-                         !IS_PERMISSION_ALLOWED(offlineAppPermission),
-                         &usage);
+  rv = gStorageDB->SetKey(this, aKey, aValue, aSecure);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  if (warnQuota >= 0 && usage > warnQuota) {
-    // try to include the window that exceeded the warn quota
-    nsCOMPtr<nsIDOMWindow> window;
-    JSContext *cx;
-    nsCOMPtr<nsIJSContextStack> stack =
-        do_GetService("@mozilla.org/js/xpc/ContextStack;1");
-    if (stack && NS_SUCCEEDED(stack->Peek(&cx)) && cx) {
-      nsCOMPtr<nsIScriptContext> scriptContext;
-      scriptContext = GetScriptContextFromJSContext(cx);
-      if (scriptContext) {
-        window = do_QueryInterface(scriptContext->GetGlobalObject());
-      }
-    }
-
-    nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
-    os->NotifyObservers(window, "dom-storage-warn-quota-exceeded",
-                       NS_ConvertUTF8toUTF16(mDomain).get());
-  }
-
   return NS_OK;
 }
 
 nsresult
 DOMStorageImpl::SetSecure(const nsAString& aKey, bool aSecure)
 {
   if (UseDB()) {
     nsresult rv = InitDB();
@@ -1205,18 +1025,17 @@ DOMStorageImpl::RemoveValue(bool aCaller
     bool secureItem;
     rv = GetDBValue(aKey, value, &secureItem);
     NS_ENSURE_SUCCESS(rv, rv);
     if (!aCallerSecure && secureItem)
       return NS_ERROR_DOM_SECURITY_ERR;
 
     oldValue = value;
 
-    rv = gStorageDB->RemoveKey(this, aKey, !IsOfflineAllowed(mDomain),
-                               aKey.Length() + value.Length());
+    rv = gStorageDB->RemoveKey(this, aKey);
     NS_ENSURE_SUCCESS(rv, rv);
   }
   else if (entry) {
     // clear string as StorageItems may be referencing this item
     oldValue = entry->mItem->GetValueInternal();
     entry->mItem->ClearValue();
   }
 
@@ -1359,23 +1178,17 @@ nsDOMStorage::InitAsLocalStorage(nsIPrin
   nsresult rv = GetDomainURI(aPrincipal, false, getter_AddRefs(domainURI));
   NS_ENSURE_SUCCESS(rv, rv);
 
   mDocumentURI = aDocumentURI;
   mPrincipal = aPrincipal;
 
   mStorageType = LocalStorage;
 
-  bool canUseChromePersist = false;
-  nsCOMPtr<nsIURI> URI;
-  if (NS_SUCCEEDED(aPrincipal->GetURI(getter_AddRefs(URI))) && URI) {
-    canUseChromePersist = URICanUseChromePersist(URI);
-  }
-  
-  mStorageImpl->InitAsLocalStorage(domainURI, canUseChromePersist, aPrivate);
+  mStorageImpl->InitAsLocalStorage(domainURI, aPrivate);
   return NS_OK;
 }
 
 bool
 DOMStorageBase::CanUseStorage()
 {
   return nsDOMStorage::CanUseStorage(this);
 }
@@ -1433,19 +1246,17 @@ nsDOMStorage::CanUseStorage(DOMStorageBa
     if (aStorage)
       aStorage->mSessionOnly = true;
   }
   else if (perm != nsIPermissionManager::ALLOW_ACTION) {
     uint32_t cookieBehavior = Preferences::GetUint(kCookiesBehavior);
     uint32_t lifetimePolicy = Preferences::GetUint(kCookiesLifetimePolicy);
 
     // Treat "ask every time" as "reject always".
-    // Chrome persistent pages can bypass this check.
-    if ((cookieBehavior == BEHAVIOR_REJECT || lifetimePolicy == ASK_BEFORE_ACCEPT) &&
-        !URICanUseChromePersist(subjectURI))
+    if ((cookieBehavior == BEHAVIOR_REJECT || lifetimePolicy == ASK_BEFORE_ACCEPT))
       return false;
 
     if (lifetimePolicy == ACCEPT_SESSION && aStorage)
       aStorage->mSessionOnly = true;
   }
 
   return true;
 }
@@ -1465,25 +1276,16 @@ nsDOMStorage::CacheStoragePermissions()
 
   nsCOMPtr<nsIPrincipal> subjectPrincipal;
   nsresult rv = ssm->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
   NS_ENSURE_SUCCESS(rv, false);
 
   return CanAccess(subjectPrincipal);
 }
 
-// static
-bool
-nsDOMStorage::URICanUseChromePersist(nsIURI* aURI) {
-  bool isAbout;
-  return
-    (NS_SUCCEEDED(aURI->SchemeIs("moz-safe-about", &isAbout)) && isAbout) ||
-    (NS_SUCCEEDED(aURI->SchemeIs("about", &isAbout)) && isAbout);
-}
-
 NS_IMETHODIMP
 nsDOMStorage::GetLength(uint32_t *aLength)
 {
   if (!CacheStoragePermissions())
     return NS_ERROR_DOM_SECURITY_ERR;
   
   return mStorageImpl->GetLength(IsCallerSecure(), aLength);
 }
--- a/dom/src/storage/nsDOMStorage.h
+++ b/dom/src/storage/nsDOMStorage.h
@@ -25,20 +25,16 @@
 #include "nsIObserver.h"
 #include "nsITimer.h"
 #include "nsWeakReference.h"
 #include "nsIInterfaceRequestor.h"
 #include "mozilla/Attributes.h"
 
 #include "nsDOMStorageDBWrapper.h"
 
-#define IS_PERMISSION_ALLOWED(perm) \
-      ((perm) != nsIPermissionManager::UNKNOWN_ACTION && \
-      (perm) != nsIPermissionManager::DENY_ACTION)
-
 class nsDOMStorage;
 class nsIDOMStorage;
 class nsDOMStorageItem;
 class nsDOMStoragePersistentDB;
 
 namespace mozilla {
 namespace dom {
 class StorageParent;
@@ -109,17 +105,17 @@ protected:
 
 class DOMStorageBase : public nsIPrivacyTransitionObserver
 {
 public:
   DOMStorageBase();
   DOMStorageBase(DOMStorageBase&);
 
   virtual void InitAsSessionStorage(nsIURI* aDomainURI, bool aPrivate);
-  virtual void InitAsLocalStorage(nsIURI* aDomainURI, bool aCanUseChromePersist, bool aPrivate);
+  virtual void InitAsLocalStorage(nsIURI* aDomainURI, bool aPrivate);
 
   virtual nsTArray<nsString>* GetKeys(bool aCallerSecure) = 0;
   virtual nsresult GetLength(bool aCallerSecure, uint32_t* aLength) = 0;
   virtual nsresult GetKey(bool aCallerSecure, uint32_t aIndex, nsAString& aKey) = 0;
   virtual nsIDOMStorageItem* GetValue(bool aCallerSecure, const nsAString& aKey,
                                       nsresult* rv) = 0;
   virtual nsresult SetValue(bool aCallerSecure, const nsAString& aKey,
                             const nsAString& aData, nsAString& aOldValue) = 0;
@@ -165,21 +161,20 @@ public:
   virtual nsresult
   CloneFrom(bool aCallerSecure, DOMStorageBase* aThat) = 0;
 
   // 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.
-  nsCString& GetQuotaDomainDBKey(bool aOfflineAllowed)
+  // e.g. "moc.rab.%" - reversed eTLD+1 subpart of the domain.
+  nsCString& GetQuotaDomainDBKey()
   {
-    return aOfflineAllowed ? mQuotaDomainDBKey : mQuotaETLDplus1DomainDBKey;
+    return mQuotaETLDplus1DomainDBKey;
   }
 
   virtual bool CacheStoragePermissions() = 0;
 
 protected:
   friend class nsDOMStorageManager;
   friend class nsDOMStorage;
 
@@ -197,36 +192,34 @@ protected:
 
   // domain this store is associated with
   nsCString mDomain;
 
   // keys are used for database queries.
   // see comments of the getters bellow.
   nsCString mScopeDBKey;
   nsCString mQuotaETLDplus1DomainDBKey;
-  nsCString mQuotaDomainDBKey;
 
-  bool mCanUseChromePersist;
   bool mInPrivateBrowsing;
 };
 
 class DOMStorageImpl MOZ_FINAL : public DOMStorageBase
                                , public nsSupportsWeakReference
 {
 public:
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(DOMStorageImpl, nsIPrivacyTransitionObserver)
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_NSIPRIVACYTRANSITIONOBSERVER
 
   DOMStorageImpl(nsDOMStorage*);
   DOMStorageImpl(nsDOMStorage*, DOMStorageImpl&);
   ~DOMStorageImpl();
 
   virtual void InitAsSessionStorage(nsIURI* aDomainURI, bool aPrivate);
-  virtual void InitAsLocalStorage(nsIURI* aDomainURI, bool aCanUseChromePersist, bool aPrivate);
+  virtual void InitAsLocalStorage(nsIURI* aDomainURI, bool aPrivate);
 
   bool SessionOnly() {
     return mSessionOnly;
   }
 
   virtual nsTArray<nsString>* GetKeys(bool aCallerSecure);
   virtual nsresult GetLength(bool aCallerSecure, uint32_t* aLength);
   virtual nsresult GetKey(bool aCallerSecure, uint32_t aIndex, nsAString& aKey);
@@ -239,20 +232,16 @@ public:
   virtual nsresult Clear(bool aCallerSecure, int32_t* aOldCount);
 
   // cache the keys from the database for faster lookup
   nsresult CacheKeysFromDB();
 
   uint64_t CachedVersion() { return mItemsCachedVersion; }
   void SetCachedVersion(uint64_t version) { mItemsCachedVersion = version; }
   
-  // Some privileged internal pages can use a persistent storage even in
-  // session-only or private-browsing modes.
-  bool CanUseChromePersist();
-
   // retrieve the value and secure state corresponding to a key out of storage
   // that has been cached in mItems hash table.
   nsresult
   GetCachedValue(const nsAString& aKey,
                  nsAString& aValue,
                  bool* aSecure);
 
   // retrieve the value and secure state corresponding to a key out of storage.
@@ -286,20 +275,19 @@ private:
   friend class nsDOMStorageManager;
   friend class nsDOMStoragePersistentDB;
   friend class StorageParent;
 
   void Init(nsDOMStorage*);
 
   // Cross-process storage implementations never have InitAs(Session|Local|Global)Storage
   // called, so the appropriate initialization needs to happen from the child.
-  void InitFromChild(bool aUseDB, bool aCanUseChromePersist, bool aSessionOnly,
+  void InitFromChild(bool aUseDB, bool aSessionOnly,
                      bool aPrivate, const nsACString& aDomain,
                      const nsACString& aScopeDBKey,
-                     const nsACString& aQuotaDomainDBKey,
                      const nsACString& aQuotaETLDplus1DomainDBKey,
                      uint32_t aStorageType);
   void SetSessionOnly(bool aSessionOnly);
 
   static nsresult InitDB();
 
   // 0 initially or a positive data version number assigned by gStorageDB
   // after keys have been cached from the database
@@ -346,22 +334,16 @@ public:
   virtual bool CanAccess(nsIPrincipal *aPrincipal);
   virtual nsDOMStorageType StorageType();
 
   // Check whether storage may be used by the caller, and whether it
   // is session only.  Returns true if storage may be used.
   static bool
   CanUseStorage(DOMStorageBase* aStorage = nullptr);
 
-  // Check whether this URI can use chrome persist storage.  This kind of
-  // storage can bypass cookies limits, private browsing and uses the offline
-  // apps quota.
-  static bool
-  URICanUseChromePersist(nsIURI* aURI);
-  
   // Check whether storage may be used.  Updates mSessionOnly based on
   // the result of CanUseStorage.
   bool
   CacheStoragePermissions();
 
   nsIDOMStorageItem* GetNamedItem(const nsAString& aKey, nsresult* aResult);
 
   nsresult SetSecure(const nsAString& aKey, bool aSecure)
@@ -498,15 +480,9 @@ protected:
   // If this item came from the db, mStorage points to the storage
   // object where this item came from.
   nsRefPtr<DOMStorageBase> mStorage;
 };
 
 nsresult
 NS_NewDOMStorage2(nsISupports* aOuter, REFNSIID aIID, void** aResult);
 
-uint32_t
-GetOfflinePermission(const nsACString &aDomain);
-
-bool
-IsOfflineAllowed(const nsACString &aDomain);
-
 #endif /* nsDOMStorage_h___ */
--- a/dom/src/storage/nsDOMStorageBaseDB.cpp
+++ b/dom/src/storage/nsDOMStorageBaseDB.cpp
@@ -1,17 +1,33 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsDOMStorageBaseDB.h"
 #include "nsDOMStorage.h"
+#include "mozilla/Preferences.h"
+
+// Only allow relatively small amounts of data since performance of
+// the synchronous IO is very bad.
+#define DEFAULT_QUOTA_LIMIT (5 * 1024)
 
 uint64_t nsDOMStorageBaseDB::sGlobalVersion = 1;
+int32_t nsDOMStorageBaseDB::gQuotaLimit = DEFAULT_QUOTA_LIMIT * 1024;
+
+using namespace mozilla;
+
+/* static */
+void
+nsDOMStorageBaseDB::Init()
+{
+  Preferences::AddIntVarCache(&gQuotaLimit, "dom.storage.default_quota",
+                              DEFAULT_QUOTA_LIMIT);
+}
 
 nsDOMStorageBaseDB::nsDOMStorageBaseDB()
 {
   mScopesVersion.Init(8);
 }
 
 // public
 
--- a/dom/src/storage/nsDOMStorageBaseDB.h
+++ b/dom/src/storage/nsDOMStorageBaseDB.h
@@ -9,16 +9,18 @@
 #include "nscore.h"
 #include "nsDataHashtable.h"
 
 class DOMStorageImpl;
 
 class nsDOMStorageBaseDB
 {
 public:
+  static void Init();
+
   nsDOMStorageBaseDB();
   virtual ~nsDOMStorageBaseDB() {}
 
   /**
    * Marks the storage as "cached" after the DOMStorageImpl object has loaded
    * all items to its memory copy of the entries - IsScopeDirty returns false
    * after call of this method for this storage.
    *
@@ -29,22 +31,28 @@ public:
   void MarkScopeCached(DOMStorageImpl* aStorage);
 
   /**
    * Test whether the storage for the scope (i.e. origin or host) has been
    * changed since the last MarkScopeCached call.
    */
   bool IsScopeDirty(DOMStorageImpl* aStorage);
 
+  int32_t GetQuota() {
+    return gQuotaLimit * 1024;
+  }
+
 protected:
   nsDataHashtable<nsCStringHashKey, uint64_t> mScopesVersion;
 
   static uint64_t NextGlobalVersion();
   uint64_t CachedScopeVersion(DOMStorageImpl* aStorage);
 
   void MarkScopeDirty(DOMStorageImpl* aStorage);
   void MarkAllScopesDirty();
 
 private:
   static uint64_t sGlobalVersion;
+
+  static int32_t gQuotaLimit;
 };
 
 #endif /* nsDOMStorageDB_h___ */
--- a/dom/src/storage/nsDOMStorageDBWrapper.cpp
+++ b/dom/src/storage/nsDOMStorageDBWrapper.cpp
@@ -43,58 +43,50 @@ nsDOMStorageDBWrapper::nsDOMStorageDBWra
 nsDOMStorageDBWrapper::~nsDOMStorageDBWrapper()
 {
 }
 
 void
 nsDOMStorageDBWrapper::Close()
 {
   mPersistentDB.Close();
-  mChromePersistentDB.Close();
 }
 
 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"));
-  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::FlushAndDeleteTemporaryTables(bool force)
 {
   nsresult rv1, rv2;
-  rv1 = mChromePersistentDB.FlushTemporaryTables(force);
   rv2 = mPersistentDB.FlushTemporaryTables(force);
 
   // Everything flushed?  Then no need for a timer.
-  if (!mChromePersistentDB.mTempTableLoads.Count() && 
-      !mPersistentDB.mTempTableLoads.Count())
+  if (!mPersistentDB.mTempTableLoads.Count())
     StopTempTableFlushTimer();
 
   return NS_FAILED(rv1) ? rv1 : rv2;
 }
 
 #define IMPL_FORWARDER_GUTS(_return, _code)                                \
   PR_BEGIN_MACRO                                                      \
-  if (aStorage->CanUseChromePersist())                                \
-    _return mChromePersistentDB._code;                                \
   if (aStorage->IsPrivate())                                          \
     _return mPrivateBrowsingDB._code;                                 \
   if (aStorage->SessionOnly())                                        \
     _return mSessionOnlyDB._code;                                     \
   _return mPersistentDB._code;                                        \
   PR_END_MACRO
 
 #define IMPL_FORWARDER(_code)                                  \
@@ -118,40 +110,34 @@ nsDOMStorageDBWrapper::GetKeyValue(DOMSt
 {
   IMPL_FORWARDER(GetKeyValue(aStorage, aKey, aValue, aSecure));
 }
 
 nsresult
 nsDOMStorageDBWrapper::SetKey(DOMStorageImpl* aStorage,
                               const nsAString& aKey,
                               const nsAString& aValue,
-                              bool aSecure,
-                              int32_t aQuota,
-                              bool aExcludeOfflineFromUsage,
-                              int32_t *aNewUsage)
+                              bool aSecure)
 {
-  IMPL_FORWARDER(SetKey(aStorage, aKey, aValue, aSecure,
-                        aQuota, aExcludeOfflineFromUsage, aNewUsage));
+  IMPL_FORWARDER(SetKey(aStorage, aKey, aValue, aSecure));
 }
 
 nsresult
 nsDOMStorageDBWrapper::SetSecure(DOMStorageImpl* aStorage,
                                  const nsAString& aKey,
                                  const bool aSecure)
 {
   IMPL_FORWARDER(SetSecure(aStorage, aKey, aSecure));
 }
 
 nsresult
 nsDOMStorageDBWrapper::RemoveKey(DOMStorageImpl* aStorage,
-                                 const nsAString& aKey,
-                                 bool aExcludeOfflineFromUsage,
-                                 int32_t aKeyUsage)
+                                 const nsAString& aKey)
 {
-  IMPL_FORWARDER(RemoveKey(aStorage, aKey, aExcludeOfflineFromUsage, aKeyUsage));
+  IMPL_FORWARDER(RemoveKey(aStorage, aKey));
 }
 
 nsresult
 nsDOMStorageDBWrapper::ClearStorage(DOMStorageImpl* aStorage)
 {
   IMPL_FORWARDER(ClearStorage(aStorage));
 }
 
@@ -165,86 +151,83 @@ bool
 nsDOMStorageDBWrapper::IsScopeDirty(DOMStorageImpl* aStorage)
 {
   IMPL_FORWARDER(IsScopeDirty(aStorage));
 }
 
 nsresult
 nsDOMStorageDBWrapper::DropSessionOnlyStoragesForHost(const nsACString& aHostName)
 {
-  return mSessionOnlyDB.RemoveOwner(aHostName, true);
+  return mSessionOnlyDB.RemoveOwner(aHostName);
 }
 
 nsresult
 nsDOMStorageDBWrapper::DropPrivateBrowsingStorages()
 {
   return mPrivateBrowsingDB.RemoveAll();
 }
 
 nsresult
-nsDOMStorageDBWrapper::RemoveOwner(const nsACString& aOwner,
-                                   bool aIncludeSubDomains)
+nsDOMStorageDBWrapper::RemoveOwner(const nsACString& aOwner)
 {
   nsresult rv;
 
-  rv = mPrivateBrowsingDB.RemoveOwner(aOwner, aIncludeSubDomains);
+  rv = mPrivateBrowsingDB.RemoveOwner(aOwner);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = mSessionOnlyDB.RemoveOwner(aOwner, aIncludeSubDomains);
+  rv = mSessionOnlyDB.RemoveOwner(aOwner);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = mPersistentDB.RemoveOwner(aOwner, aIncludeSubDomains);
+  rv = mPersistentDB.RemoveOwner(aOwner);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return rv;
 }
 
 
 nsresult
-nsDOMStorageDBWrapper::RemoveOwners(const nsTArray<nsString> &aOwners,
-                                    bool aIncludeSubDomains, bool aMatch)
+nsDOMStorageDBWrapper::RemoveAll()
 {
   nsresult rv;
 
-  rv = mPrivateBrowsingDB.RemoveOwners(aOwners, aIncludeSubDomains, aMatch);
+  rv = mPrivateBrowsingDB.RemoveAll();
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = mSessionOnlyDB.RemoveOwners(aOwners, aIncludeSubDomains, aMatch);
+  rv = mSessionOnlyDB.RemoveAll();
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = mPersistentDB.RemoveOwners(aOwners, aIncludeSubDomains, aMatch);
+  rv = mPersistentDB.RemoveAll();
   NS_ENSURE_SUCCESS(rv, rv);
 
   return rv;
 }
 
 nsresult
-nsDOMStorageDBWrapper::GetUsage(DOMStorageImpl* aStorage,
-                                bool aExcludeOfflineFromUsage, int32_t *aUsage)
+nsDOMStorageDBWrapper::GetUsage(DOMStorageImpl* aStorage, int32_t *aUsage)
 {
-  IMPL_FORWARDER(GetUsage(aStorage, aExcludeOfflineFromUsage, aUsage));
+  IMPL_FORWARDER(GetUsage(aStorage, aUsage));
 }
 
 nsresult
 nsDOMStorageDBWrapper::GetUsage(const nsACString& aDomain,
-                                bool aIncludeSubDomains, int32_t *aUsage, bool aPrivate)
+                                int32_t *aUsage, bool aPrivate)
 {
   if (aPrivate)
-    return mPrivateBrowsingDB.GetUsage(aDomain, aIncludeSubDomains, aUsage);
+    return mPrivateBrowsingDB.GetUsage(aDomain, aUsage);
 
 #if 0
   // XXX Check where from all this method gets called, not sure this should
   // include any potential session-only data
   nsresult rv;
-  rv = mSessionOnlyDB.GetUsage(aDomain, aIncludeSubDomains, aUsage);
+  rv = mSessionOnlyDB.GetUsage(aDomain, aUsage);
   if (NS_SUECEEDED(rv))
     return rv;
 #endif
 
-  return mPersistentDB.GetUsage(aDomain, aIncludeSubDomains, aUsage);
+  return mPersistentDB.GetUsage(aDomain, aUsage);
 }
 
 nsresult
 nsDOMStorageDBWrapper::CreateOriginScopeDBKey(nsIURI* aUri, nsACString& aKey)
 {
   nsresult rv;
 
   rv = CreateDomainScopeDBKey(aUri, aKey);
@@ -313,56 +296,47 @@ nsDOMStorageDBWrapper::CreateDomainScope
   ReverseString(aAsciiDomain, aKey);
 
   aKey.AppendLiteral(".");
   return NS_OK;
 }
 
 nsresult
 nsDOMStorageDBWrapper::CreateQuotaDomainDBKey(const nsACString& aAsciiDomain,
-                                              bool aIncludeSubDomains,
-                                              bool aEffectiveTLDplus1Only,
                                               nsACString& aKey)
 {
   nsresult rv;
 
   nsAutoCString subdomainsDBKey;
-  if (aEffectiveTLDplus1Only) {
-    nsCOMPtr<nsIEffectiveTLDService> eTLDService(do_GetService(
-      NS_EFFECTIVETLDSERVICE_CONTRACTID, &rv));
-    NS_ENSURE_SUCCESS(rv, rv);
+  nsCOMPtr<nsIEffectiveTLDService> eTLDService(do_GetService(
+    NS_EFFECTIVETLDSERVICE_CONTRACTID, &rv));
+  NS_ENSURE_SUCCESS(rv, rv);
 
-    nsCOMPtr<nsIURI> uri;
-    rv = NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("http://") + aAsciiDomain);
-    NS_ENSURE_SUCCESS(rv, rv);
+  nsCOMPtr<nsIURI> uri;
+  rv = NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("http://") + aAsciiDomain);
+  NS_ENSURE_SUCCESS(rv, rv);
 
-    nsAutoCString eTLDplusOne;
-    rv = eTLDService->GetBaseDomain(uri, 0, eTLDplusOne);
-    if (NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS == rv) {
-      // XXX bug 357323 - what to do for localhost/file exactly?
-      eTLDplusOne = aAsciiDomain;
-      rv = NS_OK;
-    }
-    NS_ENSURE_SUCCESS(rv, rv);
+  nsAutoCString eTLDplusOne;
+  rv = eTLDService->GetBaseDomain(uri, 0, eTLDplusOne);
+  if (NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS == rv) {
+    // XXX bug 357323 - what to do for localhost/file exactly?
+    eTLDplusOne = aAsciiDomain;
+    rv = NS_OK;
+  }
+  NS_ENSURE_SUCCESS(rv, rv);
 
-    CreateDomainScopeDBKey(eTLDplusOne, subdomainsDBKey);
-  }
-  else
-    CreateDomainScopeDBKey(aAsciiDomain, subdomainsDBKey);
-
-  if (!aIncludeSubDomains)
-    subdomainsDBKey.AppendLiteral(":");
+  CreateDomainScopeDBKey(eTLDplusOne, subdomainsDBKey);
 
   aKey.Assign(subdomainsDBKey);
   return NS_OK;
 }
 
 nsresult
 nsDOMStorageDBWrapper::GetDomainFromScopeKey(const nsACString& aScope,
-                                         nsACString& aDomain)
+                                             nsACString& aDomain)
 {
   nsAutoCString reverseDomain, scope;
   scope = aScope;
   scope.Left(reverseDomain, scope.FindChar(':')-1);
 
   ReverseString(reverseDomain, aDomain);
   return NS_OK;
 }
--- a/dom/src/storage/nsDOMStorageDBWrapper.h
+++ b/dom/src/storage/nsDOMStorageDBWrapper.h
@@ -84,38 +84,33 @@ public:
 
   /**
    * Set the value and secure flag for a key in storage.
    */
   nsresult
   SetKey(DOMStorageImpl* aStorage,
          const nsAString& aKey,
          const nsAString& aValue,
-         bool aSecure,
-         int32_t aQuota,
-         bool aExcludeOfflineFromUsage,
-         int32_t* aNewUsage);
+         bool aSecure);
 
   /**
    * Set the secure flag for a key in storage. Does nothing if the key was
    * not found.
    */
   nsresult
   SetSecure(DOMStorageImpl* aStorage,
             const nsAString& aKey,
             const bool aSecure);
 
   /**
    * Removes a key from storage.
    */
   nsresult
   RemoveKey(DOMStorageImpl* aStorage,
-            const nsAString& aKey,
-            bool aExcludeOfflineFromUsage,
-            int32_t aKeyUsage);
+            const nsAString& aKey);
 
   /**
     * Remove all keys belonging to this storage.
     */
   nsresult
   ClearStorage(DOMStorageImpl* aStorage);
 
   /**
@@ -129,37 +124,35 @@ public:
    */
   nsresult
   DropPrivateBrowsingStorages();
 
   /**
    * Removes all keys added by a given domain.
    */
   nsresult
-  RemoveOwner(const nsACString& aOwner, bool aIncludeSubDomains);
+  RemoveOwner(const nsACString& aOwner);
 
   /**
-   * Removes keys owned by domains that either match or don't match the
-   * list.
+   * Removes all keys from storage. Used when clearing storage.
    */
   nsresult
-  RemoveOwners(const nsTArray<nsString>& aOwners,
-               bool aIncludeSubDomains, bool aMatch);
+  RemoveAll();
 
   /**
     * Returns usage for a storage using its GetQuotaDomainDBKey() as a key.
     */
   nsresult
-  GetUsage(DOMStorageImpl* aStorage, bool aExcludeOfflineFromUsage, int32_t *aUsage);
+  GetUsage(DOMStorageImpl* aStorage, int32_t *aUsage);
 
   /**
     * Returns usage of the domain and optionaly by any subdomain.
     */
   nsresult
-  GetUsage(const nsACString& aDomain, bool aIncludeSubDomains, int32_t *aUsage, bool aPrivate);
+  GetUsage(const nsACString& aDomain, int32_t *aUsage, bool aPrivate);
 
   /**
    * Marks the storage as "cached" after the DOMStorageImpl object has loaded
    * all items to its memory copy of the entries - IsScopeDirty returns false
    * after call of this method for this storage.
    *
    * When a key is changed or deleted in the storage, the storage scope is
    * marked as "dirty" again and makes the DOMStorageImpl object recache its
@@ -190,21 +183,20 @@ public:
   static nsresult CreateDomainScopeDBKey(const nsACString& aAsciiDomain, nsACString& aKey);
 
   /**
     * Turns "foo.bar.com" to "moc.rab.",
     * i.e. extracts eTLD+1 from the host, reverses the result
     * and appends a dot.
     */
   static nsresult CreateQuotaDomainDBKey(const nsACString& aAsciiDomain,
-                                         bool aIncludeSubDomains, bool aETLDplus1Only,
                                          nsACString& aKey);
 
   static nsresult GetDomainFromScopeKey(const nsACString& aScope,
-                                         nsACString& aDomain);
+                                        nsACString& aDomain);
 
   /**
    * Ensures the temp table flush timer is running. This is called when we add
    * data that will need to be flushed.
    */
   void EnsureTempTableFlushTimer();
 
   /**
@@ -216,17 +208,16 @@ public:
   nsresult FlushAndDeleteTemporaryTables(bool force);
 
   /**
    * Stops the temp table flush timer.
    */
   void StopTempTableFlushTimer();
 
 protected:
-  nsDOMStoragePersistentDB mChromePersistentDB;
   nsDOMStoragePersistentDB mPersistentDB;
   nsDOMStorageMemoryDB mSessionOnlyDB;
   nsDOMStorageMemoryDB mPrivateBrowsingDB;
 
   nsCOMPtr<nsITimer> mTempTableFlushTimer;
 };
 
 #endif /* nsDOMStorageDB_h___ */
--- a/dom/src/storage/nsDOMStorageMemoryDB.cpp
+++ b/dom/src/storage/nsDOMStorageMemoryDB.cpp
@@ -143,65 +143,60 @@ nsDOMStorageMemoryDB::GetKeyValue(DOMSto
   *aSecure = item->mSecure;
   return NS_OK;
 }
 
 nsresult
 nsDOMStorageMemoryDB::SetKey(DOMStorageImpl* aStorage,
                              const nsAString& aKey,
                              const nsAString& aValue,
-                             bool aSecure,
-                             int32_t aQuota,
-                             bool aExcludeOfflineFromUsage,
-                             int32_t *aNewUsage)
+                             bool aSecure)
 {
   nsresult rv;
 
   nsInMemoryStorage* storage;
   rv = GetItemsTable(aStorage, &storage);
   NS_ENSURE_SUCCESS(rv, rv);
 
   int32_t usage = 0;
-  if (!aStorage->GetQuotaDomainDBKey(!aExcludeOfflineFromUsage).IsEmpty()) {
-    rv = GetUsage(aStorage, aExcludeOfflineFromUsage, &usage);
+  if (!aStorage->GetQuotaDomainDBKey().IsEmpty()) {
+    rv = GetUsage(aStorage, &usage);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   usage += aKey.Length() + aValue.Length();
 
   nsInMemoryItem* item;
   if (!storage->mTable.Get(aKey, &item)) {
-    if (usage > aQuota) {
+    if (usage > GetQuota()) {
       return NS_ERROR_DOM_QUOTA_REACHED;
     }
 
     item = new nsInMemoryItem();
     if (!item)
       return NS_ERROR_OUT_OF_MEMORY;
 
     storage->mTable.Put(aKey, item);
     storage->mUsageDelta += aKey.Length();
   }
   else
   {
     if (!aSecure && item->mSecure)
       return NS_ERROR_DOM_SECURITY_ERR;
     usage -= aKey.Length() + item->mValue.Length();
-    if (usage > aQuota) {
+    if (usage > GetQuota()) {
       return NS_ERROR_DOM_QUOTA_REACHED;
     }
   }
 
   storage->mUsageDelta += aValue.Length() - item->mValue.Length();
 
   item->mValue = aValue;
   item->mSecure = aSecure;
 
-  *aNewUsage = usage;
-
   MarkScopeDirty(aStorage);
 
   return NS_OK;
 }
 
 nsresult
 nsDOMStorageMemoryDB::SetSecure(DOMStorageImpl* aStorage,
                                 const nsAString& aKey,
@@ -221,19 +216,17 @@ nsDOMStorageMemoryDB::SetSecure(DOMStora
 
   MarkScopeDirty(aStorage);
 
   return NS_OK;
 }
 
 nsresult
 nsDOMStorageMemoryDB::RemoveKey(DOMStorageImpl* aStorage,
-                                const nsAString& aKey,
-                                bool aExcludeOfflineFromUsage,
-                                int32_t aKeyUsage)
+                                const nsAString& aKey)
 {
   nsresult rv;
 
   nsInMemoryStorage* storage;
   rv = GetItemsTable(aStorage, &storage);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsInMemoryItem* item;
@@ -299,146 +292,93 @@ RemoveOwnersEnum(const nsACString& key,
 
   if (StringBeginsWith(key, *(struc->mSubDomain)) == struc->mMatch)
     return PL_DHASH_REMOVE;
 
   return PL_DHASH_NEXT;
 }
 
 nsresult
-nsDOMStorageMemoryDB::RemoveOwner(const nsACString& aOwner,
-                                  bool aIncludeSubDomains)
+nsDOMStorageMemoryDB::RemoveOwner(const nsACString& aOwner)
 {
   nsAutoCString subdomainsDBKey;
   nsDOMStorageDBWrapper::CreateDomainScopeDBKey(aOwner, subdomainsDBKey);
 
-  if (!aIncludeSubDomains)
-    subdomainsDBKey.AppendLiteral(":");
-
   RemoveOwnersStruc struc;
   struc.mSubDomain = &subdomainsDBKey;
   struc.mMatch = true;
   mData.Enumerate(RemoveOwnersEnum, &struc);
 
   MarkAllScopesDirty();
 
   return NS_OK;
 }
 
-
-nsresult
-nsDOMStorageMemoryDB::RemoveOwners(const nsTArray<nsString> &aOwners,
-                                   bool aIncludeSubDomains,
-                                   bool aMatch)
-{
-  if (aOwners.Length() == 0) {
-    if (aMatch) {
-      return NS_OK;
-    }
-
-    return RemoveAll();
-  }
-
-  for (uint32_t i = 0; i < aOwners.Length(); i++) {
-    nsAutoCString quotaKey;
-    nsDOMStorageDBWrapper::CreateDomainScopeDBKey(
-      NS_ConvertUTF16toUTF8(aOwners[i]), quotaKey);
-
-    if (!aIncludeSubDomains)
-      quotaKey.AppendLiteral(":");
-
-    RemoveOwnersStruc struc;
-    struc.mSubDomain = &quotaKey;
-    struc.mMatch = aMatch;
-    mData.Enumerate(RemoveOwnersEnum, &struc);
-  }
-
-  MarkAllScopesDirty();
-
-  return NS_OK;
-}
-
 nsresult
 nsDOMStorageMemoryDB::RemoveAll()
 {
   mData.Clear(); // XXX Check this releases all instances
 
   MarkAllScopesDirty();
 
   return NS_OK;
 }
 
 nsresult
-nsDOMStorageMemoryDB::GetUsage(DOMStorageImpl* aStorage,
-                               bool aExcludeOfflineFromUsage, int32_t *aUsage)
+nsDOMStorageMemoryDB::GetUsage(DOMStorageImpl* aStorage, int32_t *aUsage)
 {
-  return GetUsageInternal(aStorage->GetQuotaDomainDBKey(!aExcludeOfflineFromUsage),
-                          aExcludeOfflineFromUsage, aUsage);
+  return GetUsageInternal(aStorage->GetQuotaDomainDBKey(), aUsage);
 }
 
 nsresult
 nsDOMStorageMemoryDB::GetUsage(const nsACString& aDomain,
-                               bool aIncludeSubDomains,
                                int32_t *aUsage)
 {
   nsresult rv;
 
   nsAutoCString quotadomainDBKey;
   rv = nsDOMStorageDBWrapper::CreateQuotaDomainDBKey(aDomain,
-                                                     aIncludeSubDomains,
-                                                     false,
                                                      quotadomainDBKey);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  return GetUsageInternal(quotadomainDBKey, false, aUsage);
+  return GetUsageInternal(quotadomainDBKey, aUsage);
 }
 
 struct GetUsageEnumStruc
 {
   int32_t mUsage;
-  int32_t mExcludeOfflineFromUsage;
   nsCString mSubdomain;
 };
 
 static PLDHashOperator
 GetUsageEnum(const nsACString& key,
              nsDOMStorageMemoryDB::nsInMemoryStorage* storageData,
              void *closure)
 {
   GetUsageEnumStruc* struc = (GetUsageEnumStruc*)closure;
 
   if (StringBeginsWith(key, struc->mSubdomain)) {
-    if (struc->mExcludeOfflineFromUsage) {
-      nsAutoCString domain;
-      nsresult rv = nsDOMStorageDBWrapper::GetDomainFromScopeKey(key, domain);
-      if (NS_SUCCEEDED(rv) && IsOfflineAllowed(domain))
-        return PL_DHASH_NEXT;
-    }
-
     struc->mUsage += storageData->mUsageDelta;
   }
 
   return PL_DHASH_NEXT;
 }
 
 nsresult
 nsDOMStorageMemoryDB::GetUsageInternal(const nsACString& aQuotaDomainDBKey,
-                                       bool aExcludeOfflineFromUsage,
                                        int32_t *aUsage)
 {
   GetUsageEnumStruc struc;
   struc.mUsage = 0;
-  struc.mExcludeOfflineFromUsage = aExcludeOfflineFromUsage;
   struc.mSubdomain = aQuotaDomainDBKey;
 
   if (mPreloadDB) {
     nsresult rv;
 
-    rv = mPreloadDB->GetUsageInternal(aQuotaDomainDBKey,
-                                      aExcludeOfflineFromUsage, &struc.mUsage);
+    rv = mPreloadDB->GetUsageInternal(aQuotaDomainDBKey, &struc.mUsage);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   mData.EnumerateRead(GetUsageEnum, &struc);
 
   *aUsage = struc.mUsage;
   return NS_OK;
 }
--- a/dom/src/storage/nsDOMStorageMemoryDB.h
+++ b/dom/src/storage/nsDOMStorageMemoryDB.h
@@ -73,38 +73,33 @@ public:
 
   /**
    * Set the value and secure flag for a key in storage.
    */
   nsresult
   SetKey(DOMStorageImpl* aStorage,
          const nsAString& aKey,
          const nsAString& aValue,
-         bool aSecure,
-         int32_t aQuota,
-         bool aExcludeOfflineFromUsage,
-         int32_t* aNewUsage);
+         bool aSecure);
 
   /**
    * Set the secure flag for a key in storage. Does nothing if the key was
    * not found.
    */
   nsresult
   SetSecure(DOMStorageImpl* aStorage,
             const nsAString& aKey,
             const bool aSecure);
 
   /**
    * Removes a key from storage.
    */
   nsresult
   RemoveKey(DOMStorageImpl* aStorage,
-            const nsAString& aKey,
-            bool aExcludeOfflineFromUsage,
-            int32_t aKeyUsage);
+            const nsAString& aKey);
 
   /**
     * Remove all keys belonging to this storage.
     */
   nsresult
   ClearStorage(DOMStorageImpl* aStorage);
 
   /**
@@ -112,47 +107,39 @@ public:
    */
   nsresult
   DropStorage(DOMStorageImpl* aStorage);
 
   /**
    * Removes all keys added by a given domain.
    */
   nsresult
-  RemoveOwner(const nsACString& aOwner, bool aIncludeSubDomains);
-
-  /**
-   * Removes keys owned by domains that either match or don't match the
-   * list.
-   */
-  nsresult
-  RemoveOwners(const nsTArray<nsString>& aOwners,
-               bool aIncludeSubDomains, bool aMatch);
+  RemoveOwner(const nsACString& aOwner);
 
   /**
    * Removes all keys from storage. Used when clearing storage.
    */
   nsresult
   RemoveAll();
 
   /**
     * Returns usage for a storage using its GetQuotaDomainDBKey() as a key.
     */
   nsresult
-  GetUsage(DOMStorageImpl* aStorage, bool aExcludeOfflineFromUsage, int32_t *aUsage);
+  GetUsage(DOMStorageImpl* aStorage, int32_t *aUsage);
 
   /**
     * Returns usage of the domain and optionaly by any subdomain.
     */
   nsresult
-  GetUsage(const nsACString& aDomain, bool aIncludeSubDomains, int32_t *aUsage);
+  GetUsage(const nsACString& aDomain, int32_t *aUsage);
 
 protected:
 
   nsClassHashtable<nsCStringHashKey, nsInMemoryStorage> mData;
   nsDOMStoragePersistentDB* mPreloadDB;
   bool mPreloading;
 
   nsresult
-  GetUsageInternal(const nsACString& aQuotaDomainDBKey, bool aExcludeOfflineFromUsage, int32_t *aUsage);
+  GetUsageInternal(const nsACString& aQuotaDomainDBKey, int32_t *aUsage);
 };
 
 #endif
--- a/dom/src/storage/nsDOMStoragePersistentDB.cpp
+++ b/dom/src/storage/nsDOMStoragePersistentDB.cpp
@@ -58,59 +58,22 @@ nsReverseStringSQLFunction::OnFunctionCa
   rv = outVar->SetAsAUTF8String(result);
   NS_ENSURE_SUCCESS(rv, rv);
 
   *aResult = outVar.get();
   outVar.forget();
   return NS_OK;
 }
 
-class nsIsOfflineSQLFunction MOZ_FINAL : public mozIStorageFunction
-{
-  NS_DECL_ISUPPORTS
-  NS_DECL_MOZISTORAGEFUNCTION
-};
-
-NS_IMPL_ISUPPORTS1(nsIsOfflineSQLFunction, mozIStorageFunction)
-
 nsDOMStoragePersistentDB::nsDOMStoragePersistentDB()
 : mStatements(mConnection)
 {
   mTempTableLoads.Init(16);
 }
 
-NS_IMETHODIMP
-nsIsOfflineSQLFunction::OnFunctionCall(
-    mozIStorageValueArray *aFunctionArguments, nsIVariant **aResult)
-{
-  nsresult rv;
-
-  nsAutoCString scope;
-  rv = aFunctionArguments->GetUTF8String(0, scope);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsAutoCString domain;
-  rv = nsDOMStorageDBWrapper::GetDomainFromScopeKey(scope, domain);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  bool hasOfflinePermission = IsOfflineAllowed(domain);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIWritableVariant> outVar(do_CreateInstance(
-      NS_VARIANT_CONTRACTID, &rv));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = outVar->SetAsBool(hasOfflinePermission);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  *aResult = outVar.get();
-  outVar.forget();
-  return NS_OK;
-}
-
 nsresult
 nsDOMStoragePersistentDB::Init(const nsString& aDatabaseName)
 {
   nsresult rv;
 
   nsCOMPtr<nsIFile> storageFile;
   rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
                               getter_AddRefs(storageFile));
@@ -191,22 +154,16 @@ nsDOMStoragePersistentDB::Init(const nsS
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<mozIStorageFunction> function1(new nsReverseStringSQLFunction());
   NS_ENSURE_TRUE(function1, NS_ERROR_OUT_OF_MEMORY);
 
   rv = mConnection->CreateFunction(NS_LITERAL_CSTRING("REVERSESTRING"), 1, function1);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  nsCOMPtr<mozIStorageFunction> function2(new nsIsOfflineSQLFunction());
-  NS_ENSURE_TRUE(function2, NS_ERROR_OUT_OF_MEMORY);
-
-  rv = mConnection->CreateFunction(NS_LITERAL_CSTRING("ISOFFLINE"), 1, function2);
-  NS_ENSURE_SUCCESS(rv, rv);
-
   bool exists;
 
   // Check if there is storage of Gecko 1.9.0 and if so, upgrade that storage
   // to actual webappsstore2 table and drop the obsolete table. First process
   // this newer table upgrade to priority potential duplicates from older
   // storage table.
   rv = mConnection->TableExists(NS_LITERAL_CSTRING("webappsstore"),
                                 &exists);
@@ -471,44 +428,41 @@ nsDOMStoragePersistentDB::GetKeyValue(DO
 
   return rv;
 }
 
 nsresult
 nsDOMStoragePersistentDB::SetKey(DOMStorageImpl* aStorage,
                                  const nsAString& aKey,
                                  const nsAString& aValue,
-                                 bool aSecure,
-                                 int32_t aQuota,
-                                 bool aExcludeOfflineFromUsage,
-                                 int32_t *aNewUsage)
+                                 bool aSecure)
 {
   nsresult rv;
 
   rv = EnsureLoadTemporaryTableForStorage(aStorage);
   NS_ENSURE_SUCCESS(rv, rv);
 
   int32_t usage = 0;
-  if (!aStorage->GetQuotaDomainDBKey(!aExcludeOfflineFromUsage).IsEmpty()) {
-    rv = GetUsage(aStorage, aExcludeOfflineFromUsage, &usage);
+  if (!aStorage->GetQuotaDomainDBKey().IsEmpty()) {
+    rv = GetUsage(aStorage, &usage);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   usage += aKey.Length() + aValue.Length();
 
   nsAutoString previousValue;
   bool secure;
   rv = aStorage->GetCachedValue(aKey, previousValue, &secure);
   if (NS_SUCCEEDED(rv)) {
     if (!aSecure && secure)
       return NS_ERROR_DOM_SECURITY_ERR;
     usage -= aKey.Length() + previousValue.Length();
   }
 
-  if (usage > aQuota) {
+  if (usage > GetQuota()) {
     return NS_ERROR_DOM_QUOTA_REACHED;
   }
 
   rv = EnsureInsertTransaction();
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<mozIStorageStatement> stmt = mStatements.GetCachedStatement(
     "INSERT OR REPLACE INTO webappsstore2_temp (scope, key, value, secure, modified) "
@@ -528,23 +482,21 @@ nsDOMStoragePersistentDB::SetKey(DOMStor
   NS_ENSURE_SUCCESS(rv, rv);
   rv = stmt->BindInt32ByName(NS_LITERAL_CSTRING("secure"),
                              aSecure ? 1 : 0);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = stmt->Execute();
   NS_ENSURE_SUCCESS(rv, rv);
 
-  if (!aStorage->GetQuotaDomainDBKey(!aExcludeOfflineFromUsage).IsEmpty()) {
+  if (!aStorage->GetQuotaDomainDBKey().IsEmpty()) {
     // No need to set mCachedOwner since it was set by GetUsage()
     mCachedUsage = usage;
   }
 
-  *aNewUsage = usage;
-
   MarkScopeDirty(aStorage);
 
   return NS_OK;
 }
 
 nsresult
 nsDOMStoragePersistentDB::SetSecure(DOMStorageImpl* aStorage,
                                     const nsAString& aKey,
@@ -582,35 +534,33 @@ nsDOMStoragePersistentDB::SetSecure(DOMS
 
   MarkScopeDirty(aStorage);
 
   return NS_OK;
 }
 
 nsresult
 nsDOMStoragePersistentDB::RemoveKey(DOMStorageImpl* aStorage,
-                                    const nsAString& aKey,
-                                    bool aExcludeOfflineFromUsage,
-                                    int32_t aKeyUsage)
+                                    const nsAString& aKey)
 {
   nsresult rv;
 
   rv = MaybeCommitInsertTransaction();
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<mozIStorageStatement> stmt = mStatements.GetCachedStatement(
     "DELETE FROM webappsstore2_view "
     "WHERE scope = :scope "
       "AND key = :key "
   );
   NS_ENSURE_STATE(stmt);
   mozStorageStatementScoper scope(stmt);
 
   if (DomainMaybeCached(
-      aStorage->GetQuotaDomainDBKey(!aExcludeOfflineFromUsage))) {
+      aStorage->GetQuotaDomainDBKey())) {
     mCachedUsage = 0;
     mCachedOwner.Truncate();
   }
 
   rv = stmt->BindUTF8StringByName(NS_LITERAL_CSTRING("scope"),
                                   aStorage->GetScopeDBKey());
   NS_ENSURE_SUCCESS(rv, rv);
   rv = stmt->BindStringByName(NS_LITERAL_CSTRING("key"),
@@ -651,18 +601,17 @@ nsDOMStoragePersistentDB::ClearStorage(D
   NS_ENSURE_SUCCESS(rv, rv);
 
   MarkScopeDirty(aStorage);
 
   return NS_OK;
 }
 
 nsresult
-nsDOMStoragePersistentDB::RemoveOwner(const nsACString& aOwner,
-                                      bool aIncludeSubDomains)
+nsDOMStoragePersistentDB::RemoveOwner(const nsACString& aOwner)
 {
   nsresult rv;
 
   rv = MaybeCommitInsertTransaction();
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<mozIStorageStatement> stmt = mStatements.GetCachedStatement(
     "DELETE FROM webappsstore2_view "
@@ -674,110 +623,30 @@ nsDOMStoragePersistentDB::RemoveOwner(co
   nsAutoCString subdomainsDBKey;
   nsDOMStorageDBWrapper::CreateDomainScopeDBKey(aOwner, subdomainsDBKey);
 
   if (DomainMaybeCached(subdomainsDBKey)) {
     mCachedUsage = 0;
     mCachedOwner.Truncate();
   }
 
-  if (!aIncludeSubDomains)
-    subdomainsDBKey.AppendLiteral(":");
   subdomainsDBKey.AppendLiteral("*");
 
   rv = stmt->BindUTF8StringByName(NS_LITERAL_CSTRING("scope"),
                                   subdomainsDBKey);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = stmt->Execute();
   NS_ENSURE_SUCCESS(rv, rv);
 
   MarkAllScopesDirty();
 
   return NS_OK;
 }
 
-
-nsresult
-nsDOMStoragePersistentDB::RemoveOwners(const nsTArray<nsString> &aOwners,
-                                       bool aIncludeSubDomains,
-                                       bool aMatch)
-{
-  if (aOwners.Length() == 0) {
-    if (aMatch) {
-      return NS_OK;
-    }
-
-    return RemoveAll();
-  }
-
-  // Using nsString here because it is going to be very long
-  nsCString expression;
-
-  if (aMatch) {
-    expression.AppendLiteral("DELETE FROM webappsstore2_view WHERE scope IN (");
-  } else {
-    expression.AppendLiteral("DELETE FROM webappsstore2_view WHERE scope NOT IN (");
-  }
-
-  for (uint32_t i = 0; i < aOwners.Length(); i++) {
-    if (i)
-      expression.AppendLiteral(" UNION ");
-
-    expression.AppendLiteral(
-      "SELECT DISTINCT scope FROM webappsstore2_temp WHERE scope GLOB :scope");
-    expression.AppendInt(i);
-    expression.AppendLiteral(" UNION ");
-    expression.AppendLiteral(
-      "SELECT DISTINCT scope FROM webappsstore2 WHERE scope GLOB :scope");
-    expression.AppendInt(i);
-  }
-  expression.AppendLiteral(");");
-
-  nsCOMPtr<mozIStorageStatement> statement;
-
-  nsresult rv;
-
-  rv = MaybeCommitInsertTransaction();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = mConnection->CreateStatement(expression,
-                                    getter_AddRefs(statement));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  for (uint32_t i = 0; i < aOwners.Length(); i++) {
-    nsAutoCString quotaKey;
-    rv = nsDOMStorageDBWrapper::CreateDomainScopeDBKey(
-      NS_ConvertUTF16toUTF8(aOwners[i]), quotaKey);
-
-    if (DomainMaybeCached(quotaKey)) {
-      mCachedUsage = 0;
-      mCachedOwner.Truncate();
-    }
-
-    if (!aIncludeSubDomains)
-      quotaKey.AppendLiteral(":");
-    quotaKey.AppendLiteral("*");
-
-    nsAutoCString paramName;
-    paramName.Assign("scope");
-    paramName.AppendInt(i);
-
-    rv = statement->BindUTF8StringByName(paramName, quotaKey);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  rv = statement->Execute();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  MarkAllScopesDirty();
-
-  return NS_OK;
-}
-
 nsresult
 nsDOMStoragePersistentDB::RemoveAll()
 {
   nsresult rv;
 
   rv = MaybeCommitInsertTransaction();
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -792,94 +661,66 @@ nsDOMStoragePersistentDB::RemoveAll()
 
   MarkAllScopesDirty();
 
   return NS_OK;
 }
 
 nsresult
 nsDOMStoragePersistentDB::GetUsage(DOMStorageImpl* aStorage,
-                                   bool aExcludeOfflineFromUsage,
                                    int32_t *aUsage)
 {
-  return GetUsageInternal(aStorage->GetQuotaDomainDBKey(!aExcludeOfflineFromUsage),
-                                                        aExcludeOfflineFromUsage,
-                                                        aUsage);
+  return GetUsageInternal(aStorage->GetQuotaDomainDBKey(), aUsage);
 }
 
 nsresult
 nsDOMStoragePersistentDB::GetUsage(const nsACString& aDomain,
-                                   bool aIncludeSubDomains,
                                    int32_t *aUsage)
 {
   nsresult rv;
 
   nsAutoCString quotadomainDBKey;
   rv = nsDOMStorageDBWrapper::CreateQuotaDomainDBKey(aDomain,
-                                                     aIncludeSubDomains,
-                                                     false,
                                                      quotadomainDBKey);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  return GetUsageInternal(quotadomainDBKey, false, aUsage);
+  return GetUsageInternal(quotadomainDBKey, aUsage);
 }
 
 nsresult
 nsDOMStoragePersistentDB::GetUsageInternal(const nsACString& aQuotaDomainDBKey,
-                                           bool aExcludeOfflineFromUsage,
                                            int32_t *aUsage)
 {
   if (aQuotaDomainDBKey == mCachedOwner) {
     *aUsage = mCachedUsage;
     return NS_OK;
   }
 
   nsresult rv;
 
   rv = MaybeCommitInsertTransaction();
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<mozIStorageStatement> stmt;
-  if (aExcludeOfflineFromUsage) {
-    stmt = mStatements.GetCachedStatement(
-      "SELECT SUM(LENGTH(key) + LENGTH(value)) "
-      "FROM ( "
-        "SELECT key, value FROM webappsstore2_temp "
-        "WHERE scope GLOB :scope "
-          "AND NOT ISOFFLINE(scope) "
-        "UNION ALL "
-        "SELECT key, value FROM webappsstore2 "
-        "WHERE scope GLOB :scope "
-          "AND NOT ISOFFLINE(scope) "
-          "AND NOT EXISTS ( "
-            "SELECT scope, key "
-            "FROM webappsstore2_temp "
-            "WHERE scope = webappsstore2.scope "
-              "AND key = webappsstore2.key "
-          ") "
-      ") "
-    );
-  } else {
-    stmt = mStatements.GetCachedStatement(
-      "SELECT SUM(LENGTH(key) + LENGTH(value)) "
-      "FROM ( "
-        "SELECT key,value FROM webappsstore2_temp "
-        "WHERE scope GLOB :scope "
-        "UNION ALL "
-        "SELECT key,value FROM webappsstore2 "
-        "WHERE scope GLOB :scope "
-          "AND NOT EXISTS ( "
-            "SELECT scope, key "
-            "FROM webappsstore2_temp "
-            "WHERE scope = webappsstore2.scope "
-              "AND key = webappsstore2.key "
-          ") "
-      ") "
-    );
-  }
+  stmt = mStatements.GetCachedStatement(
+    "SELECT SUM(LENGTH(key) + LENGTH(value)) "
+    "FROM ( "
+      "SELECT key,value FROM webappsstore2_temp "
+      "WHERE scope GLOB :scope "
+      "UNION ALL "
+      "SELECT key,value FROM webappsstore2 "
+      "WHERE scope GLOB :scope "
+        "AND NOT EXISTS ( "
+          "SELECT scope, key "
+          "FROM webappsstore2_temp "
+          "WHERE scope = webappsstore2.scope "
+            "AND key = webappsstore2.key "
+        ") "
+    ") "
+  );
   NS_ENSURE_STATE(stmt);
   mozStorageStatementScoper scope(stmt);
 
   nsAutoCString scopeValue(aQuotaDomainDBKey);
   scopeValue += NS_LITERAL_CSTRING("*");
 
   rv = stmt->BindUTF8StringByName(NS_LITERAL_CSTRING("scope"), scopeValue);
   NS_ENSURE_SUCCESS(rv, rv);
--- a/dom/src/storage/nsDOMStoragePersistentDB.h
+++ b/dom/src/storage/nsDOMStoragePersistentDB.h
@@ -58,75 +58,62 @@ public:
 
   /**
    * Set the value and secure flag for a key in storage.
    */
   nsresult
   SetKey(DOMStorageImpl* aStorage,
          const nsAString& aKey,
          const nsAString& aValue,
-         bool aSecure,
-         int32_t aQuota,
-         bool aExcludeOfflineFromUsage,
-         int32_t* aNewUsage);
+         bool aSecure);
 
   /**
    * Set the secure flag for a key in storage. Does nothing if the key was
    * not found.
    */
   nsresult
   SetSecure(DOMStorageImpl* aStorage,
             const nsAString& aKey,
             const bool aSecure);
 
   /**
    * Removes a key from storage.
    */
   nsresult
   RemoveKey(DOMStorageImpl* aStorage,
-            const nsAString& aKey,
-            bool aExcludeOfflineFromUsage,
-            int32_t aKeyUsage);
+            const nsAString& aKey);
 
   /**
     * Remove all keys belonging to this storage.
     */
   nsresult ClearStorage(DOMStorageImpl* aStorage);
 
   /**
    * Removes all keys added by a given domain.
    */
   nsresult
-  RemoveOwner(const nsACString& aOwner, bool aIncludeSubDomains);
-
-  /**
-   * Removes keys owned by domains that either match or don't match the
-   * list.
-   */
-  nsresult
-  RemoveOwners(const nsTArray<nsString>& aOwners,
-               bool aIncludeSubDomains, bool aMatch);
+  RemoveOwner(const nsACString& aOwner);
 
   /**
    * Removes all keys from storage. Used when clearing storage.
    */
   nsresult
   RemoveAll();
 
   /**
     * Returns usage for a storage using its GetQuotaDomainDBKey() as a key.
     */
   nsresult
-  GetUsage(DOMStorageImpl* aStorage, bool aExcludeOfflineFromUsage, int32_t *aUsage);
+  GetUsage(DOMStorageImpl* aStorage, int32_t *aUsage);
 
   /**
     * Returns usage of the domain and optionaly by any subdomain.
     */
   nsresult
-  GetUsage(const nsACString& aDomain, bool aIncludeSubDomains, int32_t *aUsage);
+  GetUsage(const nsACString& aDomain, int32_t *aUsage);
 
   /**
    * Clears all in-memory data from private browsing mode
    */
   nsresult ClearAllPrivateBrowsingData();
 
   /**
    * We process INSERTs in a transaction because of performance.
@@ -169,17 +156,17 @@ protected:
   // Maps ScopeDBKey to time of the temporary table load for that scope.
   // If a record is present, the temp table has been loaded. If it is not
   // present, the table has not yet been loaded or has alrady been flushed.
   nsDataHashtable<nsCStringHashKey, TimeStamp> mTempTableLoads; 
 
   friend class nsDOMStorageDBWrapper;
   friend class nsDOMStorageMemoryDB;
   nsresult
-  GetUsageInternal(const nsACString& aQuotaDomainDBKey, bool aExcludeOfflineFromUsage, int32_t *aUsage);
+  GetUsageInternal(const nsACString& aQuotaDomainDBKey, int32_t *aUsage);
 
   // Compares aDomain with the mCachedOwner and returns false if changes
   // in aDomain don't affect mCachedUsage.
   bool DomainMaybeCached(const nsACString& aDomain);
 
 };
 
 #endif /* nsDOMStorageDB_h___ */
--- a/dom/tests/mochitest/localstorage/Makefile.in
+++ b/dom/tests/mochitest/localstorage/Makefile.in
@@ -47,18 +47,16 @@ MOCHITEST_FILES	= \
     test_localStorageOriginsDomainDiffs.html \
     test_localStorageOriginsSchemaDiffs.html \
     test_localStorageReplace.html \
     test_localStorageQuota.html \
     test_localStorageQuotaPrivateBrowsing.html \
     test_localStorageQuotaSessionOnly.html \
     test_localStorageQuotaSessionOnly2.html \
     test_localStorageKeyOrder.html \
-    test_removeOwnersAPI.html \
-    test_removeOwnersAPISessionOnly.html \
     test_storageConstructor.html \
     $(NULL)
 
 MOCHITEST_CHROME_FILES = \
     test_localStorageFromChrome.xhtml \
     $(NULL)
 
 include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/localstorage/test_localStorageQuota.html
+++ b/dom/tests/mochitest/localstorage/test_localStorageQuota.html
@@ -8,46 +8,17 @@
 
 <script type="text/javascript">
 
 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 
 var currentTest = 1;
 var prefs = Components.classes["@mozilla.org/preferences-service;1"]
             .getService(Components.interfaces.nsIPrefBranch);
-var quota, quotaOffline;
-
-function addOfflineApp(url)
-{
-  var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
-    .getService(Components.interfaces.nsIPermissionManager);
-  var uri = Components.classes["@mozilla.org/network/io-service;1"]
-    .getService(Components.interfaces.nsIIOService)
-    .newURI(url, null, null);
-  var principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
-                    .getService(Components.interfaces.nsIScriptSecurityManager)
-                    .getNoAppCodebasePrincipal(uri);
-
-  permissionManager.addFromPrincipal(principal, "offline-app",
-                                     Components.interfaces.nsIPermissionManager.ALLOW_ACTION);
-}
-
-function removeOfflineApp(url)
-{
-  var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
-    .getService(Components.interfaces.nsIPermissionManager);
-  var uri = Components.classes["@mozilla.org/network/io-service;1"]
-    .getService(Components.interfaces.nsIIOService)
-    .newURI(url, null, null);
-  var principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
-                    .getService(Components.interfaces.nsIScriptSecurityManager)
-                    .getNoAppCodebasePrincipal(uri);
-
-  permissionManager.removeFromPrincipal(principal, "offline-app");
-}
+var quota;
 
 function doNextTest()
 {
   slave = frame;
 
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 
   switch (currentTest)
@@ -56,22 +27,16 @@ function doNextTest()
     // set a 500 bytes key with name length 1 (allocate 501 bytes)
     case 1:
       try {
         quota = prefs.getIntPref("dom.storage.default_quota");
       } catch (ex) {
         quota = 5*1024;
       }
       prefs.setIntPref("dom.storage.default_quota", 1);
-      try {
-        quotaOffline = prefs.getIntPref("offline-apps.quota.max");
-      } catch (ex) {
-        quotaOffline = 200*1024;
-      }
-      prefs.setIntPref("offline-apps.quota.max", 2);
 
       slaveOrigin = "http://example.com";
       slave.location = slaveOrigin + slavePath + "frameQuota.html?add&A&success";
       break;
 
     // In subdomain now set another key with length 500 bytes, i.e.
     // allocate 501 bytes
     case 2:
@@ -128,84 +93,18 @@ function doNextTest()
       break;
 
     case 10:
       // Do a clean up...
       slaveOrigin = "https://test2.example.com";
       slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
       break;
 
-    case 11:
-      // test1.example.com is now using its own offline app quota
-      addOfflineApp("http://test1.example.com");
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&A&success";
-      break;
-
-    case 12:
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&B&success";
-      break;
-
-    case 13:
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&C&success";
-      // Now we have 1503 bytes stored, this exceeds the default storage quota
-      break;
-
-    case 14:
-      // Now check that upper level domain that is not set as an offline app
-      // domain is allowed to store data and is using the default quota
-      slaveOrigin = "http://example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&A&success";
-      break;
-
-    case 15:
-      slaveOrigin = "http://example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&B&success";
-      break;
-
-    case 16:
-      slaveOrigin = "http://example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&C&failure";
-      break;
-
-    case 17:
-      slaveOrigin = "http://test2.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&D&failure";
-      break;
-
-    case 18:
-      // check an offline app domain may store some more data
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&D&success";
-      break;
-
-    case 19:
-      // check an offline app domain is using its own (larger) quota
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&E&failure";
-      break;
-
-    case 20:
-      // Do a clean up...
-      slaveOrigin = "http://example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
-      break;
-
-    case 21:
-      // Do a clean up...
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
-      break;
-
     default: // end
-      removeOfflineApp("http://test1.example.com");
       prefs.setIntPref("dom.storage.default_quota", quota);
-      prefs.setIntPref("offline-apps.quota.max", quotaOffline);
       SimpleTest.finish();
   }
 
   ++currentTest;
 }
 
 function doStep()
 {
--- a/dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly.html
+++ b/dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly.html
@@ -16,46 +16,17 @@ var prefs = Components.classes["@mozilla
 var io = Components.classes["@mozilla.org/network/io-service;1"]
   .getService(Components.interfaces.nsIIOService);
 var uri = io.newURI(window.location, "", null);
 var cp = Components.classes["@mozilla.org/cookie/permission;1"]
   .getService(Components.interfaces.nsICookiePermission);
 
 cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_SESSION);
 
-var quota, quotaOffline;
-
-function addOfflineApp(url)
-{
-  var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
-    .getService(Components.interfaces.nsIPermissionManager);
-  var uri = Components.classes["@mozilla.org/network/io-service;1"]
-    .getService(Components.interfaces.nsIIOService)
-    .newURI(url, null, null);
-  var principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
-                    .getService(Components.interfaces.nsIScriptSecurityManager)
-                    .getNoAppCodebasePrincipal(uri);
-
-  permissionManager.addFromPrincipal(principal, "offline-app",
-                                     Components.interfaces.nsIPermissionManager.ALLOW_ACTION);
-}
-
-function removeOfflineApp(url)
-{
-  var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
-    .getService(Components.interfaces.nsIPermissionManager);
-  var uri = Components.classes["@mozilla.org/network/io-service;1"]
-    .getService(Components.interfaces.nsIIOService)
-    .newURI(url, null, null);
-  var principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
-                    .getService(Components.interfaces.nsIScriptSecurityManager)
-                    .getNoAppCodebasePrincipal(uri);
-
-  permissionManager.removeFromPrincipal(principal, "offline-app");
-}
+var quota;
 
 function doNextTest()
 {
   slave = frame;
 
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 
   switch (currentTest)
@@ -64,22 +35,16 @@ function doNextTest()
     // set a 500 bytes key with name length 1 (allocate 501 bytes)
     case 1:
       try {
         quota = prefs.getIntPref("dom.storage.default_quota");
       } catch (ex) {
         quota = 5*1024;
       }
       prefs.setIntPref("dom.storage.default_quota", 1);
-      try {
-        quotaOffline = prefs.getIntPref("offline-apps.quota.max");
-      } catch (ex) {
-        quotaOffline = 200*1024;
-      }
-      prefs.setIntPref("offline-apps.quota.max", 2);
 
 
       slaveOrigin = "http://example.com";
       slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&A&success";
       break;
 
     // In subdomain now set another key with length 500 bytes, i.e.
     // allocate 501 bytes
@@ -137,84 +102,18 @@ function doNextTest()
       break;
 
     case 10:
       // Do a clean up...
       slaveOrigin = "https://test2.example.com";
       slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
       break;
 
-    case 11:
-      // test1.example.com is now using its own offline app quota
-      addOfflineApp("http://test1.example.com");
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&A&success";
-      break;
-
-    case 12:
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&B&success";
-      break;
-
-    case 13:
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&C&success";
-      // Now we have 1503 bytes stored, this exceeds the default storage quota
-      break;
-
-    case 14:
-      // Now check that upper level domain that is not set as an offline app
-      // domain is allowed to store data and is using the default quota
-      slaveOrigin = "http://example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&A&success";
-      break;
-
-    case 15:
-      slaveOrigin = "http://example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&B&success";
-      break;
-
-    case 16:
-      slaveOrigin = "http://example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&C&failure";
-      break;
-
-    case 17:
-      slaveOrigin = "http://test2.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&D&failure";
-      break;
-
-    case 18:
-      // check an offline app domain may store some more data
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&D&success";
-      break;
-
-    case 19:
-      // check an offline app domain is using its own (larger) quota
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&E&failure";
-      break;
-
-    case 20:
-      // Do a clean up...
-      slaveOrigin = "http://example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
-      break;
-
-    case 21:
-      // Do a clean up...
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
-      break;
-
     default:
-      removeOfflineApp("http://test1.example.com");
       prefs.setIntPref("dom.storage.default_quota", quota);
-      prefs.setIntPref("offline-apps.quota.max", quotaOffline);
       cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_DEFAULT);
       SimpleTest.finish();
   }
 
   ++currentTest;
 }
 
 function doStep()
--- a/dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly2.html
+++ b/dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly2.html
@@ -14,68 +14,33 @@ var currentTest = 1;
 var prefs = Cc["@mozilla.org/preferences-service;1"]
             .getService(Components.interfaces.nsIPrefBranch);
 var io = Cc["@mozilla.org/network/io-service;1"]
   .getService(Components.interfaces.nsIIOService);
 var uri = io.newURI(window.location, "", null);
 var cp = Cc["@mozilla.org/cookie/permission;1"]
   .getService(Components.interfaces.nsICookiePermission);
 
-var quota, quotaOffline;
-
-function addOfflineApp(url)
-{
-  var permissionManager = Cc["@mozilla.org/permissionmanager;1"]
-    .getService(Components.interfaces.nsIPermissionManager);
-  var uri = Cc["@mozilla.org/network/io-service;1"]
-    .getService(Components.interfaces.nsIIOService)
-    .newURI(url, null, null);
-  var principal = Cc["@mozilla.org/scriptsecuritymanager;1"]
-                    .getService(Components.interfaces.nsIScriptSecurityManager)
-                    .getNoAppCodebasePrincipal(uri);
-
-  permissionManager.addFromPrincipal(principal, "offline-app",
-                                     Components.interfaces.nsIPermissionManager.ALLOW_ACTION);
-}
-
-function removeOfflineApp(url)
-{
-  var permissionManager = Cc["@mozilla.org/permissionmanager;1"]
-    .getService(Components.interfaces.nsIPermissionManager);
-  var uri = Cc["@mozilla.org/network/io-service;1"]
-    .getService(Components.interfaces.nsIIOService)
-    .newURI(url, null, null);
-  var principal = Cc["@mozilla.org/scriptsecuritymanager;1"]
-                    .getService(Components.interfaces.nsIScriptSecurityManager)
-                    .getNoAppCodebasePrincipal(uri);
-
-  permissionManager.removeFromPrincipal(principal, "offline-app");
-}
+var quota;
 
 function doNextTest()
 {
   slave = frame;
 
   switch (currentTest)
   {
     // Initialy setup the quota to testing value of 1024B and
     // set a 500 bytes key with name length 1 (allocate 501 bytes)
     case 1:
       try {
         quota = prefs.getIntPref("dom.storage.default_quota");
       } catch (ex) {
         quota = 5*1024;
       }
       prefs.setIntPref("dom.storage.default_quota", 1);
-      try {
-        quotaOffline = prefs.getIntPref("offline-apps.quota.max");
-      } catch (ex) {
-        quotaOffline = 200*1024;
-      }
-      prefs.setIntPref("offline-apps.quota.max", 2);
 
 
       slaveOrigin = "http://example.com";
       slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&A&success";
       break;
 
     // In subdomain now set another key with length 500 bytes, i.e.
     // allocate 501 bytes
@@ -121,99 +86,18 @@ function doNextTest()
 
     case 8:
       // Do a clean up...
       slaveOrigin = "http://example.com";
       slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
       cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_DEFAULT);
       break;
 
-    case 9:
-      // test1.example.com is now using its own offline app quota
-      addOfflineApp("http://test1.example.com");
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&A&success";
-      break;
-
-    case 10:
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&B&success";
-      break;
-
-    case 11:
-      cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_SESSION);
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&C&success";
-      // Now we have 1503 bytes stored, this exceeds the default storage quota
-      break;
-
-    case 12:
-      // Now check that upper level domain that is not set as an offline app
-      // domain is allowed to store data and is using the default quota
-      slaveOrigin = "http://example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&A&success";
-      break;
-
-    case 13:
-      slaveOrigin = "http://example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&B&success";
-      break;
-
-    case 14:
-      slaveOrigin = "http://example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&C&failure";
-      break;
-
-    case 15:
-      slaveOrigin = "http://test2.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&D&failure";
-      break;
-
-    case 16:
-      // Check an offline app domain may store some more data
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&D&success";
-      break;
-
-    case 17:
-      // Check an offline app domain is using its own (larger) quota
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&E&failure";
-      break;
-
-    case 18:
-      // This test checks we correctly subtract A from the usage. A is inherited
-      // from the persistent database before we switch to session-only cookies
-      // mode
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?remove&A&success";
-      break;
-
-    case 19:
-      // now we shold have more space to store a new value
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&E&success";
-      break;
-
-    case 20:
-      // Do a clean up...
-      slaveOrigin = "http://example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
-      break;
-
-    case 21:
-      // Do a clean up...
-      slaveOrigin = "http://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
-      break;
-
     default:
-      removeOfflineApp("http://test1.example.com");
       prefs.setIntPref("dom.storage.default_quota", quota);
-      prefs.setIntPref("offline-apps.quota.max", quotaOffline);
       cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_DEFAULT);
       SimpleTest.finish();
   }
 
   ++currentTest;
 }
 
 function doStep()
deleted file mode 100644
--- a/dom/tests/mochitest/localstorage/test_removeOwnersAPI.html
+++ /dev/null
@@ -1,143 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>localStorage and DOM quota test</title>
-
-<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-<script type="text/javascript" src="interOriginTest.js"></script>
-<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-
-<script type="text/javascript">
-
-netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-
-var currentTest = 1;
-var currentStep = 1;
-
-function addOfflineApp(url)
-{
-  var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
-    .getService(Components.interfaces.nsIPermissionManager);
-  var uri = Components.classes["@mozilla.org/network/io-service;1"]
-    .getService(Components.interfaces.nsIIOService)
-    .newURI(url, null, null);
-  var principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
-                    .getService(Components.interfaces.nsIScriptSecurityManager)
-                    .getNoAppCodebasePrincipal(uri);
-
-  permissionManager.addFromPrincipal(principal, "offline-app",
-                                     Components.interfaces.nsIPermissionManager.ALLOW_ACTION);
-}
-
-function removeOfflineApp(url)
-{
-  var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
-    .getService(Components.interfaces.nsIPermissionManager);
-  var uri = Components.classes["@mozilla.org/network/io-service;1"]
-    .getService(Components.interfaces.nsIIOService)
-    .newURI(url, null, null);
-  var principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
-                    .getService(Components.interfaces.nsIScriptSecurityManager)
-                    .getNoAppCodebasePrincipal(uri);
-
-  permissionManager.removeFromPrincipal(principal, "offline-app");
-}
-
-function doNextTest()
-{
-  slave = frame;
-
-  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-  currentStep = 1;
-
-  switch (currentTest)
-  {
-    // Add something to storage of example.com
-    case 1:
-      slaveOrigin = "http://example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&A&success";
-      break;
-
-    // Add something to storage of test1.example.com, secure schema
-    case 2:
-      slaveOrigin = "https://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&B&success";
-      break;
-
-    // Add something to storage of http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp, secure schema
-    case 3:
-      slaveOrigin = "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?add&C&success";
-      break;
-
-    // Call RemoveOwners API through storage manager.
-    // Classify the sites above as offline-app using
-    // the permission manager to let the storage manager
-    // know about them.
-    case 4:
-      addOfflineApp("http://example.com");
-      addOfflineApp("http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp");
-      var manager = Components.classes["@mozilla.org/dom/storagemanager;1"]
-                    .getService(Components.interfaces.nsIDOMStorageManager);
-      try {
-        manager.clearOfflineApps();
-      }
-      catch (ex) {
-        ok(false, "Exception not thrown during clearOfflineApps()");
-      }
-      removeOfflineApp("http://example.com");
-      removeOfflineApp("http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp");
-
-      // Now check that those two sites' data disappeared
-      slaveOrigin = "http://example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?checkclean&A&success";
-      break;
-
-    case 5:
-      slaveOrigin = "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?checkclean&C&success";
-      break;
-
-    case 6:
-      // Also subdomains to example.com must be deleted
-      slaveOrigin = "https://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?checkclean&B&success";
-      break;
-
-    case 7:
-      addOfflineApp("https://test1.example.com");
-      var manager = Components.classes["@mozilla.org/dom/storagemanager;1"]
-                    .getService(Components.interfaces.nsIDOMStorageManager);
-      try {
-        manager.clearOfflineApps();
-      }
-      catch (ex) {
-        ok(false, "Exception not thrown during clearOfflineApps()");
-      }
-      removeOfflineApp("https://test1.example.com");
-
-      // Now check that those site's data disappeared
-      slaveOrigin = "https://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuota.html?checkclean&B&success";
-      break;
-
-    case 8:
-      SimpleTest.finish();
-  }
-
-  ++currentTest;
-}
-
-function doStep()
-{
-}
-
-SimpleTest.waitForExplicitFinish();
-
-</script>
-
-</head>
-
-<body onload="doNextTest();">
-  <iframe src="" name="frame"></iframe>
-</body>
-</html>
deleted file mode 100644
--- a/dom/tests/mochitest/localstorage/test_removeOwnersAPISessionOnly.html
+++ /dev/null
@@ -1,158 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>localStorage and DOM quota test</title>
-
-<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-<script type="text/javascript" src="interOriginTest.js"></script>
-<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-
-<script type="text/javascript">
-
-netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-
-var currentTest = 1;
-var currentStep = 1;
-
-function addOfflineApp(url)
-{
-  var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
-    .getService(Components.interfaces.nsIPermissionManager);
-  var uri = Components.classes["@mozilla.org/network/io-service;1"]
-    .getService(Components.interfaces.nsIIOService)
-    .newURI(url, null, null);
-  var principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
-                    .getService(Components.interfaces.nsIScriptSecurityManager)
-                    .getNoAppCodebasePrincipal(uri);
-
-  permissionManager.addFromPrincipal(principal, "offline-app",
-                                     Components.interfaces.nsIPermissionManager.ALLOW_ACTION);
-}
-
-function removeOfflineApp(url)
-{
-  var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
-    .getService(Components.interfaces.nsIPermissionManager);
-  var uri = Components.classes["@mozilla.org/network/io-service;1"]
-    .getService(Components.interfaces.nsIIOService)
-    .newURI(url, null, null);
-  var principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
-                    .getService(Components.interfaces.nsIScriptSecurityManager)
-                    .getNoAppCodebasePrincipal(uri);
-
-  permissionManager.removeFromPrincipal(principal, "offline-app");
-}
-
-function doNextTest()
-{
-  slave = frame;
-
-  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-  currentStep = 1;
-
-  switch (currentTest)
-  {
-    // Add something to storage of example.com
-    case 1:
-      slaveOrigin = "http://example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&A&success";
-      break;
-
-    // Add something to storage of test1.example.com, secure schema
-    case 2:
-      slaveOrigin = "https://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&B&success";
-      break;
-
-    // Add something to storage of http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp, secure schema
-    case 3:
-      slaveOrigin = "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp";
-      slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&C&success";
-      break;
-
-    // Call RemoveOwners API through storage manager.
-    // Classify the sites above as offline-app using
-    // the permission manager to let the storage manager
-    // know about them.
-    case 4:
-      addOfflineApp("http://example.com");
-      addOfflineApp("http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp");
-      var manager = Components.classes["@mozilla.org/dom/storagemanager;1"]
-                    .getService(Components.interfaces.nsIDOMStorageManager);
-      try {
-        manager.clearOfflineApps();
-      }
-      catch (ex) {
-        ok(false, "Exception not thrown during clearOfflineApps()");
-      }
-      removeOfflineApp("http://example.com");
-      removeOfflineApp("http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp");
-
-      // Now check that those two sites' data disappeared
-      slaveOrigin = "http://example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?checkclean&A&success";
-      break;
-
-    case 5:
-      slaveOrigin = "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp";
-      slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?checkclean&C&success";
-      break;
-
-    case 6:
-      // Also subdomains to example.com must be deleted
-      slaveOrigin = "https://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?checkclean&B&success";
-      break;
-
-    case 7:
-      addOfflineApp("https://test1.example.com");
-      var manager = Components.classes["@mozilla.org/dom/storagemanager;1"]
-                    .getService(Components.interfaces.nsIDOMStorageManager);
-      try {
-        manager.clearOfflineApps();
-      }
-      catch (ex) {
-        ok(false, "Exception not thrown during clearOfflineApps()");
-      }
-      removeOfflineApp("https://test1.example.com");
-
-      // Now check that those site's data disappeared
-      slaveOrigin = "https://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?checkclean&B&success";
-      break;
-
-    case 8:
-      slaveOrigin = "http://example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
-      break;
-      
-    case 9:
-      slaveOrigin = "https://test1.example.com";
-      slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
-      break;
-      
-    case 10:
-      slaveOrigin = "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp";
-      slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
-      break;
-      
-    case 11:
-      SimpleTest.finish();
-  }
-
-  ++currentTest;
-}
-
-function doStep()
-{
-}
-
-SimpleTest.waitForExplicitFinish();
-
-</script>
-
-</head>
-
-<body onload="doNextTest();">
-  <iframe src="" name="frame"></iframe>
-</body>
-</html>
--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -54,16 +54,17 @@
 #include "nsFocusManager.h"
 #include "nsFrameList.h"
 #include "nsListControlFrame.h"
 #include "nsHTMLInputElement.h"
 #include "nsSVGUtils.h"
 #include "nsMathMLAtoms.h"
 #include "nsMathMLOperators.h"
 #include "Navigator.h"
+#include "nsDOMStorageBaseDB.h"
 
 #ifdef MOZ_XUL
 #include "nsXULPopupManager.h"
 #include "nsXULContentUtils.h"
 #include "nsXULPrototypeCache.h"
 #include "nsXULTooltipListener.h"
 
 #include "inDOMView.h"
@@ -250,16 +251,18 @@ nsLayoutStatics::Initialize()
   nsWindowMemoryReporter::Init();
 
   nsSVGUtils::Init();
 
   InitProcessPriorityManager();
 
   nsPermissionManager::AppUninstallObserverInit();
 
+  nsDOMStorageBaseDB::Init();
+
   return NS_OK;
 }
 
 void
 nsLayoutStatics::Shutdown()
 {
   // Don't need to shutdown nsWindowMemoryReporter, that will be done by the
   // memory reporter manager.