Generate a HAR using the devtools log
See HAR
Logging the request IDs you can see the following:
Going through the devtools log you can see that there are no Page.frameAttached events for the second iframe, despite a Network.requestWillBeSent event referring to the frameId25A2EF16DA63D669E56F8639E5EFE72C.
This could well be a bug in Chromium as when I was trying to reproduce the issue I noticed that if the first iframe was on the same domain it would create the Page.frameAttached event but when it's on a different domain it doesn't.
I still think it'd be good to show these events in the HAR as they are happening.
The block of code which ultimately removes the entry is during Network.responseReceived and it can't be matched to a page:
const frameId = rootFrameMappings.get(params.frameId) || params.frameId;
const page = pages.find((page) => page.__frameId === frameId);
if (!page) {
debug(
`Received network response for requestId ${params.requestId} that can't be mapped to any page.`
);
continue;
}
I noticed that when processing Network.requestWillBeSent the last page is used, which was added to support multi page hars in PR #30
const page = pages[pages.length - 1];
Do you think we can do something similar to this? Where we look for the page but fallback to the last page?
Hi @mikedijkstra yes a PR is very welcome. If you also can add a trace in the tests with that behaviour so that we don't break it in the future that would be great.
I've come across an issue where requests are being omitted from an iFrame in an iFrame.
I've created a reproducible case where an image (
img_girl.jpg
) is missing from the generated HAR, even though it is in the devtools logs.How to reproduce
Going through the devtools log you can see that there are no
Page.frameAttached
events for the second iframe, despite aNetwork.requestWillBeSent
event referring to theframeId
25A2EF16DA63D669E56F8639E5EFE72C
.This could well be a bug in Chromium as when I was trying to reproduce the issue I noticed that if the first iframe was on the same domain it would create the
Page.frameAttached
event but when it's on a different domain it doesn't.I still think it'd be good to show these events in the HAR as they are happening.
The block of code which ultimately removes the entry is during Network.responseReceived and it can't be matched to a page:
I noticed that when processing Network.requestWillBeSent the last page is used, which was added to support multi page hars in PR #30
Do you think we can do something similar to this? Where we look for the page but fallback to the last page?
I'm not sure of the reasoning behind filtering the events out or what the repercussions of doing this as a fallback would be.
Again, happy to work on a PR for this if we think there's a good way forward!