Changeset 268867 in webkit


Ignore:
Timestamp:
Oct 22, 2020 9:01:40 AM (21 months ago)
Author:
commit-queue@webkit.org
Message:

Elements in Shadow DOM are wrongly marked as stale by the WebDriver
https://bugs.webkit.org/show_bug.cgi?id=217635

Patch by Nitzan Uziely <linkgoron@gmail.com> on 2020-10-22
Reviewed by Brian Burg.

Source/WebDriver:

Changed stale checking, to check if the root node is the document element,
instead of document.contains which doesn't work for elements in Shadow DOM.

  • Session.cpp:

(WebDriver::Session::elementSendKeys):

Source/WebKit:

Fixed the focus script to work for elements in Shadow DOM
instead of declaring them as not interactable.

  • WebProcess/Automation/WebAutomationSessionProxy.js:

(let.AutomationSessionProxy.prototype._clearStaleNodes):
(let.AutomationSessionProxy):

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebDriver/ChangeLog

    r268793 r268867  
     12020-10-22  Nitzan Uziely  <linkgoron@gmail.com>
     2
     3        Elements in Shadow DOM are wrongly marked as stale by the WebDriver
     4        https://bugs.webkit.org/show_bug.cgi?id=217635
     5
     6        Reviewed by Brian Burg.
     7
     8        Changed stale checking, to check if the root node is the document element,
     9        instead of document.contains which doesn't work for elements in Shadow DOM.
     10
     11        * Session.cpp:
     12        (WebDriver::Session::elementSendKeys):
     13
    1142020-10-21  Carlos Garcia Campos  <cgarcia@igalia.com>
    215
  • trunk/Source/WebDriver/Session.cpp

    r268793 r268867  
    20952095                    "    let doc = element.ownerDocument || element;"
    20962096                    "    let prevActiveElement = doc.activeElement;"
    2097                     "    if (element != prevActiveElement && prevActiveElement)"
     2097                    "    let elementRootNode = element.getRootNode();"
     2098                    "    if (elementRootNode.activeElement !== element && prevActiveElement)"
    20982099                    "        prevActiveElement.blur();"
    20992100                    "    element.focus();"
     
    21042105                    "    if (isTextElement && element.selectionEnd == 0)"
    21052106                    "        element.setSelectionRange(element.value.length, element.value.length);"
    2106                     "    if (element != doc.activeElement)"
     2107                    "    if (elementRootNode.activeElement !== element)"
    21072108                    "        throw {name: 'ElementNotInteractable', message: 'Element is not focusable.'};"
    21082109                    "}";
  • trunk/Source/WebKit/ChangeLog

    r268866 r268867  
     12020-10-22  Nitzan Uziely  <linkgoron@gmail.com>
     2
     3        Elements in Shadow DOM are wrongly marked as stale by the WebDriver
     4        https://bugs.webkit.org/show_bug.cgi?id=217635
     5
     6        Reviewed by Brian Burg.
     7
     8        Fixed the focus script to work for elements in Shadow DOM
     9        instead of declaring them as not interactable.
     10
     11        * WebProcess/Automation/WebAutomationSessionProxy.js:
     12        (let.AutomationSessionProxy.prototype._clearStaleNodes):
     13        (let.AutomationSessionProxy):
     14
    1152020-10-22  Aditya Keerthi  <akeerthi@apple.com>
    216
  • trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.js

    r254329 r268867  
    253253    {
    254254        for (var [node, identifier] of this._nodeToIdMap) {
    255             if (!document.contains(node)) {
     255            const rootNode = node.getRootNode({ composed: true });
     256            if (rootNode !== document) {
    256257                this._nodeToIdMap.delete(node);
    257258                this._idToNodeMap.delete(identifier);
Note: See TracChangeset for help on using the changeset viewer.