Jacek Caban : mshtml: Added IUri-based implementation of nsIURL::[Get|Set] Ref.
Alexandre Julliard
julliard at winehq.org
Tue Jan 18 10:27:37 CST 2011
Module: wine
Branch: master
Commit: e72e7de0e58c41afa928ce4fc81ac60e5d2baf1f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e72e7de0e58c41afa928ce4fc81ac60e5d2baf1f
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Jan 18 12:28:17 2011 +0100
mshtml: Added IUri-based implementation of nsIURL::[Get|Set]Ref.
---
dlls/mshtml/nsio.c | 43 +++++++++++++++++++++++++++++++------------
1 files changed, 31 insertions(+), 12 deletions(-)
diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c
index e7a6c2c..617b3f3 100644
--- a/dlls/mshtml/nsio.c
+++ b/dlls/mshtml/nsio.c
@@ -2217,34 +2217,53 @@ static nsresult NSAPI nsURL_SetQuery(nsIURL *iface, const nsACString *aQuery)
static nsresult NSAPI nsURL_GetRef(nsIURL *iface, nsACString *aRef)
{
nsWineURI *This = impl_from_nsIURL(iface);
+ char *refa = NULL;
+ BSTR ref;
+ HRESULT hres;
TRACE("(%p)->(%p)\n", This, aRef);
- if(This->nsurl)
- return nsIURL_GetRef(This->nsurl, aRef);
+ if(!ensure_uri(This))
+ return NS_ERROR_UNEXPECTED;
- FIXME("default action not implemented\n");
- return NS_ERROR_NOT_IMPLEMENTED;
+ hres = IUri_GetFragment(This->uri, &ref);
+ if(FAILED(hres))
+ return NS_ERROR_UNEXPECTED;
+
+ refa = heap_strdupWtoA(ref);
+ SysFreeString(ref);
+ if(ref && !refa)
+ return NS_ERROR_OUT_OF_MEMORY;
+
+ nsACString_SetData(aRef, refa && *refa == '#' ? refa+1 : refa);
+ heap_free(refa);
+ return NS_OK;
}
static nsresult NSAPI nsURL_SetRef(nsIURL *iface, const nsACString *aRef)
{
nsWineURI *This = impl_from_nsIURL(iface);
const char *refa;
+ WCHAR *ref;
+ HRESULT hres;
TRACE("(%p)->(%s)\n", This, debugstr_nsacstr(aRef));
- if(This->nsurl) {
- invalidate_uri(This);
- return nsIURL_SetRef(This->nsurl, aRef);
- }
+ if(!ensure_uri_builder(This))
+ return NS_ERROR_UNEXPECTED;
nsACString_GetData(aRef, &refa);
- if(!*refa)
- return NS_OK;
+ ref = heap_strdupAtoW(refa);
+ if(!ref)
+ return NS_ERROR_OUT_OF_MEMORY;
- FIXME("default action not implemented\n");
- return NS_ERROR_NOT_IMPLEMENTED;
+ hres = IUriBuilder_SetFragment(This->uri_builder, ref);
+ heap_free(ref);
+ if(FAILED(hres))
+ return NS_ERROR_UNEXPECTED;
+
+ sync_wine_url(This);
+ return NS_OK;
}
static nsresult NSAPI nsURL_GetDirectory(nsIURL *iface, nsACString *aDirectory)
More information about the wine-cvs
mailing list