mirror of
https://github.com/thoughtbot/capybara-webkit
synced 2023-03-27 23:22:28 -04:00
2eb38b3c02
WebPage::setContent will cause the loadFinished signal to fire, so there's no need to call loadFinished if the signal is connected.
23 lines
714 B
C++
23 lines
714 B
C++
#include "UnsupportedContentHandler.h"
|
|
#include "WebPage.h"
|
|
#include <QNetworkReply>
|
|
|
|
UnsupportedContentHandler::UnsupportedContentHandler(WebPage *page, QNetworkReply *reply, QObject *parent) : QObject(parent) {
|
|
m_page = page;
|
|
m_reply = reply;
|
|
}
|
|
|
|
void UnsupportedContentHandler::renderNonHtmlContent() {
|
|
QByteArray text = m_reply->readAll();
|
|
m_page->mainFrame()->setContent(text, QString("text/plain"), m_reply->url());
|
|
m_page->unsupportedContentFinishedReply(m_reply);
|
|
this->deleteLater();
|
|
}
|
|
|
|
void UnsupportedContentHandler::waitForReplyToFinish() {
|
|
connect(m_reply, SIGNAL(finished()), this, SLOT(replyFinished()));
|
|
}
|
|
|
|
void UnsupportedContentHandler::replyFinished() {
|
|
renderNonHtmlContent();
|
|
}
|