Automation: stale elements not detected when removed from the DOM
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Mar 2018 08:28:42 +0000 (08:28 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Mar 2018 08:28:42 +0000 (08:28 +0000)
commitaf93f6050809595a08e1c9b3288ba711b812c339
tree94e562aaebcf7640e5d9e47c9206df383e16c67f
parent5d86714dfce615580774aaef6782c6c48a7449f8
Automation: stale elements not detected when removed from the DOM
https://bugs.webkit.org/show_bug.cgi?id=183278

Reviewed by Brian Burg.

We detect stale elements when the page is reloaded because the maps are recreated, but if an element is removed
from the DOM for the same document we keep the nodes in the maps. We should clear stale elements before
accessing the maps.

Fixes: imported/selenium/py/test/selenium/webdriver/common/webdriverwait_tests.py::testExpectedConditionStalenessOf

* WebProcess/Automation/WebAutomationSessionProxy.js:
(let.AutomationSessionProxy.prototype.evaluateJavaScriptFunction): Call _clearStaleNodes()
(let.AutomationSessionProxy.prototype.nodeForIdentifier): Ditto.
(let.AutomationSessionProxy.prototype._clearStaleNodes): Check if cached nodes are still in document and remove them
from the maps if they aren't.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229210 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.js