summaryrefslogtreecommitdiffstats
path: root/chrome_frame/chrome_active_document.cc
diff options
context:
space:
mode:
authorsanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-21 16:35:21 +0000
committersanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-21 16:35:21 +0000
commit53b19ac1bdf1771f173a3389cd7fca68dbb2a132 (patch)
treeea2605e9468b24a8832b916bd73f45094f1738fa /chrome_frame/chrome_active_document.cc
parentbfcc96f374e0813b1d7bd435e9aa88af7f931ca6 (diff)
downloadchromium_src-53b19ac1bdf1771f173a3389cd7fca68dbb2a132.zip
chromium_src-53b19ac1bdf1771f173a3389cd7fca68dbb2a132.tar.gz
chromium_src-53b19ac1bdf1771f173a3389cd7fca68dbb2a132.tar.bz2
Revert 53194 - A different approach to avoid crashes in buggy 3rd party BHOs.This time we're more preceise and only target the buggy components.Behaviour for components that handle browser events correctly, is unchanged even in the presence of buggy DLLs.The core class here is the BuggyBhoTls class and here's the comment for that class:
// Construct an instance of this class on the stack when firing web browser // events that can be sent to buggy BHOs. This class will intercept those // BHOs (see list in cc file) and ignore notifications to those components // for as long as the BuggyBhoTls instance on the stack lives. TEST=A better fix for bug 44463 but also fixes bug 49373 and a number of crashes that haven't been associated with bug reports yet. BUG=44463, 49373 Review URL: http://codereview.chromium.org/3031009 TBR=tommi@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53197 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/chrome_active_document.cc')
-rw-r--r--chrome_frame/chrome_active_document.cc77
1 files changed, 65 insertions, 12 deletions
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc
index e4c61a6..899ec80 100644
--- a/chrome_frame/chrome_active_document.cc
+++ b/chrome_frame/chrome_active_document.cc
@@ -18,6 +18,7 @@
#include "base/command_line.h"
#include "base/file_util.h"
+#include "base/file_version_info.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/process_util.h"
@@ -38,7 +39,6 @@
#include "chrome/test/automation/tab_proxy.h"
#include "chrome_frame/bho.h"
#include "chrome_frame/bind_context_info.h"
-#include "chrome_frame/buggy_bho_handling.h"
#include "chrome_frame/crash_reporting/crash_metrics.h"
#include "chrome_frame/utils.h"
@@ -50,6 +50,7 @@ static const wchar_t kHandleTopLevelRequests[] = L"HandleTopLevelRequests";
DEFINE_GUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0,
0x46);
+
base::ThreadLocalPointer<ChromeActiveDocument> g_active_doc_cache;
bool g_first_launch_by_process_ = true;
@@ -723,15 +724,6 @@ void ChromeActiveDocument::UpdateNavigationState(
ScopedComPtr<IDocObjectService> doc_object_svc;
ScopedComPtr<IWebBrowserEventsService> web_browser_events_svc;
- buggy_bho::BuggyBhoTls bad_bho_tls;
- if (GetConfigBool(true, kEnableBuggyBhoIntercept)) {
- ScopedComPtr<IWebBrowser2> wb2;
- DoQueryService(SID_SWebBrowserApp, m_spClientSite, wb2.Receive());
- if (wb2) {
- buggy_bho::BuggyBhoTls::PatchBuggyBHOs(wb2);
- }
- }
-
DoQueryService(__uuidof(web_browser_events_svc), m_spClientSite,
web_browser_events_svc.Receive());
@@ -772,10 +764,12 @@ void ChromeActiveDocument::UpdateNavigationState(
// Now call the FireNavigateCompleteEvent which makes IE update the text
// in the address-bar.
doc_object_svc->FireNavigateComplete2(this, 0);
- doc_object_svc->FireDocumentComplete(this, 0);
+ if (ShouldFireDocumentComplete())
+ doc_object_svc->FireDocumentComplete(this, 0);
} else if (web_browser_events_svc) {
web_browser_events_svc->FireNavigateComplete2Event();
- web_browser_events_svc->FireDocumentCompleteEvent();
+ if (ShouldFireDocumentComplete())
+ web_browser_events_svc->FireDocumentCompleteEvent();
}
}
@@ -1270,3 +1264,62 @@ LRESULT ChromeActiveDocument::OnFirePrivacyChange(UINT message, WPARAM wparam,
return 0;
}
+namespace {
+struct ModuleAndVersion {
+ const char* module_name_;
+ const uint32 major_version_;
+ const uint32 minor_version_;
+};
+} // end namespace
+
+// static
+bool ChromeActiveDocument::ShouldFireDocumentComplete() {
+ typedef enum ModuleCheckResult {
+ CHECK_NOT_DONE,
+ DOCUMENT_COMPLETE_OK,
+ DOCUMENT_COMPLETE_NOT_OK
+ };
+
+ static ModuleCheckResult results = CHECK_NOT_DONE;
+
+ if (results == CHECK_NOT_DONE) {
+ // These modules are missing some checks in their DocumentComplete
+ // implementation that causes a crash.
+ static const ModuleAndVersion buggy_modules[] = {
+ { "askbar.dll", 4, 1 }, // biggest troublemaker: 4.1.0.5.
+ { "gbieh.dll", 3, 8 }, // biggest troublemaker: 3.8.14.12
+ { "gbiehcef.dll", 3, 8 }, // biggest troublemaker: 3.8.11.23
+ { "gbiehUni.dll", 3, 8 }, // Another Banco DLL.
+ };
+
+ for (size_t i = 0; results == CHECK_NOT_DONE &&
+ i < arraysize(buggy_modules); ++i) {
+ const ModuleAndVersion& module = buggy_modules[i];
+ HMODULE mod = ::GetModuleHandleA(module.module_name_);
+ if (mod) {
+ wchar_t path[MAX_PATH * 2] = {0};
+ ::GetModuleFileNameW(mod, path, arraysize(path));
+ scoped_ptr<FileVersionInfo> version_info(
+ FileVersionInfo::CreateFileVersionInfo(FilePath(path)));
+ DCHECK(version_info.get());
+ if (version_info.get()) {
+ uint32 major = 0, minor = 0;
+ if (!ParseVersion(version_info->file_version(), &major, &minor))
+ ParseVersion(version_info->product_version(), &major, &minor);
+ if (major < module.major_version_ ||
+ (major == module.major_version_ &&
+ minor <= module.minor_version_)) {
+ DLOG(WARNING) << "Buggy module found: " << module.module_name_;
+ results = DOCUMENT_COMPLETE_NOT_OK;
+ }
+ }
+ }
+ }
+
+ if (results == CHECK_NOT_DONE)
+ results = DOCUMENT_COMPLETE_OK;
+ }
+
+ return results == DOCUMENT_COMPLETE_OK;
+}
+