Title: [254330] trunk/Source/WebKit
Revision
254330
Author
[email protected]
Date
2020-01-10 00:45:56 -0800 (Fri, 10 Jan 2020)

Log Message

Automation: resolveChildFrameWithNodeHandle should return NodeNotFound when node doesn't exist
https://bugs.webkit.org/show_bug.cgi?id=205993

Reviewed by Brian Burg.

According to the spec:

"If element is stale, return error with error code stale element reference."
https://w3c.github.io/webdriver/#switch-to-frame

Fixes: imported/w3c/webdriver/tests/switch_to_frame/switch.py::test_frame_id_webelement_stale_reference

* WebProcess/Automation/WebAutomationSessionProxy.cpp:
(WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (254329 => 254330)


--- trunk/Source/WebKit/ChangeLog	2020-01-10 08:44:37 UTC (rev 254329)
+++ trunk/Source/WebKit/ChangeLog	2020-01-10 08:45:56 UTC (rev 254330)
@@ -1,5 +1,22 @@
 2020-01-10  Carlos Garcia Campos  <[email protected]>
 
+        Automation: resolveChildFrameWithNodeHandle should return NodeNotFound when node doesn't exist
+        https://bugs.webkit.org/show_bug.cgi?id=205993
+
+        Reviewed by Brian Burg.
+
+        According to the spec:
+
+        "If element is stale, return error with error code stale element reference."
+        https://w3c.github.io/webdriver/#switch-to-frame
+
+        Fixes: imported/w3c/webdriver/tests/switch_to_frame/switch.py::test_frame_id_webelement_stale_reference
+
+        * WebProcess/Automation/WebAutomationSessionProxy.cpp:
+        (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
+
+2020-01-10  Carlos Garcia Campos  <[email protected]>
+
         Automation: evaluateJavaScriptFunction should use Promises
         https://bugs.webkit.org/show_bug.cgi?id=204151
 

Modified: trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp (254329 => 254330)


--- trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp	2020-01-10 08:44:37 UTC (rev 254329)
+++ trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp	2020-01-10 08:45:56 UTC (rev 254330)
@@ -439,6 +439,12 @@
     }
 
     WebCore::Element* coreElement = elementForNodeHandle(*frame, nodeHandle);
+    if (!coreElement) {
+        String nodeNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::NodeNotFound);
+        completionHandler(nodeNotFoundErrorType, WTF::nullopt);
+        return;
+    }
+
     if (!is<WebCore::HTMLFrameElementBase>(coreElement)) {
         completionHandler(frameNotFoundErrorType, WTF::nullopt);
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to