Bug 29466
Summary: | [Qt] [Webkit] Using backslash escaping breaks links. | ||
---|---|---|---|
Product: | WebKit | Reporter: | Tor Arne Vestbø <vestbo> |
Component: | Page Loading | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Minor | CC: | jturcotte |
Priority: | P2 | Keywords: | Qt |
Version: | 528+ (Nightly build) | ||
Hardware: | Other | ||
OS: | OS X 10.5 |
Tor Arne Vestbø
This bug report originated from issue QTBUG-2479
<http://bugreports.qt.nokia.com/browse/QTBUG-2479>
--- Description ---
When using the following link to a local HMTL file and clicking a link to another local file, the new page doesn’t load.
For example: “c:\\pages\\index.html” is written in the address bar in the Qt browser demo. The page loads but when a link inside is pressed; the new page is not loaded properly.
With “c:/pages/index.html” everything works perfect.
On Tue Jul 22 13:56:37 2008 qtsupport wrote:
- How to reproduce:
1. Start the demo browser in Qt 4.4
2. Copy the files from task 220074 to a directory(i.e. c:/pages)
3. Load the page typing “c:\\pages\\index.html” in the address bar.
4. Click on the link
- Expected result:
New page should load.
- Actual result:
A blank page
Contents:
Or use this code(four files):
Testlinkclicked.h
class testLinkClicked : public QObject
{
Q_OBJECT
public:
testLinkClicked() {};
testLinkClicked( QWebView* w ){
connect( w, SIGNAL( linkClicked ( const QUrl & ) ),
this, SLOT( showLinkClicked() ) );
}
public slots:
void showLinkClicked(){
qDebug("Link has been clicked!");
}
};
qtest.cpp
int main(int argc, char **argv){
QApplication qapp(argc,argv);
QWebView* view = new QWebView();
/*
* uncomment these lines to see if link is clicked
*/
// view->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
// testLinkClicked test( view );
/*
* works: absolute path with forward slashes
*/
QString l_urlString = QDir::currentPath() + "/index.html";
/*
* does not work: the slash before the html file is a backslash!
*
* effect: link acts as being clicked (changes color) but index.html stays the current page
*/
// QString l_urlString = QDir::currentPath() + "\\index.html";
/*
* does not work: all slashes are backslash
*
* effect: blank page is shown
*/
// QString l_urlString = QDir::currentPath().replace('/', "\\") + "\\index.html";
qDebug( "%s", qPrintable( l_urlString ) );
QUrl l_url( l_urlString );
view->setUrl( l_url );
view->show();
qapp.exec();
}
Index.html
<html><head><title>This is page 1</title></head><body><h1>this is page 1 (index.html)</h1>Click here to go to <a href="page2.html">page2</a></body></html>
Page2.html
<html><head><title>This is page 2</title></head><body><h1>This is page 2</h1></body></html>
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Jocelyn Turcotte
Fixed in 4.6.0