Bug 687579 part 1: Remove globalStorage implementation. r=jst

Bug 687579 part 1: Remove globalStorage implementation. r=jst
This commit is contained in:
Matheus Kerschbaum 2011-10-09 22:14:00 -04:00
parent 44e1aab59c
commit 89b7db65ac
14 changed files with 5 additions and 125 deletions

View File

@ -73,6 +73,5 @@ DEPRECATED_OPERATION(TextContent)
DEPRECATED_OPERATION(EnablePrivilege)
DEPRECATED_OPERATION(Position)
DEPRECATED_OPERATION(TotalSize)
DEPRECATED_OPERATION(GlobalStorage)
DEPRECATED_OPERATION(InputEncoding)
DEPRECATED_OPERATION(MozBeforePaint)

View File

@ -269,7 +269,6 @@ using namespace mozilla::dom;
using mozilla::TimeStamp;
using mozilla::TimeDuration;
nsIDOMStorageList *nsGlobalWindow::sGlobalStorageList = nsnull;
nsGlobalWindow::WindowByIdTable *nsGlobalWindow::sWindowsById = nsnull;
bool nsGlobalWindow::sWarnedAboutWindowInternal = false;
@ -1087,8 +1086,6 @@ nsGlobalWindow::~nsGlobalWindow()
void
nsGlobalWindow::ShutDown()
{
NS_IF_RELEASE(sGlobalStorageList);
if (gDumpFile && gDumpFile != stdout) {
fclose(gDumpFile);
}
@ -8195,32 +8192,6 @@ nsGlobalWindow::GetSessionStorage(nsIDOMStorage ** aSessionStorage)
return NS_OK;
}
NS_IMETHODIMP
nsGlobalWindow::GetGlobalStorage(nsIDOMStorageList ** aGlobalStorage)
{
NS_ENSURE_ARG_POINTER(aGlobalStorage);
nsCOMPtr<nsIDocument> document = do_QueryInterface(GetExtantDocument());
if (document) {
document->WarnOnceAbout(nsIDocument::eGlobalStorage);
}
if (!Preferences::GetBool(kStorageEnabled)) {
*aGlobalStorage = nsnull;
return NS_OK;
}
if (!sGlobalStorageList) {
nsresult rv = NS_NewDOMStorageList(&sGlobalStorageList);
NS_ENSURE_SUCCESS(rv, rv);
}
*aGlobalStorage = sGlobalStorageList;
NS_IF_ADDREF(*aGlobalStorage);
return NS_OK;
}
NS_IMETHODIMP
nsGlobalWindow::GetLocalStorage(nsIDOMStorage ** aLocalStorage)
{

View File

@ -1001,7 +1001,6 @@ protected:
friend class nsDOMScriptableHelper;
friend class nsDOMWindowUtils;
friend class PostMessageEvent;
static nsIDOMStorageList* sGlobalStorageList;
static WindowByIdTable* sWindowsById;
static bool sWarnedAboutWindowInternal;

View File

@ -438,11 +438,6 @@ interface nsIDOMWindow : nsISupports
*/
readonly attribute nsIDOMMozURLProperty URL;
/**
* Global storage, accessible by domain.
*/
readonly attribute nsIDOMStorageList globalStorage;
/**
* HTML5 event attributes that only apply to windows and <body>/<frameset>
*/

View File

@ -59,14 +59,12 @@ public:
typedef enum {
Unknown = 0,
GlobalStorage = 1,
LocalStorage = 2,
SessionStorage = 3
LocalStorage = 1,
SessionStorage = 2
} nsDOMStorageType;
virtual nsresult InitAsSessionStorage(nsIPrincipal *aPrincipal, const nsSubstring &aDocumentURI) = 0;
virtual nsresult InitAsLocalStorage(nsIPrincipal *aPrincipal, const nsSubstring &aDocumentURI) = 0;
virtual nsresult InitAsGlobalStorage(const nsACString &aDomainDemanded) = 0;
virtual already_AddRefed<nsIDOMStorage> Clone() = 0;
virtual already_AddRefed<nsIDOMStorage> Fork(const nsSubstring &aDocumentURI) = 0;

View File

@ -114,7 +114,6 @@ nsIJSONDecodeDeprecatedWarning=nsIJSON.decode is deprecated. Please use JSON.pa
nsIJSONEncodeDeprecatedWarning=nsIJSON.encode is deprecated. Please use JSON.stringify instead.
nsIDOMWindowInternalWarning=Use of nsIDOMWindowInternal is deprecated. Use nsIDOMWindow instead.
InputEncodingWarning=Use of inputEncoding is deprecated.
GlobalStorageWarning=Use of globalStorage is deprecated. Please use localStorage instead.
# LOCALIZATION NOTE: Do not translate "MozBeforePaint" and "mozRequestAnimationFrame"
MozBeforePaintWarning=MozBeforePaint events are no longer supported. mozRequestAnimationFrame must be passed a non-null callback argument.
FullScreenDeniedDisabled=Request for full-screen was denied because full-screen API is disabled by user preference.

View File

@ -130,13 +130,6 @@ StorageChild::InitAsLocalStorage(nsIURI* aDomainURI, bool aCanUseChromePersist)
InitRemote();
}
void
StorageChild::InitAsGlobalStorage(const nsACString& aDomainDemanded)
{
DOMStorageBase::InitAsGlobalStorage(aDomainDemanded);
InitRemote();
}
nsTArray<nsString>*
StorageChild::GetKeys(bool aCallerSecure)
{

View File

@ -59,7 +59,6 @@ public:
virtual void InitAsSessionStorage(nsIURI* aDomainURI);
virtual void InitAsLocalStorage(nsIURI* aDomainURI, bool aCanUseChromePersist);
virtual void InitAsGlobalStorage(const nsACString& aDomainDemanded);
virtual bool CacheStoragePermissions();

View File

@ -699,27 +699,6 @@ DOMStorageBase::InitAsLocalStorage(nsIURI* aDomainURI,
mStorageType = nsPIDOMStorage::LocalStorage;
}
void
DOMStorageBase::InitAsGlobalStorage(const nsACString& aDomainDemanded)
{
mDomain = aDomainDemanded;
nsDOMStorageDBWrapper::CreateDomainScopeDBKey(aDomainDemanded, mScopeDBKey);
// 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.
if (!(mUseDB = !mScopeDBKey.IsEmpty()))
mScopeDBKey.AppendLiteral(":");
nsDOMStorageDBWrapper::CreateQuotaDomainDBKey(aDomainDemanded,
true, false, mQuotaDomainDBKey);
nsDOMStorageDBWrapper::CreateQuotaDomainDBKey(aDomainDemanded,
true, true, mQuotaETLDplus1DomainDBKey);
mStorageType = nsPIDOMStorage::GlobalStorage;
}
PLDHashOperator
SessionStorageTraverser(nsSessionStorageEntry* aEntry, void* userArg) {
nsCycleCollectionTraversalCallback *cb =
@ -834,12 +813,6 @@ DOMStorageImpl::InitAsLocalStorage(nsIURI* aDomainURI,
DOMStorageBase::InitAsLocalStorage(aDomainURI, aCanUseChromePersist);
}
void
DOMStorageImpl::InitAsGlobalStorage(const nsACString& aDomainDemanded)
{
DOMStorageBase::InitAsGlobalStorage(aDomainDemanded);
}
bool
DOMStorageImpl::CacheStoragePermissions()
{
@ -890,8 +863,7 @@ DOMStorageImpl::GetDBValue(const nsAString& aKey, nsAString& aValue,
nsAutoString value;
rv = gStorageDB->GetKeyValue(this, aKey, value, aSecure);
if (rv == NS_ERROR_DOM_NOT_FOUND_ERR &&
mStorageType != nsPIDOMStorage::GlobalStorage) {
if (rv == NS_ERROR_DOM_NOT_FOUND_ERR) {
SetDOMStringToNull(aValue);
}
@ -1437,15 +1409,6 @@ nsDOMStorage::InitAsLocalStorage(nsIPrincipal *aPrincipal, const nsSubstring &aD
return NS_OK;
}
nsresult
nsDOMStorage::InitAsGlobalStorage(const nsACString &aDomainDemanded)
{
mStorageType = GlobalStorage;
mEventBroadcaster = this;
mStorageImpl->InitAsGlobalStorage(aDomainDemanded);
return NS_OK;
}
//static
bool
nsDOMStorage::CanUseStorage(bool* aSessionOnly)
@ -1612,8 +1575,6 @@ TelemetryIDForKey(nsPIDOMStorage::nsDOMStorageType type)
MOZ_ASSERT(false);
// We need to return something to satisfy the compiler.
// Fallthrough.
case nsPIDOMStorage::GlobalStorage:
return Telemetry::GLOBALDOMSTORAGE_KEY_SIZE_BYTES;
case nsPIDOMStorage::LocalStorage:
return Telemetry::LOCALDOMSTORAGE_KEY_SIZE_BYTES;
case nsPIDOMStorage::SessionStorage:
@ -1629,8 +1590,6 @@ TelemetryIDForValue(nsPIDOMStorage::nsDOMStorageType type)
MOZ_ASSERT(false);
// We need to return something to satisfy the compiler.
// Fallthrough.
case nsPIDOMStorage::GlobalStorage:
return Telemetry::GLOBALDOMSTORAGE_VALUE_SIZE_BYTES;
case nsPIDOMStorage::LocalStorage:
return Telemetry::LOCALDOMSTORAGE_VALUE_SIZE_BYTES;
case nsPIDOMStorage::SessionStorage:
@ -1662,7 +1621,7 @@ nsDOMStorage::SetItem(const nsAString& aKey, const nsAString& aData)
if (NS_FAILED(rv))
return rv;
if ((oldValue != aData || mStorageType == GlobalStorage) && mEventBroadcaster)
if (oldValue != aData && mEventBroadcaster)
mEventBroadcaster->BroadcastChangeNotification(aKey, oldValue, aData);
return NS_OK;
@ -1683,7 +1642,7 @@ NS_IMETHODIMP nsDOMStorage::RemoveItem(const nsAString& aKey)
if (NS_FAILED(rv))
return rv;
if ((!oldValue.IsEmpty() && mStorageType != GlobalStorage) && mEventBroadcaster) {
if (!oldValue.IsEmpty() && mEventBroadcaster) {
nsAutoString nullString;
SetDOMStringToNull(nullString);
mEventBroadcaster->BroadcastChangeNotification(aKey, oldValue, nullString);
@ -1869,13 +1828,6 @@ nsDOMStorage2::InitAsLocalStorage(nsIPrincipal *aPrincipal, const nsSubstring &a
return mStorage->InitAsLocalStorage(aPrincipal, aDocumentURI);
}
nsresult
nsDOMStorage2::InitAsGlobalStorage(const nsACString &aDomainDemanded)
{
NS_ASSERTION(false, "Should not initialize nsDOMStorage2 as global storage.");
return NS_ERROR_NOT_IMPLEMENTED;
}
already_AddRefed<nsIDOMStorage>
nsDOMStorage2::Clone()
{
@ -2172,11 +2124,6 @@ nsDOMStorageList::GetStorageForDomain(const nsACString& aRequestedDomain,
nsRefPtr<nsDOMStorage> newstorage;
newstorage = new nsDOMStorage();
if (newstorage && mStorages.Put(usedDomain, newstorage)) {
*aResult = newstorage->InitAsGlobalStorage(usedDomain);
if (NS_FAILED(*aResult)) {
mStorages.Remove(usedDomain);
return nsnull;
}
storage = newstorage;
}
else {

View File

@ -152,7 +152,6 @@ public:
virtual void InitAsSessionStorage(nsIURI* aDomainURI);
virtual void InitAsLocalStorage(nsIURI* aDomainURI, bool aCanUseChromePersist);
virtual void InitAsGlobalStorage(const nsACString& aDomainDemanded);
virtual nsTArray<nsString>* GetKeys(bool aCallerSecure) = 0;
virtual nsresult GetLength(bool aCallerSecure, PRUint32* aLength) = 0;
@ -251,7 +250,6 @@ public:
virtual void InitAsSessionStorage(nsIURI* aDomainURI);
virtual void InitAsLocalStorage(nsIURI* aDomainURI, bool aCanUseChromePersist);
virtual void InitAsGlobalStorage(const nsACString& aDomainDemanded);
bool SessionOnly() {
return mSessionOnly;
@ -362,7 +360,6 @@ public:
// nsPIDOMStorage
virtual nsresult InitAsSessionStorage(nsIPrincipal *aPrincipal, const nsSubstring &aDocumentURI);
virtual nsresult InitAsLocalStorage(nsIPrincipal *aPrincipal, const nsSubstring &aDocumentURI);
virtual nsresult InitAsGlobalStorage(const nsACString &aDomainDemanded);
virtual already_AddRefed<nsIDOMStorage> Clone();
virtual already_AddRefed<nsIDOMStorage> Fork(const nsSubstring &aDocumentURI);
virtual bool IsForkOf(nsIDOMStorage* aThat);
@ -442,7 +439,6 @@ public:
// nsPIDOMStorage
virtual nsresult InitAsSessionStorage(nsIPrincipal *aPrincipal, const nsSubstring &aDocumentURI);
virtual nsresult InitAsLocalStorage(nsIPrincipal *aPrincipal, const nsSubstring &aDocumentURI);
virtual nsresult InitAsGlobalStorage(const nsACString &aDomainDemanded);
virtual already_AddRefed<nsIDOMStorage> Clone();
virtual already_AddRefed<nsIDOMStorage> Fork(const nsSubstring &aDocumentURI);
virtual bool IsForkOf(nsIDOMStorage* aThat);

View File

@ -53,7 +53,6 @@ DIRS += \
general \
whatwg \
geolocation \
globalstorage \
localstorage \
orientation \
sessionstorage \

View File

@ -78,13 +78,6 @@ _TEST_FILES = \
test_bug397571.html \
test_bug400204.html \
test_bug404748.html \
test_bug407839.html \
iframe_bug407839-1.html \
iframe_bug407839-2.html \
test_bug424093.html \
iframe_bug424093.html \
test_bug409349.html \
iframe_bug409349.html \
test_bug411103.html \
test_bug414291.html \
test_bug430276.html \
@ -96,8 +89,6 @@ _TEST_FILES = \
test_bug458091.html \
bug458091_child.html \
test_bug459848.html \
test_bug463000.html \
iframe_bug463000.html \
test_bug465263.html \
test_bug479143.html \
test_bug484775.html \

View File

@ -47,9 +47,6 @@ include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TEST_FILES = \
frameGlobalStorageMaster.html \
frameGlobalStorageSlaveEqual.html \
frameGlobalStorageSlaveNotEqual.html \
frameLocalStorageMaster.html \
frameLocalStorageSlaveEqual.html \
frameLocalStorageSlaveNotEqual.html \
@ -57,8 +54,6 @@ _TEST_FILES = \
frameSessionStorageMasterNotEqual.html \
frameSessionStorageSlaveEqual.html \
frameSessionStorageSlaveNotEqual.html \
test_storageGlobalStorageEventCheckNoPropagation.html \
test_storageGlobalStorageEventCheckPropagation.html \
test_storageLocalStorageEventCheckNoPropagation.html \
test_storageLocalStorageEventCheckPropagation.html \
test_storageSessionStorageEventCheckPropagation.html \

View File

@ -75,7 +75,6 @@ members = [
'nsIDOMWindow.getComputedStyle',
'nsIDOMWindow.sessionStorage',
'nsIDOMWindow.localStorage',
'nsIDOMWindow.globalStorage',
'nsIDOMWindow.onmouseenter',
'nsIDOMWindow.onmouseleave',
'nsIDOMJSWindow.dump',