From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmllocation.c | 19 ++++++++++++++++++- dlls/mshtml/tests/documentmode.js | 3 +++ 2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c index 5c7e66c40df..f1c3a7cbdac 100644 --- a/dlls/mshtml/htmllocation.c +++ b/dlls/mshtml/htmllocation.c @@ -54,6 +54,23 @@ static HRESULT get_url_components(HTMLLocation *This, URL_COMPONENTSW *url) return S_OK; }
+static BOOL is_default_port(URL_COMPONENTSW *url) +{ + INTERNET_PORT def; + + switch (url->nScheme) + { + case INTERNET_SCHEME_HTTP: def = INTERNET_DEFAULT_HTTP_PORT; break; + case INTERNET_SCHEME_HTTPS: def = INTERNET_DEFAULT_HTTPS_PORT; break; + case INTERNET_SCHEME_FTP: def = INTERNET_DEFAULT_FTP_PORT; break; + case INTERNET_SCHEME_SOCKS: def = INTERNET_DEFAULT_SOCKS_PORT; break; + case INTERNET_SCHEME_GOPHER: def = INTERNET_DEFAULT_GOPHER_PORT; break; + default: return FALSE; + } + + return (url->nPort == def); +} + static inline HTMLLocation *impl_from_IHTMLLocation(IHTMLLocation *iface) { return CONTAINING_RECORD(iface, HTMLLocation, IHTMLLocation_iface); @@ -241,7 +258,7 @@ static HRESULT WINAPI HTMLLocation_get_host(IHTMLLocation *iface, BSTR *p) return S_OK; }
- if(url.nPort) { + if(url.nPort && (dispex_compat_mode(&This->window->base.inner_window->event_target.dispex) < COMPAT_MODE_IE10 || !is_default_port(&url))) { /* <hostname>:<port> */ DWORD len, port_len; WCHAR portW[6]; diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index c2230f61ce2..f3ab12765e3 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -1184,8 +1184,11 @@ async_test("script_load", function() { });
sync_test("location", function() { + var v = document.documentMode; document.body.innerHTML = '<a name="testanchor">test</a>';
+ ok(location.host === "winetest.example.org" + (v < 10 ? ":80" : ""), "location.host = " + location.host); + ok(location.hash === "", "initial location.hash = " + location.hash); location.hash = "TestAnchor"; ok(location.hash === "#TestAnchor", "location.hash after set to TestAnchor = " + location.hash);