[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdelibs/KDE/4.14] khtml: Fix setting unencoded url fragment id
From: Andrea Iacovitti <aiacovitti () libero ! it>
Date: 2014-11-30 20:40:36
Message-ID: E1XvBIK-0004wU-Kd () scm ! kde ! org
[Download RAW message or body]
Git commit c80098c40cb520da9ac5715603fef77d969c9971 by Andrea Iacovitti.
Committed on 30/11/2014 at 20:37.
Pushed by aiacovitti into branch 'KDE/4.14'.
Fix setting unencoded url fragment id
BUG: 303618
M +2 -2 khtml/ecma/kjs_window.cpp
M +12 -0 khtml/xml/dom_docimpl.cpp
http://commits.kde.org/kdelibs/c80098c40cb520da9ac5715603fef77d969c9971
diff --git a/khtml/ecma/kjs_window.cpp b/khtml/ecma/kjs_window.cpp
index bd83222..d9b26f7 100644
--- a/khtml/ecma/kjs_window.cpp
+++ b/khtml/ecma/kjs_window.cpp
@@ -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: {
diff --git a/khtml/xml/dom_docimpl.cpp b/khtml/xml/dom_docimpl.cpp
index b8e5910..0453e1b 100644
--- a/khtml/xml/dom_docimpl.cpp
+++ b/khtml/xml/dom_docimpl.cpp
@@ -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();
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic