diff options
author | Steve Block <steveblock@google.com> | 2010-04-27 16:31:00 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-05-11 14:42:12 +0100 |
commit | dcc8cf2e65d1aa555cce12431a16547e66b469ee (patch) | |
tree | 92a8d65cd5383bca9749f5327fb5e440563926e6 /WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp | |
parent | ccac38a6b48843126402088a309597e682f40fe6 (diff) | |
download | external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2 |
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp')
-rw-r--r-- | WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp index 19bf84a..2e031da 100644 --- a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp +++ b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp @@ -31,28 +31,35 @@ #include "DumpRenderTree.h" #include "LayoutTestController.h" -#include <comutil.h> #include <WebKit/WebKitCOMAPI.h> +#include <comutil.h> +#include <sstream> +#include <tchar.h> #include <wtf/HashMap.h> #include <wtf/Vector.h> -#include <sstream> - -using std::wstring; -using std::wiostream; +using namespace std; static inline wstring wstringFromBSTR(BSTR str) { return wstring(str, ::SysStringLen(str)); } -wstring wstringFromInt(int i) +static inline wstring wstringFromInt(int i) { - std::wostringstream ss; + wostringstream ss; ss << i; return ss.str(); } +static inline BSTR BSTRFromString(const string& str) +{ + int length = ::MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), 0, 0); + BSTR result = ::SysAllocStringLen(0, length); + ::MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), result, length); + return result; +} + typedef HashMap<unsigned long, wstring> IdentifierMap; IdentifierMap& urlMap() @@ -254,8 +261,16 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::willSendRequest( return S_OK; } - request->AddRef(); - *newRequest = request; + IWebMutableURLRequest* requestCopy = 0; + request->mutableCopy(&requestCopy); + const set<string>& clearHeaders = gLayoutTestController->willSendRequestClearHeaders(); + for (set<string>::const_iterator header = clearHeaders.begin(); header != clearHeaders.end(); ++header) { + BSTR bstrHeader = BSTRFromString(*header); + requestCopy->setValue(0, bstrHeader); + SysFreeString(bstrHeader); + } + + *newRequest = requestCopy; return S_OK; } |