Bug 25166 - [Qt] Add QWebFrame::requestCount() method for obtaining the number of associated resource requests.
Summary: [Qt] Add QWebFrame::requestCount() method for obtaining the number of associa...
Status: RESOLVED DUPLICATE of bug 29975
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: All OS X 10.5
: P2 Enhancement
Assignee: Nobody
Keywords: Qt
Depends on:
Reported: 2009-04-13 15:56 PDT by Jakub Wieczorek
Modified: 2009-11-24 06:48 PST (History)
5 users (show)

See Also:

patch (11.30 KB, patch)
2009-04-13 15:57 PDT, Jakub Wieczorek
no flags Details | Formatted Diff | Diff
patch (11.30 KB, patch)
2009-04-13 15:57 PDT, Jakub Wieczorek
ariya.hidayat: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Wieczorek 2009-04-13 15:56:19 PDT
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.
Comment 1 Jakub Wieczorek 2009-04-13 15:57:18 PDT
Created attachment 29443 [details]
Comment 2 Jakub Wieczorek 2009-04-13 15:57:28 PDT
Created attachment 29444 [details]
Comment 3 Simon Hausmann 2009-04-14 13:23:53 PDT
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?
Comment 4 Jakub Wieczorek 2009-04-14 14:21:55 PDT
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 5 Holger Freyther 2009-05-11 03:50:53 PDT
Comment on attachment 29443 [details]

Make one of the two copies drop out of the review queue.
Comment 6 Ariya Hidayat 2009-06-08 04:03:03 PDT
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.
Comment 7 Piotr Dobrogost 2009-09-07 09:29:29 PDT
What about using custom requests/replies by QtWebKit and placing additional information (about frame in this case) there?
Comment 8 Simon Hausmann 2009-11-24 06:48:08 PST

*** This bug has been marked as a duplicate of bug 29975 ***