Bug 492219 - localStorage's constructor should be Storage, r+sr=jst
authorHonza Bambas <honzab.moz@firemni.cz>
Sat, 16 May 2009 15:59:30 +0200
changeset 28438 8208b02cba3c4ba6936695db529c97cde0d8b46d
parent 28437 0a205bf8e74751749326e778fa43f26ab8ba5b79
child 28440 7c8a301b990ee5cb3f7006c55563943d0c4df6f5
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs492219
milestone1.9.2a1pre
Bug 492219 - localStorage's constructor should be Storage, r+sr=jst
docshell/base/nsDocShell.cpp
docshell/base/nsDocShell.h
docshell/base/nsIDocShell.idl
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoID.h
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindow.h
dom/interfaces/storage/Makefile.in
dom/interfaces/storage/nsIDOMStorage.idl
dom/interfaces/storage/nsIDOMStorage2.idl
dom/interfaces/storage/nsIDOMStorageList.idl
dom/interfaces/storage/nsIDOMStorageManager.idl
dom/interfaces/storage/nsIDOMStorageObsolete.idl
dom/interfaces/storage/nsIDOMStorageWindow.idl
dom/interfaces/storage/nsPIDOMStorage.h
dom/src/storage/nsDOMStorage.cpp
dom/src/storage/nsDOMStorage.h
dom/tests/mochitest/chrome/domstorage_global.js
dom/tests/mochitest/localstorage/Makefile.in
dom/tests/mochitest/localstorage/test_storageConstructor.html
embedding/components/windowwatcher/src/nsWindowWatcher.cpp
js/src/xpconnect/src/dom_quickstubs.qsconf
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -48,17 +48,17 @@
 
 #include "nsIBrowserDOMWindow.h"
 #include "nsIComponentManager.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMNSDocument.h"
 #include "nsIDOMElement.h"
-#include "nsIDOMStorage.h"
+#include "nsIDOMStorageObsolete.h"
 #include "nsPIDOMStorage.h"
 #include "nsIDocumentViewer.h"
 #include "nsIDocumentLoaderFactory.h"
 #include "nsCURILoader.h"
 #include "nsURILoader.h"
 #include "nsDocShellCID.h"
 #include "nsLayoutCID.h"
 #include "nsDOMCID.h"
@@ -2122,17 +2122,17 @@ nsDocShell::HistoryPurged(PRInt32 aNumEn
     }
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShell::GetSessionStorageForPrincipal(nsIPrincipal* aPrincipal,
                                           PRBool aCreate,
-                                          nsIDOMStorage** aStorage)
+                                          nsIDOMStorageObsolete** aStorage)
 {
     NS_ENSURE_ARG_POINTER(aStorage);
     *aStorage = nsnull;
 
     if (!aPrincipal)
         return NS_OK;
 
     nsCOMPtr<nsIURI> codebaseURI;
@@ -2161,25 +2161,25 @@ nsDocShell::GetSessionStorageForPrincipa
         }
     }
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShell::GetSessionStorageForURI(nsIURI* aURI,
-                                    nsIDOMStorage** aStorage)
+                                    nsIDOMStorageObsolete** aStorage)
 {
     return GetSessionStorageForURI(aURI, PR_TRUE, aStorage);
 }
 
 nsresult
 nsDocShell::GetSessionStorageForURI(nsIURI* aURI,
                                     PRBool aCreate,
-                                    nsIDOMStorage** aStorage)
+                                    nsIDOMStorageObsolete** aStorage)
 {
     NS_ENSURE_ARG(aURI);
     NS_ENSURE_ARG_POINTER(aStorage);
 
     *aStorage = nsnull;
 
     nsCOMPtr<nsIURI> innerURI = NS_GetInnermostURI(aURI);
     NS_ASSERTION(innerURI, "Failed to get innermost URI");
@@ -2201,17 +2201,17 @@ nsDocShell::GetSessionStorageForURI(nsIU
     nsCAutoString currentDomain;
     rv = innerURI->GetAsciiHost(currentDomain);
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (currentDomain.IsEmpty())
         return NS_OK;
 
     if (!mStorages.Get(currentDomain, aStorage) && aCreate) {
-        nsCOMPtr<nsIDOMStorage> newstorage =
+        nsCOMPtr<nsIDOMStorageObsolete> newstorage =
             do_CreateInstance("@mozilla.org/dom/storage;1");
         if (!newstorage)
             return NS_ERROR_OUT_OF_MEMORY;
 
         nsCOMPtr<nsPIDOMStorage> pistorage = do_QueryInterface(newstorage);
         if (!pistorage)
             return NS_ERROR_FAILURE;
         pistorage->InitAsSessionStorage(aURI);
@@ -2222,17 +2222,17 @@ nsDocShell::GetSessionStorageForURI(nsIU
         newstorage.swap(*aStorage);
     }
 
     return NS_OK;
 }
 
 nsresult
 nsDocShell::AddSessionStorage(const nsACString& aDomain,
-                              nsIDOMStorage* aStorage)
+                              nsIDOMStorageObsolete* aStorage)
 {
     NS_ENSURE_ARG_POINTER(aStorage);
 
     if (aDomain.IsEmpty())
         return NS_OK;
 
     nsCOMPtr<nsIDocShellTreeItem> topItem;
     nsresult rv = GetSameTypeRootTreeItem(getter_AddRefs(topItem));
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -601,17 +601,17 @@ protected:
     // InternalLoad).  This makes sure that we're not inside unload, or that if
     // we are it's still OK to load this URI.
     PRBool IsOKToLoadURI(nsIURI* aURI);
     
     void ReattachEditorToWindow(nsISHEntry *aSHEntry);
 
     nsresult GetSessionStorageForURI(nsIURI* aURI,
                                      PRBool create,
-                                     nsIDOMStorage** aStorage);
+                                     nsIDOMStorageObsolete** aStorage);
 
     // helpers for executing commands
     nsresult GetControllerForCommand(const char *inCommand,
                                      nsIController** outController);
     nsresult IsCommandEnabled(const char * inCommand, PRBool* outEnabled);
     nsresult DoCommand(const char * inCommand);
     nsresult EnsureCommandHandler();
     
@@ -721,17 +721,17 @@ protected:
     nsCOMPtr<nsISHEntry>       mLSHE;
 
     // Holds a weak pointer to a RestorePresentationEvent object if any that
     // holds a weak pointer back to us.  We use this pointer to possibly revoke
     // the event whenever necessary.
     nsRevocableEventPtr<RestorePresentationEvent> mRestorePresentationEvent;
 
     // hash of session storages, keyed by domain
-    nsInterfaceHashtable<nsCStringHashKey, nsIDOMStorage> mStorages;
+    nsInterfaceHashtable<nsCStringHashKey, nsIDOMStorageObsolete> mStorages;
 
     // Index into the SHTransaction list, indicating the previous and current
     // transaction at the time that this DocShell begins to load
     PRInt32                    mPreviousTransIndex;
     PRInt32                    mLoadedTransIndex;
 
     // Editor data, if this document is designMode or contentEditable.
     nsAutoPtr<nsDocShellEditorData> mEditorData;
--- a/docshell/base/nsIDocShell.idl
+++ b/docshell/base/nsIDocShell.idl
@@ -61,17 +61,17 @@ interface nsIDocShellLoadInfo;
 interface nsIDocumentCharsetInfo;
 interface nsIWebNavigation;
 interface nsISimpleEnumerator;
 interface nsIInputStream;
 interface nsIRequest;
 interface nsISHEntry;
 interface nsILayoutHistoryState;
 interface nsISecureBrowserUI;
-interface nsIDOMStorage;
+interface nsIDOMStorageObsolete;
 interface nsIPrincipal;
 
 [scriptable, uuid(dc4daea1-b43d-406f-bd62-c2ee879192ad)]
 interface nsIDocShell : nsISupports
 {
   /**
    * Loads a given URI.  This will give priority to loading the requested URI
    * in the object implementing	this interface.  If it can't be loaded here
@@ -427,25 +427,25 @@ interface nsIDocShell : nsISupports
   void historyPurged(in long numEntries);
 
   /*
    * Retrieves the WebApps session storage object for the supplied domain.
    * If it doesn't already exist, a new one will be created.
    *
    * @param uri the uri of the storage object to retrieve
    */
-  nsIDOMStorage getSessionStorageForURI(in nsIURI uri);
+  nsIDOMStorageObsolete getSessionStorageForURI(in nsIURI uri);
 
   /*
    * Add a WebApps session storage object to the docshell.
    *
    * @param domain the domain the storage object is associated with
    * @param storage the storage object to add
    */
-  void addSessionStorage(in ACString aDomain, in nsIDOMStorage storage);
+  void addSessionStorage(in ACString aDomain, in nsIDOMStorageObsolete storage);
 
   /**
    * Gets the channel for the currently loaded document, if any. 
    * For a new document load, this will be the channel of the previous document
    * until after OnLocationChange fires.
    */
   readonly attribute nsIChannel currentDocumentChannel;
 
@@ -488,11 +488,11 @@ interface nsIDocShell_MOZILLA_1_9_1 : ns
 {
   /*
    * Retrieves the WebApps session storage object for the supplied principal.
    *
    * @param principal returns a storage for this principal
    * @param create If true and a session storage object doesn't
    *               already exist, a new one will be created.
    */
-  nsIDOMStorage getSessionStorageForPrincipal(in nsIPrincipal principal,
-                                              in boolean create);
+  nsIDOMStorageObsolete getSessionStorageForPrincipal(in nsIPrincipal principal,
+                                                      in boolean create);
 };
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -1177,26 +1177,26 @@ static nsDOMClassInfoData sClassInfoData
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   // WhatWG Storage
 
   // mrbkap says we don't need WANT_ADDPROPERTY on Storage objects
   // since a call to addProperty() is always followed by a call to
   // setProperty(), except in the case when a getter or setter is set
   // for a property. But we don't care about getters or setters here.
-  NS_DEFINE_CLASSINFO_DATA(Storage, nsStorageSH,
+  NS_DEFINE_CLASSINFO_DATA(StorageObsolete, nsStorageSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS |
                            nsIXPCScriptable::WANT_NEWRESOLVE |
                            nsIXPCScriptable::WANT_GETPROPERTY |
                            nsIXPCScriptable::WANT_SETPROPERTY |
                            nsIXPCScriptable::WANT_DELPROPERTY |
                            nsIXPCScriptable::DONT_ENUM_STATIC_PROPS |
                            nsIXPCScriptable::WANT_NEWENUMERATE)
 
-  NS_DEFINE_CLASSINFO_DATA(Storage2, nsStorage2SH,
+  NS_DEFINE_CLASSINFO_DATA(Storage, nsStorage2SH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS |
                            nsIXPCScriptable::WANT_NEWRESOLVE |
                            nsIXPCScriptable::WANT_GETPROPERTY |
                            nsIXPCScriptable::WANT_SETPROPERTY |
                            nsIXPCScriptable::WANT_DELPROPERTY |
                            nsIXPCScriptable::DONT_ENUM_STATIC_PROPS |
                            nsIXPCScriptable::WANT_NEWENUMERATE)
   NS_DEFINE_CLASSINFO_DATA(StorageList, nsStorageListSH,
@@ -3391,24 +3391,24 @@ nsDOMClassInfo::Init()
   DOM_CLASSINFO_MAP_BEGIN(XPathNSResolver, nsIDOMXPathNSResolver)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMXPathNSResolver)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(XPathResult, nsIDOMXPathResult)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMXPathResult)
   DOM_CLASSINFO_MAP_END
 
+  DOM_CLASSINFO_MAP_BEGIN(StorageObsolete, nsIDOMStorageObsolete)
+    DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageObsolete)
+  DOM_CLASSINFO_MAP_END
+
   DOM_CLASSINFO_MAP_BEGIN(Storage, nsIDOMStorage)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorage)
   DOM_CLASSINFO_MAP_END
 
-  DOM_CLASSINFO_MAP_BEGIN(Storage2, nsIDOMStorage2)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorage2)
-  DOM_CLASSINFO_MAP_END
-
   DOM_CLASSINFO_MAP_BEGIN(StorageList, nsIDOMStorageList)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageList)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(StorageItem, nsIDOMStorageItem)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageItem)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMToString)
   DOM_CLASSINFO_MAP_END
