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

Unified Diff: chrome/browser/automation/automation_provider_observers.cc

Issue 9950098: Fixed bug where the ExecuteJavascript() family of PyAuto hooks ignored the automation id of message… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Found a use where this change broke ExecuteJavascript, this should fix it. Created 8 years, 8 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/browser/automation/automation_provider_observers.cc
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc
index 32e61b13ad0ba085ddc2042d91e13b9569b21c52..c6cfd5b37e83c1fd01e444dcd7729368559b6018 100644
--- a/chrome/browser/automation/automation_provider_observers.cc
+++ b/chrome/browser/automation/automation_provider_observers.cc
@@ -1194,7 +1194,8 @@ void FindInPageNotificationObserver::Observe(
// static
const int FindInPageNotificationObserver::kFindInPageRequestId = -1;
-DomOperationObserver::DomOperationObserver() {
+DomOperationObserver::DomOperationObserver(int automation_id)
+ : automation_id_(automation_id) {
registrar_.Add(this, content::NOTIFICATION_DOM_OPERATION_RESPONSE,
content::NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN,
@@ -1210,7 +1211,8 @@ void DomOperationObserver::Observe(
const content::NotificationDetails& details) {
if (type == content::NOTIFICATION_DOM_OPERATION_RESPONSE) {
content::Details<DomOperationNotificationDetails> dom_op_details(details);
- OnDomOperationCompleted(dom_op_details->json);
+ if (dom_op_details->automation_id == automation_id_)
+ OnDomOperationCompleted(dom_op_details->json);
} else if (type == chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN) {
OnModalDialogShown();
} else if (type == chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED) {
@@ -1232,7 +1234,8 @@ DomOperationMessageSender::DomOperationMessageSender(
AutomationProvider* automation,
IPC::Message* reply_message,
bool use_json_interface)
- : automation_(automation->AsWeakPtr()),
+ : DomOperationObserver(0),
+ automation_(automation->AsWeakPtr()),
reply_message_(reply_message),
use_json_interface_(use_json_interface) {
}
« no previous file with comments | « chrome/browser/automation/automation_provider_observers.h ('k') | chrome/browser/automation/testing_automation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698