diff -r dee5afe5301f -r 3f74d0d4af4c demos/browser/webview.cpp --- a/demos/browser/webview.cpp Mon Mar 15 12:43:09 2010 +0200 +++ b/demos/browser/webview.cpp Thu Apr 08 14:19:33 2010 +0300 @@ -143,11 +143,19 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) { - if (reply->error() == QNetworkReply::NoError) { - BrowserApplication::downloadManager()->handleUnsupportedContent(reply); + QString errorString = reply->errorString(); + + if (m_loadingUrl != reply->url()) { + // sub resource of this page + qWarning() << "Resource" << reply->url().toEncoded() << "has unknown Content-Type, will be ignored."; + reply->deleteLater(); return; } + if (reply->error() == QNetworkReply::NoError && !reply->header(QNetworkRequest::ContentTypeHeader).isValid()) { + errorString = "Unknown Content-Type"; + } + QFile file(QLatin1String(":/notfound.html")); bool isOpened = file.open(QIODevice::ReadOnly); Q_ASSERT(isOpened); @@ -156,7 +164,7 @@ QString title = tr("Error loading page: %1").arg(reply->url().toString()); QString html = QString(QLatin1String(file.readAll())) .arg(title) - .arg(reply->errorString()) + .arg(errorString) .arg(reply->url().toString()); QBuffer imageBuffer;