зеркало из https://github.com/mozilla/pjs.git
Bug 649997 part 2. Change nsIHTMLCollection::GetNodeAt to not use an nsresult outparam. r=peterv
This commit is contained in:
Родитель
0dc40dfd54
Коммит
c05ccf5f1e
|
@ -615,13 +615,6 @@ nsContentList::GetNodeAt(PRUint32 aIndex)
|
|||
return Item(aIndex, PR_TRUE);
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
nsContentList::GetNodeAt(PRUint32 aIndex, nsresult* aResult)
|
||||
{
|
||||
*aResult = NS_OK;
|
||||
return Item(aIndex, PR_TRUE);
|
||||
}
|
||||
|
||||
nsISupports*
|
||||
nsContentList::GetNamedItem(const nsAString& aName, nsWrapperCache **aCache,
|
||||
nsresult* aResult)
|
||||
|
|
|
@ -260,7 +260,7 @@ public:
|
|||
virtual PRInt32 IndexOf(nsIContent* aContent);
|
||||
|
||||
// nsIHTMLCollection
|
||||
virtual nsIContent* GetNodeAt(PRUint32 aIndex, nsresult* aResult);
|
||||
// GetNodeAt already declared as part of nsINodeList
|
||||
virtual nsISupports* GetNamedItem(const nsAString& aName,
|
||||
nsWrapperCache** aCache,
|
||||
nsresult* aResult);
|
||||
|
|
|
@ -45,8 +45,8 @@ class nsWrapperCache;
|
|||
|
||||
// IID for the nsIHTMLCollection interface
|
||||
#define NS_IHTMLCOLLECTION_IID \
|
||||
{ 0xf38b43dc, 0x74d4, 0x4b11, \
|
||||
{ 0xa6, 0xc9, 0xf8, 0xf4, 0xb5, 0xd3, 0x84, 0xe3 } }
|
||||
{ 0xf615e447, 0xbdab, 0x4469, \
|
||||
{ 0x92, 0x7c, 0x15, 0xb3, 0xed, 0x07, 0x36, 0x2e } }
|
||||
|
||||
/**
|
||||
* An internal interface that allows QI-less getting of nodes from HTML
|
||||
|
@ -60,7 +60,7 @@ public:
|
|||
/**
|
||||
* Get the node at the index. Returns null if the index is out of bounds.
|
||||
*/
|
||||
virtual nsIContent* GetNodeAt(PRUint32 aIndex, nsresult* aResult) = 0;
|
||||
virtual nsIContent* GetNodeAt(PRUint32 aIndex) = 0;
|
||||
|
||||
/**
|
||||
* Get the node for the name. Returns null if no node exists for the name.
|
||||
|
|
|
@ -121,12 +121,10 @@ public:
|
|||
// nsIDOMHTMLCollection interface
|
||||
NS_DECL_NSIDOMHTMLCOLLECTION
|
||||
|
||||
virtual nsIContent* GetNodeAt(PRUint32 aIndex, nsresult* aResult)
|
||||
virtual nsIContent* GetNodeAt(PRUint32 aIndex)
|
||||
{
|
||||
FlushPendingNotifications();
|
||||
|
||||
*aResult = NS_OK;
|
||||
|
||||
return mElements.SafeElementAt(aIndex, nsnull);
|
||||
}
|
||||
virtual nsISupports* GetNamedItem(const nsAString& aName,
|
||||
|
@ -2306,7 +2304,7 @@ NS_IMETHODIMP
|
|||
nsFormControlList::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsresult rv;
|
||||
nsISupports* item = GetNodeAt(aIndex, &rv);
|
||||
nsISupports* item = GetNodeAt(aIndex);
|
||||
if (!item) {
|
||||
*aReturn = nsnull;
|
||||
|
||||
|
|
|
@ -2169,22 +2169,19 @@ nsHTMLOptionCollection::SetSelectedIndex(PRInt32 aSelectedIndex)
|
|||
NS_IMETHODIMP
|
||||
nsHTMLOptionCollection::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsresult rv;
|
||||
nsISupports* item = GetNodeAt(aIndex, &rv);
|
||||
nsISupports* item = GetNodeAt(aIndex);
|
||||
if (!item) {
|
||||
*aReturn = nsnull;
|
||||
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return CallQueryInterface(item, aReturn);
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
nsHTMLOptionCollection::GetNodeAt(PRUint32 aIndex, nsresult* aResult)
|
||||
nsHTMLOptionCollection::GetNodeAt(PRUint32 aIndex)
|
||||
{
|
||||
*aResult = NS_OK;
|
||||
|
||||
return static_cast<nsIContent*>(ItemAsOption(aIndex));
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
// nsIDOMHTMLCollection interface, all its methods are defined in
|
||||
// nsIDOMHTMLOptionsCollection
|
||||
|
||||
virtual nsIContent* GetNodeAt(PRUint32 aIndex, nsresult* aResult);
|
||||
virtual nsIContent* GetNodeAt(PRUint32 aIndex);
|
||||
virtual nsISupports* GetNamedItem(const nsAString& aName,
|
||||
nsWrapperCache** aCache,
|
||||
nsresult* aResult);
|
||||
|
|
|
@ -126,7 +126,7 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_NSIDOMHTMLCOLLECTION
|
||||
|
||||
virtual nsIContent* GetNodeAt(PRUint32 aIndex, nsresult* aResult);
|
||||
virtual nsIContent* GetNodeAt(PRUint32 aIndex);
|
||||
virtual nsISupports* GetNamedItem(const nsAString& aName,
|
||||
nsWrapperCache **aCache,
|
||||
nsresult* aResult);
|
||||
|
@ -281,7 +281,7 @@ GetItemOrCountInRowGroup(nsIDOMHTMLCollection* rows,
|
|||
}
|
||||
|
||||
nsIContent*
|
||||
TableRowsCollection::GetNodeAt(PRUint32 aIndex, nsresult *aResult)
|
||||
TableRowsCollection::GetNodeAt(PRUint32 aIndex)
|
||||
{
|
||||
DO_FOR_EACH_ROWGROUP(
|
||||
PRUint32 count;
|
||||
|
@ -294,21 +294,17 @@ TableRowsCollection::GetNodeAt(PRUint32 aIndex, nsresult *aResult)
|
|||
aIndex -= count;
|
||||
);
|
||||
|
||||
*aResult = NS_OK;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TableRowsCollection::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsISupports* node = GetNodeAt(aIndex, &rv);
|
||||
nsISupports* node = GetNodeAt(aIndex);
|
||||
if (!node) {
|
||||
*aReturn = nsnull;
|
||||
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return CallQueryInterface(node, aReturn);
|
||||
|
|
|
@ -8351,7 +8351,7 @@ nsHTMLCollectionSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
|||
#endif
|
||||
|
||||
nsINode *item;
|
||||
*aCache = item = collection->GetNodeAt(aIndex, aResult);
|
||||
*aCache = item = collection->GetNodeAt(aIndex);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
@ -8413,7 +8413,7 @@ nsContentListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
|||
nsContentList *list = nsContentList::FromSupports(aNative);
|
||||
|
||||
nsIContent *item;
|
||||
*aCache = item = list->GetNodeAt(aIndex, aResult);
|
||||
*aCache = item = list->GetNodeAt(aIndex);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
@ -9491,8 +9491,7 @@ nsHTMLSelectElementSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext
|
|||
|
||||
nsHTMLOptionCollection *options = s->GetOptions();
|
||||
if (options) {
|
||||
nsresult rv;
|
||||
nsISupports *node = options->GetNodeAt(n, &rv);
|
||||
nsISupports *node = options->GetNodeAt(n);
|
||||
if (node) {
|
||||
*objp = obj;
|
||||
*_retval = JS_DefineElement(cx, obj, n, JSVAL_VOID, nsnull, nsnull,
|
||||
|
@ -9521,7 +9520,7 @@ nsHTMLSelectElementSH::GetProperty(nsIXPConnectWrappedNative *wrapper,
|
|||
nsHTMLOptionCollection *options = s->GetOptions();
|
||||
|
||||
if (options) {
|
||||
nsISupports *node = options->GetNodeAt(n, &rv);
|
||||
nsISupports *node = options->GetNodeAt(n);
|
||||
|
||||
rv = WrapNative(cx, JS_GetGlobalForScopeChain(cx), node,
|
||||
&NS_GET_IID(nsIDOMNode), PR_TRUE, vp);
|
||||
|
|
Загрузка…
Ссылка в новой задаче