Changeset 55893 in webkit
- Timestamp:
- Mar 12, 2010 6:06:31 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r55892 r55893 1 2010-03-12 Jochen Eisinger <jochen@chromium.org> 2 3 Reviewed by Jeremy Orlow. 4 5 Test for referrer information being stripped when the header is removed in willSendRequest 6 https://bugs.webkit.org/show_bug.cgi?id=35920 7 8 * http/tests/security/no-referrer-expected.txt: Added. 9 * http/tests/security/no-referrer.html: Added. 10 * http/tests/security/resources/no-referrer-frame.php: Added. 11 * http/tests/security/resources/no-referrer.php: Added. 12 * platform/gtk/Skipped: 13 * platform/qt/Skipped: 14 1 15 2010-03-12 Nikolas Zimmermann <nzimmermann@rim.com> 2 16 -
trunk/LayoutTests/platform/gtk/Skipped
r55852 r55893 5677 5677 media/video-loop.html 5678 5678 5679 # GTK+ does not have layoutTestController.setWillSendRequestClearHeader. 5680 http/tests/security/no-referrer.html 5681 5679 5682 # GTK+ does not have layoutTestController.setWillSendRequestReturnsNull. 5680 5683 fast/loader/onload-willSendRequest-null-for-script.html -
trunk/LayoutTests/platform/qt/Skipped
r55886 r55893 199 199 http/tests/misc/redirect-to-external-url.html 200 200 http/tests/security/feed-urls-from-remote.html 201 202 # Missing layoutTestController.setWillSendRequestClearHeader() 203 http/tests/security/no-referrer.html 201 204 202 205 # Missing layoutTestController.setWillSendRequestReturnsNull() -
trunk/WebKitTools/ChangeLog
r55884 r55893 1 2010-03-12 Jochen Eisinger <jochen@chromium.org> 2 3 Reviewed by Jeremy Orlow. 4 5 Introduce setWillSendRequestClearHeader to LayoutTestController to selectively remove headers in willSendRequest. Used in http/tests/security/no-referrer.html 6 https://bugs.webkit.org/show_bug.cgi?id=35920 7 8 * DumpRenderTree/LayoutTestController.cpp: 9 (setWillSendRequestClearHeaderCallback): 10 (LayoutTestController::staticFunctions): 11 * DumpRenderTree/LayoutTestController.h: 12 (LayoutTestController::willSendRequestClearHeaders): 13 (LayoutTestController::setWillSendRequestClearHeader): 14 * DumpRenderTree/mac/ResourceLoadDelegate.mm: 15 (-[ResourceLoadDelegate webView:resource:willSendRequest:redirectResponse:fromDataSource:]): 16 * DumpRenderTree/win/ResourceLoadDelegate.cpp: 17 (ResourceLoadDelegate::willSendRequest): 18 1 19 2010-03-11 Fumitoshi Ukai <ukai@chromium.org> 2 20 -
trunk/WebKitTools/DumpRenderTree/LayoutTestController.cpp
r55582 r55893 1020 1020 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1021 1021 controller->setUserStyleSheetLocation(path.get()); 1022 1023 return JSValueMakeUndefined(context); 1024 } 1025 1026 static JSValueRef setWillSendRequestClearHeaderCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1027 { 1028 // Has mac & windows implementation 1029 if (argumentCount < 1) 1030 return JSValueMakeUndefined(context); 1031 1032 JSRetainPtr<JSStringRef> header(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1033 ASSERT(!*exception); 1034 1035 size_t maxLength = JSStringGetMaximumUTF8CStringSize(header.get()); 1036 char* headerBuffer = new char[maxLength + 1]; 1037 JSStringGetUTF8CString(header.get(), headerBuffer, maxLength + 1); 1038 1039 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1040 controller->setWillSendRequestClearHeader(headerBuffer); 1022 1041 1023 1042 return JSValueMakeUndefined(context); … … 1464 1483 { "setUserStyleSheetEnabled", setUserStyleSheetEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1465 1484 { "setUserStyleSheetLocation", setUserStyleSheetLocationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1485 { "setWillSendRequestClearHeader", setWillSendRequestClearHeaderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1466 1486 { "setWillSendRequestReturnsNull", setWillSendRequestReturnsNullCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1467 1487 { "setWillSendRequestReturnsNullOnRedirect", setWillSendRequestReturnsNullOnRedirectCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, -
trunk/WebKitTools/DumpRenderTree/LayoutTestController.h
r55582 r55893 32 32 #include <JavaScriptCore/JSObjectRef.h> 33 33 #include <JavaScriptCore/JSRetainPtr.h> 34 #include < wtf/RefCounted.h>34 #include <set> 35 35 #include <string> 36 36 #include <vector> 37 #include <wtf/RefCounted.h> 37 38 38 39 class LayoutTestController : public RefCounted<LayoutTestController> { … … 187 188 void waitToDumpWatchdogTimerFired(); 188 189 190 const std::set<std::string>& willSendRequestClearHeaders() const { return m_willSendRequestClearHeaders; } 191 void setWillSendRequestClearHeader(std::string header) { m_willSendRequestClearHeaders.insert(header); } 192 189 193 bool willSendRequestReturnsNull() const { return m_willSendRequestReturnsNull; } 190 194 void setWillSendRequestReturnsNull(bool returnsNull) { m_willSendRequestReturnsNull = returnsNull; } … … 285 289 std::string m_testPathOrURL; 286 290 std::string m_expectedPixelHash; // empty string if no hash 291 292 std::set<std::string> m_willSendRequestClearHeaders; 287 293 288 294 // origins which have been granted desktop notification access -
trunk/WebKitTools/DumpRenderTree/mac/ResourceLoadDelegate.mm
r53277 r55893 36 36 #import <wtf/Assertions.h> 37 37 38 using namespace std; 39 38 40 @interface NSURL (DRTExtras) 39 41 - (NSString *)_drt_descriptionSuitableForTestResult; … … 122 124 } 123 125 124 -(NSURLRequest *)webView: (WebView *)wv resource:identifier willSendRequest: (NSURLRequest *) newRequest redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)dataSource125 { 126 if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) { 127 NSString *string = [NSString stringWithFormat:@"%@ - willSendRequest %@ redirectResponse %@", identifier, [ newRequest _drt_descriptionSuitableForTestResult],126 -(NSURLRequest *)webView: (WebView *)wv resource:identifier willSendRequest: (NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)dataSource 127 { 128 if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) { 129 NSString *string = [NSString stringWithFormat:@"%@ - willSendRequest %@ redirectResponse %@", identifier, [request _drt_descriptionSuitableForTestResult], 128 130 [redirectResponse _drt_descriptionSuitableForTestResult]]; 129 131 printf("%s\n", [string UTF8String]); … … 138 140 } 139 141 140 NSURL *url = [ newRequest URL];142 NSURL *url = [request URL]; 141 143 NSString *host = [url host]; 142 144 if (host … … 152 154 return nil; 153 155 154 return newRequest; 156 NSMutableURLRequest *newRequest = [request mutableCopy]; 157 const set<string>& clearHeaders = gLayoutTestController->willSendRequestClearHeaders(); 158 for (set<string>::const_iterator header = clearHeaders.begin(); header != clearHeaders.end(); ++header) { 159 NSString *nsHeader = [[NSString alloc] initWithUTF8String:header->c_str()]; 160 [newRequest setValue:nil forHTTPHeaderField:nsHeader]; 161 [nsHeader release]; 162 } 163 164 return [newRequest autorelease]; 155 165 } 156 166 -
trunk/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp
r53277 r55893 32 32 #include "DumpRenderTree.h" 33 33 #include "LayoutTestController.h" 34 #include <WebKit/WebKitCOMAPI.h> 34 35 #include <comutil.h> 35 #include <WebKit/WebKitCOMAPI.h> 36 #include <sstream> 37 #include <tchar.h> 36 38 #include <wtf/HashMap.h> 37 39 #include <wtf/Vector.h> 38 #include <sstream> 39 40 41 using std::wstring; 42 using std::wiostream; 40 41 using namespace std; 43 42 44 43 static inline wstring wstringFromBSTR(BSTR str) … … 47 46 } 48 47 49 wstring wstringFromInt(int i)50 { 51 std::wostringstream ss;48 static inline wstring wstringFromInt(int i) 49 { 50 wostringstream ss; 52 51 ss << i; 53 52 return ss.str(); 53 } 54 55 static inline BSTR BSTRFromString(const string& str) 56 { 57 int length = ::MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), 0, 0); 58 BSTR result = ::SysAllocStringLen(0, length); 59 ::MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), result, length); 60 return result; 54 61 } 55 62 … … 255 262 } 256 263 257 request->AddRef(); 258 *newRequest = request; 264 IWebMutableURLRequest* requestCopy = 0; 265 request->mutableCopy(&requestCopy); 266 const set<string>& clearHeaders = gLayoutTestController->willSendRequestClearHeaders(); 267 for (set<string>::const_iterator header = clearHeaders.begin(); header != clearHeaders.end(); ++header) { 268 BSTR bstrHeader = BSTRFromString(*header); 269 requestCopy->setValue(0, bstrHeader); 270 SysFreeString(bstrHeader); 271 } 272 273 *newRequest = requestCopy; 259 274 return S_OK; 260 275 }
Note: See TracChangeset
for help on using the changeset viewer.