Jacek Caban : mshtml: Added nsIURL::Resolve implementation.

Alexandre Julliard julliard at winehq.org
Wed Aug 18 12:09:59 CDT 2010


Module: wine
Branch: master
Commit: ceab38175077a28772ec591680153b08383090f4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ceab38175077a28772ec591680153b08383090f4

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Aug 18 13:37:32 2010 +0200

mshtml: Added nsIURL::Resolve implementation.

---

 dlls/mshtml/mshtml_private.h |    1 +
 dlls/mshtml/nsio.c           |   36 +++++++++++++++++++++++++++++++-----
 2 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index d501da3..e1193e3 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -36,6 +36,7 @@
 
 #define NS_OK                     ((nsresult)0x00000000L)
 #define NS_ERROR_FAILURE          ((nsresult)0x80004005L)
+#define NS_ERROR_OUT_OF_MEMORY    ((nsresult)0x8007000EL)
 #define NS_NOINTERFACE            ((nsresult)0x80004002L)
 #define NS_ERROR_NOT_IMPLEMENTED  ((nsresult)0x80004001L)
 #define NS_ERROR_NOT_AVAILABLE    ((nsresult)0x80040111L)
diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c
index cdd1e24..986cc76 100644
--- a/dlls/mshtml/nsio.c
+++ b/dlls/mshtml/nsio.c
@@ -1925,18 +1925,44 @@ static nsresult NSAPI nsURI_Clone(nsIURL *iface, nsIURI **_retval)
     return NS_OK;
 }
 
-static nsresult NSAPI nsURI_Resolve(nsIURL *iface, const nsACString *arelativePath,
+static nsresult NSAPI nsURI_Resolve(nsIURL *iface, const nsACString *aRelativePath,
         nsACString *_retval)
 {
     nsWineURI *This = NSURI_THIS(iface);
+    WCHAR url[INTERNET_MAX_URL_LENGTH];
+    const char *patha;
+    WCHAR *path;
+    char *urla;
+    DWORD len;
+    HRESULT hres;
 
-    TRACE("(%p)->(%s %p)\n", This, debugstr_nsacstr(arelativePath), _retval);
+    TRACE("(%p)->(%s %p)\n", This, debugstr_nsacstr(aRelativePath), _retval);
 
     if(This->uri)
-        return nsIURI_Resolve(This->uri, arelativePath, _retval);
+        return nsIURI_Resolve(This->uri, aRelativePath, _retval);
 
-    FIXME("default action not implemented\n");
-    return NS_ERROR_NOT_IMPLEMENTED;
+    nsACString_GetData(aRelativePath, &patha);
+    path = heap_strdupAtoW(patha);
+    if(!path)
+        return NS_ERROR_OUT_OF_MEMORY;
+
+    hres = CoInternetCombineUrl(This->wine_url, path,
+                                URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO,
+                                url, sizeof(url)/sizeof(WCHAR), &len, 0);
+    heap_free(path);
+    if(FAILED(hres)) {
+        ERR("CoIntenetCombineUrl failed: %08x\n", hres);
+        return NS_ERROR_FAILURE;
+    }
+
+    urla = heap_strdupWtoA(url);
+    if(!urla)
+        return NS_ERROR_OUT_OF_MEMORY;
+
+    TRACE("returning %s\n", debugstr_a(urla));
+    nsACString_SetData(_retval, urla);
+    heap_free(urla);
+    return NS_OK;
 }
 
 static nsresult NSAPI nsURI_GetAsciiSpec(nsIURL *iface, nsACString *aAsciiSpec)




More information about the wine-cvs mailing list