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

Unified Diff: chrome/renderer/extensions/automation_internal_custom_bindings.cc

Issue 1413033012: Fix crashes in AutomationInternalCustomBindings due to no v8 context. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/automation_internal_custom_bindings.cc
diff --git a/chrome/renderer/extensions/automation_internal_custom_bindings.cc b/chrome/renderer/extensions/automation_internal_custom_bindings.cc
index 844fd87dd09790dbc38ce9615333ee5698240fdd..3a620c89d4946091ff07a0c49c8899ca0bcbd6ed 100644
--- a/chrome/renderer/extensions/automation_internal_custom_bindings.cc
+++ b/chrome/renderer/extensions/automation_internal_custom_bindings.cc
@@ -136,8 +136,14 @@ AutomationInternalCustomBindings::AutomationInternalCustomBindings(
AutomationInternalCustomBindings::~AutomationInternalCustomBindings() {
if (message_filter_)
David Tseng 2015/11/03 18:37:44 Perhaps this class needs to override Invalidate (a
dmazzoni 2015/11/06 22:49:58 Good catch. Done, that seems to work.
message_filter_->Detach();
- STLDeleteContainerPairSecondPointers(tree_id_to_tree_cache_map_.begin(),
- tree_id_to_tree_cache_map_.end());
+
+ // Delete the TreeCaches quickly by first clearing their delegates so
+ // we don't get a callback for every node being deleted.
+ for (auto iter : tree_id_to_tree_cache_map_) {
+ TreeCache* cache = iter.second;
+ cache->tree.SetDelegate(nullptr);
+ delete cache;
+ }
}
void AutomationInternalCustomBindings::OnMessageReceived(
@@ -628,6 +634,9 @@ void AutomationInternalCustomBindings::SendTreeChangeEvent(
if (!is_active_profile_)
return;
+ if (!GetIsolate() || !context())
David Tseng 2015/11/03 18:37:44 Do you need to do this if teardown occurs in Inval
dmazzoni 2015/11/06 22:49:58 Probably not.
+ return;
+
auto iter = axtree_to_tree_cache_map_.find(tree);
if (iter == axtree_to_tree_cache_map_.end())
return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698