RE: Navigation Timing in Firefox

To clarify, the onload_test event handler is registered on the iframe.

<body>
    <iframe id="frame_context"
            onload="onload_test();" 
            height="500px"
            width="500px"
            src="<somewhere>"></iframe>
    <br />
    <div id="notes">Notes:<br/></div>
</body>

-Karen
 
-----Original Message-----
From: public-web-perf-request@w3.org [mailto:public-web-perf-request@w3.org] On Behalf Of Karen Anderson (IE)
Sent: Wednesday, October 19, 2011 11:06 AM
To: Philippe Le Hegaret; Boris Zbarsky
Cc: public-web-perf@w3.org
Subject: RE: Navigation Timing in Firefox

I ran a similar test which in essence does the same logic but also queues a setTimeout timer at the end (code below).  What I find interesting is that IE and Chrome always have loadEventStart == loadEventEnd in both the onload event and in the callback.  In FF, after yielding via setTimeout(0), loadEventStart == loadEventEnd == loadEventStart within the onload event handler.  Seems that if there is no delta between the end of the onload handler and the start of the setTimeout callback, then the loadEventEnd could be set during the onload event handler.  Given that, I think the test is correct.   What are your thoughts?
 

Test Script:
<script type="text/javascript">
        var step = 1;
        function later()
        {
            var frameObj = document.getElementById("frame_context").contentWindow;
            var notes = document.getElementById("notes");

            notes.innerHTML += "Later Callback:<br/>" +
                               "later (start): " + frameObj.performance.timing.loadEventStart + "<br/>" +
                               "later (end)  : " + frameObj.performance.timing.loadEventEnd + "<br/>";
        }

        function onload_test() 
        {
            var frameObj = document.getElementById("frame_context").contentWindow;
            var notes = document.getElementById("notes");

            switch (step) {
                case 1:
                    frameObj.location.href = <somewhere else>;

                    notes.innerHTML += "onload Event Step1:<br/>" +
                                       "onload_test (start): " + frameObj.performance.timing.loadEventStart + "<br/>" +
                                       "onload_test (end)  : " + frameObj.performance.timing.loadEventEnd + "<br/>";
                    step++;
                    break;
                case 2:
                    notes.innerHTML += "onload Event Step2:<br/>" +
                                       "onload_test (start): " + frameObj.performance.timing.loadEventStart + "<br/>" +
                                       "onload_test (end)  : " + frameObj.performance.timing.loadEventEnd + "<br/>";
                    step++;
                    setTimeout(later, 0);
                    break;
                default:
                    break;
            }
        }
    </script>

Output:
onload Event Step1:
onload_test (start): 1319046633056
onload_test (end) : 1319046633056
onload Event Step2:
onload_test (start): 1319046633076
onload_test (end) : 1319046633076
Later Callback:
later (start): 1319046633076
later (end) : 1319046633076

Chrome:
onload Event Step1:
onload_test (start): 1319046606461
onload_test (end) : 1319046606461
onload Event Step2:
onload_test (start): 1319046606487
onload_test (end) : 1319046606487
Later Callback:
later (start): 1319046606487
later (end) : 1319046606487

FF:
onload Event Step1:
onload_test (start): 1319046685613
onload_test (end) : 0
onload Event Step2:
onload_test (start): 1319046685624
onload_test (end) : 0
Later Callback:
later (start): 1319046685624
later (end) : 1319046685624

Thanks,
Karen

-----Original Message-----
From: public-web-perf-request@w3.org [mailto:public-web-perf-request@w3.org] On Behalf Of Philippe Le Hegaret
Sent: Saturday, October 15, 2011 9:59 AM
To: Boris Zbarsky
Cc: public-web-perf@w3.org
Subject: Re: Navigation Timing in Firefox

On Fri, 2011-10-14 at 14:09 -0400, Boris Zbarsky wrote:
> On 10/14/11 1:32 PM, Philippe Le Hegaret wrote:
> > I noticed that they fail on the following tests:
> > http://w3c-test.org/webperf/tests/approved/navigation-timing/html5/t

> > est_document_open.html
> 
> I haven't looked into whether this test is correct or what the spec 
> says here... if anything.  Please file bugs as neded!

We should probably look at the test on our side first before filing a bug.

> > http://w3c-test.org/webperf/tests/approved/navigation-timing/html5/t

> > est_timing_attributes_order.html
> 
> The test looks wrong to me.  In particular, it's running the 
> loadEventEnd test before the relevant load event is completed in 
> Gecko, so we're correctly returning 0 for loadEventEnd.
> 
> In particular, the test is using this setup:
> 
>    <iframe onload="onload_test();">
> 
> and in Gecko the load event firing on the <iframe> is the default 
> action of the load event on the window contained in the subframe.
> Therefore onload_test is run before event dispatch for the window's 
> load event is complete.
> 
> Of course the spec doesn't actually define what it means for the load 
> event to be "completed", so testing it is somewhat nonsensical in any 
> sync setup run off load events; a test run off a timeout set in onload 
> would make more sense.
> 
> How do I report a bug in the test?  There seems to be no link to do 
> that at http://w3c-test.org/webperf/tests/ or anywhere else I can find.

Sending an email to public-web-perf@w3.org is good enough. So consider your bug reported.

I updated http://w3c-test.org/webperf/tests/ to make this clear. I'll also ask the group if they're interested in a bugzilla instance to facilitate tracking.

> > They fail a lot more of the tests if the tests are executed in an 
> > iframe, such as
> >   
> > http://w3c-test.org/framework/test/nav-timing-default/single/test_pe

> > rformance_attributes_exist/
> >
> > It looks like they don't support window.performance.navigation 
> > within a iframe?
> 
> That's not an iframe.  It's an <object>.
> 
> And yes, looks like inside an <object> window.performance is null at 
> the moment.  Looks like a bug to me.  I filed
> https://bugzilla.mozilla.org/show_bug.cgi?id=694612


Thank you!

Philippe

Received on Wednesday, 19 October 2011 18:44:08 UTC