@@ -10244,17 +10244,17 @@ nsStorageSH::NewResolve(nsIXPConnectWrap
     // nothing left to do here then.
 
     return NS_OK;
   }
 
   // We're resolving property that doesn't exist on the prototype,
   // check if the key exists in the storage object.
 
-  nsCOMPtr<nsIDOMStorage> storage(do_QueryWrappedNative(wrapper));
+  nsCOMPtr<nsIDOMStorageObsolete> storage(do_QueryWrappedNative(wrapper));
 
   // GetItem() will return null if the caller can't access the session
   // storage item.
   nsCOMPtr<nsIDOMStorageItem> item;
   nsresult rv = storage->GetItem(nsDependentJSString(jsstr),
                                  getter_AddRefs(item));
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -10280,17 +10280,17 @@ nsStorageSH::GetNamedItem(nsISupports *a
   return storage->GetNamedItem(aName, aResult);
 }
 
 NS_IMETHODIMP
 nsStorageSH::SetProperty(nsIXPConnectWrappedNative *wrapper,
                          JSContext *cx, JSObject *obj, jsval id,
                          jsval *vp, PRBool *_retval)
 {
-  nsCOMPtr<nsIDOMStorage> storage(do_QueryWrappedNative(wrapper));
+  nsCOMPtr<nsIDOMStorageObsolete> storage(do_QueryWrappedNative(wrapper));
   NS_ENSURE_TRUE(storage, NS_ERROR_UNEXPECTED);
 
   JSString *key = ::JS_ValueToString(cx, id);
   NS_ENSURE_TRUE(key, NS_ERROR_UNEXPECTED);
 
   JSString *value = ::JS_ValueToString(cx, *vp);
   NS_ENSURE_TRUE(value, NS_ERROR_UNEXPECTED);
 
@@ -10303,17 +10303,17 @@ nsStorageSH::SetProperty(nsIXPConnectWra
   return rv;
 }
 
 NS_IMETHODIMP
 nsStorageSH::DelProperty(nsIXPConnectWrappedNative *wrapper,
                          JSContext *cx, JSObject *obj, jsval id,
                          jsval *vp, PRBool *_retval)
 {
-  nsCOMPtr<nsIDOMStorage> storage(do_QueryWrappedNative(wrapper));
+  nsCOMPtr<nsIDOMStorageObsolete> storage(do_QueryWrappedNative(wrapper));
   NS_ENSURE_TRUE(storage, NS_ERROR_UNEXPECTED);
 
   JSString *key = ::JS_ValueToString(cx, id);
   NS_ENSURE_TRUE(key, NS_ERROR_UNEXPECTED);
 
   nsresult rv = storage->RemoveItem(nsDependentJSString(key));
   if (NS_SUCCEEDED(rv)) {
     rv = NS_SUCCESS_I_DID_SOMETHING;
@@ -10414,17 +10414,17 @@ nsStorage2SH::NewResolve(nsIXPConnectWra
     // nothing left to do here then.
 
     return NS_OK;
   }
 
   // We're resolving property that doesn't exist on the prototype,
   // check if the key exists in the storage object.
 
-  nsCOMPtr<nsIDOMStorage2> storage(do_QueryWrappedNative(wrapper));
+  nsCOMPtr<nsIDOMStorage> storage(do_QueryWrappedNative(wrapper));
 
   // GetItem() will return null if the caller can't access the session
   // storage item.
   nsAutoString data;
   nsresult rv = storage->GetItem(nsDependentJSString(jsstr), data);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!DOMStringIsNull(data)) {
@@ -10439,17 +10439,17 @@ nsStorage2SH::NewResolve(nsIXPConnectWra
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsStorage2SH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
                           JSObject *obj, jsval id, jsval *vp, PRBool *_retval)
 {
-  nsCOMPtr<nsIDOMStorage2> storage(do_QueryWrappedNative(wrapper));
+  nsCOMPtr<nsIDOMStorage> storage(do_QueryWrappedNative(wrapper));
   NS_ENSURE_TRUE(storage, NS_ERROR_UNEXPECTED);
 
   nsAutoString val;
   nsresult rv = NS_OK;
 
   if (JSVAL_IS_STRING(id)) {
     // For native wrappers, do not get random names on storage objects.
     if (ObjectIsNativeWrapper(cx, obj)) {
@@ -10483,17 +10483,17 @@ nsStorage2SH::GetProperty(nsIXPConnectWr
   return NS_SUCCESS_I_DID_SOMETHING;
 }
 
 NS_IMETHODIMP
 nsStorage2SH::SetProperty(nsIXPConnectWrappedNative *wrapper,
                           JSContext *cx, JSObject *obj, jsval id,
                           jsval *vp, PRBool *_retval)
 {
-  nsCOMPtr<nsIDOMStorage2> storage(do_QueryWrappedNative(wrapper));
+  nsCOMPtr<nsIDOMStorage> storage(do_QueryWrappedNative(wrapper));
   NS_ENSURE_TRUE(storage, NS_ERROR_UNEXPECTED);
 
   JSString *key = ::JS_ValueToString(cx, id);
   NS_ENSURE_TRUE(key, NS_ERROR_UNEXPECTED);
 
   JSString *value = ::JS_ValueToString(cx, *vp);
   NS_ENSURE_TRUE(value, NS_ERROR_UNEXPECTED);
 
@@ -10506,17 +10506,17 @@ nsStorage2SH::SetProperty(nsIXPConnectWr
   return rv;
 }
 
 NS_IMETHODIMP
 nsStorage2SH::DelProperty(nsIXPConnectWrappedNative *wrapper,
                           JSContext *cx, JSObject *obj, jsval id,
                           jsval *vp, PRBool *_retval)
 {
-  nsCOMPtr<nsIDOMStorage2> storage(do_QueryWrappedNative(wrapper));
+  nsCOMPtr<nsIDOMStorage> storage(do_QueryWrappedNative(wrapper));
   NS_ENSURE_TRUE(storage, NS_ERROR_UNEXPECTED);
 
   JSString *key = ::JS_ValueToString(cx, id);
   NS_ENSURE_TRUE(key, NS_ERROR_UNEXPECTED);
 
   nsresult rv = storage->RemoveItem(nsDependentJSString(key));
   if (NS_SUCCEEDED(rv)) {
     rv = NS_SUCCESS_I_DID_SOMETHING;
--- a/dom/base/nsDOMClassInfoID.h
+++ b/dom/base/nsDOMClassInfoID.h
@@ -377,18 +377,18 @@ enum nsDOMClassInfoID {
   // DOM Level 3 XPath objects
   eDOMClassInfo_XPathEvaluator_id,
   eDOMClassInfo_XPathException_id,
   eDOMClassInfo_XPathExpression_id,
   eDOMClassInfo_XPathNSResolver_id,
   eDOMClassInfo_XPathResult_id,
 
   // WhatWG WebApps Objects
+  eDOMClassInfo_StorageObsolete_id,
   eDOMClassInfo_Storage_id,
-  eDOMClassInfo_Storage2_id,
   eDOMClassInfo_StorageList_id,
   eDOMClassInfo_StorageItem_id,
   eDOMClassInfo_StorageEvent_id,
 
   eDOMClassInfo_WindowRoot_id,
 
   // DOMParser, XMLSerializer
   eDOMClassInfo_DOMParser_id,
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -6767,17 +6767,17 @@ nsGlobalWindow::GetDocument(nsIDOMDocume
   return rv;
 }
 
 //*****************************************************************************
 // nsGlobalWindow::nsIDOMStorageWindow
 //*****************************************************************************
 
 NS_IMETHODIMP
-nsGlobalWindow::GetSessionStorage(nsIDOMStorage ** aSessionStorage)
+nsGlobalWindow::GetSessionStorage(nsIDOMStorageObsolete ** aSessionStorage)
 {
   FORWARD_TO_INNER(GetSessionStorage, (aSessionStorage), NS_ERROR_UNEXPECTED);
 
   *aSessionStorage = nsnull;
 
   nsIPrincipal *principal = GetPrincipal();
   nsCOMPtr<nsIDocShell_MOZILLA_1_9_1> docShell =
     do_QueryInterface(GetDocShell());
@@ -6814,17 +6814,17 @@ nsGlobalWindow::GetGlobalStorage(nsIDOMS
 
   return NS_OK;
 #else
   return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
 #endif
 }
 
 NS_IMETHODIMP
-nsGlobalWindow::GetLocalStorage(nsIDOMStorage2 ** aLocalStorage)
+nsGlobalWindow::GetLocalStorage(nsIDOMStorage ** aLocalStorage)
 {
   FORWARD_TO_INNER(GetLocalStorage, (aLocalStorage), NS_ERROR_UNEXPECTED);
 
   NS_ENSURE_ARG(aLocalStorage);
 
   if (nsDOMStorageManager::gStorageManager &&
       nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode())
     return NS_ERROR_DOM_SECURITY_ERR;
@@ -6991,17 +6991,17 @@ nsGlobalWindow::Observe(nsISupports* aSu
     nsIPrincipal *principal;
     nsresult rv;
 
     principal = GetPrincipal();
     if (!aData) {
       nsCOMPtr<nsIDocShell_MOZILLA_1_9_1> docShell =
         do_QueryInterface(GetDocShell());
       if (principal && docShell) {
-        nsCOMPtr<nsIDOMStorage> storage;
+        nsCOMPtr<nsIDOMStorageObsolete> storage;
         docShell->GetSessionStorageForPrincipal(principal,
                                                 PR_FALSE,
                                                 getter_AddRefs(storage));
 
         if (!SameCOMIdentity(storage, aSubject)) {
           // A sessionStorage object changed, but not our session storage
           // object.
           return NS_OK;
@@ -7085,17 +7085,17 @@ nsGlobalWindow::Observe(nsISupports* aSu
   return NS_ERROR_FAILURE;
 }
 
 static PLDHashOperator
 FirePendingStorageEvents(const nsAString& aKey, PRBool aData, void *userArg)
 {
   nsGlobalWindow *win = static_cast<nsGlobalWindow *>(userArg);
 
-  nsCOMPtr<nsIDOMStorage> storage;
+  nsCOMPtr<nsIDOMStorageObsolete> storage;
   win->GetSessionStorage(getter_AddRefs(storage));
 
   if (storage) {
     win->Observe(storage, "dom-storage-changed",
                  aKey.IsEmpty() ? nsnull : PromiseFlatString(aKey).get());
   }
 
   return PL_DHASH_NEXT;
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -87,17 +87,17 @@
 #include "nsIPrincipal.h"
 #include "nsPluginArray.h"
 #include "nsMimeTypeArray.h"
 #include "nsIXPCScriptable.h"
 #include "nsPoint.h"
 #include "nsSize.h"
 #include "mozFlushType.h"
 #include "prclist.h"
-#include "nsIDOMStorage.h"
+#include "nsIDOMStorageObsolete.h"
 #include "nsIDOMStorageList.h"
 #include "nsIDOMStorageWindow.h"
 #include "nsIDOMOfflineResourceList.h"
 #include "nsPIDOMEventTarget.h"
 #include "nsIArray.h"
 
 #define DEFAULT_HOME_PAGE "www.mozilla.org"
 #define PREF_BROWSER_STARTUP_HOMEPAGE "browser.startup.homepage"
@@ -703,30 +703,30 @@ protected:
   nsString                      mDefaultStatus;
   // index 0->language_id 1, so index MAX-1 == language_id MAX
   nsCOMPtr<nsIScriptContext>    mScriptContexts[NS_STID_ARRAY_UBOUND];
   void *                        mScriptGlobals[NS_STID_ARRAY_UBOUND];
   nsGlobalWindowObserver*       mObserver;
 
   nsCOMPtr<nsIDOMCrypto>        mCrypto;
 
-  nsCOMPtr<nsIDOMStorage2>      mLocalStorage;
+  nsCOMPtr<nsIDOMStorage>      mLocalStorage;
 
   nsCOMPtr<nsISupports>         mInnerWindowHolders[NS_STID_ARRAY_UBOUND];
   nsCOMPtr<nsIPrincipal> mOpenerScriptPrincipal; // strong; used to determine
                                                  // whether to clear scope
 
   // These member variable are used only on inner windows.
   nsCOMPtr<nsIEventListenerManager> mListenerManager;
   PRCList                       mTimeouts;
   // If mTimeoutInsertionPoint is non-null, insertions should happen after it.
   nsTimeout*                    mTimeoutInsertionPoint;
   PRUint32                      mTimeoutPublicIdCounter;
   PRUint32                      mTimeoutFiringDepth;
-  nsCOMPtr<nsIDOMStorage>       mSessionStorage;
+  nsCOMPtr<nsIDOMStorageObsolete>       mSessionStorage;
 
   // Holder of the dummy java plugin, used to expose window.java and
   // window.packages.
   nsRefPtr<nsDummyJavaPluginOwner> mDummyJavaPluginOwner;
 
   // These member variables are used on both inner and the outer windows.
   nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
   nsCOMPtr<nsIDocument> mDoc;  // For fast access to principals
--- a/dom/interfaces/storage/Makefile.in
+++ b/dom/interfaces/storage/Makefile.in
@@ -47,21 +47,21 @@ XPIDL_MODULE   = dom_storage
 GRE_MODULE     = 1
 
 EXPORTS =                                      \
        nsPIDOMStorage.h                        \
        $(NULL)
 
 XPIDLSRCS =                                    \
        nsIDOMToString.idl                      \
-       nsIDOMStorage2.idl                      \
        nsIDOMStorageManager.idl                \
        $(NULL)
 
 SDK_XPIDLSRCS =                      \
         nsIDOMStorage.idl        \
+        nsIDOMStorageObsolete.idl\
         nsIDOMStorageEvent.idl   \
         nsIDOMStorageItem.idl    \
         nsIDOMStorageList.idl    \
         nsIDOMStorageWindow.idl  \
        $(NULL)
 
 include $(topsrcdir)/config/rules.mk
--- a/dom/interfaces/storage/nsIDOMStorage.idl
+++ b/dom/interfaces/storage/nsIDOMStorage.idl
@@ -10,21 +10,22 @@
  * Software distributed under the License is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  * for the specific language governing rights and limitations under the
  * License.
  *
  * The Original Code is mozilla.org code.
  *
  * The Initial Developer of the Original Code is
- *   Neil Deakin <enndeakin@sympatico.ca>
- * Portions created by the Initial Developer are Copyright (C) 2006
+ * Mozilla Corporation
+ * Portions created by the Initial Developer are Copyright (C) 2008
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
+ *    Jan Bambas <honzab@firemni.cz>
  *
  * 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"),
  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
@@ -34,31 +35,29 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "domstubs.idl"
 
 /**
  * Interface for client side storage. See
- * http://www.whatwg.org/specs/web-apps/current-work/#scs-client-side
+ * http://www.whatwg.org/specs/web-apps/current-work/multipage/structured.html#storage0
  * for more information.
  *
  * A storage object stores an arbitrary set of key-value pairs, which
  * may be retrieved, modified and removed as needed. A key may only
  * exist once within a storage object, and only one value may be
  * associated with a particular key. Keys are stored in a particular
  * order with the condition that this order not change by merely changing
  * the value associated with a key, but the order may change when a
  * key is added or removed.
  */
 
-interface nsIDOMStorageItem;
-
-[scriptable, uuid(95CC1383-3B62-4B89-AAEF-1004A513EF47)]
+[scriptable, uuid(43E5EDAD-1E02-42c4-9D99-C3D9DEE22A20)]
 interface nsIDOMStorage : nsISupports
 {
   /**
    * The number of keys stored.
    */
   readonly attribute unsigned long length;
 
   /**
@@ -69,19 +68,19 @@ interface nsIDOMStorage : nsISupports
    * @throws INDEX_SIZE_ERR if there is no key at that index
    */
   DOMString key(in unsigned long index);
 
   /**
    * Retrieve an item with a given key
    *
    * @param key key to retrieve
-   * @returns found item or null if the key was not found
+   * @returns found data or empty string if the key was not found
    */
-  nsIDOMStorageItem getItem(in DOMString key);
+  DOMString getItem(in DOMString key);
 
   /**
    * Assign a value with a key. If the key does not exist already, a new
    * key is added associated with that value. If the key already exists,
    * then the existing value is replaced with a new value.
    *
    * @param key key to set
    * @param data data to associate with the key
@@ -89,9 +88,15 @@ interface nsIDOMStorage : nsISupports
   void setItem(in DOMString key, in DOMString data);
 
   /**
    * Remove a key and its corresponding value.
    *
    * @param key key to remove
    */
   void removeItem(in DOMString key);
+
+  /**
+   * Clear the content of this storage bound to a domain
+   * or an origin.
+   */
+  void clear();
 };
deleted file mode 100644
--- a/dom/interfaces/storage/nsIDOMStorage2.idl
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Mozilla Corporation
- * Portions created by the Initial Developer are Copyright (C) 2008
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *    Jan Bambas <honzab@firemni.cz>
- *
- * 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"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "domstubs.idl"
-
-/**
- * Interface for client side storage. See
- * http://www.whatwg.org/specs/web-apps/current-work/multipage/structured.html#storage0
- * for more information.
- *
- * A storage object stores an arbitrary set of key-value pairs, which
- * may be retrieved, modified and removed as needed. A key may only
- * exist once within a storage object, and only one value may be
- * associated with a particular key. Keys are stored in a particular
- * order with the condition that this order not change by merely changing
- * the value associated with a key, but the order may change when a
- * key is added or removed.
- */
-
-[scriptable, uuid(A67BA00F-CCB8-4ffe-BADA-F8913CAAFB20)]
-interface nsIDOMStorage2 : nsISupports
-{
-  /**
-   * The number of keys stored.
-   */
-  readonly attribute unsigned long length;
-
-  /**
-   * Retrieve the name of the key at a particular index.
-   *
-   * @param index index of the item to retrieve
-   * @returns the key at index
-   * @throws INDEX_SIZE_ERR if there is no key at that index
-   */
-  DOMString key(in unsigned long index);
-
-  /**
-   * Retrieve an item with a given key
-   *
-   * @param key key to retrieve
-   * @returns found data or empty string if the key was not found
-   */
-  DOMString getItem(in DOMString key);
-
-  /**
-   * Assign a value with a key. If the key does not exist already, a new
-   * key is added associated with that value. If the key already exists,
-   * then the existing value is replaced with a new value.
-   *
-   * @param key key to set
-   * @param data data to associate with the key
-   */
-  void setItem(in DOMString key, in DOMString data);
-
-  /**
-   * Remove a key and its corresponding value.
-   *
-   * @param key key to remove
-   */
-  void removeItem(in DOMString key);
-
-  /**
-   * Clear the content of this storage bound to a domain
-   * or an origin.
-   */
-  void clear();
-};
--- a/dom/interfaces/storage/nsIDOMStorageList.idl
+++ b/dom/interfaces/storage/nsIDOMStorageList.idl
@@ -40,21 +40,21 @@
 /**
  * Interface for a client side storage. See
  * http://www.whatwg.org/specs/web-apps/current-work/#scs-client-side
  * for more information.
  *
  * Allows access to contextual storage areas by domain.
  */
 
-interface nsIDOMStorage;
+interface nsIDOMStorageObsolete;
 
 [scriptable, uuid(f2166929-91B6-4372-8D5F-C366F47A5F54)]
 interface nsIDOMStorageList : nsISupports
 {
   /**
    * Returns a storage object for a particular domain.
    *
    * @param domain domain to retrieve
    * @returns a storage area for the given domain
    */
-  nsIDOMStorage namedItem(in DOMString domain);
+  nsIDOMStorageObsolete namedItem(in DOMString domain);
 };
--- a/dom/interfaces/storage/nsIDOMStorageManager.idl
+++ b/dom/interfaces/storage/nsIDOMStorageManager.idl
@@ -32,17 +32,17 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsISupports.idl"
 
-interface nsIDOMStorage2;
+interface nsIDOMStorage;
 interface nsIPrincipal;
 
 [scriptable, uuid(9efc2081-218f-4622-837b-40bdb870a1c8)]
 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
@@ -59,10 +59,10 @@ interface nsIDOMStorageManager : nsISupp
    */
   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.
    */
-  nsIDOMStorage2 getLocalStorageForPrincipal(in nsIPrincipal aPrincipal);
+  nsIDOMStorage getLocalStorageForPrincipal(in nsIPrincipal aPrincipal);
 };
new file mode 100644
--- /dev/null
+++ b/dom/interfaces/storage/nsIDOMStorageObsolete.idl
@@ -0,0 +1,97 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ *   Neil Deakin <enndeakin@sympatico.ca>
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * 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"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "domstubs.idl"
+
+/**
+ * Interface for client side storage. See
+ * http://www.whatwg.org/specs/web-apps/current-work/#scs-client-side
+ * for more information.
+ *
+ * A storage object stores an arbitrary set of key-value pairs, which
+ * may be retrieved, modified and removed as needed. A key may only
+ * exist once within a storage object, and only one value may be
+ * associated with a particular key. Keys are stored in a particular
+ * order with the condition that this order not change by merely changing
+ * the value associated with a key, but the order may change when a
+ * key is added or removed.
+ */
+
+interface nsIDOMStorageItem;
+
+[scriptable, uuid(18013CF9-B104-49cf-9484-C2A7A845457E)]
+interface nsIDOMStorageObsolete : nsISupports
+{
+  /**
+   * The number of keys stored.
+   */
+  readonly attribute unsigned long length;
+
+  /**
+   * Retrieve the name of the key at a particular index.
+   *
+   * @param index index of the item to retrieve
+   * @returns the key at index
+   * @throws INDEX_SIZE_ERR if there is no key at that index
+   */
+  DOMString key(in unsigned long index);
+
+  /**
+   * Retrieve an item with a given key
+   *
+   * @param key key to retrieve
+   * @returns found item or null if the key was not found
+   */
+  nsIDOMStorageItem getItem(in DOMString key);
+
+  /**
+   * Assign a value with a key. If the key does not exist already, a new
+   * key is added associated with that value. If the key already exists,
+   * then the existing value is replaced with a new value.
+   *
+   * @param key key to set
+   * @param data data to associate with the key
+   */
+  void setItem(in DOMString key, in DOMString data);
+
+  /**
+   * Remove a key and its corresponding value.
+   *
+   * @param key key to remove
+   */
+  void removeItem(in DOMString key);
+};
--- a/dom/interfaces/storage/nsIDOMStorageWindow.idl
+++ b/dom/interfaces/storage/nsIDOMStorageWindow.idl
@@ -40,30 +40,30 @@
 /**
  * Interface for a client side storage. See
  * http://www.whatwg.org/specs/web-apps/current-work/#scs-client-side
  * for more information.
  *
  * Allows access to contextual storage areas.
  */
 
+interface nsIDOMStorageObsolete;
 interface nsIDOMStorage;
-interface nsIDOMStorage2;
 interface nsIDOMStorageList;
 
 [scriptable, uuid(B4F572FB-9BA5-480b-9361-C230863323E4)]
 interface nsIDOMStorageWindow : nsISupports
 {
   /**
    * Session storage for the current browsing context.
    */
-  readonly attribute nsIDOMStorage sessionStorage;
+  readonly attribute nsIDOMStorageObsolete sessionStorage;
 
   /**
    * Global storage, accessible by domain.
    */
   readonly attribute nsIDOMStorageList globalStorage;
 
   /**
    * Local storage for the current browsing context.
    */
-  readonly attribute nsIDOMStorage2 localStorage;
+  readonly attribute nsIDOMStorage localStorage;
 };
--- a/dom/interfaces/storage/nsPIDOMStorage.h
+++ b/dom/interfaces/storage/nsPIDOMStorage.h
@@ -38,34 +38,34 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef __nsPIDOMStorage_h_
 #define __nsPIDOMStorage_h_
 
 #include "nsISupports.h"
 #include "nsTArray.h"
 
-class nsIDOMStorage;
+class nsIDOMStorageObsolete;
 class nsIURI;
 class nsIPrincipal;
 
 #define NS_PIDOMSTORAGE_IID                                 \
   { 0x2cbaea60, 0x69e7, 0x4b49,                             \
       { 0xa2, 0xe2, 0x99, 0x53, 0xf4, 0x11, 0xd0, 0x8f } }
 
 class nsPIDOMStorage : public nsISupports
 {
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_PIDOMSTORAGE_IID)
 
   virtual nsresult InitAsLocalStorage(nsIPrincipal *aPrincipal) = 0;
   virtual nsresult InitAsGlobalStorage(const nsACString &aDomainDemanded) = 0;
   virtual nsresult InitAsSessionStorage(nsIURI* aURI) = 0;
 
-  virtual already_AddRefed<nsIDOMStorage> Clone() = 0;
+  virtual already_AddRefed<nsIDOMStorageObsolete> Clone() = 0;
 
   virtual nsTArray<nsString> *GetKeys() = 0;
 
   virtual const nsCString &Domain() = 0;
   virtual PRBool CanAccess(nsIPrincipal *aPrincipal) = 0;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsPIDOMStorage, NS_PIDOMSTORAGE_IID)
--- a/dom/src/storage/nsDOMStorage.cpp
+++ b/dom/src/storage/nsDOMStorage.cpp
@@ -380,17 +380,17 @@ nsDOMStorageManager::ClearOfflineApps()
     nsTArray<nsString> domains;
     rv = GetOfflineDomains(domains);
     NS_ENSURE_SUCCESS(rv, rv);
     return nsDOMStorage::gStorageDB->RemoveOwners(domains, PR_FALSE, PR_TRUE);
 }
 
 NS_IMETHODIMP
 nsDOMStorageManager::GetLocalStorageForPrincipal(nsIPrincipal *aPrincipal,
-                                                 nsIDOMStorage2 **aResult)
+                                                 nsIDOMStorage **aResult)
 {
   NS_ENSURE_ARG_POINTER(aPrincipal);
   *aResult = nsnull;
 
   nsresult rv;
 
   nsRefPtr<nsDOMStorage2> storage = new nsDOMStorage2();
   if (!storage)
@@ -460,23 +460,23 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_0(nsDOMS
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMStorage)
   {
     if (tmp->mItems.IsInitialized()) {
       tmp->mItems.EnumerateEntries(SessionStorageTraverser, &cb);
     }
   }
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsDOMStorage, nsIDOMStorage)
-NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(nsDOMStorage, nsIDOMStorage)
+NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsDOMStorage, nsIDOMStorageObsolete)
+NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(nsDOMStorage, nsIDOMStorageObsolete)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMStorage)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMStorage)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMStorage)
+  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMStorageObsolete)
+  NS_INTERFACE_MAP_ENTRY(nsIDOMStorageObsolete)
   NS_INTERFACE_MAP_ENTRY(nsPIDOMStorage)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Storage)
+  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(StorageObsolete)
 NS_INTERFACE_MAP_END
 
 NS_IMETHODIMP
 NS_NewDOMStorage(nsISupports* aOuter, REFNSIID aIID, void** aResult)
 {
   nsDOMStorage* storage = new nsDOMStorage();
   if (!storage)
     return NS_ERROR_OUT_OF_MEMORY;
@@ -1207,17 +1207,17 @@ CopyStorageItems(nsSessionStorageEntry* 
 
   if (aEntry->mItem->IsSecure()) {
     newstorage->SetSecure(aEntry->GetKey(), PR_TRUE);
   }
 
   return PL_DHASH_NEXT;
 }
 
-already_AddRefed<nsIDOMStorage>
+already_AddRefed<nsIDOMStorageObsolete>
 nsDOMStorage::Clone()
 {
   if (UseDB()) {
     NS_ERROR("Uh, don't clone a global or local storage object.");
 
     return nsnull;
   }
 
@@ -1314,40 +1314,40 @@ nsDOMStorage::BroadcastChangeNotificatio
     do_GetService("@mozilla.org/observer-service;1", &rv);
   if (NS_FAILED(rv)) {
     return;
   }
 
   // Fire off a notification that a storage object changed. If the
   // storage object is a session storage object, we don't pass a
   // domain, but if it's a global storage object we do.
-  observerService->NotifyObservers((nsIDOMStorage *)this,
+  observerService->NotifyObservers((nsIDOMStorageObsolete *)this,
                                    "dom-storage-changed",
                                    UseDB() ? NS_ConvertUTF8toUTF16(mDomain).get() : nsnull);
 }
 
 //
 // nsDOMStorage2
 //
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMStorage2)
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMStorage2)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mStorage)
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMStorage2)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mStorage, nsIDOMStorage)
+  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mStorage, nsIDOMStorageObsolete)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsDOMStorage2, nsIDOMStorage2)
-NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(nsDOMStorage2, nsIDOMStorage2)
+NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsDOMStorage2, nsIDOMStorage)
+NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(nsDOMStorage2, nsIDOMStorage)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMStorage2)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMStorage2)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMStorage2)
+  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMStorage)
+  NS_INTERFACE_MAP_ENTRY(nsIDOMStorage)
   NS_INTERFACE_MAP_ENTRY(nsPIDOMStorage)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Storage2)
