mshtml: Use helper to get IUri in HTMLLocation implementation.
This commit is contained in:
parent
3918213586
commit
28f35f86c6
|
@ -46,6 +46,13 @@ static HRESULT get_url(HTMLLocation *This, const WCHAR **ret)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static IUri *get_uri(HTMLLocation *This)
|
||||
{
|
||||
if(!This->window)
|
||||
return NULL;
|
||||
return This->window->uri;
|
||||
}
|
||||
|
||||
static HRESULT get_url_components(HTMLLocation *This, URL_COMPONENTSW *url)
|
||||
{
|
||||
const WCHAR *doc_url;
|
||||
|
@ -278,6 +285,7 @@ static HRESULT WINAPI HTMLLocation_get_protocol(IHTMLLocation *iface, BSTR *p)
|
|||
HTMLLocation *This = impl_from_IHTMLLocation(iface);
|
||||
BSTR protocol, ret;
|
||||
unsigned len;
|
||||
IUri *uri;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
@ -285,12 +293,12 @@ static HRESULT WINAPI HTMLLocation_get_protocol(IHTMLLocation *iface, BSTR *p)
|
|||
if(!p)
|
||||
return E_POINTER;
|
||||
|
||||
if(!This->window || !This->window->uri) {
|
||||
if(!(uri = get_uri(This))) {
|
||||
FIXME("No current URI\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
hres = IUri_GetSchemeName(This->window->uri, &protocol);
|
||||
hres = IUri_GetSchemeName(uri, &protocol);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
if(hres == S_FALSE) {
|
||||
|
@ -367,6 +375,7 @@ static HRESULT WINAPI HTMLLocation_get_hostname(IHTMLLocation *iface, BSTR *p)
|
|||
{
|
||||
HTMLLocation *This = impl_from_IHTMLLocation(iface);
|
||||
BSTR hostname;
|
||||
IUri *uri;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
@ -374,12 +383,12 @@ static HRESULT WINAPI HTMLLocation_get_hostname(IHTMLLocation *iface, BSTR *p)
|
|||
if(!p)
|
||||
return E_POINTER;
|
||||
|
||||
if(!This->window || !This->window->uri) {
|
||||
if(!(uri = get_uri(This))) {
|
||||
FIXME("No current URI\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
hres = IUri_GetHost(This->window->uri, &hostname);
|
||||
hres = IUri_GetHost(uri, &hostname);
|
||||
if(hres == S_OK) {
|
||||
*p = hostname;
|
||||
}else if(hres == S_FALSE) {
|
||||
|
@ -403,6 +412,7 @@ static HRESULT WINAPI HTMLLocation_get_port(IHTMLLocation *iface, BSTR *p)
|
|||
{
|
||||
HTMLLocation *This = impl_from_IHTMLLocation(iface);
|
||||
DWORD port;
|
||||
IUri *uri;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
@ -410,12 +420,12 @@ static HRESULT WINAPI HTMLLocation_get_port(IHTMLLocation *iface, BSTR *p)
|
|||
if(!p)
|
||||
return E_POINTER;
|
||||
|
||||
if(!This->window || !This->window->uri) {
|
||||
if(!(uri = get_uri(This))) {
|
||||
FIXME("No current URI\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
hres = IUri_GetPort(This->window->uri, &port);
|
||||
hres = IUri_GetPort(uri, &port);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
|
@ -479,6 +489,7 @@ static HRESULT WINAPI HTMLLocation_get_search(IHTMLLocation *iface, BSTR *p)
|
|||
{
|
||||
HTMLLocation *This = impl_from_IHTMLLocation(iface);
|
||||
BSTR query;
|
||||
IUri *uri;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
@ -486,12 +497,12 @@ static HRESULT WINAPI HTMLLocation_get_search(IHTMLLocation *iface, BSTR *p)
|
|||
if(!p)
|
||||
return E_POINTER;
|
||||
|
||||
if(!This->window || !This->window->uri) {
|
||||
if(!(uri = get_uri(This))) {
|
||||
FIXME("No current URI\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
hres = IUri_GetQuery(This->window->uri, &query);
|
||||
hres = IUri_GetQuery(uri, &query);
|
||||
if(hres == S_OK) {
|
||||
*p = query;
|
||||
}else if(hres == S_FALSE) {
|
||||
|
@ -515,6 +526,7 @@ static HRESULT WINAPI HTMLLocation_get_hash(IHTMLLocation *iface, BSTR *p)
|
|||
{
|
||||
HTMLLocation *This = impl_from_IHTMLLocation(iface);
|
||||
BSTR hash;
|
||||
IUri *uri;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
@ -522,12 +534,12 @@ static HRESULT WINAPI HTMLLocation_get_hash(IHTMLLocation *iface, BSTR *p)
|
|||
if(!p)
|
||||
return E_POINTER;
|
||||
|
||||
if(!This->window || !This->window->uri) {
|
||||
if(!(uri = get_uri(This))) {
|
||||
FIXME("No current URI\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
hres = IUri_GetFragment(This->window->uri, &hash);
|
||||
hres = IUri_GetFragment(uri, &hash);
|
||||
if(hres == S_OK) {
|
||||
*p = hash;
|
||||
}else if(hres == S_FALSE) {
|
||||
|
|
Loading…
Reference in New Issue