Bug 29424 - [Qt] QWebFrame: When a relative url is loaded then it will make it absolute internally, however this strips out any query/fragments
Summary: [Qt] QWebFrame: When a relative url is loaded then it will make it absolute i...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks:
 
Reported: 2009-09-18 07:42 PDT by Tor Arne Vestbø
Modified: 2011-02-16 02:47 PST (History)
4 users (show)

See Also:


Attachments
Testcase (807 bytes, text/x-c++src)
2010-03-15 08:56 PDT, Kent Hansen
no flags Details
Patch for review (1.56 KB, patch)
2011-02-15 12:37 PST, Aparna Nandyal
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tor Arne Vestbø 2009-09-18 07:42:52 PDT
This bug report originated from issue QTBUG-3889
<http://bugreports.qt.nokia.com/browse/QTBUG-3889>

--- Description ---

QWebFrame: When a relative url is loaded then it will make it absolute internally, however this strips out any query/fragments
Comment 1 Kent Hansen 2010-03-15 08:56:10 PDT
Created attachment 50712 [details]
Testcase
Comment 2 Kent Hansen 2010-03-15 08:56:41 PDT
Reproduced with r55986.
Comment 3 Jesus Sanchez-Palencia 2010-05-14 07:43:36 PDT
Reproduced on Snow Leopard with Qt 4.7 trunk (HEAD 03f8f1df0d88f5ffe0b3120cffce614cbeefdb70) and WebKit trunk (r59155).
Comment 4 Aparna Nandyal 2011-02-15 12:37:54 PST
Created attachment 82506 [details]
Patch for review

In function ensureAbsoluteUrl, call is made to QUrl::toLocalFile() which strips the query, fragment part out. Patch corrects this to resolve it before returning absolute url.
Comment 5 Andreas Kling 2011-02-15 12:40:05 PST
Comment on attachment 82506 [details]
Patch for review

Needs a test. :)
Comment 6 Aparna Nandyal 2011-02-16 00:34:04 PST
(In reply to comment #5)
> (From update of attachment 82506 [details])
> Needs a test. :)

Kling as discussed yesterday, I am able to write an automation test. The patch can get tested only when a relative url is passed to QWebView. But the way automation test framework is designed, the test html files are stored in resources directory and an absolute path like qrc:///resources/local.html needs to be passed. When this is passed, the code that needs to be tested is not hit. Tested the below code by passing relative url and it works fine. 

void tst_QWebView::loadRelativeUrl()
{
    QWebView view;
    QSignalSpy spy(view.page(), SIGNAL(loadFinished(bool)));

    // This is the line that should be in the final test. But its absolute path
    // QUrl url("qrc:///resources/local.html");
    
    // This url actually tests the patch
    QUrl url("local.html");

    url.setFragment("Overview");

    view.load(url);
    ::waitForSignal(&view, SIGNAL(loadFinished(bool)));
    QCOMPARE(spy.count(), 1);

    QUrl loadedUrl = view.page()->mainFrame()->url();
    QVERIFY(loadedUrl.hasFragment());
}

Any suggestions to get around this problem.
Comment 7 WebKit Commit Bot 2011-02-16 02:47:34 PST
Comment on attachment 82506 [details]
Patch for review

Clearing flags on attachment: 82506

Committed r78688: <http://trac.webkit.org/changeset/78688>
Comment 8 WebKit Commit Bot 2011-02-16 02:47:39 PST
All reviewed patches have been landed.  Closing bug.