[webkit-qt] Page loading status API could be improved

Jesus Sanchez-Palencia jesus at webkit.org
Mon Apr 2 11:28:56 PDT 2012


Heeey,

On Fri, Mar 30, 2012 at 5:29 PM, Marcelo Lira <marcelo.lira at openbossa.org>wrote:

> Hi all,
>
> In Qt5/WebKit2, when monitoring the loading of a page in a WebView,
> before the loading is complete I call WebView.stop(). After stoping,
> WebView.loadRequest.status will be set to WebView.LoadFailedStatus.
> But this is no error, since the load was intentionally interrupted.
>


Suddenly it came to my mind that "Cancellation errors" should not emit
LoadFailedStatus by any means, as decided a while ago. That was when I
realized we do actually have a bug because ResourceError::isCancellation()
is always returning false to errors that have been sent through IPC.

Bug: https://bugs.webkit.org/show_bug.cgi?id=82917

I  will upload a patch within the next 7 minutes. And now we'll be able to
handle this properly and raise a LoadStoppedStatus :} .

Cheers!
jesus




>
> To know if the LoadFailedStatus represents an intentional stop to the
> loading process, I have to check also loadRequest.errorCode, as in the
> QML code below:
>
> WebView {
>    onLoadingChanged: {
>        if (loadRequest.status !== WebView.LoadFailedStatus
>            || loadRequest.errorCode ===
> NetworkReply.OperationCanceledError)
>            return; // Not an error, user stopped the page loading.
>        (...)
>        // Check for real errors.
>    }
> }
>
> Checking QQuickWebView I saw these possible load statuses:
>
> enum LoadStatus {
>    LoadStartedStatus,
>    LoadSucceededStatus,
>    LoadFailedStatus
> };
>
> It seems to me that a LoadStoppedStatus would make more sense for the
> case I'm describing, and also make the checking code simpler.
> Does any one agree with this? Should I fill a bug, or leave it be?
>
> Cheers,
> Marcelo
> _______________________________________________
> webkit-qt mailing list
> webkit-qt at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20120402/d1fad652/attachment.html>


More information about the webkit-qt mailing list