Add onloadfired and visiblefired flags to mark if these events have fired.

These two event handlers set a flag if either onload or visibility have fired.
We can use this, for example, to determine if the user leaves a page before
onload fires, ie, they got tired of waiting for it to load.
Subscribe to xhr_load event and handle it differently from page load

For xhr load, the page identifier is specified in event.name, so use that,
and fire a beacon even if a load beacon has already been fired.
add unloaded flag to make sure we do not fire unload more than once
Add unloadstate to debug message.
blank line for readability
Add cookie start time to beacon if we aren't using it to help with server-side debugging.
Call done() on unload as well just in case the user left the page before
the onload event fired.

We will only send a beacon if unload fired before onload, and will include
a rt.abrt flag on the beacon.
do not block unload beacon if page has not finished loading
measure navtiming on load or unload, whichever happens first