diff options
Diffstat (limited to 'Source/WebCore/page/Location.cpp')
-rw-r--r-- | Source/WebCore/page/Location.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Source/WebCore/page/Location.cpp b/Source/WebCore/page/Location.cpp index 5af48cf..9528437 100644 --- a/Source/WebCore/page/Location.cpp +++ b/Source/WebCore/page/Location.cpp @@ -84,7 +84,7 @@ String Location::host() const // Note: this is the IE spec. The NS spec swaps the two, it says // "The hostname property is the concatenation of the host and port properties, separated by a colon." const KURL& url = this->url(); - return url.port() ? url.host() + ":" + String::number(url.port()) : url.host(); + return url.hasPort() ? url.host() + ":" + String::number(url.port()) : url.host(); } String Location::hostname() const @@ -101,7 +101,7 @@ String Location::port() const return String(); const KURL& url = this->url(); - return url.port() ? String::number(url.port()) : ""; + return url.hasPort() ? String::number(url.port()) : ""; } String Location::pathname() const @@ -201,7 +201,7 @@ void Location::setPort(const String& portString, DOMWindow* activeWindow, DOMWin return; KURL url = m_frame->document()->url(); int port = portString.toInt(); - if (port < 0 || port > 0xFFFF) + if (port < 0 || port > 0xFFFF || portString.isEmpty()) url.removePort(); else url.setPort(port); |