Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10788)

Unified Diff: chrome/renderer/resources/extensions/automation/automation_node.js

Issue 1970153003: Completely detach removed nodes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/resources/extensions/automation/automation_node.js
diff --git a/chrome/renderer/resources/extensions/automation/automation_node.js b/chrome/renderer/resources/extensions/automation/automation_node.js
index d2f9a56aea9bc1fcc2660c78d998d9345bc192c6..4171d75e5da8757a3913dbc9453444f69ee1574a 100644
--- a/chrome/renderer/resources/extensions/automation/automation_node.js
+++ b/chrome/renderer/resources/extensions/automation/automation_node.js
@@ -199,6 +199,7 @@ var utils = require('utils');
*/
function AutomationNodeImpl(root) {
this.rootImpl = root;
+ this.hostNode_ = null;
this.listeners = {__proto__: null};
}
@@ -208,8 +209,14 @@ AutomationNodeImpl.prototype = {
id: -1,
isRootNode: false,
+ detach: function() {
+ this.rootImpl = null;
+ this.hostNode_ = null;
+ this.listeners = {__proto__: null};
+ },
+
get root() {
- return this.rootImpl.wrapper;
+ return this.rootImpl && this.rootImpl.wrapper;
},
get parent() {
@@ -907,11 +914,16 @@ AutomationRootNodeImpl.prototype = {
},
remove: function(id) {
+ if (this.axNodeDataCache_[id])
+ privates(this.axNodeDataCache_[id]).impl.detach();
delete this.axNodeDataCache_[id];
},
destroy: function() {
this.dispatchEvent(schema.EventType.destroyed);
+ for (var id in this.axNodeDataCache_)
+ this.remove(id);
+ this.detach();
},
setHostNode(hostNode) {

Powered by Google App Engine
This is Rietveld 408576698