Commit c13fdb2e authored by Shengfa Lin's avatar Shengfa Lin Committed by Commit Bot

[chromedriver] Fix javascript check node is reachable for Proxy

The root level node could be a javascript Proxy
object(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy)
instead of the document itself. In this case, we cannot use "==
document" to check if an element is reachable and generate the stale element
error. Instead, we will use "== document.documentElement.parentNode",
which should be document or the Proxy node.

Bug: chromedriver:3628
Change-Id: Ie7c7c78e0e796dcf3023aa1d5385fa95bd139ba0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2502576Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
Commit-Queue: Shengfa Lin <shengfa@google.com>
Cr-Commit-Position: refs/heads/master@{#821428}
parent 129185f5
...@@ -134,7 +134,7 @@ CacheWithUUID.prototype = { ...@@ -134,7 +134,7 @@ CacheWithUUID.prototype = {
*/ */
isNodeReachable_: function(node) { isNodeReachable_: function(node) {
var nodeRoot = getNodeRootThroughAnyShadows(node); var nodeRoot = getNodeRootThroughAnyShadows(node);
return (nodeRoot == document); return (nodeRoot == document.documentElement.parentNode);
} }
...@@ -202,7 +202,7 @@ Cache.prototype = { ...@@ -202,7 +202,7 @@ Cache.prototype = {
*/ */
isNodeReachable_: function(node) { isNodeReachable_: function(node) {
var nodeRoot = getNodeRootThroughAnyShadows(node); var nodeRoot = getNodeRootThroughAnyShadows(node);
return (nodeRoot == document); return (nodeRoot == document.documentElement.parentNode);
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment