Changeset 243496 in webkit


Ignore:
Timestamp:
Mar 26, 2019 8:58:36 AM (5 years ago)
Author:
ap@apple.com
Message:

Address NSWindow sometimes using WebKitTestRunnerEvent too early
https://bugs.webkit.org/show_bug.cgi?id=196211
rdar://problem/49110552

Reviewed by Tim Horton.

  • WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize):

Make sure that EventSenderProxy always exists when running tests. We used to create
it when resetting before the first test, which is a bit too late.

  • WebKitTestRunner/TestController.h:
  • WebKitTestRunner/cocoa/TestControllerCocoa.mm:

(WTR::TestController::platformCreateWebView):
(WTR::TestController::platformCreateOtherPage):
(WTR::TestController::finishCreatingPlatformWebView):

  • WebKitTestRunner/mac/PlatformWebViewMac.mm:

(WTR::PlatformWebView::PlatformWebView):
Moved some code that made NSWindow use NSEvent during web view creation. We may
need to move more if some other case us found, but this is enough for now.

Location:
trunk/Tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r243491 r243496  
     12019-03-25  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Address NSWindow sometimes using WebKitTestRunnerEvent too early
     4        https://bugs.webkit.org/show_bug.cgi?id=196211
     5        rdar://problem/49110552
     6
     7        Reviewed by Tim Horton.
     8
     9        * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize):
     10        Make sure that EventSenderProxy always exists when running tests. We used to create
     11        it when resetting before the first test, which is a bit too late.
     12
     13        * WebKitTestRunner/TestController.h:
     14        * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
     15        (WTR::TestController::platformCreateWebView):
     16        (WTR::TestController::platformCreateOtherPage):
     17        (WTR::TestController::finishCreatingPlatformWebView):
     18        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
     19        (WTR::PlatformWebView::PlatformWebView):
     20        Moved some code that made NSWindow use NSEvent during web view creation. We may
     21        need to move more if some other case us found, but this is enough for now.
     22
    1232019-03-26  Carlos Garcia Campos  <cgarcia@igalia.com>
    224
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r243482 r243496  
    459459    WKRetainPtr<WKStringRef> pageGroupIdentifier(AdoptWK, WKStringCreateWithUTF8CString("WebKitTestRunnerPageGroup"));
    460460    m_pageGroup.adopt(WKPageGroupCreateWithIdentifier(pageGroupIdentifier.get()));
     461
     462    m_eventSenderProxy = std::make_unique<EventSenderProxy>(this);
    461463}
    462464
  • trunk/Tools/WebKitTestRunner/TestController.h

    r243181 r243496  
    454454    static void runModal(PlatformWebView*);
    455455
     456#if PLATFORM(COCOA)
     457    static void finishCreatingPlatformWebView(PlatformWebView*, const TestOptions&);
     458#endif
     459
    456460    static const char* libraryPathForTesting();
    457461    static const char* platformLibraryPathForTesting();
  • trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm

    r242727 r243496  
    167167
    168168    m_mainWebView = std::make_unique<PlatformWebView>(copiedConfiguration.get(), options);
     169    finishCreatingPlatformWebView(m_mainWebView.get(), options);
    169170
    170171    if (options.punchOutWhiteBackgroundsInDarkMode)
     
    179180    WKWebViewConfiguration *newConfiguration = [[globalWebViewConfiguration copy] autorelease];
    180181    newConfiguration._relatedWebView = static_cast<WKWebView*>(parentView->platformView());
    181     return new PlatformWebView(newConfiguration, options);
     182    PlatformWebView* view = new PlatformWebView(newConfiguration, options);
     183    finishCreatingPlatformWebView(view, options);
     184    return view;
     185}
     186
     187// Code that needs to run after TestController::m_mainWebView is initialized goes into this function.
     188void TestController::finishCreatingPlatformWebView(PlatformWebView* view, const TestOptions& options)
     189{
     190#if PLATFORM(MAC)
     191    if (options.shouldShowWebView)
     192        [view->platformWindow() orderFront:nil];
     193    else
     194        [view->platformWindow() orderBack:nil];
     195#endif
    182196}
    183197
  • trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm

    r242339 r243496  
    8181    [m_window setCollectionBehavior:NSWindowCollectionBehaviorStationary];
    8282    [[m_window contentView] addSubview:m_view];
    83     if (m_options.shouldShowWebView)
    84         [m_window orderFront:nil];
    85     else
    86         [m_window orderBack:nil];
    8783    [m_window setReleasedWhenClosed:NO];
    8884}
Note: See TracChangeset for help on using the changeset viewer.