+  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Storage)
 NS_INTERFACE_MAP_END
 
 nsresult
 nsDOMStorage2::InitAsLocalStorage(nsIPrincipal *aPrincipal)
 {
   mStorage = new nsDOMStorage();
   if (!mStorage)
     return NS_ERROR_OUT_OF_MEMORY;
@@ -1368,21 +1368,21 @@ nsDOMStorage2::InitAsSessionStorage(nsIU
 {
   mStorage = new nsDOMStorage();
   if (!mStorage)
     return NS_ERROR_OUT_OF_MEMORY;
 
   return mStorage->InitAsSessionStorage(aURI);
 }
 
-already_AddRefed<nsIDOMStorage>
+already_AddRefed<nsIDOMStorageObsolete>
 nsDOMStorage2::Clone()
 {
   // XXX: this will need to be fixed before sessionStorage is moved
-  // to nsIDOMStorage2.
+  // to nsIDOMStorage.
   NS_ASSERTION(PR_FALSE, "Cannot clone nsDOMStorage2");
   return nsnull;
 }
 
 nsTArray<nsString> *
 nsDOMStorage2::GetKeys()
 {
   return mStorage->GetKeys();
@@ -1454,17 +1454,17 @@ NS_INTERFACE_MAP_BEGIN(nsDOMStorageList)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
   NS_INTERFACE_MAP_ENTRY(nsIDOMStorageList)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(StorageList)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_ADDREF(nsDOMStorageList)
 NS_IMPL_RELEASE(nsDOMStorageList)
 
-nsIDOMStorage*
+nsIDOMStorageObsolete*
 nsDOMStorageList::GetNamedItem(const nsAString& aDomain, nsresult* aResult)
 {
   nsCAutoString requestedDomain;
 
   // Normalize the requested domain
   nsCOMPtr<nsIIDNService> idn = do_GetService(NS_IDNSERVICE_CONTRACTID);
   if (idn) {
     *aResult = idn->ConvertUTF8toACE(NS_ConvertUTF16toUTF8(aDomain),
@@ -1509,32 +1509,32 @@ nsDOMStorageList::GetNamedItem(const nsA
   }
 
   return GetStorageForDomain(requestedDomain,
                              currentDomain, isSystem, aResult);
 }
 
 NS_IMETHODIMP
 nsDOMStorageList::NamedItem(const nsAString& aDomain,
-                            nsIDOMStorage** aStorage)
+                            nsIDOMStorageObsolete** aStorage)
 {
   nsresult rv;
   NS_IF_ADDREF(*aStorage = GetNamedItem(aDomain, &rv));
   return rv;
 }
 
 // static
 PRBool
 nsDOMStorageList::CanAccessDomain(const nsACString& aRequestedDomain,
                                   const nsACString& aCurrentDomain)
 {
   return aRequestedDomain.Equals(aCurrentDomain);
 }
 
-nsIDOMStorage*
+nsIDOMStorageObsolete*
 nsDOMStorageList::GetStorageForDomain(const nsACString& aRequestedDomain,
                                       const nsACString& aCurrentDomain,
                                       PRBool aNoCurrentDomainCheck,
                                       nsresult* aResult)
 {
   nsTArray<nsCString> requestedDomainArray;
   if ((!aNoCurrentDomainCheck &&
        !CanAccessDomain(aRequestedDomain, aCurrentDomain)) ||
@@ -1552,17 +1552,17 @@ nsDOMStorageList::GetStorageForDomain(co
     if (!usedDomain.IsEmpty())
       usedDomain.Append('.');
     usedDomain.Append(requestedDomainArray[requestedPos]);
   }
 
   *aResult = NS_OK;
 
   // now have a valid domain, so look it up in the storage table
-  nsIDOMStorage* storage = mStorages.GetWeak(usedDomain);
+  nsIDOMStorageObsolete* storage = mStorages.GetWeak(usedDomain);
   if (!storage) {
     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;
@@ -1626,17 +1626,17 @@ NS_NewDOMStorageList(nsIDOMStorageList**
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMStorageItem)
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMStorageItem)
   {
     tmp->mStorage = nsnull;
   }
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMStorageItem)
   {
-    cb.NoteXPCOMChild((nsIDOMStorage*) tmp->mStorage);
+    cb.NoteXPCOMChild((nsIDOMStorageObsolete*) tmp->mStorage);
   }
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsDOMStorageItem, nsIDOMStorageItem)
 NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(nsDOMStorageItem, nsIDOMStorageItem)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMStorageItem)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMStorageItem)
   NS_INTERFACE_MAP_ENTRY(nsIDOMStorageItem)
--- a/dom/src/storage/nsDOMStorage.h
+++ b/dom/src/storage/nsDOMStorage.h
@@ -38,18 +38,18 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsDOMStorage_h___
 #define nsDOMStorage_h___
 
 #include "nscore.h"
 #include "nsAutoPtr.h"
+#include "nsIDOMStorageObsolete.h"
 #include "nsIDOMStorage.h"
-#include "nsIDOMStorage2.h"
 #include "nsIDOMStorageList.h"
 #include "nsIDOMStorageItem.h"
 #include "nsInterfaceHashtable.h"
 #include "nsVoidArray.h"
 #include "nsTArray.h"
 #include "nsPIDOMStorage.h"
 #include "nsIDOMToString.h"
 #include "nsDOMEvent.h"
@@ -57,17 +57,17 @@
 #include "nsIDOMStorageManager.h"
 #include "nsCycleCollectionParticipant.h"
 
 #ifdef MOZ_STORAGE
 #include "nsDOMStorageDB.h"
 #endif
 
 class nsDOMStorage;
-class nsIDOMStorage2;
+class nsIDOMStorage;
 class nsDOMStorageItem;
 
 class nsDOMStorageEntry : public nsVoidPtrHashKey
 {
 public:
   nsDOMStorageEntry(KeyTypePointer aStr);
   nsDOMStorageEntry(const nsDOMStorageEntry& aToCopy);
   ~nsDOMStorageEntry();
@@ -115,40 +115,40 @@ public:
   static nsDOMStorageManager* gStorageManager;
 
 protected:
 
   nsTHashtable<nsDOMStorageEntry> mStorages;
   PRBool mInPrivateBrowsing;
 };
 
-class nsDOMStorage : public nsIDOMStorage,
+class nsDOMStorage : public nsIDOMStorageObsolete,
                      public nsPIDOMStorage
 {
 public:
   nsDOMStorage();
   nsDOMStorage(nsDOMStorage& aThat);
   virtual ~nsDOMStorage();
 
   // nsISupports
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsDOMStorage, nsIDOMStorage)
+  NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsDOMStorage, nsIDOMStorageObsolete)
 
-  // nsIDOMStorage
-  NS_DECL_NSIDOMSTORAGE
+  // nsIDOMStorageObsolete
+  NS_DECL_NSIDOMSTORAGEOBSOLETE
 
-  // Helpers for implementing nsIDOMStorage2
+  // Helpers for implementing nsIDOMStorage
   nsresult GetItem(const nsAString& key, nsAString& aData);
   nsresult Clear();
 
   // nsPIDOMStorage
   virtual nsresult InitAsLocalStorage(nsIPrincipal *aPrincipal);
   virtual nsresult InitAsGlobalStorage(const nsACString &aDomainDemanded);
   virtual nsresult InitAsSessionStorage(nsIURI* aURI);
-  virtual already_AddRefed<nsIDOMStorage> Clone();
+  virtual already_AddRefed<nsIDOMStorageObsolete> Clone();
   virtual nsTArray<nsString> *GetKeys();
   virtual const nsCString &Domain();
   virtual PRBool CanAccess(nsIPrincipal *aPrincipal);
 
   // If true, the contents of the storage should be stored in the
   // database, otherwise this storage should act like a session
   // storage.
   // This call relies on mSessionOnly, and should only be used
@@ -189,17 +189,17 @@ public:
 
   // clear all values from the store
   void ClearAll();
 
   nsIDOMStorageItem* GetNamedItem(const nsAString& aKey, nsresult* aResult);
 
   static nsDOMStorage* FromSupports(nsISupports* aSupports)
   {
-    return static_cast<nsDOMStorage*>(static_cast<nsIDOMStorage*>(aSupports));
+    return static_cast<nsDOMStorage*>(static_cast<nsIDOMStorageObsolete*>(aSupports));
   }
 
 protected:
 
   friend class nsDOMStorageManager;
   friend class nsDOMStorage2;
 
   static nsresult InitDB();
@@ -251,31 +251,31 @@ public:
   // (in future) reversed offline application allowed domain.
   nsCString& GetQuotaDomainDBKey() {return mQuotaDomainDBKey;}
 
  #ifdef MOZ_STORAGE
    static nsDOMStorageDB* gStorageDB;
  #endif
 };
 
