Changeset 57111 in webkit


Ignore:
Timestamp:
Apr 5, 2010 6:45:42 PM (14 years ago)
Author:
mrowe@apple.com
Message:

Test case for <http://webkit.org/b/37115> / <rdar://problem/7829331>.
REGRESSION(r56989): Crash in Mail in WebCore::Position::isCandidate when deleting block using block deletion UI

Reviewed by Adele Peterson.

WebKit/mac:

  • WebView/WebHTMLView.mm:

(-[WebHTMLView _updateFontPanel]): Ask the window whether it is the key window rather than doing the comparison
manually. This allows DumpRenderTree's override of isKeyWindow to force this code path to be taken during tests.

WebKitTools:

Add a JavaScript hook in DRT to call through to WebView's -setEditable:. This is required in order to reproduce
the crash.

  • DumpRenderTree/LayoutTestController.cpp:

(setWebViewEditableCallback):
(LayoutTestController::staticFunctions):

  • DumpRenderTree/LayoutTestController.h:
  • DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:

(LayoutTestController::setWebViewEditable):

  • DumpRenderTree/mac/DumpRenderTree.mm:

(resetWebViewToConsistentStateBeforeTesting):

  • DumpRenderTree/mac/LayoutTestControllerMac.mm:

(LayoutTestController::setWebViewEditable):

  • DumpRenderTree/win/LayoutTestControllerWin.cpp:

(LayoutTestController::setWebViewEditable):

  • DumpRenderTree/wx/LayoutTestControllerWx.cpp:

(LayoutTestController::setWebViewEditable):
(LayoutTestController::layerTreeAsText):

LayoutTests:

  • platform/mac/editing/deleting/deletionUI-successful-deletion-expected.txt: Added.
  • platform/mac/editing/deleting/deletionUI-successful-deletion.html: Added.
  • platform/mac/editing/deleting/resources/deletionUI-helpers.js:

(deletionUIDeleteButtonForElement):
(determineDeletionUIExistence):

