Bug 24626 - REGRESSION: undo-iframe-location-change.html is failing on the buildbots
Summary: REGRESSION: undo-iframe-location-change.html is failing on the buildbots
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P1 Normal
Assignee: Nobody
URL: http://build.webkit.org/results/trunk...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-16 13:20 PDT by Eric Seidel (no email)
Modified: 2009-03-16 13:57 PDT (History)
2 users (show)

See Also:


Attachments
Reviewed by Sam Weinig. (1.42 KB, patch)
2009-03-16 13:56 PDT, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2009-03-16 13:20:48 PDT
http://build.webkit.org/results/trunk-mac-ppc-release/16864/editing/undo/undo-iframe-location-change-diffs.txt

I've debugged it a little.  It seems that 

bool WebEditorClient::canUndo() const
{
    return [[m_webView undoManager] canUndo];
}

is actually returning "true".

void WebEditorClient::clearUndoRedoOperations()
{
    if (m_haveUndoRedoOperations) {
        // workaround for <rdar://problem/4645507> NSUndoManager dies
        // with uncaught exception when undo items cleared while
        // groups are open
        NSUndoManager *undoManager = [m_webView undoManager];
        int groupingLevel = [undoManager groupingLevel];
        for (int i = 0; i < groupingLevel; ++i)
            [undoManager endUndoGrouping];
        
        [undoManager removeAllActionsWithTarget:m_undoTarget.get()];
        
        for (int i = 0; i < groupingLevel; ++i)
            [undoManager beginUndoGrouping];
        
        m_haveUndoRedoOperations = NO;
        ASSERT(![undoManager canUndo]); // I ADDED THIS, IT FAILS!
    }
}

Should be called from 

bool FrameLoader::closeURL()
{
    saveDocumentState();
    stopLoading(true);
    m_frame->editor()->clearUndoRedoOperations();
    return true;
}

which it is, correctly.  The problem is that [undoManager canUndo] is still true after calling clearUndoRedoOperations().  The test expects it to be false.  Maybe other things in the undo stack (non-editing related) are causing this test to fail?

I could change the test to call execCommand("redo") a bunch before running?  Maybe that would fix the test failure.
Comment 1 Eric Seidel (no email) 2009-03-16 13:56:50 PDT
Created attachment 28659 [details]
        Reviewed by Sam Weinig.


        REGRESSION: undo-iframe-location-change.html is failing on the buildbots
        https://bugs.webkit.org/show_bug.cgi?id=24626

        Added a call to [[webview undoManager] removeAllActions]
        to make sure anything left on the undo stack after one test
        will not affect any later test.

        * DumpRenderTree/mac/DumpRenderTree.mm:
        (resetWebViewToConsistentStateBeforeTesting):
---
 WebKitTools/ChangeLog                            |   14 ++++++++++++++
 WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm |    1 +
 2 files changed, 15 insertions(+), 0 deletions(-)
Comment 2 Eric Seidel (no email) 2009-03-16 13:57:13 PDT
Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	WebKitTools/ChangeLog
	M	WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
Committed r41740