<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[204976] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/204976">204976</a></dd>
<dt>Author</dt> <dd>achristensen@apple.com</dd>
<dt>Date</dt> <dd>2016-08-25 11:22:25 -0700 (Thu, 25 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Update the Resource Timing implementation
https://bugs.webkit.org/show_bug.cgi?id=161068

Patch by Johan K. Jensen &lt;johan_jensen@apple.com&gt; on 2016-08-25
Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Added W3C Web Platform Tests for Resource Timing.

* web-platform-tests/resource-timing/OWNERS: Added.
* web-platform-tests/resource-timing/SyntheticResponse.py: Added.
(main):
* web-platform-tests/resource-timing/iframe-setdomain.sub.html: Added.
* web-platform-tests/resource-timing/resource-timing.html: Added.
* web-platform-tests/resource-timing/resource-timing.js: Added.
(testCases.test):
(test):
(runNextCase):
(assertInvariants):
(assertResourceEntryInvariants):
(canonicalize):
(createUniqueQueryArgument):
(getSyntheticUrl):
(initiateFetch):
(window.onload):
* web-platform-tests/resource-timing/resources/resource_timing_test0.css: Added.
(div#resource_link_css):
* web-platform-tests/resource-timing/resources/resource_timing_test0.html: Added.
* web-platform-tests/resource-timing/resources/resource_timing_test0.js: Added.
* web-platform-tests/resource-timing/resources/resource_timing_test0.png: Added.
* web-platform-tests/resource-timing/resources/resource_timing_test0.xml: Added.
* web-platform-tests/resource-timing/resources/webperftestharness.js: Added.
(wp_test):
(test_namespace):
(test_timing_order):
(test_timing_equals):
(sleep_milliseconds):
(test_true):
(test_equals):
(test_greater_than):
(test_greater_or_equals):
* web-platform-tests/resource-timing/test_resource_timing.html: Added.
* web-platform-tests/resource-timing/test_resource_timing.js: Added.
(setup):
(resolve):
(switch.):
(switch.case.string_appeared_here.xmlhttp.onload):
(switch.default.element.onload):
(onload):
(poll_for_stylesheet_load.inner):
(poll_for_stylesheet_load):
(resource_load):

Source/WebCore:

Tests: imported/w3c/web-platform-tests/resource-timing/resource-timing.html
       imported/w3c/web-platform-tests/resource-timing/test_resource_timing.html

Update the Resource Timing implementation for better compatibility with the Resource Timing API spec.
Use LoadTiming for general timing information about a resources load timeline.
Mark timestamps for newly loaded resources as well as cached resources.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::startLoadingMainResource):
StartTime and fetchStart should be equal initially.

* loader/LoadTiming.cpp:
(WebCore::LoadTiming::LoadTiming): Moved member initialization out. Removed constructor.
* loader/LoadTiming.h:
(WebCore::LoadTiming::markStartTimeAndFetchStart):
Mark startTime and fetchStart simultaneously.

* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::init):
Mark the start time of resources.

* loader/ResourceLoader.h:
(WebCore::ResourceLoader::loadTiming):
Add LoadTiming info to handle a resources load timing.

* loader/ResourceTimingInformation.cpp:
(WebCore::ResourceTimingInformation::addResourceTiming):
* loader/ResourceTimingInformation.h:
Only pass in the URL from the ResourceRequest.
Pass LoadTiming instead of timestamps.

* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal):
Mark redirects.

(WebCore::SubresourceLoader::didFinishLoading):
Mark the responseEnd timestamp.
Add the ResourceEntry to the timeline before notifyDone is called.

* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
(WebCore::CachedResourceLoader::revalidateResource):
(WebCore::CachedResourceLoader::loadDone):
Mark timestamps for cached resources and use them instead of a cached LoadTiming.

* loader/cache/CachedResourceLoader.h:
(WebCore::CachedResourceLoader::resourceTimingInformation):
Add ResourceTimingInformation getter so SubresourceLoader.cpp can add entries before callbacks.

* page/Performance.cpp:
(WebCore::Performance::addResourceTiming):
* page/Performance.h:
Update signature: URLs and LoadTiming instead of timestamps.

