finding event "at end of page load", redux

Ray Kiddy <[email protected]> Mon, 21 Apr 2008 15:14:36 -0700
Newsgroups gmane.comp.mozilla.performance
Message-ID <[email protected]>
I have an extension which I use in automated testing which waits for a 
page to load and then shuts down the Firefox instance. This may seem 
harsh, but if you want to start Firefox instances and then shut the 
instance down without human intervention, this is what I think one has 
to do. Testing page loading in a single running instance seems wrong. 
The loading time of a page would, I think, be affected by the behavior 
of earlier pages.

But the question of what event one could look for that would represent 
the end of the page loading is a complicated one. Right now, my 
extension looks for the first DOMContentLoaded that occurs after an 
onload. DOMContentLoaded occurs more than once, so you have to wait for it.

I was asked about this recently and I thought of something that might be 
more meaningful, but may be more hassle than it is worth.

What occurred to me is that I could look for the CSS RestyleEvent. But, 
I think I would have to look for any tag that took a src attribute (img, 
frame, iframe, input, script) and wait for all RestyleEvent occurrences 
from any of these as well. And, actually, I would have to make sure more 
tags were not added, and then wait for those if there were new tags. But 
this is getting a little complicated.

Is there any value in this approach at all? Does anyone have anything 
simpler that really is a "this page has loaded" event?

cheers - ray