Bug 732708 - Part e: Pass nsDOMStorage* to InitAsSessionStorageFork; r=mayhemer

This commit is contained in:
Ms2ger 2012-05-05 11:00:05 +02:00
parent 25be92c77d
commit 56504c3389
2 changed files with 8 additions and 18 deletions

View File

@ -1808,16 +1808,8 @@ already_AddRefed<nsIDOMStorage>
nsDOMStorage2::Fork(const nsSubstring &aDocumentURI) nsDOMStorage2::Fork(const nsSubstring &aDocumentURI)
{ {
nsRefPtr<nsDOMStorage2> storage = new nsDOMStorage2(); nsRefPtr<nsDOMStorage2> storage = new nsDOMStorage2();
if (!storage) storage->InitAsSessionStorageFork(mPrincipal, aDocumentURI, mStorage);
return nsnull; return storage.forget();
nsresult rv = storage->InitAsSessionStorageFork(mPrincipal, aDocumentURI, mStorage);
if (NS_FAILED(rv))
return nsnull;
nsIDOMStorage* result = static_cast<nsIDOMStorage*>(storage.get());
storage.forget();
return result;
} }
bool nsDOMStorage2::IsForkOf(nsIDOMStorage* aThat) bool nsDOMStorage2::IsForkOf(nsIDOMStorage* aThat)
@ -1829,14 +1821,12 @@ bool nsDOMStorage2::IsForkOf(nsIDOMStorage* aThat)
return mStorage == storage->mStorage; return mStorage == storage->mStorage;
} }
nsresult void
nsDOMStorage2::InitAsSessionStorageFork(nsIPrincipal *aPrincipal, const nsSubstring &aDocumentURI, nsIDOMStorageObsolete* aStorage) nsDOMStorage2::InitAsSessionStorageFork(nsIPrincipal *aPrincipal, const nsSubstring &aDocumentURI, nsDOMStorage* aStorage)
{ {
mPrincipal = aPrincipal; mPrincipal = aPrincipal;
mDocumentURI = aDocumentURI; mDocumentURI = aDocumentURI;
mStorage = static_cast<nsDOMStorage*>(aStorage); mStorage = aStorage;
return NS_OK;
} }
nsTArray<nsString> * nsTArray<nsString> *

View File

@ -447,9 +447,9 @@ public:
void BroadcastChangeNotification(const nsSubstring &aKey, void BroadcastChangeNotification(const nsSubstring &aKey,
const nsSubstring &aOldValue, const nsSubstring &aOldValue,
const nsSubstring &aNewValue); const nsSubstring &aNewValue);
nsresult InitAsSessionStorageFork(nsIPrincipal *aPrincipal, void InitAsSessionStorageFork(nsIPrincipal *aPrincipal,
const nsSubstring &aDocumentURI, const nsSubstring &aDocumentURI,
nsIDOMStorageObsolete* aStorage); nsDOMStorage* aStorage);
private: private:
// storages bound to an origin hold the principal to // storages bound to an origin hold the principal to