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

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

Issue 2522033002: Generalized fix for serialization error/reset issues (Closed)
Patch Set: Fix test. Created 4 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
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 e8c836dfa1cb2ffd6637298af57ef0c415cd012a..1cc6e97f6b25c7f74e466e7cf67c163c358d9cc8 100644
--- a/chrome/renderer/extensions/automation_internal_custom_bindings.cc
+++ b/chrome/renderer/extensions/automation_internal_custom_bindings.cc
@@ -1157,8 +1157,15 @@ void AutomationInternalCustomBindings::OnAccessibilityEvent(
// Update the internal state whether it's the active profile or not.
cache->location_offset = params.location_offset;
deleted_node_ids_.clear();
+ v8::Isolate* isolate = GetIsolate();
+ v8::HandleScope handle_scope(isolate);
+ v8::Context::Scope context_scope(context()->v8_context());
+ v8::Local<v8::Array> args(v8::Array::New(GetIsolate(), 1U));
if (!cache->tree.Unserialize(params.update)) {
LOG(ERROR) << cache->tree.error();
+ args->Set(0U, v8::Number::New(isolate, tree_id));
+ context()->DispatchEvent(
+ "automationInternal.onAccessibilityTreeSerializationError", args);
return;
}
@@ -1169,10 +1176,6 @@ void AutomationInternalCustomBindings::OnAccessibilityEvent(
SendNodesRemovedEvent(&cache->tree, deleted_node_ids_);
deleted_node_ids_.clear();
- v8::Isolate* isolate = GetIsolate();
- v8::HandleScope handle_scope(isolate);
- v8::Context::Scope context_scope(context()->v8_context());
- v8::Local<v8::Array> args(v8::Array::New(GetIsolate(), 1U));
v8::Local<v8::Object> event_params(v8::Object::New(GetIsolate()));
event_params->Set(CreateV8String(isolate, "treeID"),
v8::Integer::New(GetIsolate(), params.tree_id));

Powered by Google App Engine
This is Rietveld 408576698