Bug 64362 - [Qt][WK2] Add informative loadFailed() signal to web views.
Summary: [Qt][WK2] Add informative loadFailed() signal to web views.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks:
 
Reported: 2011-07-12 08:24 PDT by Andreas Kling
Modified: 2011-07-12 13:22 PDT (History)
3 users (show)

See Also:


Attachments
Proposed patch (17.88 KB, patch)
2011-07-12 08:26 PDT, Andreas Kling
no flags Details | Formatted Diff | Diff
Proposed patch v2 (17.78 KB, patch)
2011-07-12 08:31 PDT, Andreas Kling
no flags Details | Formatted Diff | Diff
Proposed patch v3 (22.53 KB, patch)
2011-07-12 08:57 PDT, Andreas Kling
benjamin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kling 2011-07-12 08:24:37 PDT
SSIA.
Comment 1 Andreas Kling 2011-07-12 08:26:27 PDT
Created attachment 100488 [details]
Proposed patch
Comment 2 Andreas Kling 2011-07-12 08:27:44 PDT
Comment on attachment 100488 [details]
Proposed patch

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

> Source/WebKit2/UIProcess/API/qt/qweberror.cpp:81
> +    WKRetainPtr<WKURLRef> failingURL = adoptWK(WKErrorCopyFailingURL(d->error.get()));
> +    WKRetainPtr<WKStringRef> failingURLString = adoptWK(WKURLCopyString(failingURL.get()));
> +    return QUrl(WKStringCopyQString(failingURLString.get()));

