Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Unified Diff: third_party/WebKit/Source/core/html/HTMLTableSectionElement.cpp

Issue 1771043004: tbody.deleteRow(-1) should never throw an exception (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLTableSectionElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLTableSectionElement.cpp b/third_party/WebKit/Source/core/html/HTMLTableSectionElement.cpp
index 4c602ca3aaa390a0c59cdc8a22f3cef0b3b7b670..89198c3e369b4cd1705ad9782a621e171c93a76a 100644
--- a/third_party/WebKit/Source/core/html/HTMLTableSectionElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLTableSectionElement.cpp
@@ -74,8 +74,11 @@ void HTMLTableSectionElement::deleteRow(int index, ExceptionState& exceptionStat
{
RefPtrWillBeRawPtr<HTMLCollection> children = rows();
int numRows = children ? (int)children->length() : 0;
- if (index == -1)
+ if (index == -1) {
+ if (!numRows)
+ return;
index = numRows - 1;
+ }
if (index >= 0 && index < numRows) {
RefPtrWillBeRawPtr<Element> row = children->item(index);
HTMLElement::removeChild(row.get(), exceptionState);
« no previous file with comments | « third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/tabular-data/the-tbody-element/deleteRow-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698