diff options
author | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-14 16:45:34 +0000 |
---|---|---|
committer | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-14 16:45:34 +0000 |
commit | 89c75df34e80ca45f60b8b06f4102f8da7b132fb (patch) | |
tree | 03ea2b3f6ed8d43f0a3585bcf68aa3da2de5a78e /chrome/browser/automation | |
parent | 62eeafc6f90d4e9625da2f453913e7861889f0db (diff) | |
download | chromium_src-89c75df34e80ca45f60b8b06f4102f8da7b132fb.zip chromium_src-89c75df34e80ca45f60b8b06f4102f8da7b132fb.tar.gz chromium_src-89c75df34e80ca45f60b8b06f4102f8da7b132fb.tar.bz2 |
Reland "Make AutomationProvider fail fast on messages it doesn't understand."
Original review: http://codereview.chromium.org/3224001
Revert review: http://codereview.chromium.org/3317023
Relanding because it didn't cause the problem.
BUG=54453
TEST=chromebot
Review URL: http://codereview.chromium.org/3396001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59381 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation')
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 14 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider.h | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 6642a2a..664c639 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -388,9 +388,23 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_LoginWithUserAndPass, LoginWithUserAndPass) #endif // defined(OS_CHROMEOS) + IPC_MESSAGE_UNHANDLED(OnUnhandledMessage()) IPC_END_MESSAGE_MAP() } +void AutomationProvider::OnUnhandledMessage() { + // We should not hang here. Print a message to indicate what's going on, + // and disconnect the channel to notify the caller about the error + // in a way it can't ignore, and make any further attempts to send + // messages fail fast. + LOG(ERROR) << "AutomationProvider received a message it can't handle. " + << "Please make sure that you use switches::kTestingChannelID " + << "for test code (TestingAutomationProvider), and " + << "switches::kAutomationClientChannelID for everything else " + << "(like ChromeFrame). Closing the automation channel."; + channel_->Close(); +} + // This task just adds another task to the event queue. This is useful if // you want to ensure that any tasks added to the event queue after this one // have already been processed by the time |task| is run. diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index 82af88c..2ad6dea 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -192,6 +192,8 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, CancelableRequestConsumer consumer_; private: + void OnUnhandledMessage(); + // IPC Message callbacks. void WindowSimulateDrag(int handle, std::vector<gfx::Point> drag_path, |