Changeset 281147 in webkit
- Timestamp:
- Aug 17, 2021, 10:30:54 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_values-expected.txt (modified) (1 diff)
-
LayoutTests/platform/mac-wk1/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/Document.cpp (modified) (5 diffs)
-
Source/WebCore/dom/Document.h (modified) (1 diff)
-
Source/WebCore/loader/DocumentLoadTiming.h (modified) (1 diff)
-
Source/WebCore/page/DOMWindow.cpp (modified) (2 diffs)
-
Source/WebCore/page/Performance.h (modified) (1 diff)
-
Source/WebCore/page/PerformanceNavigationTiming.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r281146 r281147 1 2021-08-17 Alex Christensen <achristensen@webkit.org> 2 3 Document load events should update timing in PerformanceNavigationTiming even after its instantiation 4 https://bugs.webkit.org/show_bug.cgi?id=229181 5 6 Reviewed by Chris Dumez. 7 8 * TestExpectations: 9 * platform/mac-wk1/TestExpectations: 10 This test now always passes in WK2. 11 1 12 2021-08-17 Eric Hutchison <ehutchison@apple.com> 2 13 -
trunk/LayoutTests/TestExpectations
r281125 r281147 1133 1133 imported/w3c/web-platform-tests/resource-timing/crossorigin-sandwich-partial-TAO.sub.html [ Pass Failure ] 1134 1134 imported/w3c/web-platform-tests/navigation-timing/secure_connection_start_non_zero.https.html [ Pass Failure ] 1135 imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_values.html [ Pass Failure ]1136 1135 imported/w3c/web-platform-tests/resource-timing/TAO-match.html [ Pass Failure ] 1137 1136 imported/w3c/web-platform-tests/resource-timing/iframe-failed-commit.html [ Pass Failure ] -
trunk/LayoutTests/imported/w3c/ChangeLog
r281140 r281147 1 2021-08-17 Alex Christensen <achristensen@webkit.org> 2 3 Document load events should update timing in PerformanceNavigationTiming even after its instantiation 4 https://bugs.webkit.org/show_bug.cgi?id=229181 5 6 Reviewed by Chris Dumez. 7 8 * web-platform-tests/navigation-timing/nav2_test_attributes_values-expected.txt: 9 1 10 2021-08-17 Alex Christensen <achristensen@webkit.org> 2 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_values-expected.txt
r278477 r281147 4 4 5 5 6 FAIL Performance navigation timing instance's value is reasonable. assert_greater_than: Expected domInteractive to be greater than 0 expected a number greater than 0 but got 0 6 PASS Performance navigation timing instance's value is reasonable. 7 7 -
trunk/LayoutTests/platform/mac-wk1/TestExpectations
r281108 r281147 582 582 # NSURLConnection doesn't have an API to give us good timing for redirects. We do what we can with MonotonicTime::now() but this still fails sometimes. 583 583 imported/w3c/web-platform-tests/navigation-timing/nav2_test_redirect_server.html [ Pass Failure ] 584 imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_values.html [ Pass Failure ] 584 585 585 586 webkit.org/b/160101 userscripts/window-onerror-for-isolated-world-3.html [ Pass Failure ] -
trunk/Source/WebCore/ChangeLog
r281136 r281147 1 2021-08-17 Alex Christensen <achristensen@webkit.org> 2 3 Document load events should update timing in PerformanceNavigationTiming even after its instantiation 4 https://bugs.webkit.org/show_bug.cgi?id=229181 5 6 Reviewed by Chris Dumez. 7 8 When we make a PerformanceNavigationTiming object, we copy the DocumentLoadTiming and DocumentEventTiming values. 9 If PerformanceNavigationTiming is accessed before the document has finished loading, we still need to update the timing values. 10 11 Covered by a newly passing WPT test, which Chrome and Firefox already pass. 12 13 * dom/Document.cpp: 14 (WebCore::Document::documentEventTimingFromNavigationTiming): 15 (WebCore::Document::setReadyState): 16 (WebCore::Document::finishedParsing): 17 * dom/Document.h: 18 * loader/DocumentLoadTiming.h: 19 (WebCore::DocumentLoadTiming::setLoadEventStart): 20 (WebCore::DocumentLoadTiming::setLoadEventEnd): 21 (WebCore::DocumentLoadTiming::markLoadEventStart): Deleted. 22 (WebCore::DocumentLoadTiming::markLoadEventEnd): Deleted. 23 * page/DOMWindow.cpp: 24 (WebCore::DOMWindow::dispatchLoadEvent): 25 * page/Performance.h: 26 * page/PerformanceNavigationTiming.h: 27 1 28 2021-08-17 Antti Koivisto <antti@apple.com> 2 29 -
trunk/Source/WebCore/dom/Document.cpp
r280953 r281147 162 162 #include "PaintWorkletGlobalScope.h" 163 163 #include "Performance.h" 164 #include "PerformanceNavigationTiming.h" 164 165 #include "PlatformLocale.h" 165 166 #include "PlatformMediaSessionManager.h" … … 1375 1376 } 1376 1377 1378 DocumentEventTiming* Document::documentEventTimingFromNavigationTiming() 1379 { 1380 auto* window = domWindow(); 1381 if (!window) 1382 return nullptr; 1383 auto* navigationTiming = window->performance().navigationTiming(); 1384 if (!navigationTiming) 1385 return nullptr; 1386 return &navigationTiming->documentEventTiming(); 1387 } 1388 1377 1389 void Document::setReadyState(ReadyState readyState) 1378 1390 { … … 1382 1394 switch (readyState) { 1383 1395 case Loading: 1384 if (!m_eventTiming.domLoading) 1385 m_eventTiming.domLoading = MonotonicTime::now(); 1396 if (!m_eventTiming.domLoading) { 1397 auto now = MonotonicTime::now(); 1398 m_eventTiming.domLoading = now; 1399 if (auto* eventTiming = documentEventTimingFromNavigationTiming()) 1400 eventTiming->domLoading = now; 1401 } 1386 1402 break; 1387 1403 case Complete: 1388 if (!m_eventTiming.domComplete) 1389 m_eventTiming.domComplete = MonotonicTime::now(); 1404 if (!m_eventTiming.domComplete) { 1405 auto now = MonotonicTime::now(); 1406 m_eventTiming.domComplete = now; 1407 if (auto* eventTiming = documentEventTimingFromNavigationTiming()) 1408 eventTiming->domComplete = now; 1409 } 1390 1410 FALLTHROUGH; 1391 1411 case Interactive: 1392 if (!m_eventTiming.domInteractive) 1393 m_eventTiming.domInteractive = MonotonicTime::now(); 1412 if (!m_eventTiming.domInteractive) { 1413 auto now = MonotonicTime::now(); 1414 m_eventTiming.domInteractive = now; 1415 if (auto* eventTiming = documentEventTimingFromNavigationTiming()) 1416 eventTiming->domInteractive = now; 1417 } 1394 1418 break; 1395 1419 } … … 6071 6095 scriptRunner().documentFinishedParsing(); 6072 6096 6073 if (!m_eventTiming.domContentLoadedEventStart) 6074 m_eventTiming.domContentLoadedEventStart = MonotonicTime::now(); 6097 if (!m_eventTiming.domContentLoadedEventStart) { 6098 auto now = MonotonicTime::now(); 6099 m_eventTiming.domContentLoadedEventStart = now; 6100 if (auto* eventTiming = documentEventTimingFromNavigationTiming()) 6101 eventTiming->domContentLoadedEventStart = now; 6102 } 6075 6103 6076 6104 // FIXME: Schedule a task to fire DOMContentLoaded event instead. See webkit.org/b/82931 … … 6078 6106 dispatchEvent(Event::create(eventNames().DOMContentLoadedEvent, Event::CanBubble::Yes, Event::IsCancelable::No)); 6079 6107 6080 if (!m_eventTiming.domContentLoadedEventEnd) 6081 m_eventTiming.domContentLoadedEventEnd = MonotonicTime::now(); 6108 if (!m_eventTiming.domContentLoadedEventEnd) { 6109 auto now = MonotonicTime::now(); 6110 m_eventTiming.domContentLoadedEventEnd = now; 6111 if (auto* eventTiming = documentEventTimingFromNavigationTiming()) 6112 eventTiming->domContentLoadedEventEnd = now; 6113 } 6082 6114 6083 6115 if (RefPtr<Frame> frame = this->frame()) { -
trunk/Source/WebCore/dom/Document.h
r280881 r281147 1660 1660 void detachParser(); 1661 1661 1662 DocumentEventTiming* documentEventTimingFromNavigationTiming(); 1663 1662 1664 // ScriptExecutionContext 1663 1665 CSSFontSelector* cssFontSelector() final { return m_fontSelector.ptr(); } -
trunk/Source/WebCore/loader/DocumentLoadTiming.h
r278391 r281147 38 38 void markUnloadEventStart() { m_unloadEventStart = MonotonicTime::now(); } 39 39 void markUnloadEventEnd() { m_unloadEventEnd = MonotonicTime::now(); } 40 void markLoadEventStart() { m_loadEventStart = MonotonicTime::now(); }41 void markLoadEventEnd() { m_loadEventEnd = MonotonicTime::now(); }40 void setLoadEventStart(MonotonicTime time) { m_loadEventStart = time; } 41 void setLoadEventEnd(MonotonicTime time) { m_loadEventEnd = time; } 42 42 43 43 void setHasSameOriginAsPreviousDocument(bool value) { m_hasSameOriginAsPreviousDocument = value; } -
trunk/Source/WebCore/page/DOMWindow.cpp
r280861 r281147 87 87 #include "PageTransitionEvent.h" 88 88 #include "Performance.h" 89 #include "PerformanceNavigationTiming.h" 89 90 #include "RequestAnimationFrameCallback.h" 90 91 #include "ResourceLoadInfo.h" … … 2260 2261 bool shouldMarkLoadEventTimes = protectedLoader && !protectedLoader->timing().loadEventStart(); 2261 2262 2262 if (shouldMarkLoadEventTimes) 2263 protectedLoader->timing().markLoadEventStart(); 2263 if (shouldMarkLoadEventTimes) { 2264 auto now = MonotonicTime::now(); 2265 protectedLoader->timing().setLoadEventStart(now); 2266 if (auto* navigationTiming = performance().navigationTiming()) 2267 navigationTiming->documentLoadTiming().setLoadEventStart(now); 2268 } 2264 2269 2265 2270 dispatchEvent(Event::create(eventNames().loadEvent, Event::CanBubble::No, Event::IsCancelable::No), document()); 2266 2271 2267 if (shouldMarkLoadEventTimes) 2268 protectedLoader->timing().markLoadEventEnd(); 2272 if (shouldMarkLoadEventTimes) { 2273 auto now = MonotonicTime::now(); 2274 protectedLoader->timing().setLoadEventEnd(now); 2275 if (auto* navigationTiming = performance().navigationTiming()) 2276 navigationTiming->documentLoadTiming().setLoadEventEnd(now); 2277 } 2269 2278 2270 2279 // Send a separate load event to the element that owns this frame. -
trunk/Source/WebCore/page/Performance.h
r280988 r281147 117 117 void scheduleNavigationObservationTaskIfNeeded(); 118 118 119 PerformanceNavigationTiming* navigationTiming() { return m_navigationTiming.get(); } 120 119 121 private: 120 122 Performance(ScriptExecutionContext*, MonotonicTime timeOrigin); -
trunk/Source/WebCore/page/PerformanceNavigationTiming.h
r278391 r281147 69 69 double duration() const final; 70 70 71 DocumentEventTiming& documentEventTiming() { return m_documentEventTiming; } 72 DocumentLoadTiming& documentLoadTiming() { return m_documentLoadTiming; } 73 71 74 private: 72 75 PerformanceNavigationTiming(MonotonicTime timeOrigin, CachedResource&, const DocumentLoadTiming&, const NetworkLoadMetrics&, const DocumentEventTiming&, const SecurityOrigin&, WebCore::NavigationType);
Note:
See TracChangeset
for help on using the changeset viewer.