Rob Shearman : mshtml: The SRC value returned from HTMLElement_getAttribute should be an absolute , not relative URL.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jun 25 07:28:31 CDT 2007


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

Author: Rob Shearman <rob at codeweavers.com>
Date:   Sun Jun 24 09:17:51 2007 +0100

mshtml: The SRC value returned from HTMLElement_getAttribute should be an absolute, not relative URL.

---

 dlls/mshtml/htmlelem.c |   30 +++++++++++++++++++++++++++---
 1 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index 37abb51..516a0d0 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -26,8 +26,10 @@
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
+#include "winreg.h"
 #include "winnls.h"
 #include "ole2.h"
+#include "shlwapi.h"
 
 #include "wine/debug.h"
 #include "wine/unicode.h"
@@ -149,6 +151,8 @@ static HRESULT WINAPI HTMLElement_getAttribute(IHTMLElement *iface, BSTR strAttr
 
     WARN("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
 
+    VariantInit(AttributeValue);
+
     nsAString_Init(&attr_str, strAttributeName);
     nsAString_Init(&value_str, NULL);
 
@@ -156,10 +160,30 @@ static HRESULT WINAPI HTMLElement_getAttribute(IHTMLElement *iface, BSTR strAttr
     nsAString_Finish(&attr_str);
 
     if(NS_SUCCEEDED(nsres)) {
+        static const WCHAR wszSRC[] = {'s','r','c',0};
         nsAString_GetData(&value_str, &value, NULL);
-        V_VT(AttributeValue) = VT_BSTR;
-        V_BSTR(AttributeValue) = SysAllocString(value);
-        TRACE("attr_value=%s\n", debugstr_w(V_BSTR(AttributeValue)));
+        if(!strcmpiW(strAttributeName, wszSRC))
+        {
+            WCHAR buffer[256];
+            DWORD len;
+            BSTR bstrBaseUrl;
+            hres = IHTMLDocument2_get_URL(HTMLDOC(This->node->doc), &bstrBaseUrl);
+            if(SUCCEEDED(hres)) {
+                hres = CoInternetCombineUrl(bstrBaseUrl, value,
+                                            URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO,
+                                            buffer, sizeof(buffer)/sizeof(WCHAR), &len, 0);
+                SysFreeString(bstrBaseUrl);
+                if(SUCCEEDED(hres)) {
+                    V_VT(AttributeValue) = VT_BSTR;
+                    V_BSTR(AttributeValue) = SysAllocString(buffer);
+                    TRACE("attr_value=%s\n", debugstr_w(V_BSTR(AttributeValue)));
+                }
+            }
+        }else {
+            V_VT(AttributeValue) = VT_BSTR;
+            V_BSTR(AttributeValue) = SysAllocString(value);
+            TRACE("attr_value=%s\n", debugstr_w(V_BSTR(AttributeValue)));
+        }
     }else {
         ERR("GetAttribute failed: %08x\n", nsres);
         hres = E_FAIL;




More information about the wine-cvs mailing list