Skip to content
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

Redirects in main document are not detected as new page (explicit redirect or navigation) #65

Open
xavier-medioni opened this issue May 22, 2020 · 3 comments

Comments

@xavier-medioni
Copy link

Hi everybody !

At first, thanks for this very useful tool !

And I wanted to suggest an improvement about a multi page HAR output, and I will try to provide as many elements as possible.

Usecase:

page1.html: loading 3 images + 1 js file, redirecting to page2.html on DOMContentloaded + 500ms
page2.html: loading 2 images

With chrome-har:

  • the generated HAR object is "flat" (only page1.html detected, and every entries are relative to this page => 1 page in har.log.pages)

1-page-detected

1-page-detected-pages-section

With Chrome Devtools > Save all as HAR with content:

  • the generated HAR object detects the 2 pages (page1.html and page2.html exist in har.log.pages, with entry.pageref relative to expected page id)

2-pages-detected

2-pages-detected-pages-section

Suspicion:

  • in chrome-har/index.js, method harFromMessages: add a page (maybe on "Page.frameScheduledNavigation" protocol event) when frameId == rootFrame ?

strong-suspicion

protocol-monitor

Alternative / extended behaviour:

  • possibility to add an extra "allowMultiPage" parameter to harFromMessages to generate multi page HAR when set to true (preserve default behaviour) ?

Thanks by advance !

@soulgalore
Copy link
Member

Hi @xavier-medioni
thanks for creating the issue! So for redirects its been that by choice, with the idea that you choose to test one page, it redirects to the "same" page that you wanted to test.

For multi, yeah, I started to do that before but it started to get too complicated at that time. That's low prio for me but if someone is interested maybe I can guide you through it.

@xavier-medioni
Copy link
Author

Hi @soulgalore,

Thank you for your reply.
As you probably already guessed, I was trying to evaluate, from a network point of view, the cost of a potential redirect, capturing protocol events "live", and using harFromMessages.
I tried to tweak the existing harFromMessages method to add page on "Page.frameScheduledNavigation" event (maybe the most convenient event to track to detect redirects), but got stucked due to an exception because
const entrySecs = page.__wallTime + (timing.requestTime - page.__timestamp);
with page.__wallTime and page.__timestamp were null.
I noticed the use of addFromFirstRequest, (addFromFirstRequest(page, paramsWithoutPage[0]), also called into "Network.requestWillBeSent" case), but not yet sure about how to use it for this usecase.

If you have any lead, I could be working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@soulgalore @xavier-medioni and others