* page/PerformanceResourceTiming.cpp:
(WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
(WebCore::PerformanceResourceTiming::redirectStart):
(WebCore::PerformanceResourceTiming::redirectEnd):
(WebCore::PerformanceResourceTiming::fetchStart):
(WebCore::PerformanceResourceTiming::domainLookupStart):
(WebCore::PerformanceResourceTiming::domainLookupEnd):
(WebCore::PerformanceResourceTiming::connectStart):
(WebCore::PerformanceResourceTiming::connectEnd):
(WebCore::PerformanceResourceTiming::requestStart):
(WebCore::PerformanceResourceTiming::responseStart):
(WebCore::PerformanceResourceTiming::responseEnd):
(WebCore::PerformanceResourceTiming::resourceTimeToDocumentMilliseconds):
* page/PerformanceResourceTiming.h:
Update signatures and properties to use LoadTiming.
Use LoadTiming’s redirectStart/End, fetchStart, responseStart/End.
Make sure dns and connection timestamps are in increasing order, even when cached.

* page/PerformanceResourceTiming.idl:
Add responseStart.

LayoutTests:

* TestExpectations:
Skip resource outside of resource-folder.
Mark one test as flaky (see bug 161088).

* resources/testharnessreport.js:
(self.testRunner.add_completion_callback):
Updated completion callback to wait for any other completion callbacks
before finishing, so the Resource Timing tests can cleanup first.
Enabled the ResourceTiming runtime flag.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsresourcestestharnessreportjs">trunk/LayoutTests/resources/testharnessreport.js</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreloaderDocumentLoadercpp">trunk/Source/WebCore/loader/DocumentLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderLoadTimingcpp">trunk/Source/WebCore/loader/LoadTiming.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderLoadTimingh">trunk/Source/WebCore/loader/LoadTiming.h</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadercpp">trunk/Source/WebCore/loader/ResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoaderh">trunk/Source/WebCore/loader/ResourceLoader.h</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceTimingInformationcpp">trunk/Source/WebCore/loader/ResourceTimingInformation.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceTimingInformationh">trunk/Source/WebCore/loader/ResourceTimingInformation.h</a></li>
<li><a href="#trunkSourceWebCoreloaderSubresourceLoadercpp">trunk/Source/WebCore/loader/SubresourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceLoadercpp">trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceLoaderh">trunk/Source/WebCore/loader/cache/CachedResourceLoader.h</a></li>
<li><a href="#trunkSourceWebCorepagePerformancecpp">trunk/Source/WebCore/page/Performance.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePerformanceh">trunk/Source/WebCore/page/Performance.h</a></li>
<li><a href="#trunkSourceWebCorepagePerformanceResourceTimingcpp">trunk/Source/WebCore/page/PerformanceResourceTiming.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePerformanceResourceTimingh">trunk/Source/WebCore/page/PerformanceResourceTiming.h</a></li>
<li><a href="#trunkSourceWebCorepagePerformanceResourceTimingidl">trunk/Source/WebCore/page/PerformanceResourceTiming.idl</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkNetworkLoadTimingh">trunk/Source/WebCore/platform/network/NetworkLoadTiming.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingOWNERS">trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/OWNERS</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingSyntheticResponsepy">trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/SyntheticResponse.py</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingiframesetdomainsubhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/iframe-setdomain.sub.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingresourcetimingexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingresourcetiminghtml">trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingresourcetimingjs">trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing.js</a></li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingresourcesresource_timing_test0css">trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.css</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingresourcesresource_timing_test0html">trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingresourcesresource_timing_test0js">trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingresourcesresource_timing_test0png">trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.png</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingresourcesresource_timing_test0xml">trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.xml</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingresourceswebperftestharnessjs">trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/webperftestharness.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingtest_resource_timingexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingtest_resource_timinghtml">trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingtest_resource_timingjs">trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/LayoutTests/ChangeLog        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-08-25  Johan K. Jensen  &lt;johan_jensen@apple.com&gt;
+
+        Update the Resource Timing implementation
+        https://bugs.webkit.org/show_bug.cgi?id=161068
+
+        Reviewed by Alex Christensen.
+
+        * TestExpectations:
+        Skip resource outside of resource-folder.
+        Mark one test as flaky (see bug 161088).
+
+        * resources/testharnessreport.js:
+        (self.testRunner.add_completion_callback):
+        Updated completion callback to wait for any other completion callbacks
+        before finishing, so the Resource Timing tests can cleanup first.
+        Enabled the ResourceTiming runtime flag.
+
</ins><span class="cx"> 2016-08-25  Jiewen Tan  &lt;jiewen_tan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rebase iOS simulator WK1 fast/multicol tests
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/LayoutTests/TestExpectations        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -449,6 +449,7 @@
</span><span class="cx"> imported/w3c/web-platform-tests/html/semantics/grouping-content/the-ol-element/reversed-1c.html [ Skip ]
</span><span class="cx"> imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/script-not-executed-after-shutdown-child.html [ Skip ]
</span><span class="cx"> imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/focus-iframe.html [ Skip ]
</span><ins>+imported/w3c/web-platform-tests/resource-timing/iframe-setdomain.sub.html [ Skip ]
</ins><span class="cx"> 
</span><span class="cx"> imported/w3c/web-platform-tests/service-workers [ Skip ]
</span><span class="cx"> 
</span><span class="lines">@@ -1242,3 +1243,5 @@
</span><span class="cx"> webkit.org/b/159755 fast/text/emoji-gender.html [ ImageOnlyFailure ]
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/160017 js/regress-139548.html [ Slow ]
</span><ins>+
+webkit.org/b/161088 imported/w3c/web-platform-tests/resource-timing/resource-timing.html [ Pass Failure ]
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -1,3 +1,56 @@
</span><ins>+2016-08-25  Johan K. Jensen  &lt;johan_jensen@apple.com&gt;
+
+        Update the Resource Timing implementation
+        https://bugs.webkit.org/show_bug.cgi?id=161068
+
+        Reviewed by Alex Christensen.
+
+        Added W3C Web Platform Tests for Resource Timing.
+
+        * web-platform-tests/resource-timing/OWNERS: Added.
+        * web-platform-tests/resource-timing/SyntheticResponse.py: Added.
+        (main):
+        * web-platform-tests/resource-timing/iframe-setdomain.sub.html: Added.
+        * web-platform-tests/resource-timing/resource-timing.html: Added.
+        * web-platform-tests/resource-timing/resource-timing.js: Added.
+        (testCases.test):
+        (test):
+        (runNextCase):
+        (assertInvariants):
+        (assertResourceEntryInvariants):
+        (canonicalize):
+        (createUniqueQueryArgument):
+        (getSyntheticUrl):
+        (initiateFetch):
+        (window.onload):
+        * web-platform-tests/resource-timing/resources/resource_timing_test0.css: Added.
+        (div#resource_link_css):
+        * web-platform-tests/resource-timing/resources/resource_timing_test0.html: Added.
+        * web-platform-tests/resource-timing/resources/resource_timing_test0.js: Added.
+        * web-platform-tests/resource-timing/resources/resource_timing_test0.png: Added.
+        * web-platform-tests/resource-timing/resources/resource_timing_test0.xml: Added.
+        * web-platform-tests/resource-timing/resources/webperftestharness.js: Added.
+        (wp_test):
+        (test_namespace):
+        (test_timing_order):
+        (test_timing_equals):
+        (sleep_milliseconds):
+        (test_true):
+        (test_equals):
+        (test_greater_than):
+        (test_greater_or_equals):
+        * web-platform-tests/resource-timing/test_resource_timing.html: Added.
+        * web-platform-tests/resource-timing/test_resource_timing.js: Added.
+        (setup):
+        (resolve):
+        (switch.):
+        (switch.case.string_appeared_here.xmlhttp.onload):
+        (switch.default.element.onload):
+        (onload):
+        (poll_for_stylesheet_load.inner):
+        (poll_for_stylesheet_load):
+        (resource_load):
+
</ins><span class="cx"> 2016-08-24  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Import w3c URL tests
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingOWNERS"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/OWNERS (0 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/OWNERS                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/OWNERS        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+@haoxli
+@plehegar
+@zqzhang
+@igrigorik
+@toddreifsteck
+@yoavweiss
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingSyntheticResponsepy"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/SyntheticResponse.py (0 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/SyntheticResponse.py                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/SyntheticResponse.py        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+import urllib
+import time
+
+def main(request, response):
+    index = request.request_path.index(&quot;?&quot;)
+    args = request.request_path[index+1:].split(&quot;&amp;&quot;)
+    headersSent = 0
+    for arg in args:
+        if arg.startswith(&quot;ignored&quot;):
+            continue
+        elif arg.endswith(&quot;ms&quot;):
+            time.sleep(float(arg[0:-2]) / 1E3);
+        elif arg.startswith(&quot;redirect:&quot;):
+            return (302, &quot;WEBPERF MARKETING&quot;), [(&quot;Location&quot;, urllib.unquote(arg[9:]))], &quot;TEST&quot;
+        elif arg.startswith(&quot;mime:&quot;):
+            response.headers.set(&quot;Content-Type&quot;, urllib.unquote(arg[5:]))
+        elif arg.startswith(&quot;send:&quot;):
+            text = urllib.unquote(arg[5:])
+            if headersSent == 0:
+                response.write_status_headers()
+                headersSent = 1
+
+            response.writer.write(text)
+#        else:
+#            error &quot;  INVALID ARGUMENT %s&quot; % arg
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingiframesetdomainsubhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/iframe-setdomain.sub.html (0 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/iframe-setdomain.sub.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/iframe-setdomain.sub.html        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+  &lt;title&gt;domain: {{domains[www]}}&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+  &lt;script&gt;
+    // The purpose of this IFrame is to change the 'document.domain'
+    document.domain = &quot;{{domains[www]}}&quot;;
+  &lt;/script&gt;
+  The resource-timings.html test loads this document into an IFrame to vet that setting
+  'document.domain' does not effect the timing allowed.
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingresourcetimingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing-expected.txt (0 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing-expected.txt        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+CONSOLE MESSAGE: line 9: SecurityError (DOM Exception 18): The operation is insecure.
+
+PASS No timeline entry for about:blank
+PASS Setting 'document.domain' does not effect same-origin checks
+PASS 'iframe (Populate cache): The initial request populates the cache (if appropriate).
+PASS 'iframe (Potentially Cached): Immediately fetch the same URL, exercising the cache hit path (if any).
+PASS 'xmlhttprequest (Populate cache): The initial request populates the cache (if appropriate).
+PASS 'xmlhttprequest (Potentially Cached): Immediately fetch the same URL, exercising the cache hit path (if any).
+PASS 'script (Populate cache): The initial request populates the cache (if appropriate).
+PASS 'script (Potentially Cached): Immediately fetch the same URL, exercising the cache hit path (if any).
+PASS 'link (Populate cache): The initial request populates the cache (if appropriate).
+PASS 'link (Potentially Cached): Immediately fetch the same URL, exercising the cache hit path (if any).
+PASS 'iframe: 1 second delay before 'responseStart', another 1 second delay before 'responseEnd'.
+PASS 'xmlhttprequest: 1 second delay before 'responseStart', another 1 second delay before 'responseEnd'.
+PASS 'script: 1 second delay before 'responseStart', another 1 second delay before 'responseEnd'.
+PASS 'link: 1 second delay before 'responseStart', another 1 second delay before 'responseEnd'.
+PASS 'iframe (Redirected): 1 second delay before 'redirectEnd', another 1 second delay before 'responseStart'.
+PASS 'xmlhttprequest (Redirected): 1 second delay before 'redirectEnd', another 1 second delay before 'responseStart'.
+PASS 'script (Redirected): 1 second delay before 'redirectEnd', another 1 second delay before 'responseStart'.
+PASS 'link (Redirected): 1 second delay before 'redirectEnd', another 1 second delay before 'responseStart'.
+Show details
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingresourcetiminghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing.html (0 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing.html        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+  &lt;title&gt;Resource-Timing Level 1&lt;/title&gt;
+  &lt;!-- To aid debugability, explicitly link the testharness's CSS to avoid demand
+       loading it while the test executes. --&gt;
+  &lt;script src=&quot;/resources/testharness.js&quot;&gt;&lt;/script&gt;
+  &lt;script src=&quot;/resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+
+  &lt;link rel=&quot;author&quot; title=&quot;Microsoft&quot; href=&quot;http://www.microsoft.com/&quot;&gt;
+  &lt;link rel=&quot;help&quot; href=&quot;https://w3c.github.io/resource-timing/&quot;&gt;
+&lt;/head&gt;
+&lt;body&gt;
+  &lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+  &lt;pre id=&quot;output&quot;&gt;&lt;/pre&gt;
+  &lt;script src=&quot;resource-timing.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingresourcetimingjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing.js (0 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing.js                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing.js        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -0,0 +1,465 @@
</span><ins>+&quot;use strict&quot;;
+
+window.onload =
+    function () {
+        setup({ explicit_timeout: true });
+
+        /** Number of milliseconds to delay when the server injects pauses into the response.
+
+            This should be large enough that we can distinguish it from noise with high confidence,
+            but small enough that tests complete quickly. */
+        var serverStepDelay = 250;
+
+        var mimeHtml    = &quot;text/html&quot;;
+        var mimeText    = &quot;text/plain&quot;;
+        var mimePng     = &quot;image/png&quot;;
+        var mimeScript  = &quot;application/javascript&quot;;
+        var mimeCss     = &quot;text/css&quot;;
+
+        /** Hex encoding of a a 150x50px green PNG. */
+        var greenPng = &quot;0x89504E470D0A1A0A0000000D494844520000006400000032010300000090FBECFD00000003504C544500FF00345EC0A80000000F49444154281563601805A36068020002BC00011BDDE3900000000049454E44AE426082&quot;;
+
+        /** Array containing test cases to run.  Initially, it contains the one-off 'about:blank&quot; test,
+            but additional cases are pushed below by expanding templates. */
+        var testCases = [
+            {
+                description: &quot;No timeline entry for about:blank&quot;,
+                test:
+                    function (test) {
+                        // Insert an empty IFrame.
+                        var frame = document.createElement(&quot;iframe&quot;);
+
+                        // Wait for the IFrame to load and ensure there is no resource entry for it on the timeline.
+                        //
+                        // We use the 'createOnloadCallbackFn()' helper which is normally invoked by 'initiateFetch()'
+                        // to avoid setting the IFrame's src.  It registers a test step for us, finds our entry on the
+                        // resource timeline, and wraps our callback function to automatically vet invariants.
+                        frame.onload = createOnloadCallbackFn(test, frame, &quot;about:blank&quot;,
+                            function (initiator, entry) {
+                                assert_equals(entry, undefined, &quot;Inserting an IFrame with a src of 'about:blank' must not add an entry to the timeline.&quot;);
+                                assertInvariants(
+                                    test,
+                                    function () {
+                                        test.done();
+                                    });
+                            });
+
+                        document.body.appendChild(frame);
+
+                        // Paranoid check that the new IFrame has loaded about:blank.
+                        assert_equals(
+                            frame.contentWindow.location.href,
+                            &quot;about:blank&quot;,
+                            &quot;'Src' of new &lt;iframe&gt; must be 'about:blank'.&quot;);
+                    }
+            },
+            {
+                description: &quot;Setting 'document.domain' does not effect same-origin checks&quot;,
+                test:
+                    function (test) {
+                        initiateFetch(
+                            test,
+                            &quot;iframe&quot;,
+                            canonicalize(&quot;iframe-setdomain.sub.html&quot;),
+                            function (initiator, entry) {
+                                // Ensure that the script inside the IFrame has successfully changed the IFrame's domain.
+                                assert_throws(
+                                    null,
+                                    function () {
+                                        assert_not_equals(frame.contentWindow.document, null);
+                                    },
+                                    &quot;Test Error: IFrame is not recognized as cross-domain.&quot;);
+
+                                // To verify that setting 'document.domain' did not change the results of the timing allow check,
+                                // verify that the following non-zero properties return their value.
+                                [&quot;domainLookupStart&quot;, &quot;domainLookupEnd&quot;, &quot;connectStart&quot;, &quot;connectEnd&quot;]
+                                    .forEach(function(property) {
+                                        assert_greater_than(entry.connectEnd, 0,
+                                            &quot;Property should be non-zero because timing allow check ignores 'document.domain'.&quot;);
+                                    });
+                                test.done();
+                            });
+                    }
+            }
+        ];
+
+        // Create cached/uncached tests from the following array of templates.  For each template entry,
+        // we add two identical test cases to 'testCases'.  The first case initiates a fetch to populate the
+        // cache.  The second request initiates a fetch with the same URL to cover the case where we hit
+        // the cache (if the caching policy permits caching).
+        [
+            { initiator: &quot;iframe&quot;,         response: &quot;(done)&quot;,      mime: mimeHtml },
+            { initiator: &quot;xmlhttprequest&quot;, response: &quot;(done)&quot;,      mime: mimeText },
+            // Multiple browsers seem to cheat a bit and race onLoad of images.  Microsoft https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/2379187
+            // { initiator: &quot;img&quot;,            response: greenPng,      mime: mimePng },
+            { initiator: &quot;script&quot;,         response: '&quot;&quot;;',         mime: mimeScript },
+            { initiator: &quot;link&quot;,           response: &quot;.unused{}&quot;,   mime: mimeCss },
+        ]
+        .forEach(function (template) {
+            testCases.push({
+                description: &quot;'&quot; + template.initiator + &quot; (Populate cache): The initial request populates the cache (if appropriate).&quot;,
+                test: function (test) {
+                    initiateFetch(
+                        test,
+                        template.initiator,
+                        getSyntheticUrl(
+                            &quot;mime:&quot; + encodeURIComponent(template.mime)
+                                + &quot;&amp;send:&quot; + encodeURIComponent(template.response),
+                            /* allowCaching = */ true),
+                        function (initiator, entry) {
+                            test.done();
+                        });
+                    }
+                });
+
+            testCases.push({
+                description: &quot;'&quot; + template.initiator + &quot; (Potentially Cached): Immediately fetch the same URL, exercising the cache hit path (if any).&quot;,
+                test: function (test) {
+                    initiateFetch(
+                        test,
+                        template.initiator,
+                        getSyntheticUrl(
+                            &quot;mime:&quot; + encodeURIComponent(template.mime)
+                                + &quot;&amp;send:&quot; + encodeURIComponent(template.response),
+                            /* allowCaching = */ true),
+                        function (initiator, entry) {
+                            test.done();
+                        });
+                    }
+                });
+            });
+
+        // Create responseStart/responseEnd tests from the following array of templates.  In this test, the server delays before
+        // responding with responsePart1, then delays again before completing with responsePart2.  The test looks for the expected
+        // pauses before responeStart and responseEnd.
+        [
+            { initiator: &quot;iframe&quot;,         responsePart1: serverStepDelay + &quot;ms;&quot;, responsePart2: (serverStepDelay * 2) + &quot;ms;(done)&quot;,                                                      mime: mimeHtml },
+            { initiator: &quot;xmlhttprequest&quot;, responsePart1: serverStepDelay + &quot;ms;&quot;, responsePart2: (serverStepDelay * 2) + &quot;ms;(done)&quot;,                                                      mime: mimeText },
+            // Multiple browsers seem to cheat a bit and race img.onLoad and setting responseEnd.  Microsoft https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/2379187
+            // { initiator: &quot;img&quot;,            responsePart1: greenPng.substring(0, greenPng.length / 2), responsePart2: &quot;0x&quot; + greenPng.substring(greenPng.length / 2, greenPng.length),       mime: mimePng },
+            { initiator: &quot;script&quot;,         responsePart1: '&quot;', responsePart2: '&quot;;',                                                                                                         mime: mimeScript },
+            { initiator: &quot;link&quot;,           responsePart1: &quot;.unused{&quot;, responsePart2: &quot;}&quot;,                                                                                                   mime: mimeCss },
+        ]
+        .forEach(function (template) {
+            testCases.push({
+                description: &quot;'&quot; + template.initiator + &quot;: 1 second delay before 'responseStart', another 1 second delay before 'responseEnd'.&quot;,
+                test: function (test) {
+                    initiateFetch(
+                        test,
+                        template.initiator,
+                        getSyntheticUrl(serverStepDelay + &quot;ms&quot;                          // Wait, then echo back responsePart1
+                            + &quot;&amp;mime:&quot; + encodeURIComponent(template.mime)
+                            + &quot;&amp;send:&quot; + encodeURIComponent(template.responsePart1)
+                            + &quot;&amp;&quot; + serverStepDelay + &quot;ms&quot;                              // Wait, then echo back responsePart2
+                            + &quot;&amp;send:&quot; + encodeURIComponent(template.responsePart2)),
+
+                        function (initiator, entry) {
+                            // Per https://w3c.github.io/resource-timing/#performanceresourcetiming:
+                            // If no redirects (or equivalent) occur, this redirectStart/End must return zero.
+                            assert_equals(entry.redirectStart, 0, &quot;When no redirect occurs, redirectStart must be 0.&quot;);
+                            assert_equals(entry.redirectEnd, 0, &quot;When no redirect occurs, redirectEnd must be 0.&quot;);
+
+                            // Server creates a gap between 'requestStart' and 'responseStart'.
+                            assert_greater_than_equal(
+                                entry.responseStart,
+                                entry.requestStart + serverStepDelay,
+                                &quot;'responseStart' must be &quot; + serverStepDelay + &quot;ms later than 'requestStart'.&quot;);
+
+                            // Server creates a gap between 'responseStart' and 'responseEnd'.
+                            assert_greater_than_equal(
+                                entry.responseEnd,
+                                entry.responseStart + serverStepDelay,
+                                &quot;'responseEnd' must be &quot; + serverStepDelay + &quot;ms later than 'responseStart'.&quot;);
+
+                            test.done();
+                        });
+                    }
+                });
+            });
+
+        // Create redirectEnd/responseStart tests from the following array of templates.  In this test, the server delays before
+        // redirecting to a new synthetic response, then delays again before responding with 'response'.  The test looks for the
+        // expected pauses before redirectEnd and responseStart.
+        [
+            { initiator: &quot;iframe&quot;,         response: serverStepDelay + &quot;ms;redirect;&quot; + (serverStepDelay * 2) + &quot;ms;(done)&quot;,        mime: mimeHtml },
+            { initiator: &quot;xmlhttprequest&quot;, response: serverStepDelay + &quot;ms;redirect;&quot; + (serverStepDelay * 2) + &quot;ms;(done)&quot;,        mime: mimeText },
+            // Multiple browsers seem to cheat a bit and race img.onLoad and setting responseEnd.  Microsoft https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/2379187
+            // { initiator: &quot;img&quot;,            response: greenPng,                                                                      mime: mimePng },
+            { initiator: &quot;script&quot;,         response: '&quot;&quot;;',                                                                         mime: mimeScript },
+            { initiator: &quot;link&quot;,           response: &quot;.unused{}&quot;,                                                                   mime: mimeCss },
+        ]
+        .forEach(function (template) {
+            testCases.push({
+                description: &quot;'&quot; + template.initiator + &quot; (Redirected): 1 second delay before 'redirectEnd', another 1 second delay before 'responseStart'.&quot;,
+                test: function (test) {
+                    initiateFetch(
+                        test,
+                        template.initiator,
+                        getSyntheticUrl(serverStepDelay + &quot;ms&quot;      // Wait, then redirect to a second page that waits
+                            + &quot;&amp;redirect:&quot;                          // before echoing back the response.
+                                + encodeURIComponent(
+                                    getSyntheticUrl(serverStepDelay + &quot;ms&quot;
+                                        + &quot;&amp;mime:&quot; + encodeURIComponent(template.mime)
+                                        + &quot;&amp;send:&quot; + encodeURIComponent(template.response)))),
+                        function (initiator, entry) {
+                            // Per https://w3c.github.io/resource-timing/#performanceresourcetiming:
+                            //      &quot;[If redirected, startTime] MUST return the same value as redirectStart.
+                            assert_equals(entry.startTime, entry.redirectStart, &quot;startTime must be equal to redirectStart.&quot;);
+
+                            // Server creates a gap between 'redirectStart' and 'redirectEnd'.
+                            assert_greater_than_equal(
+                                entry.redirectEnd,
+                                entry.redirectStart + serverStepDelay,
+                                &quot;'redirectEnd' must be &quot; + serverStepDelay + &quot;ms later than 'redirectStart'.&quot;);
+
+                            // Server creates a gap between 'requestStart' and 'responseStart'.
+                            assert_greater_than_equal(
+                                entry.responseStart,
+                                entry.requestStart + serverStepDelay,
+                                &quot;'responseStart' must be &quot; + serverStepDelay + &quot;ms later than 'requestStart'.&quot;);
+
+                            test.done();
+                        });
+                    }
+                });
+            });
+
+        // Function to run the next case in the queue.
+        var currentTestIndex = -1;
+        function runNextCase() {
+            var testCase = testCases[++currentTestIndex];
+            if (testCase !== undefined) {
+                async_test(testCase.test, testCase.description);
+            }
+        }
+
+        // When a test completes, run the next case in the queue.
+        add_result_callback(runNextCase);
+
+        // Start the first test.
+        runNextCase();
+
+        /** Iterates through all resource entries on the timeline, vetting all invariants. */
+        function assertInvariants(test, done) {
+            // Multiple browsers seem to cheat a bit and race img.onLoad and setting responseEnd.  Microsoft https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/2379187
+            // Yield for 100ms to workaround a suspected race where window.onload fires before
+            //     script visible side-effects from the wininet/urlmon thread have finished.
+            window.setTimeout(
+                test.step_func(
+                    function () {
+                        performance
+                            .getEntriesByType(&quot;resource&quot;)
+                            .forEach(
+                                function (entry, index, entries) {
+                                    assertResourceEntryInvariants(entry);
+                                });
+
+                        done();
+                    }),
+                    100);
+        }
+
+        /** Assets the invariants for a resource timeline entry. */
+        function assertResourceEntryInvariants(actual) {
+            // Example from http://w3c.github.io/resource-timing/#resources-included:
+            //     &quot;If an HTML IFRAME element is added via markup without specifying a src attribute,
+            //      the user agent may load the about:blank document for the IFRAME. If at a later time
+            //      the src attribute is changed dynamically via script, the user agent may fetch the new
+            //      URL resource for the IFRAME. In this case, only the fetch of the new URL would be
+            //      included as a PerformanceResourceTiming object in the Performance Timeline.&quot;
+            assert_not_equals(
+                actual.name,
+                &quot;about:blank&quot;,
+                &quot;Fetch for 'about:blank' must not appear in timeline.&quot;);
+
+            assert_not_equals(actual.startTime, 0, &quot;startTime&quot;);
+
+            // Per https://w3c.github.io/resource-timing/#performanceresourcetiming:
+            //      &quot;[If redirected, startTime] MUST return the same value as redirectStart. Otherwise,
+            //      [startTime] MUST return the same value as fetchStart.&quot;
+            assert_true(actual.startTime == actual.redirectStart || actual.startTime == actual.fetchStart,
+                &quot;startTime must be equal to redirectStart or fetchStart.&quot;);
+
+            // redirectStart &lt;= redirectEnd &lt;= fetchStart &lt;= domainLookupStart &lt;= domainLookupEnd &lt;= connectStart
+            assert_less_than_equal(actual.redirectStart, actual.redirectEnd, &quot;redirectStart &lt;= redirectEnd&quot;);
+            assert_less_than_equal(actual.redirectEnd, actual.fetchStart, &quot;redirectEnd &lt;= fetchStart&quot;);
+            assert_less_than_equal(actual.fetchStart, actual.domainLookupStart, &quot;fetchStart &lt;= domainLookupStart&quot;);
+            assert_less_than_equal(actual.domainLookupStart, actual.domainLookupEnd, &quot;domainLookupStart &lt;= domainLookupEnd&quot;);
+            assert_less_than_equal(actual.domainLookupEnd, actual.connectStart, &quot;domainLookupEnd &lt;= connectStart&quot;);
+
+            // Per https://w3c.github.io/resource-timing/#performanceresourcetiming:
+            //      &quot;This attribute is optional. User agents that don't have this attribute available MUST set it
+            //      as undefined.  [...]  If the secureConnectionStart attribute is available but HTTPS is not used,
+            //      this attribute MUST return zero.&quot;
+            assert_true(actual.secureConnectionStart == undefined ||
+                        actual.secureConnectionStart == 0 ||
+                        actual.secureConnectionStart &gt;= actual.connectEnd, &quot;secureConnectionStart time&quot;);
+
+            // connectStart &lt;= connectEnd &lt;= requestStart &lt;= responseStart &lt;= responseEnd
+            assert_less_than_equal(actual.connectStart, actual.connectEnd, &quot;connectStart &lt;= connectEnd&quot;);
+            assert_less_than_equal(actual.connectEnd, actual.requestStart, &quot;connectEnd &lt;= requestStart&quot;);
+            assert_less_than_equal(actual.requestStart, actual.responseStart, &quot;requestStart &lt;= responseStart&quot;);
+            assert_less_than_equal(actual.responseStart, actual.responseEnd, &quot;responseStart &lt;= responseEnd&quot;);
+        }
+
+        /** Helper function to resolve a relative URL */
+        function canonicalize(url) {
+            var div = document.createElement('div');
+            div.innerHTML = &quot;&lt;a&gt;&lt;/a&gt;&quot;;
+            div.firstChild.href = url;
+            div.innerHTML = div.innerHTML;
+            return div.firstChild.href;
+        }
+
+        /** Generates a unique string, used by getSyntheticUrl() to avoid hitting the cache. */
+        function createUniqueQueryArgument() {
+            var result =
+                &quot;ignored_&quot;
+                    + Date.now()
+                    + &quot;-&quot;
+                    + ((Math.random() * 0xFFFFFFFF) &gt;&gt;&gt; 0)
+                    + &quot;-&quot;
+                    + syntheticRequestCount;
+
+            return result;
+        }
+
+        /** Count of the calls to getSyntheticUrl().  Used by createUniqueQueryArgument() to generate unique strings. */
+        var syntheticRequestCount = 0;
+
+        /** Return a URL to a server that will synthesize an HTTP response using the given
+            commands. (See SyntheticResponse.aspx). */
+        function getSyntheticUrl(commands, allowCache) {
+            syntheticRequestCount++;
+
+            var url =
+                canonicalize(&quot;./SyntheticResponse.py&quot;)    // ASP.NET page that will synthesize the response.
+                    + &quot;?&quot; + commands;                       // Commands that will be used.
+
+            if (allowCache !== true) {                      // If caching is disallowed, append a unique argument
+                url += &quot;&amp;&quot; + createUniqueQueryArgument();   // to the URL's query string.
+            }
+
+            return url;
+        }
+
+        /** Given an 'initiatorType' (e.g., &quot;img&quot;) , it triggers the appropriate type of fetch for the specified
+            url and invokes 'onloadCallback' when the fetch completes.  If the fetch caused an entry to be created
+            on the resource timeline, the entry is passed to the callback. */
+        function initiateFetch(test, initiatorType, url, onloadCallback) {
+            assertInvariants(
+                test,
+                function () {
+                    log(&quot;--- Begin: &quot; + url);
+
+                    switch (initiatorType) {
+                        case &quot;script&quot;:
+                        case &quot;img&quot;:
+                        case &quot;iframe&quot;: {
+                            var element = document.createElement(initiatorType);
+                            document.body.appendChild(element);
+                            element.onload = createOnloadCallbackFn(test, element, url, onloadCallback);
+                            element.src = url;
+                            break;
+                        }
+                        case &quot;link&quot;: {
+                            var element = document.createElement(initiatorType);
+                            element.rel = &quot;stylesheet&quot;;
+                            document.body.appendChild(element);
+                            element.onload = createOnloadCallbackFn(test, element, url, onloadCallback);
+                            element.href = url;
+                            break;
+                        }
+                        case &quot;xmlhttprequest&quot;: {
+                            var xhr = new XMLHttpRequest();
+                            xhr.open('GET', url, true);
+                            xhr.onreadystatechange = createOnloadCallbackFn(test, xhr, url, onloadCallback);
+                            xhr.send();
+                            break;
+                        }
+                        default:
+                            assert_unreached(&quot;Unsupported initiatorType '&quot; + initiatorType + &quot;'.&quot;);
+                            break;
+                    }});
+        }
+
+        /** Used by 'initiateFetch' to register a test step for the asynchronous callback, vet invariants,
+            find the matching resource timeline entry (if any), and pass it to the given 'onloadCallback'
+            when invoked. */
+        function createOnloadCallbackFn(test, initiator, url, onloadCallback) {
+            // Remember the number of entries on the timeline prior to initiating the fetch:
+            var beforeEntryCount = performance.getEntries().length;
+
+            return test.step_func(
+                function() {
+                    // If the fetch was initiated by XHR, we're subscribed to the 'onreadystatechange' event.
+                    // Ignore intermediate callbacks and wait for the XHR to complete.
+                    if (Object.getPrototypeOf(initiator) === XMLHttpRequest.prototype) {
+                        if (initiator.readyState != 4) {
+                            return;
+                        }
+                    }
+
+                    var entries = performance.getEntries();
+                    var candidateEntry = entries[entries.length - 1];
+
+                    switch (entries.length - beforeEntryCount)
+                    {
+                        case 0:
+                            candidateEntry = undefined;
+                            break;
+                        case 1:
+                            // Per https://w3c.github.io/resource-timing/#performanceresourcetiming:
+                            //     &quot;This attribute MUST return the resolved URL of the requested resource. This attribute
+                            //      MUST NOT change even if the fetch redirected to a different URL.&quot;
+                            assert_equals(candidateEntry.name, url, &quot;'name' did not match expected 'url'.&quot;);
+                            logResourceEntry(candidateEntry);
+                            break;
+                        default:
+                            assert_unreached(&quot;At most, 1 entry should be added to the performance timeline during a fetch.&quot;);
+                            break;
+                    }
+
+                    assertInvariants(
+                        test,
+                        function () {
+                            onloadCallback(initiator, candidateEntry);
+                        });
+                });
+        }
+
+        /** Log the given text to the document element with id='output' */
+        function log(text) {
+            var output = document.getElementById(&quot;output&quot;);
+            output.textContent += text + &quot;\r\n&quot;;
+        }
+
+        add_completion_callback(function () {
+            var output = document.getElementById(&quot;output&quot;);
+            var button = document.createElement('button');
+            output.parentNode.insertBefore(button, output);
+            button.onclick = function () {
+                var showButton = output.style.display == 'none';
+                output.style.display = showButton ? null : 'none';
+                button.textContent = showButton ? 'Hide details' : 'Show details';
+            }
+            button.onclick();
+            var iframes = document.querySelectorAll('iframe');
+            for (var i = 0; i &lt; iframes.length; i++)
+                iframes[i].parentNode.removeChild(iframes[i]);
+        });
+
+        /** pretty print a resource timeline entry. */
+        function logResourceEntry(entry) {
+            log(&quot;[&quot; + entry.entryType + &quot;] &quot; + entry.name);
+
+            [&quot;startTime&quot;, &quot;redirectStart&quot;, &quot;redirectEnd&quot;, &quot;fetchStart&quot;, &quot;domainLookupStart&quot;, &quot;domainLookupEnd&quot;, &quot;connectStart&quot;, &quot;secureConnectionStart&quot;, &quot;connectEnd&quot;, &quot;requestStart&quot;, &quot;responseStart&quot;, &quot;responseEnd&quot;]
+                .forEach(
+                    function (property, index, array) {
+                        var value = entry[property];
+                        log(property + &quot;:\t&quot; + value);
+                    });
+
+            log(&quot;\r\n&quot;);
+        }
+    };
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingresourcesresource_timing_test0css"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.css (0 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.css                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.css        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+div#resource_link_css
+{
+    color:hotpink;
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingresourcesresource_timing_test0html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.html (0 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.html        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;title&gt;
+        Child Frame
+        &lt;/title&gt;
+    &lt;/head&gt;
+    &lt;body style=&quot;background-color: #C0C0C0&quot;&gt;
+
+        &lt;h1&gt;
+        Child Document
+        &lt;/h1&gt;
+
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingresourcesresource_timing_test0js"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.js (0 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.js                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.js        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+// This is a test script for purposes of testing the
+// script initiator type in the Resource Timing feature
+var testDummyValue = 0;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingresourcesresource_timing_test0png"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Index: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.png
</span><span class="cx">===================================================================
</span><del>--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.png        2016-08-25 18:21:16 UTC (rev 204975)
</del><ins>+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.png        2016-08-25 18:22:25 UTC (rev 204976)
</ins><span class="cx">Property changes on: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<ins>+application/octet-stream
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingresourcesresource_timing_test0xml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.xml (0 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.xml                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/resource_timing_test0.xml        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt;
+&lt;TESTDATA&gt;
+    &lt;ITEM&gt;
+        &lt;DATA&gt;Test XML Data&lt;/DATA&gt;
+    &lt;/ITEM&gt;
+&lt;/TESTDATA&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingresourceswebperftestharnessjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/webperftestharness.js (0 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/webperftestharness.js                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/webperftestharness.js        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -0,0 +1,145 @@
</span><ins>+//
+// Helper Functions for NavigationTiming W3C tests
+//
+
+var performanceNamespace = window.performance;
+var timingAttributes = [
+    'connectEnd',
+    'connectStart',
+    'domComplete',
+    'domContentLoadedEventEnd',
+    'domContentLoadedEventStart',
+    'domInteractive',
+    'domLoading',
+    'domainLookupEnd',
+    'domainLookupStart',
+    'fetchStart',
+    'loadEventEnd',
+    'loadEventStart',
+    'navigationStart',
+    'redirectEnd',
+    'redirectStart',
+    'requestStart',
+    'responseEnd',
+    'responseStart',
+    'unloadEventEnd',
+    'unloadEventStart'
+];
+
+var namespace_check = false;
+
+//
+// All test() functions in the WebPerf test suite should use wp_test() instead.
+//
+// wp_test() validates the window.performance namespace exists prior to running tests and
+// immediately shows a single failure if it does not.
+//
+
+function wp_test(func, msg, properties)
+{
+    // only run the namespace check once
+    if (!namespace_check)
+    {
+        namespace_check = true;
+
+        if (performanceNamespace === undefined || performanceNamespace == null)
+        {
+            // show a single error that window.performance is undefined
+            test(function() { assert_true(performanceNamespace !== undefined &amp;&amp; performanceNamespace != null, &quot;window.performance is defined and not null&quot;); }, &quot;window.performance is defined and not null.&quot;, {author:&quot;W3C http://www.w3.org/&quot;,help:&quot;http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute&quot;,assert:&quot;The window.performance attribute provides a hosting area for performance related attributes. &quot;});
+        }
+    }
+
+    test(func, msg, properties);
+}
+
+function test_namespace(child_name, skip_root)
+{
+    if (skip_root === undefined) {
+        var msg = 'window.performance is defined';
+        wp_test(function () { assert_true(performanceNamespace !== undefined, msg); }, msg,{author:&quot;W3C http://www.w3.org/&quot;,help:&quot;http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute&quot;,assert:&quot;The window.performance attribute provides a hosting area for performance related attributes. &quot;});
+    }
+
+    if (child_name !== undefined) {
+        var msg2 = 'window.performance.' + child_name + ' is defined';
+        wp_test(function() { assert_true(performanceNamespace[child_name] !== undefined, msg2); }, msg2,{author:&quot;W3C http://www.w3.org/&quot;,help:&quot;http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute&quot;,assert:&quot;The window.performance attribute provides a hosting area for performance related attributes. &quot;});
+    }
+}
+
+function test_attribute_exists(parent_name, attribute_name, properties)
+{
+    var msg = 'window.performance.' + parent_name + '.' + attribute_name + ' is defined.';
+    wp_test(function() { assert_true(performanceNamespace[parent_name][attribute_name] !== undefined, msg); }, msg, properties);
+}
+
+function test_enum(parent_name, enum_name, value, properties)
+{
+    var msg = 'window.performance.' + parent_name + '.' + enum_name + ' is defined.';
+    wp_test(function() { assert_true(performanceNamespace[parent_name][enum_name] !== undefined, msg); }, msg, properties);
+
+    msg = 'window.performance.' + parent_name + '.' + enum_name + ' = ' + value;
+    wp_test(function() { assert_equals(performanceNamespace[parent_name][enum_name], value, msg); }, msg, properties);
+}
+
+function test_timing_order(attribute_name, greater_than_attribute, properties)
+{
+    // ensure it's not 0 first
+    var msg = &quot;window.performance.timing.&quot; + attribute_name + &quot; &gt; 0&quot;;
+    wp_test(function() { assert_true(performanceNamespace.timing[attribute_name] &gt; 0, msg); }, msg, properties);
+
+    // ensure it's in the right order
+    msg = &quot;window.performance.timing.&quot; + attribute_name + &quot; &gt;= window.performance.timing.&quot; + greater_than_attribute;
+    wp_test(function() { assert_true(performanceNamespace.timing[attribute_name] &gt;= performanceNamespace.timing[greater_than_attribute], msg); }, msg, properties);
+}
+
+function test_timing_greater_than(attribute_name, greater_than, properties)
+{
+    var msg = &quot;window.performance.timing.&quot; + attribute_name + &quot; &gt; &quot; + greater_than;
+    test_greater_than(performanceNamespace.timing[attribute_name], greater_than, msg, properties);
+}
+
+function test_timing_equals(attribute_name, equals, msg, properties)
+{
+    var test_msg = msg || &quot;window.performance.timing.&quot; + attribute_name + &quot; == &quot; + equals;
+    test_equals(performanceNamespace.timing[attribute_name], equals, test_msg, properties);
+}
+
+//
+// Non-test related helper functions
+//
+
+function sleep_milliseconds(n)
+{
+    var start = new Date().getTime();
+    while (true) {
+        if ((new Date().getTime() - start) &gt;= n) break;
+    }
+}
+
+//
+// Common helper functions
+//
+
+function test_true(value, msg, properties)
+{
+    wp_test(function () { assert_true(value, msg); }, msg, properties);
+}
+
+function test_equals(value, equals, msg, properties)
+{
+    wp_test(function () { assert_equals(value, equals, msg); }, msg, properties);
+}
+
+function test_greater_than(value, greater_than, msg, properties)
+{
+    wp_test(function () { assert_true(value &gt; greater_than, msg); }, msg, properties);
+}
+
+function test_greater_or_equals(value, greater_than, msg, properties)
+{
+    wp_test(function () { assert_true(value &gt;= greater_than, msg); }, msg, properties);
+}
+
+function test_not_equals(value, notequals, msg, properties)
+{
+    wp_test(function() { assert_true(value !== notequals, msg); }, msg, properties);
+}
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingtest_resource_timingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing-expected.txt (0 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing-expected.txt        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+Description
+
+NOTE: Due to caching behavior in the browser, it is possible that when revisiting this page, some resources may not have to be fetched from the network. As a result, the performance timeline will not contain entries for these resources. This test will fail if any entries are missing to ensure that all resources are fetched from the network and entries for these resources exist in the Performance Timeline. If revisiting this page, please either perform a full reload of the page or clear the cache between visits.
+
+
+PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (iframe) 
+PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (iframe) 
+PASS PerformanceEntry has correct order of timing attributes (iframe) 
+PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (img) 
+PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (img) 
+PASS PerformanceEntry has correct order of timing attributes (img) 
+PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (link) 
+PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (link) 
+PASS PerformanceEntry has correct order of timing attributes (link) 
+PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (script) 
+PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (script) 
+PASS PerformanceEntry has correct order of timing attributes (script) 
+PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (xmlhttprequest) 
+PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (xmlhttprequest) 
+PASS PerformanceEntry has correct order of timing attributes (xmlhttprequest) 
+PASS window.performance Resource Timing Entries exist 
+PASS window.performance Resource Timing Entries exist 1 
+PASS window.performance Resource Timing Entries exist 2 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingtest_resource_timinghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.html (0 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.html        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;meta charset=&quot;UTF-8&quot; /&gt;
+        &lt;title&gt;window.performance Resource Timing Entries exist&lt;/title&gt;
+        &lt;link rel=&quot;author&quot; title=&quot;Microsoft&quot; href=&quot;http://www.microsoft.com/&quot; /&gt;
+        &lt;link rel=&quot;help&quot; href=&quot;https://w3c.github.io/web-performance/specs/ResourceTiming/Overview.html&quot;/&gt;
+        &lt;script src=&quot;/resources/testharness.js&quot;&gt;&lt;/script&gt;
+        &lt;script src=&quot;/resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+        &lt;script src=&quot;test_resource_timing.js&quot;&gt;&lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;h1&gt;Description&lt;/h1&gt;
+        &lt;p&gt;
+           NOTE: Due to caching behavior in the browser, it is possible that when revisiting this page, some resources
+           may not have to be fetched from the network.  As a result, the performance timeline will not contain entries
+           for these resources. This test will fail if any entries are missing to ensure that all resources are fetched
+           from the network and entries for these resources exist in the Performance Timeline.  If revisiting this page,
+           please either perform a full reload of the page or clear the cache between visits.
+        &lt;/p&gt;
+
+        &lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsresourcetimingtest_resource_timingjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.js (0 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.js                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.js        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -0,0 +1,186 @@
</span><ins>+var TEST_ALLOWED_TIMING_DELTA = 20;
+
+var waitTimer;
+var expectedEntries = {};
+
+var initiatorTypes = [&quot;iframe&quot;, &quot;img&quot;, &quot;link&quot;, &quot;script&quot;, &quot;xmlhttprequest&quot;];
+
+var tests = {};
+setup(function() {
+    for (var i in initiatorTypes) {
+        var type = initiatorTypes[i];
+        tests[type] = {
+            &quot;entry&quot;: async_test(&quot;window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (&quot; + type + &quot;)&quot;),
+            &quot;simple_attrs&quot;: async_test(&quot;PerformanceEntry has correct name, initiatorType, startTime, and duration (&quot; + type + &quot;)&quot;),
+            &quot;timing_attrs&quot;: async_test(&quot;PerformanceEntry has correct order of timing attributes (&quot; + type + &quot;)&quot;)
+        };
+    }
+});
+
+function resolve(path) {
+    var a = document.createElement(&quot;a&quot;);
+    a.href = path;
+    return a.href;
+}
+
+onload = function()
+{
+    // check that the Performance Timeline API exists
+    test(function() {
+        assert_idl_attribute(window.performance, &quot;getEntriesByName&quot;,
+                             &quot;window.performance.getEntriesByName() is defined&quot;);
+    });
+    test(function() {
+        assert_idl_attribute(window.performance, &quot;getEntriesByType&quot;,
+                             &quot;window.performance.getEntriesByType() is defined&quot;);
+    });
+    test(function() {
+        assert_idl_attribute(window.performance, &quot;getEntries&quot;,
+                             &quot;window.performance.getEntries() is defined&quot;);
+    });
+
+    var expected_entry;
+    var url;
+    var type;
+    var startTime;
+    var element;
+    for (var i in initiatorTypes) {
+        startTime = window.performance.now();
+        type = initiatorTypes[i];
+        if (type != &quot;xmlhttprequest&quot;) {
+            element = document.createElement(type);
+        } else {
+            element = null;
+        }
+        switch (type) {
+        case &quot;iframe&quot;:
+            url = resolve(&quot;resources/resource_timing_test0.html&quot;);
+            element.src = url;
+            break;
+        case &quot;img&quot;:
+            url = resolve(&quot;resources/resource_timing_test0.png&quot;);
+            element.src = url;
+            break;
+        case &quot;link&quot;:
+            element.rel = &quot;stylesheet&quot;;
+            url = resolve(&quot;resources/resource_timing_test0.css&quot;);
+            element.href = url;
+            break;
+        case &quot;script&quot;:
+            element.type = &quot;text/javascript&quot;;
+            url = resolve(&quot;resources/resource_timing_test0.js&quot;);
+            element.src = url;
+            break;
+        case &quot;xmlhttprequest&quot;:
+            var xmlhttp = new XMLHttpRequest();
+            url = resolve(&quot;resources/resource_timing_test0.xml&quot;);
+            xmlhttp.open('GET', url, true);
+            xmlhttp.send();
+            break;
+        }
+
+        expected_entry = {name:url,
+                          startTime: startTime,
+                          initiatorType: type};
+
+        switch (type) {
+        case &quot;link&quot;:
+            poll_for_stylesheet_load(expected_entry);
+            document.body.appendChild(element);
+            break;
+        case &quot;xmlhttprequest&quot;:
+            xmlhttp.onload = (function(entry) {
+                return function (event) {
+                    resource_load(entry);
+                };
+            })(expected_entry);
+            break;
+        default:
+            element.onload = (function(entry) {
+                return function (event) {
+                    resource_load(entry);
+                };
+            })(expected_entry);
+            document.body.appendChild(element);
+        }
+
+    }
+};
+
+function poll_for_stylesheet_load(expected_entry) {
+    function inner() {
+        for(var i=0; i&lt;document.styleSheets.length; i++) {
+            var sheet = document.styleSheets[i];
+            if (sheet.href === expected_entry.name) {
+                try {
+                    // try/catch avoids throwing if sheet object exists before it is loaded,
+                    // which is a bug, but not what we are trying to test here.
+                    var hasRules = sheet.cssRules.length &gt; 0;
+                } catch(e) {
+                    hasRules = false;
+                }
+                if (hasRules) {
+                    setTimeout(function() {
+                        resource_load(expected_entry);
+                    }, 200);
+                    return;
+                }
+            }
+        }
+        setTimeout(inner, 100);
+    }
+    inner();
+}
+
+function resource_load(expected)
+{
+    var t = tests[expected.initiatorType];
+
+    t[&quot;entry&quot;].step(function() {
+        var entries_by_name = window.performance.getEntriesByName(expected.name);
+        assert_equals(entries_by_name.length, 1, &quot;should have a single entry for each resource (without type)&quot;);
+        var entries_by_name_type = window.performance.getEntriesByName(expected.name, &quot;resource&quot;);
+        assert_equals(entries_by_name_type.length, 1, &quot;should have a single entry for each resource (with type)&quot;);
+        assert_not_equals(entries_by_name, entries_by_name_type, &quot;values should be copies&quot;);
+        for (p in entries_by_name[0]) {
+            assert_equals(entries_by_name[0][p], entries_by_name_type[0][p], &quot;Property &quot; + p + &quot; should match&quot;);
+        }
+        this.done();
+    });
+
+    t[&quot;simple_attrs&quot;].step(function() {
+        var actual = window.performance.getEntriesByName(expected.name)[0];
+        var expected_type = expected.initiatorType;
+        assert_equals(actual.name, expected.name);
+        assert_equals(actual.initiatorType, expected_type);
+        assert_equals(actual.entryType, &quot;resource&quot;);
+        assert_greater_than_equal(actual.startTime, expected.startTime, &quot;startTime is after the script to initiate the load ran&quot;);
+        assert_equals(actual.duration, (actual.responseEnd - actual.startTime));
+        this.done();
+    });
+
+    t[&quot;timing_attrs&quot;].step(function test() {
+        var actual = window.performance.getEntriesByName(expected.name)[0];
+
+        // Debugging bug 1263428
+        // Feel free to remove/overwrite this piece of code
+        if (actual.connectStart &lt; actual.domainLookupEnd) {
+            assert_true(false, &quot;actual: &quot;+JSON.stringify(actual));
+        }
+
+        assert_equals(actual.redirectStart, 0, &quot;redirectStart time&quot;);
+        assert_equals(actual.redirectEnd, 0, &quot;redirectEnd time&quot;);
+        assert_true(actual.secureConnectionStart == undefined ||
+                    actual.secureConnectionStart == 0, &quot;secureConnectionStart time&quot;);
+        assert_equals(actual.fetchStart, actual.startTime, &quot;fetchStart is equal to startTime&quot;);
+        assert_greater_than_equal(actual.domainLookupStart, actual.fetchStart, &quot;domainLookupStart after fetchStart&quot;);
+        assert_greater_than_equal(actual.domainLookupEnd, actual.domainLookupStart, &quot;domainLookupEnd after domainLookupStart&quot;);
+        assert_greater_than_equal(actual.connectStart, actual.domainLookupEnd, &quot;connectStart after domainLookupEnd&quot;);
+        assert_greater_than_equal(actual.connectEnd, actual.connectStart, &quot;connectEnd after connectStart&quot;);
+        assert_greater_than_equal(actual.requestStart, actual.connectEnd, &quot;requestStart after connectEnd&quot;);
+        assert_greater_than_equal(actual.responseStart, actual.requestStart, &quot;responseStart after requestStart&quot;);
+        assert_greater_than_equal(actual.responseEnd, actual.responseStart, &quot;responseEnd after responseStart&quot;);
+        this.done();
+    });
+
+}
</ins></span></pre></div>
<a id="trunkLayoutTestsresourcestestharnessreportjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/resources/testharnessreport.js (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/resources/testharnessreport.js        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/LayoutTests/resources/testharnessreport.js        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -50,31 +50,37 @@
</span><span class="cx">     *   manner that allows dumpAsText to produce readable test results
</span><span class="cx">     */
</span><span class="cx">     add_completion_callback(function (tests, harness_status) {
</span><del>-        var results = document.createElement(&quot;pre&quot;);
-        var resultStr = &quot;\n&quot;;
</del><ins>+        // Wait for any other completion callbacks
+        setTimeout(function() {
+            var results = document.createElement(&quot;pre&quot;);
+            var resultStr = &quot;\n&quot;;
</ins><span class="cx"> 
</span><del>-        if(harness_status.status != 0)
-            resultStr += &quot;Harness Error (&quot; + convertResult(harness_status.status) + &quot;), message = &quot; + harness_status.message + &quot;\n\n&quot;;
</del><ins>+            if(harness_status.status != 0)
+                resultStr += &quot;Harness Error (&quot; + convertResult(harness_status.status) + &quot;), message = &quot; + harness_status.message + &quot;\n\n&quot;;
</ins><span class="cx"> 
</span><del>-        for (var i = 0; i &lt; tests.length; i++) {
-            var message = (tests[i].message != null) ? tests[i].message : &quot;&quot;;
-            if (tests[i].status == 1 &amp;&amp; !tests[i].dumpStack) {
-                // Remove stack for failed tests for proper string comparison without file paths.
-                // For a test to dump the stack set its dumpStack attribute to true.
-                var stackIndex = message.indexOf(&quot;(stack:&quot;);
-                if (stackIndex &gt; 0)
-                    message = message.substr(0, stackIndex);
</del><ins>+            for (var i = 0; i &lt; tests.length; i++) {
+                var message = (tests[i].message != null) ? tests[i].message : &quot;&quot;;
+                if (tests[i].status == 1 &amp;&amp; !tests[i].dumpStack) {
+                    // Remove stack for failed tests for proper string comparison without file paths.
+                    // For a test to dump the stack set its dumpStack attribute to true.
+                    var stackIndex = message.indexOf(&quot;(stack:&quot;);
+                    if (stackIndex &gt; 0)
+                        message = message.substr(0, stackIndex);
+                }
+                resultStr += convertResult(tests[i].status) + &quot; &quot; +  (tests[i].name != null ? tests[i].name : &quot;&quot;) + &quot; &quot; + message + &quot;\n&quot;;
</ins><span class="cx">             }
</span><del>-            resultStr += convertResult(tests[i].status) + &quot; &quot; +  (tests[i].name != null ? tests[i].name : &quot;&quot;) + &quot; &quot; + message + &quot;\n&quot;;
-        }
</del><span class="cx"> 
</span><del>-        results.innerText = resultStr;
-        var log = document.getElementById(&quot;log&quot;);
-        if (log)
-            log.appendChild(results);
-        else
-            document.body.appendChild(results);
</del><ins>+            results.innerText = resultStr;
+            var log = document.getElementById(&quot;log&quot;);
+            if (log)
+                log.appendChild(results);
+            else
+                document.body.appendChild(results);
</ins><span class="cx"> 
</span><del>-        testRunner.notifyDone();
</del><ins>+            testRunner.notifyDone();
+        }, 0);
</ins><span class="cx">     });
</span><ins>+
+    if (window.internals)
+        window.internals.setResourceTimingSupport(true);
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/Source/WebCore/ChangeLog        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -1,3 +1,85 @@
</span><ins>+2016-08-25  Johan K. Jensen  &lt;johan_jensen@apple.com&gt;
+
+        Update the Resource Timing implementation
+        https://bugs.webkit.org/show_bug.cgi?id=161068
+
+        Reviewed by Alex Christensen.
+
+        Tests: imported/w3c/web-platform-tests/resource-timing/resource-timing.html
+               imported/w3c/web-platform-tests/resource-timing/test_resource_timing.html
+
+        Update the Resource Timing implementation for better compatibility with the Resource Timing API spec.
+        Use LoadTiming for general timing information about a resources load timeline.
+        Mark timestamps for newly loaded resources as well as cached resources.
+
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::startLoadingMainResource):
+        StartTime and fetchStart should be equal initially.
+
+        * loader/LoadTiming.cpp:
+        (WebCore::LoadTiming::LoadTiming): Moved member initialization out. Removed constructor.
+        * loader/LoadTiming.h:
+        (WebCore::LoadTiming::markStartTimeAndFetchStart):
+        Mark startTime and fetchStart simultaneously.
+
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::init):
+        Mark the start time of resources.
+
+        * loader/ResourceLoader.h:
+        (WebCore::ResourceLoader::loadTiming):
+        Add LoadTiming info to handle a resources load timing.
+
+        * loader/ResourceTimingInformation.cpp:
+        (WebCore::ResourceTimingInformation::addResourceTiming):
+        * loader/ResourceTimingInformation.h:
+        Only pass in the URL from the ResourceRequest.
+        Pass LoadTiming instead of timestamps.
+
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::willSendRequestInternal):
+        Mark redirects.
+
+        (WebCore::SubresourceLoader::didFinishLoading):
+        Mark the responseEnd timestamp.
+        Add the ResourceEntry to the timeline before notifyDone is called.
+
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::requestResource):
+        (WebCore::CachedResourceLoader::revalidateResource):
+        (WebCore::CachedResourceLoader::loadDone):
+        Mark timestamps for cached resources and use them instead of a cached LoadTiming.
+
+        * loader/cache/CachedResourceLoader.h:
+        (WebCore::CachedResourceLoader::resourceTimingInformation):
+        Add ResourceTimingInformation getter so SubresourceLoader.cpp can add entries before callbacks.
+
+        * page/Performance.cpp:
+        (WebCore::Performance::addResourceTiming):
+        * page/Performance.h:
+        Update signature: URLs and LoadTiming instead of timestamps.
+
+        * page/PerformanceResourceTiming.cpp:
+        (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
+        (WebCore::PerformanceResourceTiming::redirectStart):
+        (WebCore::PerformanceResourceTiming::redirectEnd):
+        (WebCore::PerformanceResourceTiming::fetchStart):
+        (WebCore::PerformanceResourceTiming::domainLookupStart):
+        (WebCore::PerformanceResourceTiming::domainLookupEnd):
+        (WebCore::PerformanceResourceTiming::connectStart):
+        (WebCore::PerformanceResourceTiming::connectEnd):
+        (WebCore::PerformanceResourceTiming::requestStart):
+        (WebCore::PerformanceResourceTiming::responseStart):
+        (WebCore::PerformanceResourceTiming::responseEnd):
+        (WebCore::PerformanceResourceTiming::resourceTimeToDocumentMilliseconds):
+        * page/PerformanceResourceTiming.h:
+        Update signatures and properties to use LoadTiming.
+        Use LoadTiming’s redirectStart/End, fetchStart, responseStart/End.
+        Make sure dns and connection timestamps are in increasing order, even when cached.
+
+        * page/PerformanceResourceTiming.idl:
+        Add responseStart.
+
</ins><span class="cx"> 2016-08-24  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Simplify createMouseEvent in DragController
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderDocumentLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/DocumentLoader.cpp        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -1466,7 +1466,7 @@
</span><span class="cx"> void DocumentLoader::startLoadingMainResource()
</span><span class="cx"> {
</span><span class="cx">     m_mainDocumentError = ResourceError();
</span><del>-    timing().markStartTime();
</del><ins>+    timing().markStartTimeAndFetchStart();
</ins><span class="cx">     ASSERT(!m_mainResource);
</span><span class="cx">     ASSERT(!m_loadingMainResource);
</span><span class="cx">     m_loadingMainResource = true;
</span><span class="lines">@@ -1485,8 +1485,7 @@
</span><span class="cx">     frameLoader()-&gt;addExtraFieldsToMainResourceRequest(m_request);
</span><span class="cx"> 
</span><span class="cx">     ASSERT(timing().startTime());
</span><del>-    ASSERT(!timing().fetchStart());
-    timing().markFetchStart();
</del><ins>+    ASSERT(timing().fetchStart());
</ins><span class="cx"> 
</span><span class="cx">     Ref&lt;DocumentLoader&gt; protectedThis(*this); // willSendRequest() may deallocate the provisional loader (which may be us) if it cancels the load.
</span><span class="cx">     willSendRequest(m_request, ResourceResponse());
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderLoadTimingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/LoadTiming.cpp (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/LoadTiming.cpp        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/Source/WebCore/loader/LoadTiming.cpp        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -36,24 +36,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-LoadTiming::LoadTiming()
-    : m_referenceMonotonicTime(0.0)
-    , m_referenceWallTime(0.0)
-    , m_startTime(0.0)
-    , m_unloadEventStart(0.0)
-    , m_unloadEventEnd(0.0)
-    , m_redirectStart(0.0)
-    , m_redirectEnd(0.0)
-    , m_redirectCount(0)
-    , m_fetchStart(0.0)
-    , m_responseEnd(0.0)
-    , m_loadEventStart(0.0)
-    , m_loadEventEnd(0.0)
-    , m_hasCrossOriginRedirect(false)
-    , m_hasSameOriginAsPreviousDocument(false)
-{
-}
-
</del><span class="cx"> double LoadTiming::monotonicTimeToZeroBasedDocumentTime(double monotonicTime) const
</span><span class="cx"> {
</span><span class="cx">     if (!monotonicTime)
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderLoadTimingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/LoadTiming.h (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/LoadTiming.h        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/Source/WebCore/loader/LoadTiming.h        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -34,7 +34,6 @@
</span><span class="cx"> 
</span><span class="cx"> class LoadTiming {
</span><span class="cx"> public:
</span><del>-    LoadTiming();
</del><span class="cx"> 
</span><span class="cx">     double monotonicTimeToZeroBasedDocumentTime(double) const;
</span><span class="cx">     double monotonicTimeToPseudoWallTime(double) const;
</span><span class="lines">@@ -42,6 +41,8 @@
</span><span class="cx">     void markStartTime();
</span><span class="cx">     void addRedirect(const URL&amp; redirectingUrl, const URL&amp; redirectedUrl);
</span><span class="cx"> 
</span><ins>+    void markStartTimeAndFetchStart() { markStartTime(); m_fetchStart = m_startTime; }
+
</ins><span class="cx">     void markUnloadEventStart() { m_unloadEventStart = monotonicallyIncreasingTime(); }
</span><span class="cx">     void markUnloadEventEnd() { m_unloadEventEnd = monotonicallyIncreasingTime(); }
</span><span class="cx">     void markRedirectStart() { m_redirectStart = monotonicallyIncreasingTime(); }
</span><span class="lines">@@ -70,20 +71,20 @@
</span><span class="cx">     double referenceWallTime() const { return m_referenceWallTime; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    double m_referenceMonotonicTime;
-    double m_referenceWallTime;
-    double m_startTime;
-    double m_unloadEventStart;
-    double m_unloadEventEnd;
-    double m_redirectStart;
-    double m_redirectEnd;
-    short m_redirectCount;
-    double m_fetchStart;
-    double m_responseEnd;
-    double m_loadEventStart;
-    double m_loadEventEnd;
-    bool m_hasCrossOriginRedirect;
-    bool m_hasSameOriginAsPreviousDocument;
</del><ins>+    double m_referenceMonotonicTime { 0.0 };
+    double m_referenceWallTime { 0.0 };
+    double m_startTime { 0.0 };
+    double m_unloadEventStart { 0.0 };
+    double m_unloadEventEnd { 0.0 };
+    double m_redirectStart { 0.0 };
+    double m_redirectEnd { 0.0 };
+    short m_redirectCount { 0 };
+    double m_fetchStart { 0.0 };
+    double m_responseEnd { 0.0 };
+    double m_loadEventStart { 0.0 };
+    double m_loadEventEnd { 0.0 };
+    bool m_hasCrossOriginRedirect { false };
+    bool m_hasSameOriginAsPreviousDocument { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoader.cpp        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -116,6 +116,8 @@
</span><span class="cx">     
</span><span class="cx">     ResourceRequest clientRequest(r);
</span><span class="cx"> 
</span><ins>+    m_loadTiming.markStartTimeAndFetchStart();
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     // If the documentLoader was detached while this ResourceLoader was waiting its turn
</span><span class="cx">     // in ResourceLoadScheduler queue, don't continue.
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoader.h (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoader.h        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/Source/WebCore/loader/ResourceLoader.h        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #ifndef ResourceLoader_h
</span><span class="cx"> #define ResourceLoader_h
</span><span class="cx"> 
</span><ins>+#include &quot;LoadTiming.h&quot;
</ins><span class="cx"> #include &quot;ResourceHandleClient.h&quot;
</span><span class="cx"> #include &quot;ResourceLoaderOptions.h&quot;
</span><span class="cx"> #include &quot;ResourceLoaderTypes.h&quot;
</span><span class="lines">@@ -140,6 +141,8 @@
</span><span class="cx"> 
</span><span class="cx">     void willSwitchToSubstituteResource();
</span><span class="cx"> 
</span><ins>+    const LoadTiming&amp; loadTiming() { return m_loadTiming; }
+
</ins><span class="cx"> #if PLATFORM(COCOA) &amp;&amp; !USE(CFNETWORK)
</span><span class="cx">     void schedule(WTF::SchedulePair&amp;);
</span><span class="cx">     void unschedule(WTF::SchedulePair&amp;);
</span><span class="lines">@@ -172,7 +175,8 @@
</span><span class="cx">     RefPtr&lt;Frame&gt; m_frame;
</span><span class="cx">     RefPtr&lt;DocumentLoader&gt; m_documentLoader;
</span><span class="cx">     ResourceResponse m_response;
</span><del>-    
</del><ins>+    LoadTiming m_loadTiming;
+
</ins><span class="cx"> private:
</span><span class="cx">     virtual void willCancel(const ResourceError&amp;) = 0;
</span><span class="cx">     virtual void didCancel(const ResourceError&amp;) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceTimingInformationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceTimingInformation.cpp (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceTimingInformation.cpp        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/Source/WebCore/loader/ResourceTimingInformation.cpp        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -33,12 +33,13 @@
</span><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;Frame.h&quot;
</span><span class="cx"> #include &quot;HTMLFrameOwnerElement.h&quot;
</span><ins>+#include &quot;LoadTiming.h&quot;
</ins><span class="cx"> #include &quot;Performance.h&quot;
</span><span class="cx"> #include &quot;RuntimeEnabledFeatures.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-void ResourceTimingInformation::addResourceTiming(CachedResource* resource, Document&amp; document)
</del><ins>+void ResourceTimingInformation::addResourceTiming(CachedResource* resource, Document&amp; document, const LoadTiming&amp; loadTiming)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled());
</span><span class="cx">     if (resource &amp;&amp; resource-&gt;resourceRequest().url().protocolIsInHTTPFamily()
</span><span class="lines">@@ -52,7 +53,7 @@
</span><span class="cx">             ASSERT(initiatorDocument-&gt;domWindow());
</span><span class="cx">             ASSERT(initiatorDocument-&gt;domWindow()-&gt;performance());
</span><span class="cx">             const InitiatorInfo&amp; info = initiatorIt-&gt;value;
</span><del>-            initiatorDocument-&gt;domWindow()-&gt;performance()-&gt;addResourceTiming(info.name, initiatorDocument, resource-&gt;resourceRequest(), resource-&gt;response(), info.startTime, resource-&gt;loadFinishTime());
</del><ins>+            initiatorDocument-&gt;domWindow()-&gt;performance()-&gt;addResourceTiming(info.name, initiatorDocument, resource-&gt;resourceRequest().url(), resource-&gt;response(), loadTiming);
</ins><span class="cx">             initiatorIt-&gt;value.added = Added;
</span><span class="cx">         }
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceTimingInformationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceTimingInformation.h (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceTimingInformation.h        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/Source/WebCore/loader/ResourceTimingInformation.h        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -37,11 +37,12 @@
</span><span class="cx"> class CachedResourceRequest;
</span><span class="cx"> class Document;
</span><span class="cx"> class Frame;
</span><ins>+class LoadTiming;
</ins><span class="cx"> 
</span><span class="cx"> class ResourceTimingInformation {
</span><span class="cx"> public:
</span><span class="cx"> 
</span><del>-    void addResourceTiming(CachedResource*, Document&amp;);
</del><ins>+    void addResourceTiming(CachedResource*, Document&amp;, const LoadTiming&amp;);
</ins><span class="cx">     void storeResourceTimingInitiatorInformation(const CachedResourceHandle&lt;CachedResource&gt;&amp;, const CachedResourceRequest&amp;, Frame*);
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderSubresourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/SubresourceLoader.cpp        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> #include &quot;MemoryCache.h&quot;
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;ResourceLoadObserver.h&quot;
</span><ins>+#include &quot;RuntimeEnabledFeatures.h&quot;
</ins><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="cx"> #include &lt;wtf/Ref.h&gt;
</span><span class="cx"> #include &lt;wtf/RefCountedLeakCounter.h&gt;
</span><span class="lines">@@ -216,6 +217,7 @@
</span><span class="cx">             cancel();
</span><span class="cx">             return;
</span><span class="cx">         }
</span><ins>+        m_loadTiming.addRedirect(redirectResponse.url(), newRequest.url());
</ins><span class="cx">         m_resource-&gt;redirectReceived(newRequest, redirectResponse);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -458,6 +460,12 @@
</span><span class="cx">     Ref&lt;SubresourceLoader&gt; protectedThis(*this);
</span><span class="cx">     CachedResourceHandle&lt;CachedResource&gt; protectResource(m_resource);
</span><span class="cx"> 
</span><ins>+    finishTime = monotonicallyIncreasingTime();
+    m_loadTiming.setResponseEnd(finishTime);
+
+    if (m_documentLoader-&gt;cachedResourceLoader().document() &amp;&amp; RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled())
+        m_documentLoader-&gt;cachedResourceLoader().resourceTimingInformation().addResourceTiming(m_resource, *m_documentLoader-&gt;cachedResourceLoader().document(), m_resource-&gt;loader()-&gt;loadTiming());
+
</ins><span class="cx">     m_state = Finishing;
</span><span class="cx">     m_resource-&gt;setLoadFinishTime(finishTime);
</span><span class="cx">     m_resource-&gt;finishLoading(resourceData());
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -68,6 +68,7 @@
</span><span class="cx"> #include &quot;SessionID.h&quot;
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="cx"> #include &quot;StyleSheetContents.h&quot;
</span><ins>+#include &quot;SubresourceLoader.h&quot;
</ins><span class="cx"> #include &quot;UserContentController.h&quot;
</span><span class="cx"> #include &quot;UserStyleSheet.h&quot;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="lines">@@ -595,6 +596,11 @@
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEB_TIMING)
+    LoadTiming loadTiming;
+    loadTiming.markStartTimeAndFetchStart();
+#endif
+
</ins><span class="cx">     auto&amp; memoryCache = MemoryCache::singleton();
</span><span class="cx">     if (request.allowsCaching() &amp;&amp; memoryCache.disabled()) {
</span><span class="cx">         DocumentResourceMap::iterator it = m_documentResources.find(url.string());
</span><span class="lines">@@ -638,8 +644,11 @@
</span><span class="cx">         memoryCache.resourceAccessed(*resource);
</span><span class="cx"> #if ENABLE(WEB_TIMING)
</span><span class="cx">         if (document() &amp;&amp; RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled()) {
</span><ins>+            // FIXME (161170): The networkLoadTiming shouldn't be stored on the ResourceResponse.
+            resource-&gt;response().networkLoadTiming().reset();
+            loadTiming.setResponseEnd(monotonicallyIncreasingTime());
</ins><span class="cx">             m_resourceTimingInfo.storeResourceTimingInitiatorInformation(resource, request, frame());
</span><del>-            m_resourceTimingInfo.addResourceTiming(resource.get(), *document());
</del><ins>+            m_resourceTimingInfo.addResourceTiming(resource.get(), *document(), loadTiming);
</ins><span class="cx">         }
</span><span class="cx"> #endif
</span><span class="cx">         break;
</span><span class="lines">@@ -695,7 +704,7 @@
</span><span class="cx">     memoryCache.add(*newResource);
</span><span class="cx"> #if ENABLE(WEB_TIMING)
</span><span class="cx">     if (RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled())
</span><del>-        m_resourceTimingInfo.storeResourceTimingInitiatorInformation(resource, request, frame());
</del><ins>+        m_resourceTimingInfo.storeResourceTimingInitiatorInformation(newResource, request, frame());
</ins><span class="cx"> #else
</span><span class="cx">     UNUSED_PARAM(request);
</span><span class="cx"> #endif
</span><span class="lines">@@ -988,8 +997,8 @@
</span><span class="cx">     RefPtr&lt;Document&gt; protectDocument(m_document);
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WEB_TIMING)
</span><del>-    if (document() &amp;&amp; RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled())
-        m_resourceTimingInfo.addResourceTiming(resource, *document());
</del><ins>+    if (resource &amp;&amp; document() &amp;&amp; RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled())
+        m_resourceTimingInfo.addResourceTiming(resource, *document(), resource-&gt;loader()-&gt;loadTiming());
</ins><span class="cx"> #else
</span><span class="cx">     UNUSED_PARAM(resource);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.h (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.h        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.h        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -140,6 +140,8 @@
</span><span class="cx"> 
</span><span class="cx">     void documentDidFinishLoadEvent();
</span><span class="cx"> 
</span><ins>+    ResourceTimingInformation&amp; resourceTimingInformation() { return m_resourceTimingInfo; }
+
</ins><span class="cx"> private:
</span><span class="cx">     explicit CachedResourceLoader(DocumentLoader*);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagePerformancecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Performance.cpp (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Performance.cpp        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/Source/WebCore/page/Performance.cpp        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -164,12 +164,12 @@
</span><span class="cx">         dispatchEvent(Event::create(eventNames().resourcetimingbufferfullEvent, false, false));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Performance::addResourceTiming(const String&amp; initiatorName, Document* initiatorDocument, const ResourceRequest&amp; request, const ResourceResponse&amp; response, double initiationTime, double finishTime)
</del><ins>+void Performance::addResourceTiming(const String&amp; initiatorName, Document* initiatorDocument, const URL&amp; originalURL, const ResourceResponse&amp; response, LoadTiming loadTiming)
</ins><span class="cx"> {
</span><span class="cx">     if (isResourceTimingBufferFull())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    RefPtr&lt;PerformanceEntry&gt; entry = PerformanceResourceTiming::create(initiatorName, request, response, initiationTime, finishTime, initiatorDocument);
</del><ins>+    RefPtr&lt;PerformanceEntry&gt; entry = PerformanceResourceTiming::create(initiatorName, originalURL, response, loadTiming, initiatorDocument);
</ins><span class="cx"> 
</span><span class="cx">     m_resourceTimingBuffer.append(entry);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagePerformanceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Performance.h (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Performance.h        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/Source/WebCore/page/Performance.h        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -46,10 +46,12 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class Document;
</span><ins>+class LoadTiming;
</ins><span class="cx"> class PerformanceEntry;
</span><span class="cx"> class ResourceRequest;
</span><span class="cx"> class ResourceResponse;
</span><span class="cx"> class UserTiming;
</span><ins>+class URL;
</ins><span class="cx"> 
</span><span class="cx"> class Performance final : public RefCounted&lt;Performance&gt;, public DOMWindowProperty, public EventTargetWithInlineData {
</span><span class="cx"> public:
</span><span class="lines">@@ -70,7 +72,7 @@
</span><span class="cx">     void clearResourceTimings();
</span><span class="cx">     void setResourceTimingBufferSize(unsigned);
</span><span class="cx"> 
</span><del>-    void addResourceTiming(const String&amp; initiatorName, Document*, const ResourceRequest&amp;, const ResourceResponse&amp;, double initiationTime, double finishTime);
</del><ins>+    void addResourceTiming(const String&amp; initiatorName, Document*, const URL&amp; originalURL, const ResourceResponse&amp;, LoadTiming);
</ins><span class="cx"> 
</span><span class="cx">     using RefCounted&lt;Performance&gt;::ref;
</span><span class="cx">     using RefCounted&lt;Performance&gt;::deref;
</span></span></pre></div>
<a id="trunkSourceWebCorepagePerformanceResourceTimingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PerformanceResourceTiming.cpp (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PerformanceResourceTiming.cpp        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/Source/WebCore/page/PerformanceResourceTiming.cpp        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -76,11 +76,11 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PerformanceResourceTiming::PerformanceResourceTiming(const AtomicString&amp; initiatorType, const ResourceRequest&amp; request, const ResourceResponse&amp; response, double initiationTime, double finishTime, Document* requestingDocument)
-    : PerformanceEntry(request.url().string(), &quot;resource&quot;, monotonicTimeToDocumentMilliseconds(requestingDocument, initiationTime), monotonicTimeToDocumentMilliseconds(requestingDocument, finishTime))
</del><ins>+PerformanceResourceTiming::PerformanceResourceTiming(const AtomicString&amp; initiatorType, const URL&amp; originalURL, const ResourceResponse&amp; response, LoadTiming loadTiming, Document* requestingDocument)
+    : PerformanceEntry(originalURL.string(), &quot;resource&quot;, monotonicTimeToDocumentMilliseconds(requestingDocument, loadTiming.startTime()), monotonicTimeToDocumentMilliseconds(requestingDocument, loadTiming.responseEnd()))
</ins><span class="cx">     , m_initiatorType(initiatorType)
</span><span class="cx">     , m_timing(response.networkLoadTiming())
</span><del>-    , m_finishTime(finishTime)
</del><ins>+    , m_loadTiming(loadTiming)
</ins><span class="cx">     , m_shouldReportDetails(passesTimingAllowCheck(response, requestingDocument))
</span><span class="cx">     , m_requestingDocument(requestingDocument)
</span><span class="cx"> {
</span><span class="lines">@@ -97,10 +97,10 @@
</span><span class="cx"> 
</span><span class="cx"> double PerformanceResourceTiming::redirectStart() const
</span><span class="cx"> {
</span><del>-    // FIXME: Need to track and report redirects for resources.
</del><span class="cx">     if (!m_shouldReportDetails)
</span><span class="cx">         return 0.0;
</span><del>-    return 0;
</del><ins>+
+    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_loadTiming.redirectStart());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> double PerformanceResourceTiming::redirectEnd() const
</span><span class="lines">@@ -107,13 +107,13 @@
</span><span class="cx"> {
</span><span class="cx">     if (!m_shouldReportDetails)
</span><span class="cx">         return 0.0;
</span><del>-    return 0;
</del><ins>+
+    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_loadTiming.redirectEnd());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> double PerformanceResourceTiming::fetchStart() const
</span><span class="cx"> {
</span><del>-    // FIXME: This should be different depending on redirects.
-    return (startTime());
</del><ins>+    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_loadTiming.fetchStart());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> double PerformanceResourceTiming::domainLookupStart() const
</span><span class="lines">@@ -121,7 +121,7 @@
</span><span class="cx">     if (!m_shouldReportDetails)
</span><span class="cx">         return 0.0;
</span><span class="cx"> 
</span><del>-    if (m_timing.domainLookupStart &lt; 0)
</del><ins>+    if (m_timing.domainLookupStart &lt;= 0)
</ins><span class="cx">         return fetchStart();
</span><span class="cx"> 
</span><span class="cx">     return resourceTimeToDocumentMilliseconds(m_timing.domainLookupStart);
</span><span class="lines">@@ -132,7 +132,7 @@
</span><span class="cx">     if (!m_shouldReportDetails)
</span><span class="cx">         return 0.0;
</span><span class="cx"> 
</span><del>-    if (m_timing.domainLookupEnd &lt; 0)
</del><ins>+    if (m_timing.domainLookupEnd &lt;= 0)
</ins><span class="cx">         return domainLookupStart();
</span><span class="cx"> 
</span><span class="cx">     return resourceTimeToDocumentMilliseconds(m_timing.domainLookupEnd);
</span><span class="lines">@@ -144,7 +144,7 @@
</span><span class="cx">         return 0.0;
</span><span class="cx"> 
</span><span class="cx">     // connectStart will be -1 when a network request is not made.
</span><del>-    if (m_timing.connectStart &lt; 0)
</del><ins>+    if (m_timing.connectStart &lt;= 0)
</ins><span class="cx">         return domainLookupEnd();
</span><span class="cx"> 
</span><span class="cx">     // connectStart includes any DNS time, so we may need to trim that off.
</span><span class="lines">@@ -161,7 +161,7 @@
</span><span class="cx">         return 0.0;
</span><span class="cx"> 
</span><span class="cx">     // connectStart will be -1 when a network request is not made.
</span><del>-    if (m_timing.connectEnd &lt; 0)
</del><ins>+    if (m_timing.connectEnd &lt;= 0)
</ins><span class="cx">         return connectStart();
</span><span class="cx"> 
</span><span class="cx">     return resourceTimeToDocumentMilliseconds(m_timing.connectEnd);
</span><span class="lines">@@ -186,9 +186,20 @@
</span><span class="cx">     return resourceTimeToDocumentMilliseconds(m_timing.requestStart);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+double PerformanceResourceTiming::responseStart() const
+{
+    if (!m_shouldReportDetails)
+        return 0.0;
+
+    return resourceTimeToDocumentMilliseconds(m_timing.responseStart);
+}
+
</ins><span class="cx"> double PerformanceResourceTiming::responseEnd() const
</span><span class="cx"> {
</span><del>-    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_finishTime);
</del><ins>+    if (!m_shouldReportDetails)
+        return 0.0;
+
+    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_loadTiming.responseEnd());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> double PerformanceResourceTiming::resourceTimeToDocumentMilliseconds(double deltaMilliseconds) const
</span><span class="lines">@@ -195,7 +206,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (!deltaMilliseconds)
</span><span class="cx">         return 0.0;
</span><del>-    double documentStartTime = m_requestingDocument-&gt;loader()-&gt;timing().monotonicTimeToZeroBasedDocumentTime(m_requestingDocument-&gt;loader()-&gt;timing().startTime()) * 1000.0;
</del><ins>+    double documentStartTime = m_requestingDocument-&gt;loader()-&gt;timing().monotonicTimeToZeroBasedDocumentTime(m_loadTiming.fetchStart()) * 1000.0;
</ins><span class="cx">     double resourceTimeSeconds = (documentStartTime + deltaMilliseconds) / 1000.0;
</span><span class="cx">     return 1000.0 * Performance::reduceTimeResolution(resourceTimeSeconds);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorepagePerformanceResourceTimingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PerformanceResourceTiming.h (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PerformanceResourceTiming.h        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/Source/WebCore/page/PerformanceResourceTiming.h        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WEB_TIMING)
</span><span class="cx"> 
</span><ins>+#include &quot;LoadTiming.h&quot;
</ins><span class="cx"> #include &quot;NetworkLoadTiming.h&quot;
</span><span class="cx"> #include &quot;PerformanceEntry.h&quot;
</span><span class="cx"> #include &lt;wtf/RefPtr.h&gt;
</span><span class="lines">@@ -49,9 +50,9 @@
</span><span class="cx"> 
</span><span class="cx"> class PerformanceResourceTiming final : public PerformanceEntry {
</span><span class="cx"> public:
</span><del>-    static Ref&lt;PerformanceResourceTiming&gt; create(const AtomicString&amp; initiatorType, const ResourceRequest&amp; request, const ResourceResponse&amp; response, double initiationTime, double finishTime, Document* requestingDocument)
</del><ins>+    static Ref&lt;PerformanceResourceTiming&gt; create(const AtomicString&amp; initiatorType, const URL&amp; originalURL, const ResourceResponse&amp; response, LoadTiming loadTiming, Document* requestingDocument)
</ins><span class="cx">     {
</span><del>-        return adoptRef(*new PerformanceResourceTiming(initiatorType, request, response, initiationTime, finishTime, requestingDocument));
</del><ins>+        return adoptRef(*new PerformanceResourceTiming(initiatorType, originalURL, response, loadTiming, requestingDocument));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     AtomicString initiatorType() const;
</span><span class="lines">@@ -65,12 +66,13 @@
</span><span class="cx">     double connectEnd() const;
</span><span class="cx">     double secureConnectionStart() const;
</span><span class="cx">     double requestStart() const;
</span><ins>+    double responseStart() const;
</ins><span class="cx">     double responseEnd() const;
</span><span class="cx"> 
</span><span class="cx">     bool isResource() const override { return true; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    PerformanceResourceTiming(const AtomicString&amp; initatorType, const ResourceRequest&amp;, const ResourceResponse&amp;, double initiationTime, double finishTime, Document*);
</del><ins>+    PerformanceResourceTiming(const AtomicString&amp; initatorType, const URL&amp; originalURL, const ResourceResponse&amp;, LoadTiming, Document*);
</ins><span class="cx">     ~PerformanceResourceTiming();
</span><span class="cx"> 
</span><span class="cx">     double resourceTimeToDocumentMilliseconds(double deltaMilliseconds) const;
</span><span class="lines">@@ -77,7 +79,7 @@
</span><span class="cx"> 
</span><span class="cx">     AtomicString m_initiatorType;
</span><span class="cx">     NetworkLoadTiming m_timing;
</span><del>-    double m_finishTime;
</del><ins>+    LoadTiming m_loadTiming;
</ins><span class="cx">     bool m_shouldReportDetails;
</span><span class="cx">     RefPtr&lt;Document&gt; m_requestingDocument;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorepagePerformanceResourceTimingidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PerformanceResourceTiming.idl (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PerformanceResourceTiming.idl        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/Source/WebCore/page/PerformanceResourceTiming.idl        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -44,5 +44,6 @@
</span><span class="cx">     readonly attribute unrestricted double connectEnd;
</span><span class="cx">     readonly attribute unrestricted double secureConnectionStart;
</span><span class="cx">     readonly attribute unrestricted double requestStart;
</span><ins>+    readonly attribute unrestricted double responseStart;
</ins><span class="cx">     readonly attribute unrestricted double responseEnd;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkNetworkLoadTimingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/NetworkLoadTiming.h (204975 => 204976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/NetworkLoadTiming.h        2016-08-25 18:21:16 UTC (rev 204975)
+++ trunk/Source/WebCore/platform/network/NetworkLoadTiming.h        2016-08-25 18:22:25 UTC (rev 204976)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx">         , secureConnectionStart(-1)
</span><span class="cx">     {
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     NetworkLoadTiming(const NetworkLoadTiming&amp; other)
</span><span class="cx">         : domainLookupStart(other.domainLookupStart)
</span><span class="cx">         , domainLookupEnd(other.domainLookupEnd)
</span><span class="lines">@@ -55,7 +55,18 @@
</span><span class="cx">         , secureConnectionStart(other.secureConnectionStart)
</span><span class="cx">     {
</span><span class="cx">     }
</span><del>-    
</del><ins>+
+    void reset()
+    {
+        domainLookupStart = -1;
+        domainLookupEnd = -1;
+        connectStart = -1;
+        connectEnd = -1;
+        requestStart = 0;
+        responseStart = 0;
+        secureConnectionStart = -1;
+    }
+
</ins><span class="cx">     NetworkLoadTiming&amp; operator=(const NetworkLoadTiming&amp; other)
</span><span class="cx">     {
</span><span class="cx">         domainLookupStart = other.domainLookupStart;
</span></span></pre>
</div>
</div>

</body>
</html>