void HTMLAnchorElement::setHost(const String& value) { if (value.isEmpty()) return; KURL url = href(); if (!url.canSetHostOrPort()) return; size_t separator = value.find(':'); if (!separator) return; if (separator == notFound) url.setHostAndPort(value); else { unsigned portEnd; unsigned port = parsePortFromStringPosition(value, separator + 1, portEnd); if (!port) { // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes // specifically goes against RFC 3986 (p3.2) and // requires setting the port to "0" if it is set to empty string. url.setHostAndPort(value.substring(0, separator + 1) + "0"); } else { if (isDefaultPortForProtocol(port, url.protocol())) url.setHostAndPort(value.substring(0, separator)); else url.setHostAndPort(value.substring(0, portEnd)); } } setHref(url.string()); }
void Location::setHost(LocalDOMWindow* callingWindow, LocalDOMWindow* enteredWindow, const String& host) { if (!m_frame) return; KURL url = m_frame->document()->url(); url.setHostAndPort(host); setLocation(url.string(), callingWindow, enteredWindow); }
void Location::setHost(const String& host, DOMWindow* activeWindow, DOMWindow* firstWindow) { if (!m_frame) return; KURL url = m_frame->document()->url(); url.setHostAndPort(host); setLocation(url.string(), activeWindow, firstWindow); }
void JSLocation::setHost(ExecState* exec, JSValue value) { Frame* frame = impl()->frame(); ASSERT(frame); KURL url = frame->loader()->url(); url.setHostAndPort(value.toString(exec)); navigateIfAllowed(exec, frame, url, !frame->script()->anyPageIsProcessingUserGesture(), false); }
void JSLocation::setHost(ExecState* exec, JSValue* value) { Frame* frame = impl()->frame(); ASSERT(frame); KURL url = frame->loader()->url(); url.setHostAndPort(value->toString(exec)); navigateIfAllowed(exec, frame, url, false); }