From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmldoc.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 35d8a6ac0e7..eb2269ae705 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -1040,11 +1040,31 @@ static HRESULT WINAPI HTMLDocument_get_vlinkColor(IHTMLDocument2 *iface, VARIANT static HRESULT WINAPI HTMLDocument_get_referrer(IHTMLDocument2 *iface, BSTR *p) { HTMLDocumentNode *This = impl_from_IHTMLDocument2(iface); + nsACString spec_str; + const char *spec; + nsIURI *referrer; + WCHAR *specW;
- FIXME("(%p)->(%p)\n", This, p); + TRACE("(%p)->(%p)\n", This, p);
*p = NULL; - return S_OK; + + if(!This->window || !This->window->bscallback || !(referrer = This->window->bscallback->nschannel->referrer)) + return S_OK; + + nsACString_InitDepend(&spec_str, NULL); + if(NS_FAILED(nsIURI_GetSpec(referrer, &spec_str))) { + WARN("GetSpec failed, returning NULL\n"); + return S_OK; + } + nsACString_GetData(&spec_str, &spec); + if(spec && (specW = heap_strdupAtoW(spec))) { + *p = SysAllocString(specW); + heap_free(specW); + } + nsACString_Finish(&spec_str); + + return *p || !spec ? S_OK : E_OUTOFMEMORY; }
static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLocation **p)