diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-30 21:09:52 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-30 21:09:52 +0000 |
commit | 10549c3decb367c0b1a8b00e3b84ee96deb10a37 (patch) | |
tree | b1fe105b09aeaf947919d189289e4986bafc73f2 /chrome/browser | |
parent | cafdbc858b31cb6b387733acfb4b4e44314c9f2b (diff) | |
download | chromium_src-10549c3decb367c0b1a8b00e3b84ee96deb10a37.zip chromium_src-10549c3decb367c0b1a8b00e3b84ee96deb10a37.tar.gz chromium_src-10549c3decb367c0b1a8b00e3b84ee96deb10a37.tar.bz2 |
Make AutomationProvider fail fast on messages it doesn't understand.
This prevents an awful debugging experience where things just silently hang.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/3224001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57907 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 15 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider.h | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 418738a..87578db 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -361,9 +361,24 @@ 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(); +} + void AutomationProvider::ShutdownSessionService(int handle, bool* result) { if (browser_tracker_->ContainsHandle(handle)) { Browser* browser = browser_tracker_->GetResource(handle); diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index 34967f3..ff859591 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -191,6 +191,8 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, CancelableRequestConsumer consumer_; private: + void OnUnhandledMessage(); + // IPC Message callbacks. void ShutdownSessionService(int handle, bool* result); void WindowSimulateDrag(int handle, |