New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: Request Initiator Chain #12331
Comments
The DevTools feature is built on the same CDP data so it should be possible to re-construct the chain based on CDP responses. Could you describe your use case for needing this data in Puppeteer? |
@OrKoN Good to know. Any leads to derive this will help too! Currently, we do have request events in Puppeteer. However, the complete network initiator chains for them is missing. As for our use-case, given some network calls, we intend to track them to their source on the page. Let's consider a simple case such as:
|
I think DevTools just finds requests for the initiator script in the same frame by URL: https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/models/logs/NetworkLog.ts;l=182;drc=ac291c8142f2481d814f3e13ad6138f70d4666b8 See usages of that function in that file. |
So basically the algorithm for a
DevTools also has some caching to avoid computing parts of the chain multiple times. |
Hi @OrKoN,
|
That does not exist in Chromium AFAIK, I do not think it keeps track of the request IDs that loaded a given script/resource. As you see DevTools is doing the same thing. |
There must be some way it handles this though as on recreating this case, the chains available in the Initiator section in Chromium are indeed as expected. Let me dig in and make some more sense of that code first. Thanks for the help again @OrKoN. Does it make sense to have this as a feature addition in Puppeteer? I think it calls for a decent use-case considering it is something readily available in the browser along with other request metadata. |
We can keep the feature request to see how many users have the same use case. |
Feature description
Hi,
This is to request information such as "Initiator Chain" for each request that is currently present in the Initiator section in Chrome Network tab:
Currently, it is possible to get the immediate initiator for an initial request via request events but not the complete initiator chain. It is further limited by type of initiator and only information for "Parser" and "Script" type requests are present, making it difficult to reliably generate this tree either. (Related discussions here)
While this is discussed and implemented, I would be happy to try out some alternates (maybe with CDP which exposes a little more information in some cases)?
The text was updated successfully, but these errors were encountered: