firefox-devtools / bidi-har-export

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

Guard against missmatch in entries. #10

Closed soulgalore closed 1 year ago

soulgalore commented 1 year ago

Let me know if you this is ok!

https://github.com/firefox-devtools/bidi-har-export/issues/9

juliandescottes commented 1 year ago

Thanks! That's a good first step. We can also use this spot to add a log, will be interesting to know which requests we ignore.

Some thoughts in case you want to push this further: in theory we should have enough information in the responseCompleted event to build the entry. So if there's no entry, we could just create it in the same way as what is done in _onBeforeRequestSent, but also setting the response. The only thing is that I am assuming that the requests array is sorted by request start time for now, and this approach would break this assumption, meaning we probably have to add a sorting step at the end.