-class nsDOMStorage2 : public nsIDOMStorage2,
+class nsDOMStorage2 : public nsIDOMStorage,
                       public nsPIDOMStorage
 {
 public:
   // nsISupports
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsDOMStorage2, nsIDOMStorage2)
+  NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsDOMStorage2, nsIDOMStorage)
 
-  NS_DECL_NSIDOMSTORAGE2
+  NS_DECL_NSIDOMSTORAGE
 
   // nsPIDOMStorage
   virtual nsresult InitAsLocalStorage(nsIPrincipal *aPrincipal);
   virtual nsresult InitAsGlobalStorage(const nsACString &aDomainDemanded);
   virtual nsresult InitAsSessionStorage(nsIURI* aURI);
-  virtual already_AddRefed<nsIDOMStorage> Clone();
+  virtual already_AddRefed<nsIDOMStorageObsolete> Clone();
   virtual nsTArray<nsString> *GetKeys();
   virtual const nsCString &Domain();
   virtual PRBool CanAccess(nsIPrincipal *aPrincipal);
 
 private:
   // storages bound to an origin hold the principal to
   // make security checks against it
   nsCOMPtr<nsIPrincipal> mPrincipal;
@@ -294,68 +294,68 @@ public:
   virtual ~nsDOMStorageList() {}
 
   // nsISupports
   NS_DECL_ISUPPORTS
 
   // nsIDOMStorageList
   NS_DECL_NSIDOMSTORAGELIST
 
