Bug 55501 - [Qt][WK2] Loading an empty URL crashes
Summary: [Qt][WK2] Loading an empty URL crashes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P3 Normal
Assignee: Benjamin Poulain
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks:
 
Reported: 2011-03-01 13:29 PST by Benjamin Poulain
Modified: 2011-03-16 04:21 PDT (History)
5 users (show)

See Also:


Attachments
Patch (4.93 KB, patch)
2011-03-01 14:02 PST, Benjamin Poulain
no flags Details | Formatted Diff | Diff
Patch (5.17 KB, patch)
2011-03-15 09:38 PDT, Benjamin Poulain
kling: review-
Details | Formatted Diff | Diff
Patch (5.34 KB, patch)
2011-03-16 03:52 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Poulain 2011-03-01 13:29:36 PST
WKPageLoadURL is not supposed to get null WKURLRef. This dereferences a null pointer:

void WKPageLoadURL(WKPageRef pageRef, WKURLRef URLRef)
{
    toImpl(pageRef)->loadURL(toImpl(URLRef)->string());
}
Comment 1 Benjamin Poulain 2011-03-01 14:02:40 PST
Created attachment 84290 [details]
Patch
Comment 2 WebKit Review Bot 2011-03-01 14:06:55 PST
Attachment 84290 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit..." exit_code: 1

Source/WebKit2/UIProcess/API/qt/tests/qwkpage/tst_qwkpage.cpp:20:  Found other header before WebCore config.h. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
Total errors found: 1 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Benjamin Poulain 2011-03-15 09:38:16 PDT
Created attachment 85817 [details]
Patch

As Andreas pointed out on IRC, null WKURLRef are actually a valid value in the WebKit 2 C APIs.

I changed the patch to take that into account. It happens that there is a method toWTFString() to do all the work for me :)
Comment 4 WebKit Review Bot 2011-03-15 09:39:52 PDT
Attachment 85817 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit..." exit_code: 1

Source/WebKit2/UIProcess/API/qt/tests/qwkpage/tst_qwkpage.cpp:20:  Found other header before WebCore config.h. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
Total errors found: 1 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Andreas Kling 2011-03-15 11:58:46 PDT
Comment on attachment 85817 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=85817&action=review

> Source/WebKit2/UIProcess/API/qt/tests/qgraphicswkview/tst_qgraphicswkview.cpp:99
> +    // That should not crash.
> +    m_view->show();
> +    m_view->m_webView->load(QUrl());
> +    QTest::qWait(50);
> +
> +    m_view->m_webView->load(QUrl(""));
> +    QTest::qWait(50);

Let's use the QWKPage::engineConnectionChanged() signal to find out if the web process crashed.
This test would never fail, since the autotest process cruises along happily.
Comment 6 Benjamin Poulain 2011-03-16 03:52:54 PDT
Created attachment 85921 [details]
Patch

> Let's use the QWKPage::engineConnectionChanged() signal to find out if the web process crashed.
> This test would never fail, since the autotest process cruises along happily.

Good point, I did not realize crashing the WebProcess would not have side effects on the test. Patch updated.
Comment 7 WebKit Review Bot 2011-03-16 03:57:24 PDT
Attachment 85921 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit..." exit_code: 1

Source/WebKit2/UIProcess/API/qt/tests/qwkpage/tst_qwkpage.cpp:20:  Found other header before WebCore config.h. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
Total errors found: 1 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 WebKit Commit Bot 2011-03-16 04:21:54 PDT
Comment on attachment 85921 [details]
Patch

Clearing flags on attachment: 85921

Committed r81237: <http://trac.webkit.org/changeset/81237>
Comment 9 WebKit Commit Bot 2011-03-16 04:21:59 PDT
All reviewed patches have been landed.  Closing bug.