Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
2010-07-17 Tony Gentilcore <tonyg@chromium.org>
Reviewed by Darin Fisher. [Web Timing] Move times to DocumentLoader and fix bugs in mark points https://bugs.webkit.org/show_bug.cgi?id=42512 * fast/dom/script-tests/webtiming-navigate-within-document.js: Added. Previously, navigating within a document via a fragment would reset navigationStart. This test verifies that no times are changed after navigating within a document. (checkTimingNotChanged): (): (loadHandler): * fast/dom/webtiming-expected.txt: Test now passes because when correcting for clock skew, requestTime is set to fetchStart when it is less than fetchStart. Previously it was 0, now it is fetchStart. This, unfortunately, hides the fact that test_shell isn't populating the ResourceLoadTiming API. I'll think of a way to test that when I make the change to cause test_shell to fill the ResourceLoadTiming. * fast/dom/webtiming-navigate-within-document-expected.txt: Added. * fast/dom/webtiming-navigate-within-document.html: Added. * platform/gtk/Skipped: Skip new test on platform where Web Timing is not enabled. * platform/mac/Skipped: Skip new test on platform where Web Timing is not enabled. * platform/qt/Skipped: Skip new test on platform where Web Timing is not enabled. * platform/win/Skipped: Skip new test on platform where Web Timing is not enabled. 2010-07-17 Tony Gentilcore <tonyg@chromium.org> Reviewed by Darin Fisher. [Web Timing] Move times to DocumentLoader and fix bugs in mark points https://bugs.webkit.org/show_bug.cgi?id=42512 Test: fast/dom/webtiming-navigate-within-document.html * loader/DocumentLoader.h: Move the FrameLoadTimeline (now call DocumentLoadTiming) to the DocumentLoader. (WebCore::DocumentLoader::documentLoadTiming): * loader/FrameLoader.cpp: (WebCore::FrameLoader::stopLoading): Set unloadEventEnd on the provisional DocumentLoader. Add some ASSERTs to tighten things up. (WebCore::FrameLoader::loadWithDocumentLoader): This was not the right place to set navigationStart. Setting it here caused it to be set before the unload form prompt and caused it to be reset when navigating within the document. (WebCore::FrameLoader::finishedLoading): Set responseEnd on the active DocumentLoader. (WebCore::FrameLoader::continueLoadAfterWillSubmitForm): This is the right place for navigationStart as defined by the spec. * loader/FrameLoader.h: Get rid of FrameLoadTimeline. * loader/FrameLoaderTypes.h: Rename FrameLoadTimeline to DocumentLoadTiming. It is even more apparent this doesn't belong in this file now. I am planning to submit a patch moving it out ASAP, but didn't want to muddy this patch with all those build files. (WebCore::DocumentLoadTiming::DocumentLoadTiming): * loader/MainResourceLoader.cpp: (WebCore::MainResourceLoader::willSendRequest): Move fetchStart out of this method to load(), and rewrite setting of redirectStart, redirectEnd, and redirectCount to be more readable. (WebCore::MainResourceLoader::load): Set fetchStart slightly earlier here and tighten it up with some ASSERTs. * page/DOMWindow.cpp: (WebCore::DOMWindow::dispatchLoadEvent): Set loadEventStart and loadEventEnd on the DocumentLoader. * page/Navigation.cpp: (WebCore::Navigation::redirectCount): Retrieve redirectCount from the DocumentLoader. * page/Timing.cpp: (WebCore::getPossiblySkewedTimeInKnownRange): The skew problem turned out to be due to the fact that chromium's currentTime() implementation only syncs to the system time every 60 seconds. So absolute times across threads may be skewed slightly. I resolved this temporarily by clipping the time from another thread into a known bound. A better long term solution is probably to add a currentTimeFromSystemTime() method and call that for web timing marks. (WebCore::Timing::navigationStart): (WebCore::Timing::unloadEventEnd): (WebCore::Timing::redirectStart): (WebCore::Timing::redirectEnd): (WebCore::Timing::fetchStart): (WebCore::Timing::domainLookupStart): (WebCore::Timing::domainLookupEnd): (WebCore::Timing::connectStart): (WebCore::Timing::connectEnd): (WebCore::Timing::requestStart): (WebCore::Timing::requestEnd): (WebCore::Timing::responseStart): (WebCore::Timing::responseEnd): (WebCore::Timing::loadEventStart): (WebCore::Timing::loadEventEnd): (WebCore::Timing::documentLoader): (WebCore::Timing::documentLoadTiming): (WebCore::Timing::resourceLoadTiming): (WebCore::Timing::resourceLoadTimeRelativeToAbsolute): Ensure requestTime is in the range of fetchStart to responseEnd. * page/Timing.h: Canonical link: https://commits.webkit.org/54529@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63689 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
287 additions
and 57 deletions.
- +19 −0 LayoutTests/ChangeLog
- +36 −0 LayoutTests/fast/dom/script-tests/webtiming-navigate-within-document.js
- +3 −3 LayoutTests/fast/dom/webtiming-expected.txt
- +24 −0 LayoutTests/fast/dom/webtiming-navigate-within-document-expected.txt
- +13 −0 LayoutTests/fast/dom/webtiming-navigate-within-document.html
- +1 −0 LayoutTests/platform/gtk/Skipped
- +1 −0 LayoutTests/platform/mac/Skipped
- +1 −0 LayoutTests/platform/qt/Skipped
- +1 −0 LayoutTests/platform/win/Skipped
- +49 −0 WebCore/ChangeLog
- +4 −0 WebCore/loader/DocumentLoader.h
- +12 −7 WebCore/loader/FrameLoader.cpp
- +0 −2 WebCore/loader/FrameLoader.h
- +3 −3 WebCore/loader/FrameLoaderTypes.h
- +11 −7 WebCore/loader/MainResourceLoader.cpp
- +5 −4 WebCore/page/DOMWindow.cpp
- +5 −1 WebCore/page/Navigation.cpp
- +94 −30 WebCore/page/Timing.cpp
- +5 −0 WebCore/page/Timing.h
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,36 @@ | ||
description("This test checks that navigating within the document does not reset Web Timing numbers."); | ||
|
||
var performance = window.webkitPerformance || {}; | ||
var timing = performance.timing || {}; | ||
|
||
function checkTimingNotChanged() | ||
{ | ||
for (var property in timing) { | ||
if (timing[property] === initialTiming[property]) | ||
testPassed(property + " is unchanged."); | ||
else | ||
testFailed(property + " changed."); | ||
} | ||
finishJSTest(); | ||
} | ||
|
||
var initialTiming = {}; | ||
function saveTimingAfterLoad() | ||
{ | ||
for (var property in timing) { | ||
initialTiming[property] = timing[property]; | ||
} | ||
window.location.href = "#1"; | ||
setTimeout("checkTimingNotChanged()", 0); | ||
} | ||
|
||
function loadHandler() | ||
{ | ||
window.removeEventListener("load", loadHandler); | ||
setTimeout("saveTimingAfterLoad()", 0); | ||
} | ||
window.addEventListener("load", loadHandler, false); | ||
|
||
jsTestIsAsync = true; | ||
|
||
var successfullyParsed = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,24 @@ | ||
This test checks that navigating within the document does not reset Web Timing numbers. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS requestEnd is unchanged. | ||
PASS responseStart is unchanged. | ||
PASS connectStart is unchanged. | ||
PASS domainLookupStart is unchanged. | ||
PASS connectEnd is unchanged. | ||
PASS responseEnd is unchanged. | ||
PASS requestStart is unchanged. | ||
PASS navigationStart is unchanged. | ||
PASS loadEventEnd is unchanged. | ||
PASS redirectStart is unchanged. | ||
PASS domainLookupEnd is unchanged. | ||
PASS unloadEventEnd is unchanged. | ||
PASS fetchStart is unchanged. | ||
PASS loadEventStart is unchanged. | ||
PASS redirectEnd is unchanged. | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="../js/resources/js-test-style.css"> | ||
<script src="../js/resources/js-test-pre.js"></script> | ||
</head> | ||
<body> | ||
<p id="description"></p> | ||
<div id="console"></div> | ||
<script src="script-tests/webtiming-navigate-within-document.js"></script> | ||
<script src="../js/resources/js-test-post.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.