Fixed <rdar://problem/
4532113> REGRESSION (NativeTextField): Crash occurs after modifying field then reloading page -[FormDelegate frameLayoutHasChanged:]
added a manual test because of the need to use AutoFill.
* dom/Node.h:
(WebCore::Node::aboutToUnload):
added virtual function prototype
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::aboutToUnload):
added implementation that sends textFieldDidEndEditing notification
* html/HTMLInputElement.h:
added virtual function prototype
* manual-tests/input-type-file-autocomplete-frame-1.html: Added.
* manual-tests/input-type-file-autocomplete-frame-2.html: Added.
* manual-tests/input-type-file-autocomplete-refresh.html: Added.
* page/Frame.cpp:
(WebCore::Frame::stopLoading):
before unloading, call aboutToUnload on the current focused node
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15550
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-07-20 Alice Liu <alice.liu@apple.com>
+
+ Reviewed by Adele.
+
+ Fixed <rdar://problem/4532113> REGRESSION (NativeTextField): Crash occurs after modifying field then reloading page -[FormDelegate frameLayoutHasChanged:]
+ added a manual test because of the need to use AutoFill.
+
+ * dom/Node.h:
+ (WebCore::Node::aboutToUnload):
+ added virtual function prototype
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::aboutToUnload):
+ added implementation that sends textFieldDidEndEditing notification
+ * html/HTMLInputElement.h:
+ added virtual function prototype
+ * manual-tests/input-type-file-autocomplete-frame-1.html: Added.
+ * manual-tests/input-type-file-autocomplete-frame-2.html: Added.
+ * manual-tests/input-type-file-autocomplete-refresh.html: Added.
+ * page/Frame.cpp:
+ (WebCore::Frame::stopLoading):
+ before unloading, call aboutToUnload on the current focused node
+
2006-07-20 Brady Eidson <beidson@apple.com>
Reviewed by Maciej
// but making parsing a special case in this respect should be avoided if possible.
virtual void closeRenderer() { }
+ // Called by the frame right before dispatching an unloadEvent. [Radar 4532113]
+ // This is needed for HTMLInputElements to tell the frame that it is done editing
+ // (sends textFieldDidEndEditing notification)
+ virtual void aboutToUnload() { }
+
// For <link> and <style> elements.
virtual void sheetLoaded() { }
HTMLGenericFormElement::updateFocusAppearance();
}
+void HTMLInputElement::aboutToUnload()
+{
+ if (isNonWidgetTextField() && document()->frame())
+ document()->frame()->textFieldDidEndEditing(this);
+}
+
void HTMLInputElement::dispatchFocusEvent()
{
if (isNonWidgetTextField())
virtual void dispatchFocusEvent();
virtual void dispatchBlurEvent();
virtual void updateFocusAppearance();
+ virtual void aboutToUnload();
virtual const AtomicString& name() const;
--- /dev/null
+<html>
+<body>
+<p><b>BUG ID:</b> <a href="<rdar://problem/4532113> REGRESSION (NativeTextField): Crash occurs after modifying field then reloading page -[FormDelegate frameLayoutHasChanged:]">4532113</a> REGRESSION (NativeTextField): Crash occurs after modifying field then reloading page -[FormDelegate frameLayoutHasChanged:]</p>
+
+<p id="test" style="background-color:skyblue; padding:3px;"><b>STEPS TO TEST:</b>
+<ol>
+<li> enable Safari's auto fill
+<li> type something in the input field, and press enter to register it with autofill
+<li> clear the field and type part of the same string you did previously
+<li> without ever removing focus from the input field, select the suggestion autofill suggests
+<li> refresh the page or go to a bookmark (don't remove focus from the input field)
+</ol>
+</p>
+
+<p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b>
+no crash.
+</p>
+
+<p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>
+Crash in -[FormDelegate frameLayoutHasChanged:]
+</p>
+</body>
+</html>
--- /dev/null
+<html>
+<body>
+<table><tr><td>
+<form><input size=55 value="type something in here"></form>
+</td></tr></table>
+</body>
+</html>
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+
+<frameset rows="50%,50%">
+ <frame src="./input-type-file-autocomplete-frame-1.html">
+ <frame src="./input-type-file-autocomplete-frame-2.html">
+</frameset>
+
+</html>
#include "HTMLGenericFormElement.h"
#include "HTMLNames.h"
#include "HTMLObjectElement.h"
+#include "HTMLInputElement.h"
#include "ImageDocument.h"
#include "MediaFeatureNames.h"
#include "MouseEventWithHitTestResults.h"
if (sendUnload) {
if (d->m_doc) {
if (d->m_bLoadEventEmitted && !d->m_bUnloadEventEmitted) {
+ Node* currentFocusNode = d->m_doc->focusNode();
+ if (currentFocusNode)
+ currentFocusNode->aboutToUnload();
d->m_doc->dispatchWindowEvent(unloadEvent, false, false);
if (d->m_doc)
d->m_doc->updateRendering();