Reviewed by Darin.
<rdar://problem/
4523976> REGRESSION (NativeTextField): Crash occurs when choosing "Undo Typing" after typing and setting the value
* fast/forms/text-field-setvalue-crash-expected.txt: Added.
* fast/forms/text-field-setvalue-crash.html: Added.
WebCore:
Reviewed by Darin.
<rdar://problem/
4523976> REGRESSION (NativeTextField): Crash occurs when choosing "Undo Typing" after typing and setting the value
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::updateFromElement): Clear the undo
chain when the text control contents have been set
programmatically.
* bridge/mac/FrameMac.mm:
(WebCore::FrameMac::clearUndoRedoOperations): Before clearing undo
stack, close all open undo groups and then open an equal number,
since otherwise NSUndoManager ends up in an inconsistent state
leading to uncaught ObjC exceptions.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15565
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-07-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/4523976> REGRESSION (NativeTextField): Crash occurs when choosing "Undo Typing" after typing and setting the value
+
+ * fast/forms/text-field-setvalue-crash-expected.txt: Added.
+ * fast/forms/text-field-setvalue-crash.html: Added.
+
2006-07-21 Justin Garcia <justin.garcia@apple.com>
Reviewed by levi
--- /dev/null
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV to 0 of DIV toDOMRange:range from 3 of #text > DIV to 3 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV to 0 of DIV toDOMRange:range from 3 of #text > DIV to 3 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV to 0 of DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+This test checks that undoing across a programmatic change to a text field's value doesn't cause crashes or assertion failures. If this test does not crash, it has passed.
+
+
--- /dev/null
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function test()
+{
+ var emailID=document.apply.EmailAdd;
+ emailID.focus();
+ document.execCommand("InsertText", false, "aaa")
+ emailID.value="";
+ document.execCommand("InsertText", false, "aaa")
+ document.execCommand("Undo");
+ document.execCommand("Undo");
+}
+
+</script>
+
+<BODY onload="test()">
+<p>This test checks that undoing across a programmatic change to a
+text field's value doesn't cause crashes or assertion failures. If
+this test does not crash, it has passed.</p>
+
+<form name="apply">
+<input name="EmailAdd" type="text" onBlur="javascript:ValidateForm();">
+</form>
+
+</body>
+</html>
+2006-07-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/4523976> REGRESSION (NativeTextField): Crash occurs when choosing "Undo Typing" after typing and setting the value
+
+ * rendering/RenderTextControl.cpp:
+ (WebCore::RenderTextControl::updateFromElement): Clear the undo
+ chain when the text control contents have been set
+ programmatically.
+ * bridge/mac/FrameMac.mm:
+ (WebCore::FrameMac::clearUndoRedoOperations): Before clearing undo
+ stack, close all open undo groups and then open an equal number,
+ since otherwise NSUndoManager ends up in an inconsistent state
+ leading to uncaught ObjC exceptions.
+
2006-07-21 Beth Dakin <bdakin@apple.com>
Reviewed by Darin.
=== Safari-521.20 ===
+>>>>>>> .r15564
2006-07-21 Tim Omernick <timo@apple.com>
Reviewed by Beth Dakin & John Sullivan.
void FrameMac::clearUndoRedoOperations()
{
if (_haveUndoRedoOperations) {
- [[_bridge undoManager] removeAllActionsWithTarget:_bridge];
+ // workaround for <rdar://problem/4645507> NSUndoManager dies
+ // with uncaught exception when undo items cleared while
+ // groups are open
+ NSUndoManager *undoManager = [_bridge undoManager];
+ int groupingLevel = [undoManager groupingLevel];
+ for (int i = 0; i < groupingLevel; ++i)
+ [undoManager endUndoGrouping];
+
+ [undoManager removeAllActionsWithTarget:_bridge];
+
+ for (int i = 0; i < groupingLevel; ++i)
+ [undoManager beginUndoGrouping];
+
_haveUndoRedoOperations = NO;
}
}
if (value != oldText || !m_div->hasChildNodes()) {
ExceptionCode ec = 0;
m_div->setInnerText(value, ec);
+ if (document()->frame())
+ document()->frame()->clearUndoRedoOperations();
setEdited(false);
}
element->setValueMatchesRenderer();