зеркало из https://github.com/mozilla/pjs.git
Fixing bug 114581. Making table.deleteRow() throw a INDEX_SIZE_ERR exception if the index is out of range, as per the DOM HTML spec. r=glazman@netscape.com, sr=jaggernaut@netscape.com
This commit is contained in:
Родитель
15aee81e59
Коммит
581f047c3b
|
@ -40,6 +40,7 @@
|
|||
#include "nsIDOMHTMLTableSectionElem.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "GenericElementCollection.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsIHTMLAttributes.h"
|
||||
|
@ -908,19 +909,21 @@ nsHTMLTableElement::DeleteRow(PRInt32 aValue)
|
|||
GetRows(getter_AddRefs(rows));
|
||||
nsCOMPtr<nsIDOMNode> row;
|
||||
|
||||
rows->Item(aValue, getter_AddRefs(row));
|
||||
nsresult rv = rows->Item(aValue, getter_AddRefs(row));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (row) {
|
||||
nsCOMPtr<nsIDOMNode> parent=nsnull;
|
||||
|
||||
row->GetParentNode(getter_AddRefs(parent));
|
||||
|
||||
if (parent) {
|
||||
nsCOMPtr<nsIDOMNode> deleted_row;
|
||||
parent->RemoveChild(row, getter_AddRefs(deleted_row));
|
||||
}
|
||||
if (!row) {
|
||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
|
||||
row->GetParentNode(getter_AddRefs(parent));
|
||||
NS_ENSURE_TRUE(parent, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> deleted_row;
|
||||
parent->RemoveChild(row, getter_AddRefs(deleted_row));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче