2011-01-05 James Simonsen <simonjam@chromium.org>
authorsimonjam@chromium.org <simonjam@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Jan 2011 01:22:46 +0000 (01:22 +0000)
committersimonjam@chromium.org <simonjam@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Jan 2011 01:22:46 +0000 (01:22 +0000)
        Reviewed by Darin Fisher.

        [Web Timing] requestStart and responseStart should be available even if the document is still loading
        https://bugs.webkit.org/show_bug.cgi?id=51368

        * http/tests/misc/webtiming-slow-load-expected.txt: Added.
        * http/tests/misc/webtiming-slow-load.php: Added.
2011-01-05  James Simonsen  <simonjam@chromium.org>

        Reviewed by Darin Fisher.

        [Web Timing] requestStart and responseStart should be available even if the document is still loading
        https://bugs.webkit.org/show_bug.cgi?id=51368

        Test: http/tests/misc/webtiming-slow-load.php

        * page/PerformanceTiming.cpp:
        (WebCore::getPossiblySkewedTimeInKnownRange): Handle case where response is not yet complete.
        (WebCore::PerformanceTiming::resourceLoadTimeRelativeToAbsolute): Use full upper bound.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@75120 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/misc/webtiming-slow-load-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/misc/webtiming-slow-load.php [new file with mode: 0644]
LayoutTests/platform/gtk/Skipped
LayoutTests/platform/mac/Skipped
LayoutTests/platform/win/Skipped
WebCore/ChangeLog
WebCore/page/PerformanceTiming.cpp

index 30309f8..d6dd7b5 100644 (file)
@@ -1,3 +1,13 @@
+2011-01-05  James Simonsen  <simonjam@chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        [Web Timing] requestStart and responseStart should be available even if the document is still loading
+        https://bugs.webkit.org/show_bug.cgi?id=51368
+
+        * http/tests/misc/webtiming-slow-load-expected.txt: Added.
+        * http/tests/misc/webtiming-slow-load.php: Added.
+
 2011-01-05  Kent Tamura  <tkent@chromium.org>
 
         Unreviewed, test expectation update.
diff --git a/LayoutTests/http/tests/misc/webtiming-slow-load-expected.txt b/LayoutTests/http/tests/misc/webtiming-slow-load-expected.txt
new file mode 100644 (file)
index 0000000..349927e
--- /dev/null
@@ -0,0 +1,12 @@
+Verifies that requestStart and responseStart are available before the main document has finished loading.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS timing.requestStart is non-zero.
+PASS timing.responseStart is non-zero.
+PASS timing.responseEnd is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/http/tests/misc/webtiming-slow-load.php b/LayoutTests/http/tests/misc/webtiming-slow-load.php
new file mode 100644 (file)
index 0000000..905944c
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script>
+</script>
+<link rel="stylesheet" href="../../js-test-resources/js-test-style.css">
+<script src="../../js-test-resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("Verifies that requestStart and responseStart are available before the main document has finished loading.");
+
+var performance = window.webkitPerformance || {};
+var navigation = performance.navigation || {};
+var timing = performance.timing || {};
+
+shouldBeNonZero("timing.requestStart");
+shouldBeNonZero("timing.responseStart");
+shouldBe("timing.responseEnd", "0");
+
+var successfullyParsed = true;
+</script>
+<script src="../../js-test-resources/js-test-post.js"></script>
+<?php
+    echo str_repeat(" ", 100000);
+    flush();
+    ob_flush();
+    sleep(1);
+?>
+</body>
+</html>
index 290ef4f..084b60a 100644 (file)
@@ -5313,6 +5313,7 @@ fast/dom/webtiming.html
 fast/dom/webtiming-navigate-within-document.html
 fast/dom/webtiming-document-open.html
 http/tests/misc/webtiming-one-redirect.php
+http/tests/misc/webtiming-slow-load.php
 http/tests/misc/webtiming-ssl.php
 http/tests/misc/webtiming-two-redirects.php
 
index 1e02052..73dcbc7 100644 (file)
@@ -216,6 +216,7 @@ fast/dom/webtiming.html
 fast/dom/webtiming-document-open.html
 fast/dom/webtiming-navigate-within-document.html
 http/tests/misc/webtiming-one-redirect.php
+http/tests/misc/webtiming-slow-load.php
 http/tests/misc/webtiming-ssl.php
 http/tests/misc/webtiming-two-redirects.php
 
index 7eb6dcd..c4f685d 100644 (file)
@@ -1043,6 +1043,7 @@ fast/dom/webtiming.html
 fast/dom/webtiming-document-open.html
 fast/dom/webtiming-navigate-within-document.html
 http/tests/misc/webtiming-one-redirect.php
+http/tests/misc/webtiming-slow-load.php
 http/tests/misc/webtiming-ssl.php
 http/tests/misc/webtiming-two-redirects.php
 
index a71a7c8..c7cbac4 100644 (file)
@@ -1,3 +1,16 @@
+2011-01-05  James Simonsen  <simonjam@chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        [Web Timing] requestStart and responseStart should be available even if the document is still loading
+        https://bugs.webkit.org/show_bug.cgi?id=51368
+
+        Test: http/tests/misc/webtiming-slow-load.php
+
+        * page/PerformanceTiming.cpp:
+        (WebCore::getPossiblySkewedTimeInKnownRange): Handle case where response is not yet complete.
+        (WebCore::PerformanceTiming::resourceLoadTimeRelativeToAbsolute): Use full upper bound.
+
 2011-01-05  Chris Rogers  <crogers@google.com>
 
         Reviewed by Darin Fisher.
index 47f9278..189023c 100644 (file)
@@ -39,6 +39,7 @@
 #include "Frame.h"
 #include "ResourceLoadTiming.h"
 #include "ResourceResponse.h"
+#include <wtf/CurrentTime.h>
 
 namespace WebCore {
 
@@ -59,6 +60,9 @@ static double getPossiblySkewedTimeInKnownRange(double skewedTime, double lowerB
     if (skewedTime <= lowerBound)
         return lowerBound;
 
+    if (upperBound <= 0.0)
+        upperBound = currentTime();
+
     if (skewedTime >= upperBound)
         return upperBound;
 #else
@@ -378,7 +382,7 @@ unsigned long long PerformanceTiming::resourceLoadTimeRelativeToAbsolute(int rel
     //
     // Since ResourceLoadTimings came from the network platform layer, we must
     // check them for skew because they may be from another thread/process.
-    double baseTime = getPossiblySkewedTimeInKnownRange(resourceTiming->requestTime, documentTiming->fetchStart, documentTiming->responseEnd - (resourceTiming->receiveHeadersEnd / 1000.0));
+    double baseTime = getPossiblySkewedTimeInKnownRange(resourceTiming->requestTime, documentTiming->fetchStart, documentTiming->responseEnd);
     return toIntegerMilliseconds(baseTime) + relativeSeconds;
 }