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

Marcelo Lira marcelo.lira at openbossa.org
Fri Mar 30 13:29:29 PDT 2012


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.

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


More information about the webkit-qt mailing list