Bug 9358

Summary: REGRESSION: Assertion failure in HTMLInputElement::setValueFromRenderer (value == constrainValue(value)) when deleting all text
Product: WebKit Reporter: mitz
Component: FormsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: aapo-bugzilla, adele, ap, darin, ddkilzer, ian, justin.garcia, sullivan
Priority: P1 Keywords: Regression
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
URL: data:text/html,<input value="X">
Attachments:
Description Flags
Patch v1 (no changelog; no test)
darin: review-
Patch v2 darin: review+

mitz
Reported 2006-06-08 07:35:36 PDT
I hit this assert when I try to delete the X in the field using the delete key: ASSERTION FAILED: value == constrainValue(value) (WebCore/html/HTMLInputElement.cpp:1068 void WebCore::HTMLInputElement::setValueFromRenderer(const WebCore::String&))
Attachments
Patch v1 (no changelog; no test) (690 bytes, patch)
2006-06-29 08:18 PDT, David Kilzer (:ddkilzer)
darin: review-
Patch v2 (5.20 KB, patch)
2006-06-30 08:42 PDT, David Kilzer (:ddkilzer)
darin: review+
mitz
Comment 1 2006-06-08 07:55:08 PDT
The root cause seems to be that now when you delete the last character, a <br> placeholder is inserted.
Justin Garcia
Comment 2 2006-06-08 11:40:47 PDT
Look like textContent returns "\n" for a br even if its collapsed. value = "\n" and constrainValue(value) = "".
David Kilzer (:ddkilzer)
Comment 3 2006-06-10 08:20:53 PDT
Grrr! I Just ran into this on Bugzilla's simple search page, and it killed my browser!
David Kilzer (:ddkilzer)
Comment 4 2006-06-13 15:47:01 PDT
This is also a regression (so to speak).
David Kilzer (:ddkilzer)
Comment 5 2006-06-13 15:47:22 PDT
*** Bug 9429 has been marked as a duplicate of this bug. ***
mitz
Comment 6 2006-06-22 02:38:22 PDT
*** Bug 9542 has been marked as a duplicate of this bug. ***
David Kilzer (:ddkilzer)
Comment 7 2006-06-29 08:18:30 PDT
Created attachment 9089 [details] Patch v1 (no changelog; no test) I crash from this assertion daily on my debug build.  Tell me what's wrong with this patch so it can be fixed properly.  :)
Darin Adler
Comment 8 2006-06-29 08:30:09 PDT
Comment on attachment 9089 [details] Patch v1 (no changelog; no test) It's driving me crazy too! This is an acceptable workaround for the problem, but not the right way to fix the problem. I don't want an extra call to constrainValue here in the production code in the long term. I'd prefer isEmpty() to length() == 0, and I'd like a comment here that explains exactly why we need a special case. Perhaps a better way to do it would be to add code like this before the assert:     // Workaround for bug where trailing \n is included in the result of textContent.     // <URL of a new bug report>      if (value == "\n")         value = "";
David Kilzer (:ddkilzer)
Comment 9 2006-06-29 23:50:52 PDT
(In reply to comment #8) >     // Workaround for bug where trailing \n is included in the result of > textContent. >     // <URL of a new bug report> Bug 9661 filed for the follow-up issue.
David Kilzer (:ddkilzer)
Comment 10 2006-06-30 08:42:26 PDT
Created attachment 9106 [details] Patch v2 Patch v2 includes ChangeLogs, a layout test, and addresses Darin's comments.
David Kilzer (:ddkilzer)
Comment 11 2006-06-30 08:43:13 PDT
(In reply to comment #10) > Patch v2 includes ChangeLogs, a layout test, and addresses Darin's comments. It also passed all layout tests.
Darin Adler
Comment 12 2006-06-30 11:12:16 PDT
Comment on attachment 9106 [details] Patch v2 OK. r=me
David Kilzer (:ddkilzer)
Comment 13 2006-06-30 12:04:31 PDT
Committed revision 15111!
Note You need to log in before you can comment on or make changes to this bug.