ohos: Do not report a failed page load as succeeded
When a page load fails after the navigation has been committed, the web
component reports onPageBegin, then onErrorReceive with the failure, and
finally onPageEnd. This happens, for example, when loading a qrc URL
that points to a resource which does not exist: the qrc scheme is
supported, so the load is started rather than rejected, and the missing
resource is reported asynchronously through onErrorReceive.
onPageEnd was translated unconditionally to LoadSucceededStatus, so the
emitted loadingChanged sequence was Started, Failed, Succeeded. As the
load terminated in Succeeded, waitForLoad() never observed a final
LoadFailedStatus and test_loadNonexistentFileUrl() in
tests/auto/qml/qquickwebview/tst_qquickwebview.qml failed.
Track whether the current load has already reported an error: the state
is cleared when a page starts loading in onPageBegin and set in
onErrorReceive. In onPageEnd, skip emitting LoadSucceededStatus when an
error was reported, so that a load which failed ends in
LoadFailedStatus, as test_loadNonexistentFileUrl() expects.
Task-number: QTBUG-146838
Pick-to: 6.12
Change-Id: Ide6f2c10b18d63b987cc5a60c571fe2cfb071dcb
Reviewed-by: Zbigniew Chyla <zbigniew.chyla@qt.io>
Reviewed-by: SanthoshKumar Selvaraj <santhosh.kumar.selvaraj@qt.io>