RESOLVED DUPLICATE of bug 32723 55370
[Qt] QWebView fails to load first page with an Anchor
https://bugs.webkit.org/show_bug.cgi?id=55370
Summary [Qt] QWebView fails to load first page with an Anchor
Andy Nichols
Reported 2011-02-28 05:50:45 PST
If when using QWebView::setUrl() for the first time the URL contains an anchor(ex. #something) then the QWebView will fail to update. For example: int main(int argc, char *argv[]) { QApplication a(argc, argv); QWebView webView; webView.show(); webView.setUrl(QUrl(QString::fromLatin1("http://doc.qt.nokia.com/4.7/qcombobox.html"))); return a.exec(); } will successfully update the view to display the page, while: int main(int argc, char *argv[]) { QApplication a(argc, argv); QWebView webView; webView.show(); webView.setUrl(QUrl(QString::fromLatin1("http://doc.qt.nokia.com/4.7/qcombobox.html#itemDelegate"))); return a.exec(); } Will not update the webview at all. Calling QWebView::load(QUrl(QString::fromLatin1("http://doc.qt.nokia.com/4.7/qcombobox.html#itemDelegate"))); does work however, but the inconsistency of behavior when using anchors with QWebView::setUrl(...) is cause for concernt. Also not that the following also works: int main(int argc, char *argv[]) { QApplication a(argc, argv); QWebView webView; webView.show(); webView.setUrl(QUrl(QString::fromLatin1("http://doc.qt.nokia.com/4.7/qcombobox.html#itemDelegate"))); webView.setUrl(QUrl(QString::fromLatin1("http://doc.qt.nokia.com/4.7/qcombobox.html#itemDelegate"))); return a.exec(); } It is worth noting that in FrameLoader::loadWithDocumentLoader(DocumentLoader* loader, FrameLoadType type, PassRefPtr<FormState> prpFormState), WebCore/loader/FrameLoader.cpp:2077 if (shouldScrollToAnchor(isFormSubmission, policyChecker()->loadType(), newURL)) returns true for the first call to setUrl above and false for the second. Also, the Version of Webkit used is the one included with the Qt Master branch
Attachments
Test case code (276 bytes, application/octet-stream)
2011-02-28 07:17 PST, Benjamin Poulain
no flags
Benjamin Poulain
Comment 1 2011-02-28 07:17:43 PST
Created attachment 84055 [details] Test case code
Aparna Nandyal
Comment 2 2011-03-01 03:43:42 PST
This bug is same as https://bugs.webkit.org/show_bug.cgi?id=32723 The root cause of the problem is same in both cases, the calls to d->frame->loader()->activeDocumentLoader()->writer()->begin(absolute); d->frame->loader()->activeDocumentLoader()->writer()->end(); in QWebFrame::setUrl is causing this problem. Im looking into another bug (https://bugs.webkit.org/show_bug.cgi?id=54380) that will possibly refactor this code.
Benjamin Poulain
Comment 3 2011-03-01 04:09:00 PST
*** This bug has been marked as a duplicate of bug 32723 ***
Note You need to log in before you can comment on or make changes to this bug.