-  nsIDOMStorage* GetNamedItem(const nsAString& aDomain, nsresult* aResult);
+  nsIDOMStorageObsolete* GetNamedItem(const nsAString& aDomain, nsresult* aResult);
 
   /**
    * Check whether aCurrentDomain has access to aRequestedDomain
    */
   static PRBool
   CanAccessDomain(const nsACString& aRequestedDomain,
                   const nsACString& aCurrentDomain);
 
 protected:
 
   /**
-   * Return the global nsIDOMStorage for a particular domain.
+   * Return the global nsIDOMStorageObsolete for a particular domain.
    * aNoCurrentDomainCheck may be true to skip the domain comparison;
    * this is used for chrome code so that it may retrieve data from
    * any domain.
    *
    * @param aRequestedDomain domain to return
    * @param aCurrentDomain domain of current caller
    * @param aNoCurrentDomainCheck true to skip domain comparison
    */
-  nsIDOMStorage*
+  nsIDOMStorageObsolete*
   GetStorageForDomain(const nsACString& aRequestedDomain,
                       const nsACString& aCurrentDomain,
                       PRBool aNoCurrentDomainCheck,
                       nsresult* aResult);
 
   /**
    * Convert the domain into an array of its component parts.
    */
   static PRBool
   ConvertDomainToArray(const nsACString& aDomain,
                        nsTArray<nsCString>* aArray);
 
