Commit c80098c4 authored by Andrea Iacovitti's avatar Andrea Iacovitti

Fix setting unencoded url fragment id

BUG: 303618
parent 375bca6d
......@@ -2947,12 +2947,12 @@ void Location::put(ExecState *exec, const Identifier &p, JSValue *v, int attr)
// Note that we want to do gotoAnchor even when the hash is already set, so we
// scroll the destination into view.
// Setting this must always provide a ref, even if just ; see
// Setting this must always provide a ref, even if just # see
// HTML5 2.6.
if (str.isEmpty()) {
url.setHTMLRef("");
} else {
url.setRef(str);
url.setHTMLRef(KUrl::fromPercentEncoding(str.toUtf8()));
}
break;
case Host: {
......
......@@ -1696,6 +1696,18 @@ void DocumentImpl::finishParsing ( )
QString DocumentImpl::completeURL(const QString& url) const
{
if (url.startsWith(QLatin1Char('#'))) {
const QString ref = KUrl::fromPercentEncoding(url.mid(1).toUtf8());
KUrl u = baseURL();
if (ref.isEmpty()) {
u.setHTMLRef("");
}
else {
u.setHTMLRef(ref);
}
return u.url();
}
return KUrl(baseURL(),url /*,m_decoderMibEnum*/).url();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment