From 0cce11a866153c614203f0bd1b33e338714db4fc Mon Sep 17 00:00:00 2001 From: Honza Bambas Date: Mon, 25 Oct 2010 20:40:55 +0200 Subject: [PATCH] Bug 527667 - DOM Storage (localStorage, sessionStorage) data is not cleared when 'Clear Recent History' is used with Time range not 'Everything', r+sr=jst, a=blocking2.0:betaN --- browser/base/content/sanitize.js | 5 ++ dom/interfaces/storage/nsIDOMStorageManager.idl | 11 ++- dom/src/storage/nsDOMStorage.cpp | 94 +++++++++++++++++++-- dom/src/storage/nsDOMStorage.h | 16 +++- dom/src/storage/nsDOMStorageDBWrapper.cpp | 19 +++++ dom/src/storage/nsDOMStorageDBWrapper.h | 7 ++ dom/src/storage/nsDOMStorageMemoryDB.cpp | 29 +++++++ dom/src/storage/nsDOMStorageMemoryDB.h | 9 ++ dom/src/storage/nsDOMStoragePersistentDB.cpp | 97 +++++++++++++++++++--- dom/src/storage/nsDOMStoragePersistentDB.h | 9 ++ dom/tests/mochitest/Makefile.in | 1 + .../mochitest/{ => globalstorage}/Makefile.in | 39 +++------ .../test_globalStorageDeleteSinceAPI.html | 73 ++++++++++++++++ dom/tests/mochitest/localstorage/Makefile.in | 2 + .../test_localStorageDeleteSinceAPI.html | 70 ++++++++++++++++ ..._localStorageDeleteSinceAPIPrivateBrowsing.html | 85 +++++++++++++++++++ dom/tests/mochitest/sessionstorage/Makefile.in | 1 + .../test_sessionStorageDeleteSinceAPI.html | 67 +++++++++++++++ 18 files changed, 586 insertions(+), 48 deletions(-) copy dom/tests/mochitest/{ => globalstorage}/Makefile.in (82%) create mode 100644 dom/tests/mochitest/globalstorage/test_globalStorageDeleteSinceAPI.html create mode 100644 dom/tests/mochitest/localstorage/test_localStorageDeleteSinceAPI.html create mode 100644 dom/tests/mochitest/localstorage/test_localStorageDeleteSinceAPIPrivateBrowsing.html create mode 100644 dom/tests/mochitest/sessionstorage/test_sessionStorageDeleteSinceAPI.html diff --git a/browser/base/content/sanitize.js b/browser/base/content/sanitize.js index 3834c697e1..8c6d9a7dd9 100644 --- a/browser/base/content/sanitize.js +++ b/browser/base/content/sanitize.js @@ -152,6 +152,11 @@ Sanitizer.prototype = { // This cookie was created after our cutoff, clear it cookieMgr.remove(cookie.host, cookie.name, cookie.path, false); } + + // Also handle all DOM storage data created after the cutoff. + var domStorageManager = Components.classes["@mozilla.org/dom/storagemanager;1"] + .getService(Ci.nsIDOMStorageManager); + domStorageManager.clearStorageDataSince(this.range[0]); } else { // Remove everything diff --git a/dom/interfaces/storage/nsIDOMStorageManager.idl b/dom/interfaces/storage/nsIDOMStorageManager.idl index 7df2efa347..13ef2b207a 100644 --- a/dom/interfaces/storage/nsIDOMStorageManager.idl +++ b/dom/interfaces/storage/nsIDOMStorageManager.idl @@ -40,7 +40,7 @@ interface nsIDOMStorage; interface nsIPrincipal; -[scriptable, uuid(fd91ec36-7da8-43bb-b8f2-4b57a862a467)] +[scriptable, uuid(9b729267-00ed-4e5c-a3d2-b5572ca0934d)] interface nsIDOMStorageManager : nsISupports { /** @@ -60,6 +60,15 @@ interface nsIDOMStorageManager : nsISupports void clearOfflineApps(); /** + * Clears any data stored in DOM storage since the provided time + * @param since + * Any storage value that has been inserted after the time specified + * with 'since' will be deleted. The time is in microseconds, defined + * as PR_Now() function result. + */ + void clearStorageDataSince(in PRInt64 since); + + /** * Returns instance of localStorage object for aURI's origin. * This method ensures there is always only a single instance * for a single origin. diff --git a/dom/src/storage/nsDOMStorage.cpp b/dom/src/storage/nsDOMStorage.cpp index acd3bfc1e2..e443970f1a 100644 --- a/dom/src/storage/nsDOMStorage.cpp +++ b/dom/src/storage/nsDOMStorage.cpp @@ -65,6 +65,7 @@ #include "nsDOMString.h" #include "nsNetCID.h" #include "nsIProxyObjectManager.h" +#include "nsISupportsPrimitives.h" static const PRUint32 ASK_BEFORE_ACCEPT = 1; static const PRUint32 ACCEPT_SESSION = 2; @@ -402,10 +403,13 @@ nsDOMStorageManager::Observe(nsISupports *aSubject, PRUint32 cap = 0; perm->GetCapability(&cap); - if (!(cap & nsICookiePermission::ACCESS_SESSION) || - nsDependentString(aData) != NS_LITERAL_STRING("deleted")) + if (!(cap & nsICookiePermission::ACCESS_SESSION)) return NS_OK; + // In any change to ACCESS_SESSION, like add or delete, drop the session + // only storage in-memory database. This ensures that it will always be + // newly created and therefor preloaded with data from the persistent + // database after we switched to ACCESS_SESSION. nsCAutoString host; perm->GetHost(host); if (host.IsEmpty()) @@ -439,6 +443,33 @@ nsDOMStorageManager::GetUsage(const nsAString& aDomain, } NS_IMETHODIMP +nsDOMStorageManager::ClearStorageDataSince(PRInt64 aSince) +{ + nsresult rv; + + rv = nsDOMStorage::InitDB(); + NS_ENSURE_SUCCESS(rv, rv); + + rv = nsDOMStorage::gStorageDB->RemoveTimeRange(aSince); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr obsserv = mozilla::services::GetObserverService(); + if (obsserv) { + nsCOMPtr time = do_CreateInstance( + "@mozilla.org/supports-PRTime;1", &rv); + NS_ENSURE_SUCCESS(rv, rv); + + rv = time->SetData(aSince); + NS_ENSURE_SUCCESS(rv, rv); + + rv = obsserv->NotifyObservers(time, NS_DOMSTORAGE_CUTOFF_OBSERVER, nsnull); + NS_ENSURE_SUCCESS(rv, rv); + } + + return NS_OK; +} + +NS_IMETHODIMP nsDOMStorageManager::ClearOfflineApps() { nsresult rv = nsDOMStorage::InitDB(); @@ -660,6 +691,8 @@ nsDOMStorage::InitAsSessionStorage(nsIPrincipal *aPrincipal, const nsSubstring & mQuotaDomainDBKey.Truncate(); #endif + RegisterObservers(false); + mStorageType = SessionStorage; return NS_OK; } @@ -703,7 +736,7 @@ nsDOMStorage::InitAsLocalStorage(nsIPrincipal *aPrincipal, const nsSubstring &aD mCanUseChromePersist = URICanUseChromePersist(URI); } - RegisterObservers(); + RegisterObservers(true); return NS_OK; } @@ -731,7 +764,7 @@ nsDOMStorage::InitAsGlobalStorage(const nsACString &aDomainDemanded) mStorageType = GlobalStorage; mEventBroadcaster = this; - RegisterObservers(); + RegisterObservers(true); return NS_OK; } @@ -1091,6 +1124,12 @@ nsDOMStorage::SetItem(const nsAString& aKey, const nsAString& aData) entry->mItem = newitem; } + if (!UseDB()) { + // This is used only for sessionStorage, no need to setup the time also when + // loading items from the database etc. + entry->mItem->SetInsertTimeToNow(); + } + if ((oldValue != aData || mStorageType == GlobalStorage) && mEventBroadcaster) mEventBroadcaster->BroadcastChangeNotification(aKey, oldValue, aData); @@ -1532,13 +1571,16 @@ nsDOMStorage::MaybeCommitTemporaryTable(bool force) } nsresult -nsDOMStorage::RegisterObservers() +nsDOMStorage::RegisterObservers(bool persistent) { nsCOMPtr obsserv = mozilla::services::GetObserverService(); if (obsserv) { - obsserv->AddObserver(this, "profile-before-change", PR_TRUE); - obsserv->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_TRUE); - obsserv->AddObserver(this, NS_DOMSTORAGE_FLUSH_TIMER_OBSERVER, PR_TRUE); + if (persistent) { + obsserv->AddObserver(this, "profile-before-change", PR_TRUE); + obsserv->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_TRUE); + obsserv->AddObserver(this, NS_DOMSTORAGE_FLUSH_TIMER_OBSERVER, PR_TRUE); + } + obsserv->AddObserver(this, NS_DOMSTORAGE_CUTOFF_OBSERVER, PR_TRUE); } return NS_OK; } @@ -1561,6 +1603,17 @@ nsDOMStorage::SetTemporaryTableLoaded(bool loaded) mLoadedTemporaryTable = loaded; } +static PLDHashOperator +StorageCutOffEnum(nsSessionStorageEntry* aEntry, void* userArg) +{ + PRInt64 since = *(PRInt64*)userArg; + + if (aEntry->mItem->ShouldBeCutOff(since)) + return PL_DHASH_REMOVE; + + return PL_DHASH_NEXT; +} + NS_IMETHODIMP nsDOMStorage::Observe(nsISupports *subject, const char *topic, @@ -1579,6 +1632,30 @@ nsDOMStorage::Observe(nsISupports *subject, return NS_OK; } + if (!strcmp(topic, NS_DOMSTORAGE_CUTOFF_OBSERVER)) { + if (UseDB()) { + // If this storage is using the database (localStorage, globalStorage) + // then just re-cache the items from the database, database is now up to + // date. + mItemsCached = PR_FALSE; + CacheKeysFromDB(); + } + else { + // This is sessionStorage. In that case we need to prune the mItems hash + // table. Insert times are properly set in nsDOMStorage::SetItem. + nsresult rv; + nsCOMPtr time = do_QueryInterface(subject, &rv); + NS_ENSURE_SUCCESS(rv, rv); + + PRInt64 since; + rv = time->GetData(&since); + NS_ENSURE_SUCCESS(rv, rv); + + mItems.EnumerateEntries(StorageCutOffEnum, &since); + } + return NS_OK; + } + NS_WARNING("Unrecognized topic in nsDOMStorage::Observe"); return NS_OK; } @@ -2031,6 +2108,7 @@ nsDOMStorageItem::nsDOMStorageItem(nsDOMStorage* aStorage, : mSecure(aSecure), mKey(aKey), mValue(aValue), + mInsertTime(0), mStorage(aStorage) { } diff --git a/dom/src/storage/nsDOMStorage.h b/dom/src/storage/nsDOMStorage.h index 4aad4f6c42..d8cbab687f 100644 --- a/dom/src/storage/nsDOMStorage.h +++ b/dom/src/storage/nsDOMStorage.h @@ -64,6 +64,7 @@ #include "mozilla/TimeStamp.h" #define NS_DOMSTORAGE_FLUSH_TIMER_OBSERVER "domstorage-flush-timer" +#define NS_DOMSTORAGE_CUTOFF_OBSERVER "domstorage-cutoff" #ifdef MOZ_STORAGE #include "nsDOMStorageDBWrapper.h" @@ -242,7 +243,7 @@ public: return static_cast(static_cast(aSupports)); } - nsresult RegisterObservers(); + nsresult RegisterObservers(bool persistent); nsresult MaybeCommitTemporaryTable(bool force); bool WasTemporaryTableLoaded(); @@ -464,6 +465,16 @@ public: mValue.Truncate(); } + void SetInsertTimeToNow() + { + mInsertTime = PR_Now(); + } + + bool ShouldBeCutOff(PRInt64 since) + { + return mInsertTime > since; + } + protected: // true if this value is for secure sites only @@ -475,6 +486,9 @@ protected: // value of the item nsString mValue; + // insertion/update time + PRInt64 mInsertTime; + // If this item came from the db, mStorage points to the storage // object where this item came from. nsRefPtr mStorage; diff --git a/dom/src/storage/nsDOMStorageDBWrapper.cpp b/dom/src/storage/nsDOMStorageDBWrapper.cpp index 80679f2509..28cbe1b818 100644 --- a/dom/src/storage/nsDOMStorageDBWrapper.cpp +++ b/dom/src/storage/nsDOMStorageDBWrapper.cpp @@ -263,6 +263,25 @@ nsDOMStorageDBWrapper::RemoveOwner(const nsACString& aOwner, return rv; } +nsresult +nsDOMStorageDBWrapper::RemoveTimeRange(PRInt64 aSince) +{ + nsresult rv; + + rv = mPrivateBrowsingDB.RemoveTimeRange(aSince); + NS_ENSURE_SUCCESS(rv, rv); + + if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode()) + return NS_OK; + + rv = mSessionOnlyDB.RemoveTimeRange(aSince); + NS_ENSURE_SUCCESS(rv, rv); + + rv = mPersistentDB.RemoveTimeRange(aSince); + NS_ENSURE_SUCCESS(rv, rv); + + return rv; +} nsresult nsDOMStorageDBWrapper::RemoveOwners(const nsTArray &aOwners, diff --git a/dom/src/storage/nsDOMStorageDBWrapper.h b/dom/src/storage/nsDOMStorageDBWrapper.h index ee641454c8..bb7a4bf6ff 100644 --- a/dom/src/storage/nsDOMStorageDBWrapper.h +++ b/dom/src/storage/nsDOMStorageDBWrapper.h @@ -178,6 +178,13 @@ public: PRBool aIncludeSubDomains, PRBool aMatch); /** + * Removes all keys that were created after the time specified by 'aSince'. + * 'aSince' value is compatible with PR_Now() function. + */ + nsresult + RemoveTimeRange(PRInt64 aSince); + + /** * Removes all keys from storage. Used when clearing storage. */ nsresult diff --git a/dom/src/storage/nsDOMStorageMemoryDB.cpp b/dom/src/storage/nsDOMStorageMemoryDB.cpp index 220ba527f2..5cbed5bb23 100644 --- a/dom/src/storage/nsDOMStorageMemoryDB.cpp +++ b/dom/src/storage/nsDOMStorageMemoryDB.cpp @@ -230,6 +230,7 @@ nsDOMStorageMemoryDB::SetKey(nsDOMStorage* aStorage, item->mValue = aValue; item->mSecure = aSecure; + item->mInsertTime = PR_Now(); *aNewUsage = usage; @@ -379,6 +380,34 @@ nsDOMStorageMemoryDB::RemoveOwners(const nsTArray &aOwners, return NS_OK; } +static PLDHashOperator +RemoveTimeRangeEnum(const nsAString& keyname, + nsAutoPtr& item, + void *closure) +{ + if (item->mInsertTime > *(PRInt64*)closure) + return PL_DHASH_REMOVE; + + return PL_DHASH_NEXT; +} + +static PLDHashOperator +RemoveTimeRangeStoragesEnum(const nsACString& key, + nsAutoPtr& storage, + void *closure) +{ + storage->mTable.Enumerate(RemoveTimeRangeEnum, closure); + return PL_DHASH_NEXT; +} + +nsresult +nsDOMStorageMemoryDB::RemoveTimeRange(PRInt64 since) +{ + mData.Enumerate(RemoveTimeRangeStoragesEnum, &since); + + return NS_OK; +} + nsresult nsDOMStorageMemoryDB::RemoveAll() { diff --git a/dom/src/storage/nsDOMStorageMemoryDB.h b/dom/src/storage/nsDOMStorageMemoryDB.h index c88fd38fb2..2f0f7fd614 100644 --- a/dom/src/storage/nsDOMStorageMemoryDB.h +++ b/dom/src/storage/nsDOMStorageMemoryDB.h @@ -56,6 +56,7 @@ public: public: PRBool mSecure; nsString mValue; + PRInt64 mInsertTime; }; typedef nsClassHashtable nsStorageItemsTable; @@ -160,6 +161,14 @@ public: PRBool aIncludeSubDomains, PRBool aMatch); /** + * Remove all values from all scopes not marked as offline that has been + * created after the time specified with 'aSince'. Used by the Clear Private + * Data dialog. 'aSince' value is compatible with PR_Now() function. + */ + nsresult + RemoveTimeRange(PRInt64 aSince); + + /** * Removes all keys from storage. Used when clearing storage. */ nsresult diff --git a/dom/src/storage/nsDOMStoragePersistentDB.cpp b/dom/src/storage/nsDOMStoragePersistentDB.cpp index 0de77b00a9..ae89d27e93 100644 --- a/dom/src/storage/nsDOMStoragePersistentDB.cpp +++ b/dom/src/storage/nsDOMStoragePersistentDB.cpp @@ -205,30 +205,63 @@ nsDOMStoragePersistentDB::Init(const nsString& aDatabaseName) "PRAGMA temp_store = MEMORY")); NS_ENSURE_SUCCESS(rv, rv); + PRInt32 schemaVersion; + rv = mConnection->GetSchemaVersion(&schemaVersion); + NS_ENSURE_SUCCESS(rv, rv); + mozStorageTransaction transaction(mConnection, PR_FALSE); // Ensure Gecko 1.9.1 storage table - rv = mConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING( - "CREATE TABLE IF NOT EXISTS webappsstore2 (" - "scope TEXT, " - "key TEXT, " - "value TEXT, " - "secure INTEGER, " - "owner TEXT)")); + PRBool exists; + + rv = mConnection->TableExists(NS_LITERAL_CSTRING("webappsstore2"), + &exists); NS_ENSURE_SUCCESS(rv, rv); + if (!exists) { + rv = mConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING( + "CREATE TABLE webappsstore2 (" + "scope TEXT, " + "key TEXT, " + "value TEXT, " + "secure INTEGER, " + "owner TEXT, " + "inserttime BIGINT DEFAULT 0)")); + NS_ENSURE_SUCCESS(rv, rv); + } + else { + if (schemaVersion == 0) { + rv = mConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING( + "ALTER TABLE webappsstore2 " + "ADD COLUMN inserttime BIGINT DEFAULT 0")); + NS_ENSURE_SUCCESS(rv, rv); + } + } + + if (schemaVersion == 0) { + rv = mConnection->SetSchemaVersion(1); + NS_ENSURE_SUCCESS(rv, rv); + } + rv = mConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING( "CREATE UNIQUE INDEX IF NOT EXISTS scope_key_index" " ON webappsstore2(scope, key)")); NS_ENSURE_SUCCESS(rv, rv); rv = mConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING( + "CREATE INDEX IF NOT EXISTS inserttime_index" + " ON webappsstore2(inserttime)")); + NS_ENSURE_SUCCESS(rv, rv); + + + rv = mConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING( "CREATE TEMPORARY TABLE webappsstore2_temp (" "scope TEXT, " "key TEXT, " "value TEXT, " "secure INTEGER, " - "owner TEXT)")); + "owner TEXT, " + "inserttime BIGINT DEFAULT 0)")); NS_ENSURE_SUCCESS(rv, rv); rv = mConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING( @@ -236,6 +269,11 @@ nsDOMStoragePersistentDB::Init(const nsString& aDatabaseName) " ON webappsstore2_temp(scope, key)")); NS_ENSURE_SUCCESS(rv, rv); + rv = mConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING( + "CREATE INDEX IF NOT EXISTS inserttime_index_temp" + " ON webappsstore2_temp(inserttime)")); + NS_ENSURE_SUCCESS(rv, rv); + rv = mConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING( "CREATE TEMPORARY VIEW webappsstore2_view AS " @@ -271,8 +309,6 @@ nsDOMStoragePersistentDB::Init(const nsString& aDatabaseName) rv = mConnection->CreateFunction(NS_LITERAL_CSTRING("ISOFFLINE"), 1, function2); NS_ENSURE_SUCCESS(rv, rv); - PRBool 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 @@ -355,8 +391,8 @@ nsDOMStoragePersistentDB::Init(const nsString& aDatabaseName) // insert a new key rv = mConnection->CreateStatement(NS_LITERAL_CSTRING( "INSERT OR REPLACE INTO " - "webappsstore2_temp(scope, key, value, secure) " - "VALUES (:scope, :key, :value, :secure)"), + "webappsstore2_temp(scope, key, value, secure, inserttime) " + "VALUES (:scope, :key, :value, :secure, :inserttime)"), getter_AddRefs(mInsertKeyStatement)); NS_ENSURE_SUCCESS(rv, rv); @@ -391,6 +427,14 @@ nsDOMStoragePersistentDB::Init(const nsString& aDatabaseName) getter_AddRefs(mRemoveStorageStatement)); NS_ENSURE_SUCCESS(rv, rv); + // remove keys that are junger then a specific time + rv = mConnection->CreateStatement(NS_LITERAL_CSTRING( + "DELETE FROM webappsstore2_view " + "WHERE inserttime > :time " + "AND NOT ISOFFLINE(scope)"), + getter_AddRefs(mRemoveTimeRangeStatement)); + NS_ENSURE_SUCCESS(rv, rv); + // remove all keys rv = mConnection->CreateStatement(NS_LITERAL_CSTRING( "DELETE FROM webappsstore2_view"), @@ -689,6 +733,9 @@ nsDOMStoragePersistentDB::SetKey(nsDOMStorage* aStorage, rv = binder->BindInt32ByName(NS_LITERAL_CSTRING("secure"), aSecure ? 1 : 0); NS_ENSURE_SUCCESS(rv, rv); + rv = binder->BindInt64ByName(NS_LITERAL_CSTRING("inserttime"), + PR_Now()); + NS_ENSURE_SUCCESS(rv, rv); rv = binder.Add(); NS_ENSURE_SUCCESS(rv, rv); @@ -806,6 +853,32 @@ nsDOMStoragePersistentDB::ClearStorage(nsDOMStorage* aStorage) } nsresult +nsDOMStoragePersistentDB::RemoveTimeRange(PRInt64 since) +{ + nsresult rv; + + rv = MaybeCommitInsertTransaction(); + NS_ENSURE_SUCCESS(rv, rv); + + mozStorageStatementScoper scope(mRemoveTimeRangeStatement); + + Binder binder(mRemoveTimeRangeStatement, &rv); + NS_ENSURE_SUCCESS(rv, rv); + + rv = binder->BindInt64ByName(NS_LITERAL_CSTRING("time"), + since); + NS_ENSURE_SUCCESS(rv, rv); + + rv = binder.Add(); + NS_ENSURE_SUCCESS(rv, rv); + + rv = mRemoveTimeRangeStatement->Execute(); + NS_ENSURE_SUCCESS(rv, rv); + + return NS_OK; +} + +nsresult nsDOMStoragePersistentDB::RemoveOwner(const nsACString& aOwner, PRBool aIncludeSubDomains) { diff --git a/dom/src/storage/nsDOMStoragePersistentDB.h b/dom/src/storage/nsDOMStoragePersistentDB.h index af7cfe6a30..b0034cfde9 100644 --- a/dom/src/storage/nsDOMStoragePersistentDB.h +++ b/dom/src/storage/nsDOMStoragePersistentDB.h @@ -129,6 +129,14 @@ public: PRBool aIncludeSubDomains, PRBool aMatch); /** + * Remove all values from all scopes not marked as offline that has been + * created after the time specified with 'aSince'. Used by the Clear Private + * Data dialog. 'aSince' value is compatible with PR_Now() function. + */ + nsresult + RemoveTimeRange(PRInt64 aSince); + + /** * Removes all keys from storage. Used when clearing storage. */ nsresult @@ -176,6 +184,7 @@ protected: nsCOMPtr mRemoveKeyStatement; nsCOMPtr mRemoveOwnerStatement; nsCOMPtr mRemoveStorageStatement; + nsCOMPtr mRemoveTimeRangeStatement; nsCOMPtr mRemoveAllStatement; nsCOMPtr mGetOfflineExcludedUsageStatement; nsCOMPtr mGetFullUsageStatement; diff --git a/dom/tests/mochitest/Makefile.in b/dom/tests/mochitest/Makefile.in index d13e7c90ce..93b078be63 100644 --- a/dom/tests/mochitest/Makefile.in +++ b/dom/tests/mochitest/Makefile.in @@ -54,6 +54,7 @@ DIRS += \ whatwg \ geolocation \ localstorage \ + globalstorage \ sessionstorage \ storageevent \ $(NULL) diff --git a/dom/tests/mochitest/Makefile.in b/dom/tests/mochitest/globalstorage/Makefile.in similarity index 82% copy from dom/tests/mochitest/Makefile.in copy to dom/tests/mochitest/globalstorage/Makefile.in index d13e7c90ce..06492a9e15 100644 --- a/dom/tests/mochitest/Makefile.in +++ b/dom/tests/mochitest/globalstorage/Makefile.in @@ -15,11 +15,12 @@ # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is -# Mozilla Foundation. -# Portions created by the Initial Developer are Copyright (C) 2007 +# Mozilla Corporation. +# Portions created by the Initial Developer are Copyright (C) 2008 # the Initial Developer. All Rights Reserved. # # Contributor(s): +# Jan Bambas # # Alternatively, the contents of this file may be used under the terms of # either of the GNU General Public License Version 2 or later (the "GPL"), @@ -35,33 +36,19 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../../.. +DEPTH = ../../../.. topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ +relativesrcdir = dom/tests/mochitest/globalstorage include $(DEPTH)/config/autoconf.mk -DIRS += \ - dom-level0 \ - dom-level1-core \ - dom-level2-core \ - dom-level2-html \ - ajax \ - bugs \ - chrome \ - general \ - whatwg \ - geolocation \ - localstorage \ - sessionstorage \ - storageevent \ - $(NULL) - -#needs IPC support -ifneq (mobile,$(MOZ_BUILD_APP)) -DIRS += notification -endif - include $(topsrcdir)/config/rules.mk +_TEST_FILES = \ + test_globalStorageDeleteSinceAPI.html \ + $(NULL) + +libs:: $(_TEST_FILES) + $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir) diff --git a/dom/tests/mochitest/globalstorage/test_globalStorageDeleteSinceAPI.html b/dom/tests/mochitest/globalstorage/test_globalStorageDeleteSinceAPI.html new file mode 100644 index 0000000000..9c22bf4c58 --- /dev/null +++ b/dom/tests/mochitest/globalstorage/test_globalStorageDeleteSinceAPI.html @@ -0,0 +1,73 @@ + + +globalStorage delete since API test + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/localstorage/Makefile.in b/dom/tests/mochitest/localstorage/Makefile.in index d6f8499345..1572d88eea 100644 --- a/dom/tests/mochitest/localstorage/Makefile.in +++ b/dom/tests/mochitest/localstorage/Makefile.in @@ -68,6 +68,8 @@ _TEST_FILES = \ test_localStorageBase.html \ test_localStorageBasePrivateBrowsing.html \ test_localStorageBaseSessionOnly.html \ + test_localStorageDeleteSinceAPI.html \ + test_localStorageDeleteSinceAPIPrivateBrowsing.html \ test_localStorageCookieSettings.html \ test_localStorageEnablePref.html \ test_localStorageOriginsEquals.html \ diff --git a/dom/tests/mochitest/localstorage/test_localStorageDeleteSinceAPI.html b/dom/tests/mochitest/localstorage/test_localStorageDeleteSinceAPI.html new file mode 100644 index 0000000000..e40bb9d91e --- /dev/null +++ b/dom/tests/mochitest/localstorage/test_localStorageDeleteSinceAPI.html @@ -0,0 +1,70 @@ + + +localStorage delete since API test + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/localstorage/test_localStorageDeleteSinceAPIPrivateBrowsing.html b/dom/tests/mochitest/localstorage/test_localStorageDeleteSinceAPIPrivateBrowsing.html new file mode 100644 index 0000000000..f470c3de73 --- /dev/null +++ b/dom/tests/mochitest/localstorage/test_localStorageDeleteSinceAPIPrivateBrowsing.html @@ -0,0 +1,85 @@ + + +localStorage delete since API test in Private Browsing + + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/sessionstorage/Makefile.in b/dom/tests/mochitest/sessionstorage/Makefile.in index 3036cbb703..8c40ca95a1 100644 --- a/dom/tests/mochitest/sessionstorage/Makefile.in +++ b/dom/tests/mochitest/sessionstorage/Makefile.in @@ -53,6 +53,7 @@ _TEST_FILES = \ file_https.html \ test_sessionStorageBase.html \ test_sessionStorageClone.html \ + test_sessionStorageDeleteSinceAPI.html \ test_sessionStorageReplace.html \ test_sessionStorageHttpHttps.html \ interOriginSlave.js \ diff --git a/dom/tests/mochitest/sessionstorage/test_sessionStorageDeleteSinceAPI.html b/dom/tests/mochitest/sessionstorage/test_sessionStorageDeleteSinceAPI.html new file mode 100644 index 0000000000..ce47c62b39 --- /dev/null +++ b/dom/tests/mochitest/sessionstorage/test_sessionStorageDeleteSinceAPI.html @@ -0,0 +1,67 @@ + + +sessionStorage delete since API test + + + + + + + + + + + + + -- 2.11.4.GIT