LayoutTests:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Mar 2006 19:40:40 +0000 (19:40 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Mar 2006 19:40:40 +0000 (19:40 +0000)
        Reviewed by mjs

        <http://tinymce.moxiecode.com/example_full.php?example=true>
        TinyMCE: Undo still enabled after a location change, crashes if performed

        * editing/undo/undo-iframe-location-change-expected.txt: Added.
        * editing/undo/undo-iframe-location-change.html: Added.

WebCore:

        Reviewed by mjs

        <http://tinymce.moxiecode.com/example_full.php?example=true>
        TinyMCE: Undo still enabled after a location change, crashes if performed

        Can't clear undo/redo operations registered by subframes in didOpenURL,
        because subframes have already been detached.

        * page/Frame.cpp:
        (WebCore::Frame::didOpenURL):
        (WebCore::Frame::closeURL):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@13098 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/editing/undo/undo-iframe-location-change-expected.txt [new file with mode: 0644]
LayoutTests/editing/undo/undo-iframe-location-change.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/page/Frame.cpp

index a2a47a36732ec274d389a54fb42990360e48a743..8be660e8f4b7ee2a966e8d9ab34558ebb40ee77b 100644 (file)
@@ -1,3 +1,13 @@
+2006-03-02  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by mjs
+        
+        <http://tinymce.moxiecode.com/example_full.php?example=true>
+        TinyMCE: Undo still enabled after a location change, crashes if performed
+
+        * editing/undo/undo-iframe-location-change-expected.txt: Added.
+        * editing/undo/undo-iframe-location-change.html: Added.
+
 2006-03-01  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by darin
diff --git a/LayoutTests/editing/undo/undo-iframe-location-change-expected.txt b/LayoutTests/editing/undo/undo-iframe-location-change-expected.txt
new file mode 100644 (file)
index 0000000..2392fea
--- /dev/null
@@ -0,0 +1,10 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 1 of BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of BODY > HTML > #document to 0 of BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of BODY > HTML > #document to 0 of BODY > HTML > #document toDOMRange:range from 1 of #text > BODY > HTML > #document to 1 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+
+Success
+
diff --git a/LayoutTests/editing/undo/undo-iframe-location-change.html b/LayoutTests/editing/undo/undo-iframe-location-change.html
new file mode 100644 (file)
index 0000000..6d407a9
--- /dev/null
@@ -0,0 +1,55 @@
+
+<script src="../editing.js"></script>
+<iframe name="iframe" src="../resources/contenteditable-iframe-src.html"></iframe>
+<ul id="console"></ul>
+
+<script>
+function log(message) {
+    var console = document.getElementById("console");
+    var li = document.createElement("li");
+    var text = document.createTextNode(message);
+    li.appendChild(text);
+    console.appendChild(li);
+}
+
+function part1() {
+
+    // Hack to focus the frame, should be able to do frames['iframe'].focus()
+    eventSender.mouseMoveTo(50, 50);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+    
+    // Hack to perform the editing command.  Should be able to 
+    // call execCommand on the main document.
+    frames['iframe'].document.execCommand('InsertText', false, 'c');
+    
+    window.location = window.location.toString() + "?part2";
+}
+
+function part2() {
+    if (!document.queryCommandEnabled('Undo'))
+        log("Success");
+    else
+        log("Failure, Undo was still enabled after the location changed.");
+        
+    window.layoutTestController.notifyDone();
+}
+
+function runTest() {
+    if (!window.layoutTestController)
+        return;
+
+    if (window.location.toString().indexOf("?part2") == -1) {
+        window.layoutTestController.waitUntilDone();
+        window.layoutTestController.dumpAsText();
+        // Give the iframe a moment to come into being.
+        window.setTimeout(part1, 100);
+    } else {
+        part2();
+    }
+
+}
+
+runTest();
+
+</script>
\ No newline at end of file
index 8d4912427c11a61cd90c44b418f44342c1823f19..066b7c0bc73e6d5302c0ef36273656ff8bba8df8 100644 (file)
@@ -1,3 +1,17 @@
+2006-03-02  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by mjs
+        
+        <http://tinymce.moxiecode.com/example_full.php?example=true>
+        TinyMCE: Undo still enabled after a location change, crashes if performed
+        
+        Can't clear undo/redo operations registered by subframes in didOpenURL,
+        because subframes have already been detached.
+
+        * page/Frame.cpp:
+        (WebCore::Frame::didOpenURL):
+        (WebCore::Frame::closeURL):
+
 2006-03-01  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Darin.
index 892691505655d874d4ac927cba8ce7dee845eeb2..f2f51386b3603c6fc03e432f99f5160a514db1e0 100644 (file)
@@ -210,7 +210,6 @@ bool Frame::didOpenURL(const KURL &url)
   
   // clear last edit command
   d->m_lastEditCommand = EditCommandPtr();
-  clearUndoRedoOperations();
   
   URLArgs args( d->m_extension->urlArgs() );
 
@@ -3038,6 +3037,7 @@ bool Frame::closeURL()
 {
     saveDocumentState();
     stopLoading(true);
+    clearUndoRedoOperations();
     return true;
 }