Changeset 269851 in webkit


Ignore:
Timestamp:
Nov 16, 2020 6:05:59 AM (3 years ago)
Author:
commit-queue@webkit.org
Message:

WebDriver: do not focus the main frame when switching to a window
https://bugs.webkit.org/show_bug.cgi?id=218383

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2020-11-16
Reviewed by Brian Burg.

The spec doesn't say we should focus the main frame. This is confusing WPT test
infrastructure/testdriver/actions/crossOrigin.sub.html that first focuses an input in an iframe and then it send
keyboard events to the window (after switching to the window again even when it's already the current one, that
causes the iframe focus to be lost).

  • UIProcess/Automation/WebAutomationSession.cpp:

(WebKit::WebAutomationSession::switchToBrowsingContext):

  • WebProcess/Automation/WebAutomationSessionProxy.cpp:
  • WebProcess/Automation/WebAutomationSessionProxy.h:
  • WebProcess/Automation/WebAutomationSessionProxy.messages.in:
Location:
trunk/Source/WebKit
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r269850 r269851  
     12020-11-16  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        WebDriver: do not focus the main frame when switching to a window
     4        https://bugs.webkit.org/show_bug.cgi?id=218383
     5
     6        Reviewed by Brian Burg.
     7
     8        The spec doesn't say we should focus the main frame. This is confusing WPT test
     9        infrastructure/testdriver/actions/crossOrigin.sub.html that first focuses an input in an iframe and then it send
     10        keyboard events to the window (after switching to the window again even when it's already the current one, that
     11        causes the iframe focus to be lost).
     12
     13        * UIProcess/Automation/WebAutomationSession.cpp:
     14        (WebKit::WebAutomationSession::switchToBrowsingContext):
     15        * WebProcess/Automation/WebAutomationSessionProxy.cpp:
     16        * WebProcess/Automation/WebAutomationSessionProxy.h:
     17        * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
     18
    1192020-11-16  Kimmo Kinnunen  <kkinnunen@apple.com>
    220
  • trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp

    r269421 r269851  
    376376    m_client->requestSwitchToPage(*this, *page, [frameID, page = makeRef(*page), callback = WTFMove(callback)]() {
    377377        page->setFocus(true);
    378         page->process().send(Messages::WebAutomationSessionProxy::FocusFrame(page->webPageID(), frameID), 0);
    379378
    380379        callback->sendSuccess();
  • trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp

    r268383 r269851  
    565565}
    566566
    567 void WebAutomationSessionProxy::focusFrame(WebCore::PageIdentifier pageID, Optional<WebCore::FrameIdentifier> frameID)
    568 {
    569     WebPage* page = WebProcess::singleton().webPage(pageID);
    570     if (!page)
    571         return;
    572 
    573     auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
    574     if (!frame)
    575         return;
    576 
    577     WebCore::Frame* coreFrame = frame->coreFrame();
    578     if (!coreFrame)
    579         return;
    580 
    581     WebCore::Document* coreDocument = coreFrame->document();
    582     if (!coreDocument)
    583         return;
    584 
    585     WebCore::DOMWindow* coreDOMWindow = coreDocument->domWindow();
    586     if (!coreDOMWindow)
    587         return;
    588 
    589     coreDOMWindow->focus(true);
    590 }
    591 
    592567static WebCore::Element* containerElementForElement(WebCore::Element& element)
    593568{
  • trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h

    r260653 r269851  
    7676    void resolveChildFrameWithName(WebCore::PageIdentifier, Optional<WebCore::FrameIdentifier>, const String& name, CompletionHandler<void(Optional<String>, Optional<WebCore::FrameIdentifier>)>&&);
    7777    void resolveParentFrame(WebCore::PageIdentifier, Optional<WebCore::FrameIdentifier>, CompletionHandler<void(Optional<String>, Optional<WebCore::FrameIdentifier>)>&&);
    78     void focusFrame(WebCore::PageIdentifier, Optional<WebCore::FrameIdentifier>);
    7978    void computeElementLayout(WebCore::PageIdentifier, Optional<WebCore::FrameIdentifier>, String nodeHandle, bool scrollIntoViewIfNeeded, CoordinateSystem, CompletionHandler<void(Optional<String>, WebCore::IntRect, Optional<WebCore::IntPoint>, bool)>&&);
    8079    void selectOptionElement(WebCore::PageIdentifier, Optional<WebCore::FrameIdentifier>, String nodeHandle, CompletionHandler<void(Optional<String>)>&&);
  • trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in

    r255343 r269851  
    2929    ResolveParentFrame(WebCore::PageIdentifier pageID, Optional<WebCore::FrameIdentifier> frameID) -> (Optional<String> errorType, Optional<WebCore::FrameIdentifier> frameID) Async
    3030
    31     FocusFrame(WebCore::PageIdentifier pageID, Optional<WebCore::FrameIdentifier> frameID)
    32 
    3331    ComputeElementLayout(WebCore::PageIdentifier pageID, Optional<WebCore::FrameIdentifier> frameID, String nodeHandle, bool scrollIntoViewIfNeeded, enum:uint8_t WebKit::CoordinateSystem coordinateSystem) -> (Optional<String> errorType, WebCore::IntRect rect, Optional<WebCore::IntPoint> inViewCenterPoint, bool isObscured) Async
    3432
Note: See TracChangeset for help on using the changeset viewer.