-  nsInterfaceHashtable<nsCStringHashKey, nsIDOMStorage> mStorages;
+  nsInterfaceHashtable<nsCStringHashKey, nsIDOMStorageObsolete> mStorages;
 };
 
 class nsDOMStorageItem : public nsIDOMStorageItem,
                          public nsIDOMToString
 {
 public:
   nsDOMStorageItem(nsDOMStorage* aStorage,
                    const nsAString& aKey,
                    const nsAString& aValue,
                    PRBool aSecure);
   virtual ~nsDOMStorageItem();
 
   // nsISupports
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsDOMStorageItem, nsIDOMStorageItem)
 
-  // nsIDOMStorage
+  // nsIDOMStorageObsolete
   NS_DECL_NSIDOMSTORAGEITEM
 
   // nsIDOMToString
   NS_DECL_NSIDOMTOSTRING
 
   PRBool IsSecure()
   {
     return mSecure;
--- a/dom/tests/mochitest/chrome/domstorage_global.js
+++ b/dom/tests/mochitest/chrome/domstorage_global.js
@@ -4,20 +4,20 @@ ok(globalStorage === window["globalStora
 function test_DOMStorage_global()
 {
   var currentDomain = "mozilla.com";
 
   var globalStorage = window.globalStorage;
   is(globalStorage instanceof StorageList, true, "globalStorage property");
 
   var storage = globalStorage.namedItem(currentDomain);
-  is(storage instanceof Storage, true, "StorageList namedItem");
+  is(storage instanceof StorageObsolete, true, "StorageList namedItem");
 
   var storage2 = globalStorage[currentDomain];
-  is(storage2 instanceof Storage, true, "StorageList property syntax");
+  is(storage2 instanceof StorageObsolete, true, "StorageList property syntax");
 
   is(storage, storage2, "StorageList namedItem and array return same value");
 
   // the initial value should be null
   test_DOMStorage_global_Item(storage, "sample", null, 0, "initial");
 
   // if no key is supplied, the return value will be null
   is(storage.getItem("", "Test"), null, "getItem no key");
--- a/dom/tests/mochitest/localstorage/Makefile.in
+++ b/dom/tests/mochitest/localstorage/Makefile.in
@@ -66,16 +66,17 @@ include $(topsrcdir)/config/rules.mk
     test_localStorageOriginsDiff.html \
     test_localStorageOriginsPortDiffs.html \
     test_localStorageOriginsDomainDiffs.html \
     test_localStorageOriginsSchemaDiffs.html \
     test_localStorageReplace.html \
     test_localStorageQuota.html \
     test_localStorageKeyOrder.html \
     test_removeOwnersAPI.html \
+    test_storageConstructor.html \
     $(NULL)
     
 _CHROME_FILES = \
     test_localStorageFromChrome.xhtml \
     $(NULL)
 
 libs::	$(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_storageConstructor.html
@@ -0,0 +1,37 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage different port numbers</title>
+
+<script type="text/javascript" src="/MochiKit/packed.js"></script>
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="interOriginTest2.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+function startTest()
+{
+  var functionCalled = false;
+  is(localStorage instanceof Storage, true, "localStorage is instance of Storage");
+  Storage.prototype.exists = function(key) {
+    functionCalled = true;
+    return this.getItem(key) != null;
+  }
+  localStorage.setItem("test_prototype", "value");
+  is(functionCalled, false, "Overridden function not called");
+  is(localStorage.exists("test_prototype"), true, "Prototype overridden");
+  is(functionCalled, true, "Overridden function called");
+  localStorage.clear();
+  
+  SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+</body>
+</html>
--- a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp
+++ b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp
@@ -80,17 +80,17 @@
 #include "nsPIDOMWindow.h"
 #include "nsIMarkupDocumentViewer.h"
 #include "nsIContentViewer.h"
 #include "nsIDocumentViewer.h"
 #include "nsIWindowProvider.h"
 #include "nsIMutableArray.h"
 #include "nsISupportsArray.h"
 #include "nsIDeviceContext.h"
-#include "nsIDOMStorage.h"
+#include "nsIDOMStorageObsolete.h"
 #include "nsPIDOMStorage.h"
 #include "nsIWidget.h"
 
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 
 #include "jsinterp.h" // for js_AllocStack() and js_FreeStack()
 
@@ -931,17 +931,17 @@ nsWindowWatcher::OpenWindowJSInternal(ns
 
   // Copy the current session storage for the current domain.
   nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(aParent);
   nsCOMPtr<nsIDocShell_MOZILLA_1_9_1> parentDocShell;
   if (piWindow)
     parentDocShell = do_QueryInterface(piWindow->GetDocShell());
 
   if (subjectPrincipal && parentDocShell) {
-    nsCOMPtr<nsIDOMStorage> storage;
+    nsCOMPtr<nsIDOMStorageObsolete> storage;
     parentDocShell->GetSessionStorageForPrincipal(subjectPrincipal, PR_FALSE,
                                                   getter_AddRefs(storage));
     nsCOMPtr<nsPIDOMStorage> piStorage =
       do_QueryInterface(storage);
     if (piStorage){
       storage = piStorage->Clone();
       newDocShell->AddSessionStorage(
         piStorage->Domain(),
--- a/js/src/xpconnect/src/dom_quickstubs.qsconf
+++ b/js/src/xpconnect/src/dom_quickstubs.qsconf
@@ -457,22 +457,22 @@ members = [
 
     # dom/public/idl/range
     'nsIDOMRange.collapsed',
 
     # dom/public/idl/sidebar - None.
 
     # dom/public/idl/storage
     'nsIDOMToString.toString',
-    'nsIDOMStorage2.setItem',
-    'nsIDOMStorage2.length',
-    'nsIDOMStorage2.getItem',
-    'nsIDOMStorage2.key',
-    'nsIDOMStorage2.removeItem',
-    'nsIDOMStorage2.clear',
+    'nsIDOMStorage.setItem',
+    'nsIDOMStorage.length',
+    'nsIDOMStorage.getItem',
+    'nsIDOMStorage.key',
+    'nsIDOMStorage.removeItem',
+    'nsIDOMStorage.clear',
     'nsIDOMStorageItem.value',
     'nsIDOMStorageWindow.sessionStorage',
     'nsIDOMStorageWindow.globalStorage',
 
     # dom/public/idl/stylesheets - None.
 
     # dom/public/idl/traversal
     'nsIDOMDocumentTraversal.createNodeIterator',