Changeset 63326 in webkit


Ignore:
Timestamp:
Jul 14, 2010 9:45:54 AM (14 years ago)
Author:
tonyg@chromium.org
Message:

2010-07-14 Tony Gentilcore <tonyg@chromium.org>

Reviewed by Darin Fisher.

Implement Web Timing redirectStart, redirectEnd, redirectCount
https://bugs.webkit.org/show_bug.cgi?id=42018

Tests pass with --web-timing. Expectations set to FAIL because disabled by default.

  • fast/dom/script-tests/webtiming.js: Since this is not a redirect, redirect times and count should be zero. (checkTimingBeforeLoad): (checkWebTimingOnLoad): (checkWebTimingAfterLoad):
  • fast/dom/webtiming-expected.txt:
  • fast/js/resources/js-test-pre.js: (shouldBeGreaterThanOrEqual): Factored out so that other tests can share this method.
  • http/tests/misc/resources/webtiming-one-redirect.html: Added.
  • http/tests/misc/resources/webtiming-two-redirects.html: Added.
  • http/tests/misc/webtiming-one-redirect-expected.txt: Added.
  • http/tests/misc/webtiming-one-redirect.php: Added.
  • http/tests/misc/webtiming-two-redirects-expected.txt: Added.
  • http/tests/misc/webtiming-two-redirects.php: Added.

2010-07-14 Tony Gentilcore <tonyg@chromium.org>

Reviewed by Darin Fisher.

Implement Web Timing redirectStart, redirectEnd, redirectCount
https://bugs.webkit.org/show_bug.cgi?id=42018

Tests: http/tests/misc/webtiming-one-redirect.php

http/tests/misc/webtiming-two-redirects.php

