diff options
author | robertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-03 19:42:54 +0000 |
---|---|---|
committer | robertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-03 19:42:54 +0000 |
commit | 02081fdc3a9dd9549f3e335a447a0f76376bc06d (patch) | |
tree | 77a2c5fbe154dcf00b9a3bb5bf2fe7c23b4c7433 /chrome_frame/http_negotiate.cc | |
parent | 128760848eb252751893719a0789e3122a62109f (diff) | |
download | chromium_src-02081fdc3a9dd9549f3e335a447a0f76376bc06d.zip chromium_src-02081fdc3a9dd9549f3e335a447a0f76376bc06d.tar.gz chromium_src-02081fdc3a9dd9549f3e335a447a0f76376bc06d.tar.bz2 |
Remove erroneous DCHECK that is reached when loading pages that don't call out to wininet like about:blank.
Altering constant name pulled in from latest platform SDK to avoid naming conflicts for those with said SDK.
Add slightly more logging to error messages.
BUG=DCHECK hit when loading about:blank.
TEST=Load about:blank in a debug build and no DCHECK is seen.
Review URL: http://codereview.chromium.org/465030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33706 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/http_negotiate.cc')
-rw-r--r-- | chrome_frame/http_negotiate.cc | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/chrome_frame/http_negotiate.cc b/chrome_frame/http_negotiate.cc index 1ea79e2..5f89a76 100644 --- a/chrome_frame/http_negotiate.cc +++ b/chrome_frame/http_negotiate.cc @@ -22,9 +22,11 @@ const wchar_t kChromeMimeType[] = L"application/chromepage"; const char kUACompatibleHttpHeader[] = "x-ua-compatible"; -// From the latest urlmon.h. TODO(robertshield): Remove this once we update -// our SDK version. -static const int BINDSTATUS_SERVER_MIMETYPEAVAILABLE = 54; +// From the latest urlmon.h. Symbol name prepended with LOCAL_ to +// avoid conflict (and therefore build errors) for those building with +// a newer Windows SDK. +// TODO(robertshield): Remove this once we update our SDK version. +static const int LOCAL_BINDSTATUS_SERVER_MIMETYPEAVAILABLE = 54; static const int kHttpNegotiateBeginningTransactionIndex = 3; static const int kHttpNegotiateOnResponseTransactionIndex = 4; @@ -209,7 +211,8 @@ HRESULT HttpNegotiatePatch::StartBinding( HRESULT hr = protocol_sink.QueryFrom(local_binding); if (FAILED(hr) || !protocol_sink) { - DLOG(WARNING) << "Failed to get IInternetProtocolSink from IBinding."; + DLOG(WARNING) << "Failed to get IInternetProtocolSink from IBinding: " + << hr; } else { if (!IS_PATCHED(IInternetProtocolSink)) { hr = vtable_patch::PatchInterfaceMethods(protocol_sink, @@ -217,7 +220,7 @@ HRESULT HttpNegotiatePatch::StartBinding( } DLOG_IF(WARNING, FAILED(hr)) - << "Failed to patch IInternetProtocolSink from IBinding."; + << "Failed to patch IInternetProtocolSink from IBinding: " << hr; } hr = original(me, reserved, binding); @@ -230,16 +233,22 @@ HRESULT HttpNegotiatePatch::ReportProgress( ULONG status_code, LPCWSTR status_text) { if (status_code == BINDSTATUS_MIMETYPEAVAILABLE || status_code == BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE || - status_code == BINDSTATUS_SERVER_MIMETYPEAVAILABLE) { + status_code == LOCAL_BINDSTATUS_SERVER_MIMETYPEAVAILABLE) { // Check to see if we need to alter the mime type that gets reported // by inspecting the raw header information: ScopedComPtr<IWinInetHttpInfo> win_inet_http_info; HRESULT hr = win_inet_http_info.QueryFrom(me); - if (FAILED(hr) || !win_inet_http_info) { - NOTREACHED() << "Could not get at an IWinInetHttpInfo in " - << "IInternetProtocolSink::ReportProgress."; - } else { + // Try slightly harder if we couldn't QI directly. + if (!win_inet_http_info || FAILED(hr)) { + hr = DoQueryService(IID_IWinInetHttpInfo, me, + win_inet_http_info.Receive()); + } + + // Note that it has been observed that getting an IWinInetHttpInfo will + // fail if we are loading a page like about:blank that isn't loaded via + // wininet. + if (win_inet_http_info) { // We have headers: check to see if the server is requesting CF via // the X-UA-Compatible: chrome=1 HTTP header. std::string headers(GetRawHttpHeaders(win_inet_http_info)); |