Location:
trunk
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r57109 r57111  
     12010-04-05  Mark Rowe  <mrowe@apple.com>
     2
     3        Reviewed by Adele Peterson.
     4
     5        Test case for <http://webkit.org/b/37115> / <rdar://problem/7829331>.
     6        REGRESSION(r56989): Crash in Mail in WebCore::Position::isCandidate when deleting block using block deletion UI
     7
     8        * platform/mac/editing/deleting/deletionUI-successful-deletion-expected.txt: Added.
     9        * platform/mac/editing/deleting/deletionUI-successful-deletion.html: Added.
     10        * platform/mac/editing/deleting/resources/deletionUI-helpers.js:
     11        (deletionUIDeleteButtonForElement):
     12        (determineDeletionUIExistence):
     13
    1142010-04-05  Darin Adler  <darin@apple.com>
    215
  • trunk/LayoutTests/platform/mac/editing/deleting/resources/deletionUI-helpers.js

    r42812 r57111  
    99}
    1010
    11 function determineDeletionUIExistence(id) {
     11function deletionUIDeleteButtonForElement(id)
     12{
    1213    var sel = window.getSelection();
    1314    var selElement = document.getElementById(id);
    1415    sel.setPosition(selElement, 0);
    1516    var deleteButton = document.getElementById("WebKit-Editing-Delete-Button");
     17    return deleteButton;
     18}
     19
     20function determineDeletionUIExistence(id)
     21{
     22    var deleteButton = deletionUIDeleteButtonForElement(id);
    1623    debug(id + (deleteButton ? " HAS " : " has NO ") + "deletion UI");
    1724}
  • trunk/WebKit/mac/ChangeLog

    r57095 r57111  
     12010-04-05  Mark Rowe  <mrowe@apple.com>
     2
     3        Reviewed by Adele Peterson.
     4
     5        Test case for <http://webkit.org/b/37115> / <rdar://problem/7829331>.
     6        REGRESSION(r56989): Crash in Mail in WebCore::Position::isCandidate when deleting block using block deletion UI
     7
     8        * WebView/WebHTMLView.mm:
     9        (-[WebHTMLView _updateFontPanel]): Ask the window whether it is the key window rather than doing the comparison
     10        manually.  This allows DumpRenderTree's override of isKeyWindow to force this code path to be taken during tests.
     11
    1122010-04-05  Alexey Proskuryakov  <ap@apple.com>
    213
  • trunk/WebKit/mac/WebView/WebHTMLView.mm

    r56806 r57111  
    50285028    // FIXME: NSTextView bails out if becoming or resigning first responder, for which it has ivar flags. Not
    50295029    // sure if we need to do something similar.
    5030    
     5030
    50315031    if (![self _canEdit])
    50325032        return;
    5033    
     5033
    50345034    NSWindow *window = [self window];
    50355035    // FIXME: is this first-responder check correct? What happens if a subframe is editable and is first responder?
    5036     if ([NSApp keyWindow] != window || [window firstResponder] != self)
    5037         return;
    5038    
     5036    if (![window isKeyWindow] || [window firstResponder] != self)
     5037        return;
     5038
    50395039    bool multipleFonts = false;
    50405040    NSFont *font = nil;
     
    50435043            font = fd->getNSFont();
    50445044    }
    5045    
    50465045
    50475046    // FIXME: for now, return a bogus font that distinguishes the empty selection from the non-empty
  • trunk/WebKitTools/ChangeLog

    r57102 r57111  
     12010-04-05  Mark Rowe  <mrowe@apple.com>
     2
     3        Reviewed by Adele Peterson.
     4
     5        Test case for <http://webkit.org/b/37115> / <rdar://problem/7829331>.
     6        REGRESSION(r56989): Crash in Mail in WebCore::Position::isCandidate when deleting block using block deletion UI
     7
     8        Add a JavaScript hook in DRT to call through to WebView's -setEditable:.  This is required in order to reproduce
     9        the crash.
     10
     11        * DumpRenderTree/LayoutTestController.cpp:
     12        (setWebViewEditableCallback):
     13        (LayoutTestController::staticFunctions):
     14        * DumpRenderTree/LayoutTestController.h:
     15        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
     16        (LayoutTestController::setWebViewEditable):
     17        * DumpRenderTree/mac/DumpRenderTree.mm:
     18        (resetWebViewToConsistentStateBeforeTesting):
     19        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
     20        (LayoutTestController::setWebViewEditable):
     21        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
     22        (LayoutTestController::setWebViewEditable):
     23        * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
     24        (LayoutTestController::setWebViewEditable):
     25        (LayoutTestController::layerTreeAsText):
     26
    1272010-04-05  Darin Adler  <darin@apple.com>
    228
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.cpp

    r56934 r57111  
    13311331    return JSValueMakeUndefined(context);
    13321332}
     1333
     1334static JSValueRef setWebViewEditableCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     1335{
     1336    // Has Mac implementation
     1337    if (argumentCount < 1)
     1338        return JSValueMakeUndefined(context);
     1339
     1340    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     1341    controller->setWebViewEditable(JSValueToBoolean(context, arguments[0]));
     1342
     1343    return JSValueMakeUndefined(context);
     1344}
     1345
    13331346
    13341347// Static Values
     
    14701483        { "setAuthenticationUsername", setAuthenticationUsernameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14711484        { "setAuthorAndUserStylesEnabled", setAuthorAndUserStylesEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1485        { "setCacheModel", setCacheModelCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14721486        { "setCallCloseOnWebViews", setCallCloseOnWebViewsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14731487        { "setCanOpenWindows", setCanOpenWindowsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    1474         { "setCacheModel", setCacheModelCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14751488        { "setCloseRemainingWindowsWhenComplete", setCloseRemainingWindowsWhenCompleteCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14761489        { "setCustomPolicyDelegate", setCustomPolicyDelegateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14771490        { "setDatabaseQuota", setDatabaseQuotaCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14781491        { "setDomainRelaxationForbiddenForURLScheme", setDomainRelaxationForbiddenForURLSchemeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1492        { "setFrameFlatteningEnabled", setFrameFlatteningEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14791493        { "setGeolocationPermission", setGeolocationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14801494        { "setHandlesAuthenticationChallenges", setHandlesAuthenticationChallengesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    1481         { "setPOSIXLocale", setPOSIXLocaleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14821495        { "setIconDatabaseEnabled", setIconDatabaseEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14831496        { "setJavaScriptProfilingEnabled", setJavaScriptProfilingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14841497        { "setMainFrameIsFirstResponder", setMainFrameIsFirstResponderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1498        { "setMockGeolocationError", setMockGeolocationErrorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14851499        { "setMockGeolocationPosition", setMockGeolocationPositionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    1486         { "setMockGeolocationError", setMockGeolocationErrorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14871500        { "setNewWindowsCopyBackForwardList", setNewWindowsCopyBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1501        { "setPOSIXLocale", setPOSIXLocaleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14881502        { "setPersistentUserStyleSheetLocation", setPersistentUserStyleSheetLocationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14891503        { "setPopupBlockingEnabled", setPopupBlockingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14901504        { "setPrivateBrowsingEnabled", setPrivateBrowsingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    1491         { "setXSSAuditorEnabled", setXSSAuditorEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    1492         { "setSpatialNavigationEnabled", setSpatialNavigationEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    1493         { "setFrameFlatteningEnabled", setFrameFlatteningEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14941505        { "setSelectTrailingWhitespaceEnabled", setSelectTrailingWhitespaceEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14951506        { "setSmartInsertDeleteEnabled", setSmartInsertDeleteEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1507        { "setSpatialNavigationEnabled", setSpatialNavigationEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14961508        { "setStopProvisionalFrameLoads", setStopProvisionalFrameLoadsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14971509        { "setTabKeyCyclesThroughElements", setTabKeyCyclesThroughElementsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     
    15001512        { "setUserStyleSheetEnabled", setUserStyleSheetEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    15011513        { "setUserStyleSheetLocation", setUserStyleSheetLocationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1514        { "setWebViewEditable", setWebViewEditableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    15021515        { "setWillSendRequestClearHeader", setWillSendRequestClearHeaderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    15031516        { "setWillSendRequestReturnsNull", setWillSendRequestReturnsNullCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    15041517        { "setWillSendRequestReturnsNullOnRedirect", setWillSendRequestReturnsNullOnRedirectCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    15051518        { "setWindowIsKey", setWindowIsKeyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1519        { "setXSSAuditorEnabled", setXSSAuditorEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    15061520        { "showWebInspector", showWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    15071521        { "testOnscreen", testOnscreenCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.h

    r56934 r57111  
    241241
    242242    void setPOSIXLocale(JSStringRef locale);
    243    
     243
     244    void setWebViewEditable(bool);
     245
    244246    // The following API test functions should probably be moved to platform-specific
    245247    // unit tests outside of DRT once they exist.
  • trunk/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp

    r56952 r57111  
    644644
    645645}
     646
     647void LayoutTestController::setWebViewEditable(bool)
     648{
     649}
  • trunk/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm

    r56718 r57111  
    11431143{
    11441144    WebView *webView = [mainFrame webView];
     1145    [webView setEditable:NO];
    11451146    [(EditingDelegate *)[webView editingDelegate] setAcceptsEditing:YES];
    11461147    [webView makeTextStandardSize:nil];
  • trunk/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm

    r56934 r57111  
    712712    [view goToBackForwardItem:[[view backForwardList] currentItem]];
    713713}
     714
     715void LayoutTestController::setWebViewEditable(bool editable)
     716{
     717    WebView *view = [mainFrame webView];
     718    [view setEditable:editable];
     719}
  • trunk/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp

    r56934 r57111  
    12121212    webView->goToBackForwardItem(item.get(), &success);
    12131213}
     1214
     1215void LayoutTestController::setWebViewEditable(bool)
     1216{
     1217}
  • trunk/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp

    r57005 r57111  
    398398}
    399399
     400void LayoutTestController::setWebViewEditable(bool)
     401{
     402}
     403
    400404bool LayoutTestController::callShouldCloseOnWebView()
    401405{
     
    407411    return 0;
    408412}
    409 
Note: See TracChangeset for help on using the changeset viewer.