Location:
trunk
Files:
6 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r63319 r63326  
     12010-07-14  Tony Gentilcore  <tonyg@chromium.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Implement Web Timing redirectStart, redirectEnd, redirectCount
     6        https://bugs.webkit.org/show_bug.cgi?id=42018
     7
     8        Tests pass with --web-timing. Expectations set to FAIL because disabled by default.
     9
     10        * fast/dom/script-tests/webtiming.js: Since this is not a redirect, redirect times and count should be zero.
     11        (checkTimingBeforeLoad):
     12        (checkWebTimingOnLoad):
     13        (checkWebTimingAfterLoad):
     14        * fast/dom/webtiming-expected.txt:
     15        * fast/js/resources/js-test-pre.js:
     16        (shouldBeGreaterThanOrEqual): Factored out so that other tests can share this method.
     17        * http/tests/misc/resources/webtiming-one-redirect.html: Added.
     18        * http/tests/misc/resources/webtiming-two-redirects.html: Added.
     19        * http/tests/misc/webtiming-one-redirect-expected.txt: Added.
     20        * http/tests/misc/webtiming-one-redirect.php: Added.
     21        * http/tests/misc/webtiming-two-redirects-expected.txt: Added.
     22        * http/tests/misc/webtiming-two-redirects.php: Added.
     23
    1242010-07-14  Eric Carlson  <eric.carlson@apple.com>
    225
  • trunk/LayoutTests/fast/dom/Window/window-property-descriptors-expected.txt

    r62880 r63326  
    459459PASS typeof Object.getOwnPropertyDescriptor(window, 'shouldBeEqualToString') is 'object'
    460460PASS typeof Object.getOwnPropertyDescriptor(window, 'shouldBeFalse') is 'object'
     461PASS typeof Object.getOwnPropertyDescriptor(window, 'shouldBeGreaterThanOrEqual') is 'object'
    461462PASS typeof Object.getOwnPropertyDescriptor(window, 'shouldBeNaN') is 'object'
    462463PASS typeof Object.getOwnPropertyDescriptor(window, 'shouldBeNonNull') is 'object'
  • trunk/LayoutTests/fast/dom/script-tests/webtiming.js

    r63259 r63326  
    22
    33var performance = window.webkitPerformance || {};
     4var navigation = performance.navigation || {};
    45var timing = performance.timing || {};
    56
     
    1516window.addEventListener("load", sleepFiftyMilliseconds, false);
    1617
    17 // FIXME: Move this to js-test-pre.js if it is needed by other tests.
    18 function shouldBeGreaterThanOrEqual(_a, _b) {
    19     if (typeof _a != "string" || typeof _b != "string")
    20         debug("WARN: shouldBeGreaterThanOrEqual expects string arguments");
    21 
    22     var exception;
    23     var _av;
    24     try {
    25         _av = eval(_a);
    26     } catch (e) {
    27         exception = e;
    28     }
    29     var _bv = eval(_b);
    30 
    31     if (exception)
    32         testFailed(_a + " should be >= " + _b + ". Threw exception " + exception);
    33     else if (typeof _av == "undefined" || _av < _bv)
    34         testFailed(_a + " should be >= " + _b + ". Was " + _av + " (of type " + typeof _av + ").");
    35     else
    36         testPassed(_a + " is >= " + _b);
    37 }
    38 
    3918function checkTimingBeforeLoad()
    4019{
     
    4221
    4322    shouldBeGreaterThanOrEqual("timing.unloadEventEnd", "timing.navigationStart");
     23
     24    shouldBe("timing.redirectStart", "0");
     25    shouldBe("timing.redirectEnd", "0");
     26    shouldBe("navigation.redirectCount", "0");
    4427
    4528    shouldBeGreaterThanOrEqual("timing.fetchStart", "timing.navigationStart");
     
    6750
    6851    shouldBeGreaterThanOrEqual("timing.unloadEventEnd", "timing.navigationStart");
     52
     53    shouldBe("timing.redirectStart", "0");
     54    shouldBe("timing.redirectEnd", "0");
     55    shouldBe("navigation.redirectCount", "0");
    6956
    7057    shouldBeGreaterThanOrEqual("timing.fetchStart", "timing.navigationStart");
     
    9481    shouldBeGreaterThanOrEqual("timing.unloadEventEnd", "timing.navigationStart");
    9582
     83    shouldBe("timing.redirectStart", "0");
     84    shouldBe("timing.redirectEnd", "0");
     85    shouldBe("navigation.redirectCount", "0");
     86
    9687    shouldBeGreaterThanOrEqual("timing.fetchStart", "timing.navigationStart");
    9788
  • trunk/LayoutTests/fast/dom/webtiming-expected.txt

    r63259 r63326  
    66FAIL timing.navigationStart should be >= oneHourAgoUTC. Was undefined (of type undefined).
    77FAIL timing.unloadEventEnd should be >= timing.navigationStart. Was undefined (of type undefined).
     8FAIL timing.redirectStart should be 0 (of type number). Was undefined (of type undefined).
     9FAIL timing.redirectEnd should be 0 (of type number). Was undefined (of type undefined).
     10FAIL navigation.redirectCount should be 0 (of type number). Was undefined (of type undefined).
    811FAIL timing.fetchStart should be >= timing.navigationStart. Was undefined (of type undefined).
    912FAIL timing.domainLookupStart should be 0 (of type number). Was undefined (of type undefined).
     
    1821FAIL timing.navigationStart should be >= oneHourAgoUTC. Was undefined (of type undefined).
    1922FAIL timing.unloadEventEnd should be >= timing.navigationStart. Was undefined (of type undefined).
     23FAIL timing.redirectStart should be 0 (of type number). Was undefined (of type undefined).
     24FAIL timing.redirectEnd should be 0 (of type number). Was undefined (of type undefined).
     25FAIL navigation.redirectCount should be 0 (of type number). Was undefined (of type undefined).
    2026FAIL timing.fetchStart should be >= timing.navigationStart. Was undefined (of type undefined).
    2127FAIL timing.domainLookupStart should be 0 (of type number). Was undefined (of type undefined).
     
    3137FAIL timing.navigationStart should be >= oneHourAgoUTC. Was undefined (of type undefined).
    3238FAIL timing.unloadEventEnd should be >= timing.navigationStart. Was undefined (of type undefined).
     39FAIL timing.redirectStart should be 0 (of type number). Was undefined (of type undefined).
     40FAIL timing.redirectEnd should be 0 (of type number). Was undefined (of type undefined).
     41FAIL navigation.redirectCount should be 0 (of type number). Was undefined (of type undefined).
    3342FAIL timing.fetchStart should be >= timing.navigationStart. Was undefined (of type undefined).
    3443FAIL timing.domainLookupStart should be 0 (of type number). Was undefined (of type undefined).
  • trunk/LayoutTests/fast/js/resources/js-test-pre.js

    r59602 r63326  
    219219}
    220220
     221function shouldBeGreaterThanOrEqual(_a, _b) {
     222    if (typeof _a != "string" || typeof _b != "string")
     223        debug("WARN: shouldBeGreaterThanOrEqual expects string arguments");
     224
     225    var exception;
     226    var _av;
     227    try {
     228        _av = eval(_a);
     229    } catch (e) {
     230        exception = e;
     231    }
     232    var _bv = eval(_b);
     233
     234    if (exception)
     235        testFailed(_a + " should be >= " + _b + ". Threw exception " + exception);
     236    else if (typeof _av == "undefined" || _av < _bv)
     237        testFailed(_a + " should be >= " + _b + ". Was " + _av + " (of type " + typeof _av + ").");
     238    else
     239        testPassed(_a + " is >= " + _b);
     240}
    221241
    222242function shouldThrow(_a, _e)
  • trunk/WebCore/ChangeLog

    r63325 r63326  
     12010-07-14  Tony Gentilcore  <tonyg@chromium.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Implement Web Timing redirectStart, redirectEnd, redirectCount
     6        https://bugs.webkit.org/show_bug.cgi?id=42018
     7
     8        Tests: http/tests/misc/webtiming-one-redirect.php
     9               http/tests/misc/webtiming-two-redirects.php
     10
     11        * loader/FrameLoaderTypes.h:
     12        (WebCore::FrameLoadTimeline::FrameLoadTimeline):
     13        * loader/MainResourceLoader.cpp:
     14        (WebCore::MainResourceLoader::willSendRequest): This method is called for each request (including server redirects). fetchStart is updated to the current time on each invocation so that it represents fetching of the final document and doesn't include redirect time. For each redirect, redirectCount is incremented and redirectStart to redirectEnd measures the cumulative fetch time for all redirects.
     15        * page/Navigation.cpp:
     16        (WebCore::Navigation::redirectCount): http://dev.w3.org/2006/webapi/WebTiming/#nt-redirect-count
     17        * page/Timing.cpp:
     18        (WebCore::Timing::redirectStart): http://dev.w3.org/2006/webapi/WebTiming/#nt-redirect-start
     19        (WebCore::Timing::redirectEnd): http://dev.w3.org/2006/webapi/WebTiming/#nt-redirect-end
     20        * page/Timing.h:
     21        * page/Timing.idl:
     22
    1232010-07-14  Lucas De Marchi  <lucas.demarchi@profusion.mobi>
    224
  • trunk/WebCore/loader/FrameLoaderTypes.h

    r63231 r63326  
    6161    };
    6262
     63    // FIXME: Move this to a new header file.
    6364    struct FrameLoadTimeline {
    6465        FrameLoadTimeline()
    65             : navigationStart(0)
    66             , unloadEventEnd(0)
    67             , fetchStart(0)
    68             , responseEnd(0)
    69             , loadEventStart(0)
    70             , loadEventEnd(0)
     66            : navigationStart(0.0)
     67            , unloadEventEnd(0.0)
     68            , redirectStart(0.0)
     69            , redirectEnd(0.0)
     70            , redirectCount(0)
     71            , fetchStart(0.0)
     72            , responseEnd(0.0)
     73            , loadEventStart(0.0)
     74            , loadEventEnd(0.0)
    7175        {
    7276        }
     
    7478        double navigationStart;
    7579        double unloadEventEnd;
     80        double redirectStart;
     81        double redirectEnd;
     82        short redirectCount;
    7683        double fetchStart;
    7784        double responseEnd;
  • trunk/WebCore/loader/MainResourceLoader.cpp

    r63231 r63326  
    159159    // reference to this object; one example of this is 3266216.
    160160    RefPtr<MainResourceLoader> protect(this);
    161    
    162     frameLoader()->frameLoadTimeline()->fetchStart = currentTime();
     161
     162    FrameLoadTimeline* frameLoadTimeline = frameLoader()->frameLoadTimeline();
     163    double fetchTime = currentTime();
     164    if (double fetchStart = frameLoadTimeline->fetchStart) {
     165        if (!frameLoadTimeline->redirectCount++)
     166            frameLoadTimeline->redirectStart = fetchStart;
     167        frameLoadTimeline->redirectEnd = fetchTime;
     168    }
     169    frameLoadTimeline->fetchStart = fetchTime;
    163170
    164171    // Update cookie policy base URL as URL changes, except for subframes, which use the
  • trunk/WebCore/page/Navigation.cpp

    r62947 r63326  
    8080        return 0;
    8181
    82     return 0; // FIXME
     82    return m_frame->loader()->frameLoadTimeline()->redirectCount;
    8383}
    8484
  • trunk/WebCore/page/Timing.cpp

    r63259 r63326  
    7171    return toIntegerMilliseconds(m_frame->loader()->frameLoadTimeline()->unloadEventEnd);
    7272}
     73   
     74unsigned long long Timing::redirectStart() const
     75{
     76    if (!m_frame)
     77        return 0;
     78       
     79    return toIntegerMilliseconds(m_frame->loader()->frameLoadTimeline()->redirectStart);
     80}
     81   
     82unsigned long long Timing::redirectEnd() const
     83{
     84    if (!m_frame)
     85        return 0;
     86       
     87    return toIntegerMilliseconds(m_frame->loader()->frameLoadTimeline()->redirectEnd);
     88}
    7389
    7490unsigned long long Timing::fetchStart() const
  • trunk/WebCore/page/Timing.h

    r63259 r63326  
    5151    unsigned long long navigationStart() const;
    5252    unsigned long long unloadEventEnd() const;
     53    unsigned long long redirectStart() const;
     54    unsigned long long redirectEnd() const;
    5355    unsigned long long fetchStart() const;
    5456    unsigned long long domainLookupStart() const;
  • trunk/WebCore/page/Timing.idl

    r63259 r63326  
    3333    // See: http://dev.w3.org/2006/webapi/WebTiming/
    3434    interface [Conditional=WEB_TIMING, OmitConstructor] Timing {
    35         // FIXME: Implement remainder of interface.
    3635        readonly attribute unsigned long long navigationStart;
    3736        readonly attribute unsigned long long unloadEventEnd;
    38         // readonly attribute unsigned long long redirectStart;
    39         // readonly attribute unsigned long long redirectEnd;
     37        readonly attribute unsigned long long redirectStart;
     38        readonly attribute unsigned long long redirectEnd;
    4039        readonly attribute unsigned long long fetchStart;
    4140        readonly attribute unsigned long long domainLookupStart;
Note: See TracChangeset for help on using the changeset viewer.