-
-
Notifications
You must be signed in to change notification settings - Fork 141
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
Module HAR #263
Module HAR #263
Conversation
@william-p, thanks 👍 Please update README.md file as well |
*/ | ||
|
||
if (!Date.prototype.toISOString) { | ||
Date.prototype.toISOString = function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
phantomjs> console.log(typeof Date.prototype.toISOString);
function
Polyfill not needed here :)
Done ;) |
version: '1.2', | ||
creator: { | ||
name: "Phantomas - HAR", | ||
version: VERSION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd use phantomas version here to ease debugging
One tiny little detail left and we're ready to merge it :) |
You are right 😄 |
@william-p, good point. I've added |
Okay, now i'm first to use it 😄 |
id: address, | ||
title: title, | ||
pageTimings: { | ||
onLoad: endTime.getTime() - startTime.getTime() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/HAR/Overview.html#sec-object-types-pageTimings
HAR spec mentions the optional onContentLoad
property that "represents DOMContentLoad event or document.readyState == interactive". Worth adding?
phantomas.log('Convert HAR to JSON'); | ||
var dump = JSON.stringify(har); | ||
|
||
phantomas.log('Write HAR in \'%s\'', path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrap with double quotes so you don't have to escape single quotes
HAR support is awesome to see! it'd be nice if we could identify which resources are inline à la https://github.com/cvan/phantomHAR/blob/master/phantomhar.js#L232 but that's an enhancement |
headers: endReply.headers, | ||
redirectURL: "", | ||
headersSize: -1, | ||
bodySize: startReply.bodySize, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not accurate but that's phantomJS' fault. In a project of mine, I actually request each resource separately to get the accurate number of bytes transferred (and the content of each response). It's a pain.
@william-p, it's actually a good idea to re-use @cvan code given the fact that phantomas already provides information such as type of response's content. |
@macbre, i'm agree :) you are ok with simple copy/paste with origin in comments ? |
Copy&paste - no :) As I said previously, phantomas provides most of the information for each request / response that phantom-HAR generates. There's no need to copy & paste the whole code. |
Of course, I talked about |
In that case, I'm all for it :) |
nb: |
Humm, module
Edit: |
The issue becomes unless you're keeping track of the rendered DOM, you don't know for example which images were inline and which were defined in stylesheets. I would recommend skipping on that part; that can be an enhancement.
I would not recommend reusing phantomHAR code, especially for this part. I've been reverse-engineering Chrome's HAR builder. And I've been working on a patch for my project (cvan/fastHAR-api) that generates the correct values for the following:
I'll be sure to open a pull request once I'm done. Nice work, guys! |
@cvan, I do not quite get you here. I was referring to an array that stores a list of requests that is a stored as That's my only concern regarding code style and good practices in general. Once this one is solved, we're ready to merge... @cvan, looking forward to your pull request :) |
Okay, until something better, tomorrow (France) i will make a patch for use own scope in place of @cvan, i'm waiting with impatience your enhancements ;) Nice work too 😄 |
@william-p, merci :) |
@william-p, this one is great 👍 Thanks @cvan for the feedback. |
Nice job guys, thanks for merge :) |
Add
har
module for export HAR data in external file.I use
netsniff.js
for convert to HAR format.(#64)