Bug 968766 - Part j: Remove the nsresult outparam from nsHTMLDocument::GetDocumentAllList and HTMLAllCollection::GetNamedItem; r=jst

This commit is contained in:
Ms2ger 2014-02-09 09:04:37 +01:00
parent 191c86706d
commit ce843f3b65
4 changed files with 8 additions and 17 deletions

View File

@ -132,10 +132,9 @@ HTMLAllCollection::Collection()
nsISupports*
HTMLAllCollection::GetNamedItem(const nsAString& aID,
nsWrapperCache** aCache,
nsresult* aResult)
nsWrapperCache** aCache)
{
nsContentList* docAllList = mDocument->GetDocumentAllList(aID, aResult);
nsContentList* docAllList = mDocument->GetDocumentAllList(aID);
if (!docAllList) {
return nullptr;
}
@ -226,7 +225,6 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JS::Handle<JSObject*> ob
HTMLAllCollection* allCollection = GetDocument(obj)->All();
nsISupports *result;
nsWrapperCache *cache;
nsresult rv = NS_OK;
if (JSID_IS_STRING(id)) {
if (nsDOMClassInfo::sLength_id == id) {
@ -237,12 +235,7 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JS::Handle<JSObject*> ob
// For all other strings, look for an element by id or name.
nsDependentJSString str(id);
result = allCollection->GetNamedItem(str, &cache, &rv);
if (NS_FAILED(rv)) {
xpc::Throw(cx, rv);
return false;
}
result = allCollection->GetNamedItem(str, &cache);
} else if (JSID_IS_INT(id) && JSID_TO_INT(id) >= 0) {
// Map document.all[n] (where n is a number) to the n:th item in
// the document.all node list.
@ -256,7 +249,8 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JS::Handle<JSObject*> ob
}
if (result) {
rv = WrapNative(cx, JS::CurrentGlobalOrNull(cx), result, cache, true, vp);
nsresult rv = WrapNative(cx, JS::CurrentGlobalOrNull(cx), result, cache,
true, vp);
if (NS_FAILED(rv)) {
xpc::Throw(cx, rv);

View File

@ -38,8 +38,7 @@ public:
JSObject* GetObject(JSContext* aCx, ErrorResult& aRv);
nsISupports* GetNamedItem(const nsAString& aID, nsWrapperCache** aCache,
nsresult* aResult);
nsISupports* GetNamedItem(const nsAString& aID, nsWrapperCache** aCache);
private:
nsContentList* Collection();

View File

@ -2593,10 +2593,8 @@ DocAllResultMatch(nsIContent* aContent, int32_t aNamespaceID, nsIAtom* aAtom,
nsContentList*
nsHTMLDocument::GetDocumentAllList(const nsAString& aID, nsresult *aResult)
nsHTMLDocument::GetDocumentAllList(const nsAString& aID)
{
*aResult = NS_OK;
if (nsContentList* docAllList = mAllMap.GetWeak(aID)) {
return docAllList;
}

View File

@ -105,7 +105,7 @@ public:
/**
* Returns the NodeList for document.all[aID], or null if there isn't one.
*/
nsContentList* GetDocumentAllList(const nsAString& aID, nsresult* aResult);
nsContentList* GetDocumentAllList(const nsAString& aID);
mozilla::dom::HTMLAllCollection* All();
JSObject* GetAll(JSContext* aCx, mozilla::ErrorResult& aRv);