Title: [229276] releases/WebKitGTK/webkit-2.20/Source/WebKit
- Revision
- 229276
- Author
- [email protected]
- Date
- 2018-03-05 05:18:13 -0800 (Mon, 05 Mar 2018)
Log Message
Merge r229210 - 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.
Modified Paths
Diff
Modified: releases/WebKitGTK/webkit-2.20/Source/WebKit/ChangeLog (229275 => 229276)
--- releases/WebKitGTK/webkit-2.20/Source/WebKit/ChangeLog 2018-03-05 13:18:09 UTC (rev 229275)
+++ releases/WebKitGTK/webkit-2.20/Source/WebKit/ChangeLog 2018-03-05 13:18:13 UTC (rev 229276)
@@ -1,3 +1,22 @@
+2018-03-05 Carlos Garcia Campos <[email protected]>
+
+ 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.
+
2018-03-01 Antti Koivisto <[email protected]>
Crash when updating cache entry after validation in apps that uses class A file protection
Modified: releases/WebKitGTK/webkit-2.20/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.js (229275 => 229276)
--- releases/WebKitGTK/webkit-2.20/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.js 2018-03-05 13:18:09 UTC (rev 229275)
+++ releases/WebKitGTK/webkit-2.20/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.js 2018-03-05 13:18:13 UTC (rev 229276)
@@ -46,6 +46,8 @@
if (typeof functionValue !== "function")
throw new TypeError("Script did not evaluate to a function.");
+ this._clearStaleNodes();
+
let argumentValues = argumentStrings.map(this._jsonParse, this);
let timeoutIdentifier = 0;
@@ -70,6 +72,7 @@
nodeForIdentifier(identifier)
{
+ this._clearStaleNodes();
try {
return this._nodeForIdentifier(identifier);
} catch (error) {
@@ -135,6 +138,16 @@
return identifier;
}
+
+ _clearStaleNodes()
+ {
+ for (var [node, identifier] of this._nodeToIdMap) {
+ if (!document.contains(node)) {
+ this._nodeToIdMap.delete(node);
+ this._idToNodeMap.delete(identifier);
+ }
+ }
+ }
};
return new AutomationSessionProxy;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes