Thomas Mullaly : urlmon: Implemented IUriBuilder_RemoveProperties.
Alexandre Julliard
julliard at winehq.org
Thu Sep 9 13:56:50 CDT 2010
Module: wine
Branch: master
Commit: bef85fbc980e44ae77a7d458995f870e97ed2843
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bef85fbc980e44ae77a7d458995f870e97ed2843
Author: Thomas Mullaly <thomas.mullaly at gmail.com>
Date: Wed Sep 8 20:12:37 2010 -0400
urlmon: Implemented IUriBuilder_RemoveProperties.
---
dlls/urlmon/tests/uri.c | 51 +++++++++++++++++++++++++++++++++++------------
dlls/urlmon/uri.c | 36 +++++++++++++++++++++++++++++++-
2 files changed, 72 insertions(+), 15 deletions(-)
diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c
index 37b6cfd..3045b3d 100644
--- a/dlls/urlmon/tests/uri.c
+++ b/dlls/urlmon/tests/uri.c
@@ -4943,16 +4943,38 @@ typedef struct _uri_builder_remove_test {
static const uri_builder_remove_test uri_builder_remove_tests[] = {
{ "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
- Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,TRUE,
+ Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
"http://google.com/",0,S_OK,TRUE
},
{ "http://user:[email protected]/",0,S_OK,FALSE,
- Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,TRUE,
+ Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
"http://winehq.org/",0,S_OK,TRUE
},
{ "zip://google.com?Test=x",0,S_OK,FALSE,
- Uri_HAS_HOST,S_OK,TRUE,
+ Uri_HAS_HOST,S_OK,FALSE,
"zip:/?Test=x",0,S_OK,TRUE
+ },
+ /* Doesn't remove the whole userinfo component. */
+ { "http://username:[email protected]/",0,S_OK,FALSE,
+ Uri_HAS_USER_INFO,S_OK,FALSE,
+ "http://username:[email protected]/",0,S_OK,TRUE
+ },
+ /* Doesn't remove the domain. */
+ { "http://google.com/",0,S_OK,FALSE,
+ Uri_HAS_DOMAIN,S_OK,FALSE,
+ "http://google.com/",0,S_OK,TRUE
+ },
+ { "http://google.com:120/",0,S_OK,FALSE,
+ Uri_HAS_AUTHORITY,S_OK,FALSE,
+ "http://google.com:120/",0,S_OK,TRUE
+ },
+ { "http://google.com/test.com/",0,S_OK,FALSE,
+ Uri_HAS_EXTENSION,S_OK,FALSE,
+ "http://google.com/test.com/",0,S_OK,TRUE
+ },
+ { "http://google.com/?test=x",0,S_OK,FALSE,
+ Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
+ "http://google.com/?test=x",0,S_OK,TRUE
}
};
@@ -7837,19 +7859,22 @@ static void test_IUriBuilder_RemoveProperties(void) {
for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
hr = IUriBuilder_RemoveProperties(builder, i << 1);
if((i << 1) & invalid) {
- todo_wine {
- ok(hr == E_INVALIDARG,
- "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
- hr, E_INVALIDARG, i);
- }
+ ok(hr == E_INVALIDARG,
+ "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
+ hr, E_INVALIDARG, i);
} else {
- todo_wine {
- ok(hr == S_OK,
- "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
- hr, S_OK, i);
- }
+ ok(hr == S_OK,
+ "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
+ hr, S_OK, i);
}
}
+
+ /* Also doesn't accept anything that's outside the range of the
+ * Uri_HAS flags.
+ */
+ hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
+ ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
+ hr, E_INVALIDARG);
}
if(builder) IUriBuilder_Release(builder);
diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c
index 45acde9..e69f090 100644
--- a/dlls/urlmon/uri.c
+++ b/dlls/urlmon/uri.c
@@ -4743,9 +4743,41 @@ static HRESULT WINAPI UriBuilder_SetUserName(IUriBuilder *iface, LPCWSTR pwzNewV
static HRESULT WINAPI UriBuilder_RemoveProperties(IUriBuilder *iface, DWORD dwPropertyMask)
{
+ const DWORD accepted_flags = Uri_HAS_AUTHORITY|Uri_HAS_DOMAIN|Uri_HAS_EXTENSION|Uri_HAS_FRAGMENT|Uri_HAS_HOST|
+ Uri_HAS_PASSWORD|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_QUERY|
+ Uri_HAS_SCHEME_NAME|Uri_HAS_USER_INFO|Uri_HAS_USER_NAME;
+
UriBuilder *This = URIBUILDER_THIS(iface);
- FIXME("(%p)->(0x%08x)\n", This, dwPropertyMask);
- return E_NOTIMPL;
+ TRACE("(%p)->(0x%08x)\n", This, dwPropertyMask);
+
+ if(dwPropertyMask & ~accepted_flags)
+ return E_INVALIDARG;
+
+ if(dwPropertyMask & Uri_HAS_FRAGMENT)
+ UriBuilder_SetFragment(iface, NULL);
+
+ if(dwPropertyMask & Uri_HAS_HOST)
+ UriBuilder_SetHost(iface, NULL);
+
+ if(dwPropertyMask & Uri_HAS_PASSWORD)
+ UriBuilder_SetPassword(iface, NULL);
+
+ if(dwPropertyMask & Uri_HAS_PATH)
+ UriBuilder_SetPath(iface, NULL);
+
+ if(dwPropertyMask & Uri_HAS_PORT)
+ UriBuilder_SetPort(iface, FALSE, 0);
+
+ if(dwPropertyMask & Uri_HAS_QUERY)
+ UriBuilder_SetQuery(iface, NULL);
+
+ if(dwPropertyMask & Uri_HAS_SCHEME_NAME)
+ UriBuilder_SetSchemeName(iface, NULL);
+
+ if(dwPropertyMask & Uri_HAS_USER_NAME)
+ UriBuilder_SetUserName(iface, NULL);
+
+ return S_OK;
}
static HRESULT WINAPI UriBuilder_HasBeenModified(IUriBuilder *iface, BOOL *pfModified)
More information about the wine-cvs
mailing list