Added QWebFrame::requestCount() method with following signature:
int requestCount(RequestStates state = RequestsAll, bool recursive = true) const;
The function returns number of requests (of specified status) that have been started along with creation of the frame.
RequestState enumerates following types of requests:
RequestsUnfinished = 1,
RequestsCompleted = 2,
RequestsFailed = 4,
RequestsAll = RequestsUnfinished | RequestsCompleted | RequestsFailed
recursive specifies whether the request count should be determined including the child frames and its resources or not.
The recursive call on the main frame is also wrapped in QWebPage::requestCount() method.
Patch with autotest attached.
Created attachment 29443 [details]
Created attachment 29444 [details]
I understand the motivation behind retrieving this information, but I think it's not functionality frequently used enough to have a dedicated method in QWebFrame. In theory you can determine all this already using the public API by setting a custom network access manager on a page and keeping track of the issued network requests and their results.
If at all I'd prefer if WebKit wouldn't keep track of those counts but instead just emit notification signals and let the application decide how to count.
What do you think?
Keeping track of requests and their results in a custom QNetworkAccessManager wouldn't be a solution if one wanted to know which particular frame they had come from and while it seems to be the most probable use case it's also the main point here.
But yes, I like the idea about signals.
void requestCreated(const QUrl &);
void requestFinished(const QUrl &);
void requestFailed(const QUrl &);
or even rather QNetworkRequest instead of QUrl.
What do you say?
Comment on attachment 29443 [details]
Make one of the two copies drop out of the review queue.
Comment on attachment 29444 [details]
I also agree to use a signal passing the URL or the network reply (please evaluate which one fits the use case better). r- until the new patch is ready.
What about using custom requests/replies by QtWebKit and placing additional information (about frame in this case) there?
*** This bug has been marked as a duplicate of bug 29975 ***