On Tuesday, May 26, 2015 at 9:31:01 AM UTC+2, Sebastian Zartner wrote:
>
> Regarding the event:
> What happens with requests that start after that period? Will they be 
> ignored? 
>

"HARPageLoaded" event serves as a notification that says the "page load" 
phase has finished. This page load phase is usually what automated systems 
want to monitor in order to measure/perform "page load performance" 
analyses.

Of course, there can be any number of other HTTP requests executed by the 
page after "HARPageLoaded" event (triggered e.g. by user interaction). All 
this data are also collected by the Network panel and can be exported by 
HAR.triggerExport at any time later. But, I don't  think that this "user 
interaction performance analyses" need any extra HAR events. It's entirely 
up to the automated system when to export collected data in such case.

Here is another example.

// Helper function that exports data collected by the Network panel
// and then clears its content.
function onExportHar(e) {
  HAR.triggerExport({
    fileName: "myFile.har"
  });
  HAR.clear();
}

// Handle "HARPageLoaded" event to export data related to
// page load phase and "app-specific-event" to
// export new collected data related to the user interaction
// with the page.
addEventListener("HARPageLoaded", onExportHar, true);
addEventListener("app-specific-event", onExportHar, true);

However, there can be another timeout (there already is in NetExport) that 
allows exporting data even if some requests are still pending (e.g. if the 
page is buffering a video stream). In this case "HARPageLoaded" event would 
be fired (with an extra flag in the 'event' argument or a new event like 
"HARPageTimeout") so, the automated system doesn't have to wait till the 
entire video stream is downloaded. It can significantly speed up the 
automated process.

> Could a timeout period of 0 or -1 mean to export all requests of the 
page? 

Could a timeout period of 0 or -1 mean to export all requests of the page? 
> Also, should a second event be triggered after the requests are finished to 
> let the automated system knows when it can start processing the exported 
> HAR?
>
So, there is no such concept as "all requests" since there is no an 
"endpoint" after which there are no HTTP requests.

Honza

 



> Sebastian
>
> On Monday, May 25, 2015 at 5:43:22 PM UTC+2, Jan Honza Odvarko wrote:
>>
>> We are currently working on making the "HAR Export" a native feature in 
>> Firefox (extensions not needed any more). The feature should be part of 
>> Firefox native developer tools.
>>
>> Here are two related bugs reported:
>> Bug 859058 - Implement "Copy as HAR" and "Save all as HAR" 
>> Bug 1167080 - Trigger HAR export from within the content 
>>
>> I started with manual HAR export with simple UI/UX (Network panel context 
>> menu actions):
>> 1) Save as HAR - save all HTTP data collected by the Net panel into a HAR 
>> file
>> 2) Copy as HAR - copy collected data into the clipboard.
>>
>> The second planned step (the second bug in the list above) is to support 
>> automation (automated HAR exports) and I'd like to base it on the following 
>> two things:
>>
>> 1) Expose helper API into the page content. It can be used to trigger HAR 
>> export at any time. API would be exposed only if a secret token is set in 
>> the current Firefox profile (to ensure security).
>>
>> An example:
>>
>> // Save all data within the Network panel into 'myFile.har'
>> // The default directory is specified in preferences
>> HAR.triggerExport({
>>   fileName: "myFile.har",
>> });
>>
>> 2) Expose helper event:
>>
>> "HARPageLoaded": sent when the page finishes loading. This is different 
>> from the existing 'DOMContentLoaded' and 'load' events. This new event is 
>> sent when there are no pending HTTP requests and no new HTTP requests has 
>> started for given period of time (e.g. 1000 ms).
>>
>> I believe that the trigger method and the event should be enough for 
>> integration with any automated system (e.g. based on Selenium). The rest is 
>> upto the automated system - the driver.
>>
>> What do you think?
>>
>> Can we simplify the feature yet?
>> Do you need more to implement automated HAR export from the browser?
>>
>> Honza
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Firebug" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/firebug.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/firebug/2913c5d6-d3f2-41bc-8c26-b0fc1c6b6c3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to