firefox-devtools / bidi-har-export

Experimental module to compile WebDriver BiDi network events as a HAR file
7 stars 3 forks source link

Firefox 130 makes bidi HAR exporter generate data/text pages that breaks Browsertime #26

Closed soulgalore closed 2 months ago

soulgalore commented 2 months ago

Hi, one of my test servers auto updated to Firefox 130 last night and generating HAR files broke in Browsertime. I'll fix better error handling in Browsertime but it seems like we got more pages generated with 130. It looks like this in the HAR viewer (I test Wikipedias Taylor Swift page):

Screenshot 2024-09-04 at 12 58 00

Attached the HAR: browsertimehar.json

juliandescottes commented 2 months ago

Firefox 130 added support for some data URLs (esp for navigation requests), but I assume they should all be for iframes and be ignored. I will take a look

juliandescottes commented 2 months ago

Hmm if I remember correctly we might not create correct timings for data channels, so it might just fail to associate it with the correct page

juliandescottes commented 2 months ago

Ok so indeed the computed time is wrong for data URLs. I will fix a bug on our side to fix it. In the long run however I'm curious if for HAR you would rather have the data URLs or not? If not I can simply filter them out here

juliandescottes commented 2 months ago

@soulgalore can you check with v0.0.14 ? it should exclude data URLs and fix the issue. Still interested to know if you'd like to have data URLs in har exports or not

soulgalore commented 2 months ago

Thank you @juliandescottes that fixed the problem. I think it makes sense for now to filter them out (I'm gonna check how we do it in Chrome). So this data URLs that is picked up (or at least one of them) is what we use when we navigate to a new page, it's page that we use to add a orange color to the full screen, to know when the page starts to navigate. What's strange is that I think that is added before we start to measure and one of the data URLs also resulted in a couple of GET requests, I'm thinking that we maybe we pick up something from Firefox that we shouldn't.

juliandescottes commented 2 months ago

One thing to note is that even if the har viewer shows the data URLs before the actual page, they are captured after (this is actually visible in the HAR file, which kept the entries sorted in the original order).

So I think what might happen is that we record the data URLs for the next load of the page? In terms of additional GET requests, do you mean the svg ones, or something else?

soulgalore commented 2 months ago

Aha I actually didn't check when they were created.

So I think what might happen is that we record the data URLs for the next load of the page?

I'll check the code in Browsertime, maybe we miss something between runs, or these requests come in late. I don't remember exactly how it's done toady.

In terms of additional GET requests, do you mean the svg ones, or something else?

Yes.

juliandescottes commented 2 months ago

@soulgalore Hi! For info Firefox 132 changed timings to use milliseconds, which could break the bidi har exporter. You can update to v0.0.15 which should work both with Firefox 131 or older and with Firefox 132. Thanks!