Whoops, just realized we have "QUrl WKURLCopyQUrl(WKURLRef urlRef)", will use that instead.
Comment 3 WebKit Review Bot 2011-07-12 08:29:11 PDT
Attachment 100488 [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/qweberror_p.h:24:  Header file should not contain WebCore config.h. Should be: alphabetically sorted.  [build/include_order] [4]
Total errors found: 1 in 15 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Andreas Kling 2011-07-12 08:31:50 PDT
Created attachment 100489 [details]
Proposed patch v2

Fixed style complaint and use WKURLQt convenience shizzle.
Comment 5 Benjamin Poulain 2011-07-12 08:33:21 PDT
Comment on attachment 100489 [details]
Proposed patch v2

Clearing the flag while Andreas add the test.
Comment 6 Benjamin Poulain 2011-07-12 08:45:22 PDT
Comment on attachment 100489 [details]
Proposed patch v2

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

Clearing the flag while Andreas add the test.

> Source/WebKit2/UIProcess/API/qt/qweberror.h:43
> +    int errorCode() const;

This could disappear in favor of errorCodeAsHttpStatusCode() const.

> Source/WebKit2/UIProcess/API/qt/qweberror.h:51
> +    QWebError();

Oops

> Source/WebKit2/UIProcess/qt/ClientImpl.cpp:56
> +    toQtWebPageProxy(clientInfo)->loadDidSucceed();
> +    toQtWebPageProxy(clientInfo)->updateNavigationActions();

I would invert these calls.

> Source/WebKit2/UIProcess/qt/ClientImpl.cpp:65
> +    toQtWebPageProxy(clientInfo)->loadDidFail(QWebErrorPrivate::createQWebError(error));
>      toQtWebPageProxy(clientInfo)->updateNavigationActions();

Same here, so the actions are valid in the code taking care of loadFailed().
Comment 7 Andreas Kling 2011-07-12 08:46:46 PDT
(In reply to comment #6)
> (From update of attachment 100489 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=100489&action=review
> 
> Clearing the flag while Andreas add the test.
> 
> > Source/WebKit2/UIProcess/API/qt/qweberror.h:43
> > +    int errorCode() const;
> 
> This could disappear in favor of errorCodeAsHttpStatusCode() const.

Fair enough. And we just don't make any promises about the "engine errors" for now.

> > Source/WebKit2/UIProcess/API/qt/qweberror.h:51
> > +    QWebError();
> 
> Oops

D'oh.

> > Source/WebKit2/UIProcess/qt/ClientImpl.cpp:56
> > +    toQtWebPageProxy(clientInfo)->loadDidSucceed();
> > +    toQtWebPageProxy(clientInfo)->updateNavigationActions();
> 
> I would invert these calls.
> 
> > Source/WebKit2/UIProcess/qt/ClientImpl.cpp:65
> > +    toQtWebPageProxy(clientInfo)->loadDidFail(QWebErrorPrivate::createQWebError(error));
> >      toQtWebPageProxy(clientInfo)->updateNavigationActions();
> 
> Same here, so the actions are valid in the code taking care of loadFailed().

Good idea.
Comment 8 Andreas Kling 2011-07-12 08:57:07 PDT
Created attachment 100493 [details]
Proposed patch v3
Comment 9 Benjamin Poulain 2011-07-12 09:08:16 PDT
Comment on attachment 100493 [details]
Proposed patch v3

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

> Source/WebKit2/UIProcess/API/qt/tests/commonviewtests/tst_commonviewtests.cpp:90
> +    viewAbstraction->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/kenneth_fanclub_members.html")));

I am not sure that is solid test. I can totally such a page in the tests in the near future ;)
Comment 10 Andreas Kling 2011-07-12 09:17:48 PDT
Committed r90820: <http://trac.webkit.org/changeset/90820>
Comment 11 Kenneth Rohde Christiansen 2011-07-12 13:05:27 PDT
Comment on attachment 100493 [details]
Proposed patch v3

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

> Source/WebKit2/UIProcess/API/qt/qweberror.h:39
> +        HttpError,

So what about HTTPS? SPYDY etc ... wouldn't ProtocolError be better?

> Source/WebKit2/UIProcess/API/qt/tests/commonviewtests/tst_commonviewtests.cpp:36
> +    void loadNonexistentFileUrl();

NonExisting
Comment 12 Benjamin Poulain 2011-07-12 13:15:23 PDT
(In reply to comment #11)
> > Source/WebKit2/UIProcess/API/qt/qweberror.h:39
> > +        HttpError,
> 
> So what about HTTPS? SPYDY etc ... wouldn't ProtocolError be better?

We had a little discussion with Andreas about how simple can this API be while still being useful. We recognized having the HTTP status code is an important use case even for a very simple view.

The naming is probably not good enough if you thought that could be related to https, spydy, etc.
Comment 13 Andreas Kling 2011-07-12 13:17:17 PDT
(In reply to comment #11)
> (From update of attachment 100493 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=100493&action=review
> 
> > Source/WebKit2/UIProcess/API/qt/qweberror.h:39
> > +        HttpError,
> 
> So what about HTTPS? SPYDY etc ... wouldn't ProtocolError be better?

We can certainly tweak that and/or add more error types. Do note that this kind of error will only be emitted when the QNetworkReply has the QNetworkRequest::HttpStatusCodeAttribute set.

> > Source/WebKit2/UIProcess/API/qt/tests/commonviewtests/tst_commonviewtests.cpp:36
> > +    void loadNonexistentFileUrl();
> 
> NonExisting

http://www.thefreedictionary.com/nonexistent :3
Comment 14 Kenneth Rohde Christiansen 2011-07-12 13:21:29 PDT
> We can certainly tweak that and/or add more error types. Do note that this kind of error will only be emitted when the QNetworkReply has the QNetworkRequest::HttpStatusCodeAttribute set.

Anyway, if Http covers https (which I assume) this should be fine.

> > NonExisting
> 
> http://www.thefreedictionary.com/nonexistent :3

Aha
Comment 15 Kenneth Rohde Christiansen 2011-07-12 13:22:12 PDT
Though, maybe HttpProtocolError is a better name (yes, I know the p in http means protocol, but how many things about that? :-))