Description
We set html, which contains javascript, with QWebView::setHtml(). In a javascript function we define an url, which consists only the anchor portion of the url i.e. it starts with a hash. Then an assertion fails:
ASSERTION FAILED: url.isEmpty() || isSchemeFirstChar(url[0])
platform\KURL.cpp(307) : WebCore::checkEncodedString
Using only the anchor portion of the url is a valid address in html. Thus it should not fail.
The error can be reproduced with the following code snippet.
#include <QApplication> #include <QWebView> void main(int argc, char *argv[]) { QApplication a(argc, argv); QWebView webView; webView.setHtml("<!DOCTYPE html><html><head></head><body onLoad=\"gotoAnchor();\"><script type=\"text/javascript\">function gotoAnchor() { location.href = \"#anchor\"; }</script></body></html>"); return; }
Reproducible only in Qt5.
Attachments
For Gerrit Dashboard: QTBUG-38546 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
97795,3 | Do not schedule navigation to invalid URL | 5.4 | qt/qtwebkit | Status: MERGED | +2 | 0 |