Bug 732708 - Part e: Pass nsDOMStorage* to InitAsSessionStorageFork; r=mayhemer
authorMs2ger <ms2ger@gmail.com>
Sat, 05 May 2012 11:00:05 +0200
changeset 93245 a2e3e92acba72989075bd4796992ce6fa1765a77
parent 93244 5d5454d0fe2e9dfb34fd9980e717bbe9e709e6ba
child 93246 1f825a03864a7faac252c3ce048b0cb3853197c9
push id22617
push userMs2ger@gmail.com
push dateSat, 05 May 2012 09:01:38 +0000
treeherdermozilla-central@5b9ee59e6e60 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs732708
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 732708 - Part e: Pass nsDOMStorage* to InitAsSessionStorageFork; r=mayhemer
dom/src/storage/nsDOMStorage.cpp
dom/src/storage/nsDOMStorage.h
--- a/dom/src/storage/nsDOMStorage.cpp
+++ b/dom/src/storage/nsDOMStorage.cpp
@@ -1803,45 +1803,35 @@ nsDOMStorage2::Clone()
 
   return storage;
 }
 
 already_AddRefed<nsIDOMStorage>
 nsDOMStorage2::Fork(const nsSubstring &aDocumentURI)
 {
   nsRefPtr<nsDOMStorage2> storage = new nsDOMStorage2();
-  if (!storage)
-    return nsnull;
-
-  nsresult rv = storage->InitAsSessionStorageFork(mPrincipal, aDocumentURI, mStorage);
-  if (NS_FAILED(rv))
-    return nsnull;
-
-  nsIDOMStorage* result = static_cast<nsIDOMStorage*>(storage.get());
-  storage.forget();
-  return result;
+  storage->InitAsSessionStorageFork(mPrincipal, aDocumentURI, mStorage);
+  return storage.forget();
 }
 
 bool nsDOMStorage2::IsForkOf(nsIDOMStorage* aThat)
 {
   if (!aThat)
     return false;
 
   nsDOMStorage2* storage = static_cast<nsDOMStorage2*>(aThat);
   return mStorage == storage->mStorage;
 }
 
-nsresult
-nsDOMStorage2::InitAsSessionStorageFork(nsIPrincipal *aPrincipal, const nsSubstring &aDocumentURI, nsIDOMStorageObsolete* aStorage)
+void
+nsDOMStorage2::InitAsSessionStorageFork(nsIPrincipal *aPrincipal, const nsSubstring &aDocumentURI, nsDOMStorage* aStorage)
 {
   mPrincipal = aPrincipal;
   mDocumentURI = aDocumentURI;
-  mStorage = static_cast<nsDOMStorage*>(aStorage);
-
-  return NS_OK;
+  mStorage = aStorage;
 }
 
 nsTArray<nsString> *
 nsDOMStorage2::GetKeys()
 {
   return mStorage->GetKeys();
 }
 
--- a/dom/src/storage/nsDOMStorage.h
+++ b/dom/src/storage/nsDOMStorage.h
@@ -442,19 +442,19 @@ public:
   virtual nsTArray<nsString> *GetKeys();
   virtual nsIPrincipal* Principal();
   virtual bool CanAccess(nsIPrincipal *aPrincipal);
   virtual nsDOMStorageType StorageType();
 
   void BroadcastChangeNotification(const nsSubstring &aKey,
                                    const nsSubstring &aOldValue,
                                    const nsSubstring &aNewValue);
-  nsresult InitAsSessionStorageFork(nsIPrincipal *aPrincipal,
-                                    const nsSubstring &aDocumentURI,
-                                    nsIDOMStorageObsolete* aStorage);
+  void InitAsSessionStorageFork(nsIPrincipal *aPrincipal,
+                                const nsSubstring &aDocumentURI,
+                                nsDOMStorage* aStorage);
 
 private:
   // storages bound to an origin hold the principal to
   // make security checks against it
   nsCOMPtr<nsIPrincipal> mPrincipal;
 
   // Needed for the storage event, this is address of the document this storage
   // is bound to