Merge after backout of changeset 416fbf4fdef3

This commit is contained in:
Daniel Holbert 2008-12-05 10:07:40 -08:00
commit d6fb55e4e3
3 changed files with 11 additions and 15 deletions

View File

@ -208,7 +208,6 @@ static PRLogModuleInfo* gDOMLeakPRLog;
#endif #endif
nsIFactory *nsGlobalWindow::sComputedDOMStyleFactory = nsnull; nsIFactory *nsGlobalWindow::sComputedDOMStyleFactory = nsnull;
nsIDOMStorageList *nsGlobalWindow::sGlobalStorageList = nsnull;
static nsIEntropyCollector *gEntropyCollector = nsnull; static nsIEntropyCollector *gEntropyCollector = nsnull;
static PRInt32 gRefCnt = 0; static PRInt32 gRefCnt = 0;
@ -781,7 +780,6 @@ void
nsGlobalWindow::ShutDown() nsGlobalWindow::ShutDown()
{ {
NS_IF_RELEASE(sComputedDOMStyleFactory); NS_IF_RELEASE(sComputedDOMStyleFactory);
NS_IF_RELEASE(sGlobalStorageList);
} }
// static // static
@ -1005,6 +1003,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGlobalWindow)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mScriptContexts[i]) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mScriptContexts[i])
} }
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(gGlobalStorageList)
for (PRUint32 i = 0; i < NS_STID_ARRAY_UBOUND; ++i) { for (PRUint32 i = 0; i < NS_STID_ARRAY_UBOUND; ++i) {
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mInnerWindowHolders[i]) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mInnerWindowHolders[i])
} }
@ -1036,6 +1036,8 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mScriptContexts[i]) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mScriptContexts[i])
} }
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(gGlobalStorageList)
for (PRUint32 i = 0; i < NS_STID_ARRAY_UBOUND; ++i) { for (PRUint32 i = 0; i < NS_STID_ARRAY_UBOUND; ++i) {
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mInnerWindowHolders[i]) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mInnerWindowHolders[i])
} }
@ -6698,12 +6700,12 @@ nsGlobalWindow::GetGlobalStorage(nsIDOMStorageList ** aGlobalStorage)
NS_ENSURE_ARG_POINTER(aGlobalStorage); NS_ENSURE_ARG_POINTER(aGlobalStorage);
#ifdef MOZ_STORAGE #ifdef MOZ_STORAGE
if (!sGlobalStorageList) { if (!gGlobalStorageList) {
nsresult rv = NS_NewDOMStorageList(&sGlobalStorageList); nsresult rv = NS_NewDOMStorageList(getter_AddRefs(gGlobalStorageList));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
} }
*aGlobalStorage = sGlobalStorageList; *aGlobalStorage = gGlobalStorageList;
NS_IF_ADDREF(*aGlobalStorage); NS_IF_ADDREF(*aGlobalStorage);
return NS_OK; return NS_OK;

View File

@ -699,6 +699,9 @@ protected:
nsCOMPtr<nsIDOMCrypto> mCrypto; nsCOMPtr<nsIDOMCrypto> mCrypto;
nsCOMPtr<nsIDOMPkcs11> mPkcs11; nsCOMPtr<nsIDOMPkcs11> mPkcs11;
nsCOMPtr<nsIDOMStorageList> gGlobalStorageList;
nsCOMPtr<nsISupports> mInnerWindowHolders[NS_STID_ARRAY_UBOUND]; nsCOMPtr<nsISupports> mInnerWindowHolders[NS_STID_ARRAY_UBOUND];
nsCOMPtr<nsIPrincipal> mOpenerScriptPrincipal; // strong; used to determine nsCOMPtr<nsIPrincipal> mOpenerScriptPrincipal; // strong; used to determine
// whether to clear scope // whether to clear scope
@ -737,7 +740,6 @@ protected:
friend class nsDOMWindowUtils; friend class nsDOMWindowUtils;
friend class PostMessageEvent; friend class PostMessageEvent;
static nsIFactory *sComputedDOMStyleFactory; static nsIFactory *sComputedDOMStyleFactory;
static nsIDOMStorageList* sGlobalStorageList;
}; };
/* /*

View File

@ -1,6 +1,3 @@
ok(globalStorage === this["globalStorage"], "globalStorage is global check 1")
ok(globalStorage === window["globalStorage"], "globalStorage is global check 2")
function test_DOMStorage_global() function test_DOMStorage_global()
{ {
var currentDomain = "mozilla.com"; var currentDomain = "mozilla.com";
@ -160,9 +157,4 @@ function test_DOMStorage_global_Item(storage, key, expectedvalue, expectedlength
function is(left, right, str) function is(left, right, str)
{ {
window.opener.wrappedJSObject.SimpleTest.is(left, right, str); window.opener.wrappedJSObject.SimpleTest.is(left, right, str);
} }
function ok(val, str)
{
window.opener.wrappedJSObject.SimpleTest.ok(val, str);
}