RESOLVED INVALID 29560
[Qt] QWebFrame.setHtml() doesn't resolve relative files references in HTML
https://bugs.webkit.org/show_bug.cgi?id=29560
Summary [Qt] QWebFrame.setHtml() doesn't resolve relative files references in HTML
Tor Arne Vestbø
Reported 2009-09-21 08:01:22 PDT
This bug report originated from Nokia internal issue QT-1096 --- Comments --- Version: 4.5.1 Platform: MacOSX Mac OS 10.5.6 on a Unibody Macbook (Intel Core 2 Duo) Compiler: GCC Short description: QWebFrame.setHtml() doesn't resolve relative files references in HTML Did: I use QWebPage::mainFrame()->setHtml(html,QUrl::fromLocalFile("myBasedDir")) to set the HTML content for the Frame. The HTML markup contains references to external files (css, js). The paths of these files are relative to "myBaseDir" set as baseUrl. Expected to see: Correct rendering of HTML markup including resolution of externally referenced resources (css, js) Got instead: All HTML markup and inline css and js are rendered/executed correctly. No externally linked resources are incorporated. More details: The same code works using Qt 4.5.1 on Windows XP
Attachments
Kent Hansen
Comment 1 2010-03-16 05:02:28 PDT
Reproduced with r55986 on Linux. I can't even get this to work when using an absolute base URL.
Jenya Brodskaia
Comment 2 2010-11-09 10:31:57 PST
The test case would help a lot.
Jenya Brodskaia
Comment 3 2010-11-15 08:48:27 PST
The test case is missing, so I created this one according to the description above: QWebView *myView = new QWebView(); QWebPage *myPage = myView->page(); QString html = "<html>RED APPLE <img src=\"apple.gif\"/></html>"; QUrl url = QUrl::fromLocalFile("/home/jb_test/myBaseDir/"); // Works. Valid file:/// url is constructed QUrl url1("file:///home/jb_test/myBaseDir/"); // Works. QUrl url2 = QUrl::fromLocalFile("myBaseDir/"); // Does not work. myPage->mainFrame()->setHtml(html, url); //myPage->mainFrame()->setHtml(html, url1); //myPage->mainFrame()->setHtml(html, url2); myView->show(); The issue is reproducible, but it is not a bug. QUrl::fromLocalFile("myBaseDir/") does not get resolved to the valid url, but if you provide a full file path - it does. See http://doc.trolltech.com/4.7/qurl.html. The documentation does not suggest that relative path may be used in QUrl::fromLocalFile.
Jocelyn Turcotte
Comment 4 2014-02-03 03:15:47 PST
=== Bulk closing of Qt bugs === If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it and remove [Qt] from the summary. If you believe that this is still an important QtWebKit bug, please fill a new report at https://bugreports.qt-project.org and add a link to this issue. See http://qt-project.org/wiki/ReportingBugsInQt for additional guidelines.
Note You need to log in before you can comment on or make changes to this bug.