void QtWebPageLoadClient::dispatchLoadFailed(WKErrorRef error) { int errorCode = WKErrorGetErrorCode(error); if (toImpl(error)->platformError().isCancellation() || errorCode == kWKErrorCodeFrameLoadInterruptedByPolicyChange || errorCode == kWKErrorCodePlugInWillHandleLoad) { // Make sure that LoadStartedStatus has a counterpart when e.g. requesting a download. dispatchLoadSucceeded(); return; } QtWebError qtError(error); QWebLoadRequest loadRequest(qtError.url(), QQuickWebView::LoadFailedStatus, qtError.description(), static_cast<QQuickWebView::ErrorDomain>(qtError.type()), qtError.errorCode()); emit m_webView->loadingChanged(&loadRequest); }
void QtDownloadManager::didFailDownload(WKContextRef, WKDownloadRef download, WKErrorRef error, const void* clientInfo) { QtDownloadManager* q = toQtDownloadManager(clientInfo); // Will be called when download fails or is aborted. QWebDownloadItem* downloadItem = q->m_downloads.take(WKDownloadGetID(download)); ASSERT(downloadItem); // If the parent is null at this point, the download failed before it // received a response and downloadRequested was emitted. // Due to this the item will never be parented and we have to delete it // manually at this point. if (!downloadItem->parent()) { delete downloadItem; return; } QtWebError qtError(error); emit downloadItem->failed(qtError.errorCodeAsDownloadError(), qtError.url(), qtError.description()); }