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)
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


No differences found