DOMMediaListImpl* medialist = new DOMMediaListImpl(aArray, NS_STATIC_CAST(CSSStyleSheetImpl*, aSheet));
nsCOMPtr<nsISupportsArray> array; rv = NS_NewISupportsArray(getter_AddRefs(array)); if (NS_FAILED(rv)) { return NS_ERROR_OUT_OF_MEMORY; } DOMMediaListImpl* medialist = new DOMMediaListImpl(array, nsnull);
nsresult NS_NewMediaList(nsISupportsArray* aArray, nsICSSStyleSheet* aSheet, nsIMediaList** aInstancePtrResult){  NS_ASSERTION(aInstancePtrResult, "Null out param.");  DOMMediaListImpl* medialist = new DOMMediaListImpl(aArray, NS_STATIC_CAST(CSSStyleSheetImpl*, aSheet));  *aInstancePtrResult = medialist;  NS_ENSURE_TRUE(medialist, NS_ERROR_OUT_OF_MEMORY);