Title: [138281] trunk
Revision
138281
Author
simon...@chromium.org
Date
2012-12-20 12:07:32 -0800 (Thu, 20 Dec 2012)

Log Message

[Resource Timing] 304 responses should show up in the timing buffer
https://bugs.webkit.org/show_bug.cgi?id=105490

Reviewed by Tony Gentilcore.

Source/WebCore:

Test: http/tests/w3c/webperf/submission/resource-timing/html/test_resource_cached.html

* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::loadDone):

LayoutTests:

* http/tests/w3c/webperf/resources/generate_resource.php:
* http/tests/w3c/webperf/submission/resource-timing/html/test_resource_cached-expected.txt: Added.
* http/tests/w3c/webperf/submission/resource-timing/html/test_resource_cached.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (138280 => 138281)


--- trunk/LayoutTests/ChangeLog	2012-12-20 19:44:30 UTC (rev 138280)
+++ trunk/LayoutTests/ChangeLog	2012-12-20 20:07:32 UTC (rev 138281)
@@ -1,3 +1,14 @@
+2012-12-20  James Simonsen  <simon...@chromium.org>
+
+        [Resource Timing] 304 responses should show up in the timing buffer
+        https://bugs.webkit.org/show_bug.cgi?id=105490
+
+        Reviewed by Tony Gentilcore.
+
+        * http/tests/w3c/webperf/resources/generate_resource.php:
+        * http/tests/w3c/webperf/submission/resource-timing/html/test_resource_cached-expected.txt: Added.
+        * http/tests/w3c/webperf/submission/resource-timing/html/test_resource_cached.html: Added.
+
 2012-12-20  Elliott Sprehn  <espr...@gmail.com>
 
         Block level pseudo elements bleed background color to <html>

Modified: trunk/LayoutTests/http/tests/w3c/webperf/resources/generate_resource.php (138280 => 138281)


--- trunk/LayoutTests/http/tests/w3c/webperf/resources/generate_resource.php	2012-12-20 19:44:30 UTC (rev 138280)
+++ trunk/LayoutTests/http/tests/w3c/webperf/resources/generate_resource.php	2012-12-20 20:07:32 UTC (rev 138281)
@@ -1,4 +1,9 @@
 <?php
+  if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
+    header('HTTP/1.1 304 Not Modified');
+    exit;
+  }
+
   $type = $_GET["type"];
 
   $response_code = 200;
@@ -43,6 +48,7 @@
 
   header("HTTP/1.1 $response_code");
   header("Content-type: $content_type");
+  header("Etag: 7");
   print($body);
   exit;
 ?>

Added: trunk/LayoutTests/http/tests/w3c/webperf/submission/resource-timing/html/test_resource_cached-expected.txt (0 => 138281)


--- trunk/LayoutTests/http/tests/w3c/webperf/submission/resource-timing/html/test_resource_cached-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/w3c/webperf/submission/resource-timing/html/test_resource_cached-expected.txt	2012-12-20 20:07:32 UTC (rev 138281)
@@ -0,0 +1,9 @@
+Description
+
+This test validates that a 304 Not Modified resource appears in the buffer.
+
+
+
+PASS There should be two entries 
+PASS Both entries should have the same name 
+

Added: trunk/LayoutTests/http/tests/w3c/webperf/submission/resource-timing/html/test_resource_cached.html (0 => 138281)


--- trunk/LayoutTests/http/tests/w3c/webperf/submission/resource-timing/html/test_resource_cached.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/w3c/webperf/submission/resource-timing/html/test_resource_cached.html	2012-12-20 20:07:32 UTC (rev 138281)
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Resource Timing cached resources</title>
+<link rel="author" title="Google" href="" />
+<link rel="help" href=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+setup({explicit_done: true});
+var d;
+var iframe;
+var iframeBody;
+var image;
+function setup_iframe() {
+    iframe = document.getElementById('frameContext');
+    d = iframe.contentWindow.document;
+    iframeBody = d.createElement('body');
+
+    image = d.createElement('img');
+    image.src = '';
+    iframeBody.appendChild(image);
+}
+function reload_image() {
+    iframeBody.removeChild(image);
+    image = d.createElement('img');
+    image.src = '';
+    image.addEventListener('load', onload_test, false);
+    iframeBody.appendChild(image);
+}
+function onload_test() {
+    var entries = iframe.contentWindow.performance.webkitGetEntries();
+    test_equals(entries.length, 2, "There should be two entries");
+    if (entries.length >= 2) {
+        test_equals(entries[0].name, entries[1].name, "Both entries should have the same name");
+    }
+    done();
+}
+window.setup_iframe = setup_iframe;
+window.addEventListener("load", reload_image, false);
+</script>
+</head>
+<body>
+<h1>Description</h1>
+<p>This test validates that a 304 Not Modified resource appears in the buffer.</p>
+<div id="log"></div>
+<iframe id="frameContext" src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (138280 => 138281)


--- trunk/Source/WebCore/ChangeLog	2012-12-20 19:44:30 UTC (rev 138280)
+++ trunk/Source/WebCore/ChangeLog	2012-12-20 20:07:32 UTC (rev 138281)
@@ -1,3 +1,15 @@
+2012-12-20  James Simonsen  <simon...@chromium.org>
+
+        [Resource Timing] 304 responses should show up in the timing buffer
+        https://bugs.webkit.org/show_bug.cgi?id=105490
+
+        Reviewed by Tony Gentilcore.
+
+        Test: http/tests/w3c/webperf/submission/resource-timing/html/test_resource_cached.html
+
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::loadDone):
+
 2012-12-19  Simon Fraser  <simon.fra...@apple.com>
 
         Lots of sticky tests failing in WK2

Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (138280 => 138281)


--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2012-12-20 19:44:30 UTC (rev 138280)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2012-12-20 20:07:32 UTC (rev 138281)
@@ -704,7 +704,7 @@
 
 #if ENABLE(RESOURCE_TIMING)
     // FIXME: Add resource timing support for main resources.
-    if (resource && resource->type() != CachedResource::MainResource && !resource->errorOccurred() && !resource->wasCanceled() && resource->response().isHTTP()) {
+    if (resource && resource->type() != CachedResource::MainResource && resource->response().isHTTP() && ((!resource->errorOccurred() && !resource->wasCanceled()) || resource->response().httpStatusCode() == 304)) {
         HashMap<CachedResource*, InitiatorInfo>::iterator initiatorIt = m_initiatorMap.find(resource);
         if (initiatorIt != m_initiatorMap.end()) {
             ASSERT(document());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to