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

This commit is contained in:
Rob Shearman 2007-06-24 09:17:51 +01:00 committed by Alexandre Julliard
parent 0e4ccb822c
commit 6c6e4515fc
1 changed files with 27 additions and 3 deletions

View File

@ -26,8 +26,10 @@
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winuser.h" #include "winuser.h"
#include "winreg.h"
#include "winnls.h" #include "winnls.h"
#include "ole2.h" #include "ole2.h"
#include "shlwapi.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.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); WARN("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
VariantInit(AttributeValue);
nsAString_Init(&attr_str, strAttributeName); nsAString_Init(&attr_str, strAttributeName);
nsAString_Init(&value_str, NULL); nsAString_Init(&value_str, NULL);
@ -156,10 +160,30 @@ static HRESULT WINAPI HTMLElement_getAttribute(IHTMLElement *iface, BSTR strAttr
nsAString_Finish(&attr_str); nsAString_Finish(&attr_str);
if(NS_SUCCEEDED(nsres)) { if(NS_SUCCEEDED(nsres)) {
static const WCHAR wszSRC[] = {'s','r','c',0};
nsAString_GetData(&value_str, &value, NULL); nsAString_GetData(&value_str, &value, NULL);
V_VT(AttributeValue) = VT_BSTR; if(!strcmpiW(strAttributeName, wszSRC))
V_BSTR(AttributeValue) = SysAllocString(value); {
TRACE("attr_value=%s\n", debugstr_w(V_BSTR(AttributeValue))); 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 { }else {
ERR("GetAttribute failed: %08x\n", nsres); ERR("GetAttribute failed: %08x\n", nsres);
hres = E_FAIL; hres = E_FAIL;