summaryrefslogtreecommitdiffstats
path: root/ceee
diff options
context:
space:
mode:
authormad@google.com <mad@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 22:31:13 +0000
committermad@google.com <mad@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 22:31:13 +0000
commitd73ec6ec7af898b784172a90368ca7b4111e6fee (patch)
tree6e71f0dd3d300ab6316c127a2dc0f86c6fc5e4c1 /ceee
parenta37b4be7288608ab67197a4070a1850556686a66 (diff)
downloadchromium_src-d73ec6ec7af898b784172a90368ca7b4111e6fee.zip
chromium_src-d73ec6ec7af898b784172a90368ca7b4111e6fee.tar.gz
chromium_src-d73ec6ec7af898b784172a90368ca7b4111e6fee.tar.bz2
Don't even try to create a window executor if we are given not given an IEFrame handle.
BUG=65120 TEST=See Bug description. Review URL: http://codereview.chromium.org/5578002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68085 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ceee')
-rw-r--r--ceee/ie/broker/executors_manager.cc11
-rw-r--r--ceee/ie/broker/executors_manager_unittest.cc27
2 files changed, 28 insertions, 10 deletions
diff --git a/ceee/ie/broker/executors_manager.cc b/ceee/ie/broker/executors_manager.cc
index bb4df24..84d3c37 100644
--- a/ceee/ie/broker/executors_manager.cc
+++ b/ceee/ie/broker/executors_manager.cc
@@ -209,6 +209,17 @@ HRESULT ExecutorsManager::GetExecutor(ThreadId thread_id, HWND window,
return exec_iter->second.executor->QueryInterface(riid, executor);
}
+ // If we didn't find it, it must be a windows executor, otherwise, bail out.
+ // This can happen if the cookie API for example, asks for a tab executor
+ // after it unregistered itself but before we completed the async unmapping
+ // of the tab handle to tab id that we use to confirm the tab's existence.
+ if (!common_api::CommonApiResult::IsIeFrameClass(window)) {
+ DLOG(ERROR) << "Being asked for inexistent tab executor for window: " <<
+ window;
+ *executor = NULL;
+ return E_UNEXPECTED;
+ }
+
// Check if we need to wait for a pending registration.
Tid2Event::iterator event_iter = pending_registrations_.find(thread_id);
if (event_iter == pending_registrations_.end()) {
diff --git a/ceee/ie/broker/executors_manager_unittest.cc b/ceee/ie/broker/executors_manager_unittest.cc
index c698610..9a5da77 100644
--- a/ceee/ie/broker/executors_manager_unittest.cc
+++ b/ceee/ie/broker/executors_manager_unittest.cc
@@ -332,10 +332,27 @@ TEST_F(ExecutorsManagerTests, RegisterTabExecutor) {
EXPECT_EQ(0, executors_manager.GetNumExecutors());
}
+// Mock static functions defined in CommonApiResult.
+MOCK_STATIC_CLASS_BEGIN(MockCommonApiResultStatics)
+MOCK_STATIC_INIT_BEGIN(MockCommonApiResultStatics)
+MOCK_STATIC_INIT2(common_api::CommonApiResult::IsIeFrameClass,
+ IsIeFrameClass);
+MOCK_STATIC_INIT_END()
+MOCK_STATIC1(bool, , IsIeFrameClass, HWND);
+MOCK_STATIC_CLASS_END(MockCommonApiResultStatics)
+
+
TEST_F(ExecutorsManagerTests, GetExecutor) {
testing::LogDisabler no_dchecks;
TestingExecutorsManager executors_manager;
+ // We now test that the window is a valid frame before attempting to
+ // inject an executor in the thread.
+ StrictMock<MockCommonApiResultStatics> mock_common;
+ EXPECT_CALL(
+ mock_common, IsIeFrameClass(TestingExecutorsManager::kWindowHwnd)).
+ WillRepeatedly(Return(true));
+
// Already in the map.
MockExecutor executor;
executors_manager.FakeRegisterExecutor(
@@ -677,16 +694,6 @@ TEST_F(ExecutorsManagerTests, ThreadProc) {
EXPECT_EQ(1, executors_manager.CallThreadProc());
}
-// Mock static functions defined in CommonApiResult.
-MOCK_STATIC_CLASS_BEGIN(MockCommonApiResultStatics)
- MOCK_STATIC_INIT_BEGIN(MockCommonApiResultStatics)
- MOCK_STATIC_INIT2(common_api::CommonApiResult::IsIeFrameClass,
- IsIeFrameClass);
- MOCK_STATIC_INIT_END()
- MOCK_STATIC1(bool, , IsIeFrameClass, HWND);
-MOCK_STATIC_CLASS_END(MockCommonApiResultStatics)
-
-
TEST_F(ExecutorsManagerTests, SetTabIdForHandle) {
testing::LogDisabler no_logs;
TestingExecutorsManager executors_manager;