WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
VERIFIED FIXED
5926
Assertion failure in HTMLGenericFormElementImpl::removedFromTree
https://bugs.webkit.org/show_bug.cgi?id=5926
Summary
Assertion failure in HTMLGenericFormElementImpl::removedFromTree
Alexey Proskuryakov
Reported
2005-12-03 09:55:59 PST
WebKit/WebCore/khtml/html/html_formimpl.cpp:864: failed assertion `form == m_form' Steps to reproduce (debug build of ToT): 1. open the bug URL; 2. after it finishes loading, close the window.
Attachments
Minimal testcase
(141 bytes, text/html)
2005-12-23 12:40 PST
,
Joost de Valk (AlthA)
no flags
Details
Proposed patch
(6.91 KB, patch)
2005-12-24 11:34 PST
,
mitz
no flags
Details
Formatted Diff
Diff
Reduced testcase that triggers the assert even with the patch
(221 bytes, text/html)
2005-12-27 13:34 PST
,
mitz
no flags
Details
Don't assert
(1.33 KB, patch)
2005-12-30 08:05 PST
,
mitz
no flags
Details
Formatted Diff
Diff
Corrected patch
(1.34 KB, patch)
2005-12-30 14:33 PST
,
mitz
mjs
: review-
Details
Formatted Diff
Diff
Ignore ancestor forms that aren't our form
(4.93 KB, patch)
2006-01-16 08:57 PST
,
mitz
darin
: review+
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Joost de Valk (AlthA)
Comment 1
2005-12-23 12:40:54 PST
Created
attachment 5251
[details]
Minimal testcase This is a minimal testcase for the bug, reload or close the page, and any debug build wil crash.
Joost de Valk (AlthA)
Comment 2
2005-12-23 12:41:45 PST
changed keyword NeedsReduction to HasReduction :)
mitz
Comment 3
2005-12-24 11:34:47 PST
Created
attachment 5271
[details]
Proposed patch
Maciej Stachowiak
Comment 4
2005-12-24 14:24:57 PST
Comment on
attachment 5271
[details]
Proposed patch It's a little ugly for the parser to know about this HTMLGenericFormElementImpl detail directly. Is it possible for the GenericFormElement itself to detect that it changed forms? Perhaps it can do something on removedFromDocument/insertedIntoDocument or something?
mitz
Comment 5
2005-12-24 14:39:57 PST
(In reply to
comment #4
)
> (From update of
attachment 5271
[details]
[edit]) > Is it possible for the GenericFormElement itself to detect > that it changed forms? Perhaps it can do something on > removedFromDocument/insertedIntoDocument or something?
I tried such an approach, but I couldn't differentiate between "inserted in the right place" and "inserted not where it was expected to be inserted" (in both cases insertedIntoDocument is called only once), so I ended up calling getForm() every time, which kind of defeats the presumed purpose of passing the form to the constructor. Perhaps I didn't try hard enough.
Maciej Stachowiak
Comment 6
2005-12-24 14:42:35 PST
Comment on
attachment 5271
[details]
Proposed patch r=me
mitz
Comment 7
2005-12-27 12:32:44 PST
Comment on
attachment 5271
[details]
Proposed patch The patch fixes the minimal testcase but not the given URL.
Joost de Valk (AlthA)
Comment 8
2005-12-27 12:38:27 PST
I would say, commit the patch, cause it solves a problem, and do not close the bug yet, removing the review+ seems a bit harsh.
mitz
Comment 9
2005-12-27 13:34:03 PST
Created
attachment 5307
[details]
Reduced testcase that triggers the assert even with the patch This is different from the previous reduction, in that in this case, the input element ends up belonging to form B, even though it isn't a descendant of form B. That's also what Firefox thinks should happen. However, if the input element were programatically inserted at the same place, then getForm() would be used and it would end up belonging to its ancestor, form A. Firefox says so too. I see four options: 1) Decide that the above (Firefox-compatible) behavior is correct, and remove the assert. 2) Decide that the above (Firefox-compatible) behavior is correct, add have the parser set some flag(s) on the inputElement to bypass the assert in this special case. 3) Decide that the above logic is incorrect, and change getForm() to answer "which form would the parser associate this input element with if it were here in the first place" (if the question has meaning, and if it's even possible to answer, it probably involves traversing the entire DOM tree). 4) Decide that the above logic is incorrect, and an input element's form should always be its ancestor.
mitz
Comment 10
2005-12-27 13:45:46 PST
Hmm... I checked what Firefox has to say about the original testcase, and even though it gives the same DOM tree as WebKit, where the input element is a direct descendant of form A, its form is form B. So I guess the Firefox logic when parsing is like WebKit's w/o the "proposed patch", which means that option 1) above should say "...remove the assert and don't apply the 'proposed patch'" and that the only other option that makes sense is option 4).
mitz
Comment 11
2005-12-30 08:05:59 PST
Created
attachment 5385
[details]
Don't assert According to Dave Hyatt on IRC, the assert should be yanked.
mitz
Comment 12
2005-12-30 14:31:55 PST
Comment on
attachment 5385
[details]
Don't assert I mistakenly deleted the } before the else too. That doesn't even compile!
mitz
Comment 13
2005-12-30 14:33:53 PST
Created
attachment 5388
[details]
Corrected patch
mitz
Comment 14
2005-12-30 14:34:18 PST
Comment on
attachment 5388
[details]
Corrected patch Added missing curly brace
Geoffrey Garen
Comment 15
2005-12-30 15:09:44 PST
Comment on
attachment 5388
[details]
Corrected patch Dave?
Darin Adler
Comment 16
2005-12-30 16:17:24 PST
Comment on
attachment 5388
[details]
Corrected patch I don't think it's right to just remove this assert. It's possible that a form element is being removed from the DOM tree along with a form that it's nested inside. The form the element is attached to is still in the main document's DOM tree. This code will discover the form that's being removed along with the node, but will leave the form element attached to the form still in the main document. This is not a good state -- the form from the main document has an element attached to it that's no longer in the document at all.
Maciej Stachowiak
Comment 17
2006-01-02 20:35:16 PST
Moving to r- until Darin's comment is addressed.
mitz
Comment 18
2006-01-16 08:57:17 PST
Created
attachment 5719
[details]
Ignore ancestor forms that aren't our form
Darin Adler
Comment 19
2006-01-17 00:28:30 PST
Comment on
attachment 5719
[details]
Ignore ancestor forms that aren't our form Looks fine, r=me.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug