diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp index 17112b344..4e18b807c 100644 --- a/src/networkaccessmanager.cpp +++ b/src/networkaccessmanager.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include "phantom.h" #include "config.h" @@ -251,6 +252,9 @@ QNetworkReply *NetworkAccessManager::createRequest(Operation op, const QNetworkR if (op == QNetworkAccessManager::PostOperation) data["postData"] = postData.data(); data["time"] = QDateTime::currentDateTime(); + QWebFrame *frame = qobject_cast(request.originatingObject()); + data["frameName"] = frame->frameName(); + JsNetworkRequest jsNetworkRequest(&req, this); emit resourceRequested(data, &jsNetworkRequest); @@ -307,7 +311,7 @@ void NetworkAccessManager::handleStarted() return; m_started += reply; - + QVariantList headers; foreach (QByteArray headerName, reply->rawHeaderList()) { QVariantMap header; @@ -328,6 +332,9 @@ void NetworkAccessManager::handleStarted() data["headers"] = headers; data["time"] = QDateTime::currentDateTime(); + QWebFrame *frame = qobject_cast(reply->request().originatingObject()); + data["frameName"] = frame->frameName(); + emit resourceReceived(data); } @@ -378,6 +385,9 @@ void NetworkAccessManager::handleFinished(QNetworkReply *reply, const QVariant & data["headers"] = headers; data["time"] = QDateTime::currentDateTime(); + QWebFrame *frame = qobject_cast(reply->request().originatingObject()); + data["frameName"] = frame->frameName(); + m_ids.remove(reply); m_started.remove(reply); @@ -409,5 +419,8 @@ void NetworkAccessManager::handleNetworkError() data["errorCode"] = reply->error(); data["errorString"] = reply->errorString(); + QWebFrame *frame = qobject_cast(reply->request().originatingObject()); + data["frameName"] = frame->frameName(); + emit resourceError(data); }