⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 280931 in webkit


Ignore:
Timestamp:
Aug 11, 2021, 3:05:02 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

REGRESSION (r278392) performance.measure should never throw an InvalidAccessError for fetchStart
https://bugs.webkit.org/show_bug.cgi?id=229008
<rdar://79960877>

Patch by Alex Christensen <achristensen@webkit.org> on 2021-08-11
Reviewed by Chris Dumez.

Source/WebCore:

Test: http/tests/performance/performance-measure-fetch-start.html

PerformanceTiming::fetchStart is returning 0 when we get a main resource from the cache sometimes.
This is causing PerformanceUserTiming::convertMarkToTimestamp to throw an error, which it should.
Like PerformanceResourceTiming::fetchStart we need to fall back to ResourceLoadTiming::startTime
if the NetworkLoadMetrics doesn't have any useful data for us.

  • page/PerformanceTiming.cpp:

(WebCore::PerformanceTiming::fetchStart const):

LayoutTests:

  • http/tests/performance/performance-measure-fetch-start-expected.txt: Added.
  • http/tests/performance/performance-measure-fetch-start.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r280928 r280931  
     12021-08-11  Alex Christensen  <achristensen@webkit.org>
     2
     3        REGRESSION (r278392) performance.measure should never throw an InvalidAccessError for fetchStart
     4        https://bugs.webkit.org/show_bug.cgi?id=229008
     5        <rdar://79960877>
     6
     7        Reviewed by Chris Dumez.
     8
     9        * http/tests/performance/performance-measure-fetch-start-expected.txt: Added.
     10        * http/tests/performance/performance-measure-fetch-start.html: Added.
     11
    1122021-08-11  Dana Estra  <destra@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r280930 r280931  
     12021-08-11  Alex Christensen  <achristensen@webkit.org>
     2
     3        REGRESSION (r278392) performance.measure should never throw an InvalidAccessError for fetchStart
     4        https://bugs.webkit.org/show_bug.cgi?id=229008
     5        <rdar://79960877>
     6
     7        Reviewed by Chris Dumez.
     8
     9        Test: http/tests/performance/performance-measure-fetch-start.html
     10
     11        PerformanceTiming::fetchStart is returning 0 when we get a main resource from the cache sometimes.
     12        This is causing PerformanceUserTiming::convertMarkToTimestamp to throw an error, which it should.
     13        Like PerformanceResourceTiming::fetchStart we need to fall back to ResourceLoadTiming::startTime
     14        if the NetworkLoadMetrics doesn't have any useful data for us.
     15
     16        * page/PerformanceTiming.cpp:
     17        (WebCore::PerformanceTiming::fetchStart const):
     18
    1192021-08-11  John Wilander  <wilander@apple.com>
    220
  • trunk/Source/WebCore/page/PerformanceTiming.cpp

    r280454 r280931  
    138138
    139139    auto* metrics = networkLoadMetrics();
    140     if (!metrics)
    141         return 0;
    142 
    143     m_fetchStart = monotonicTimeToIntegerMilliseconds(metrics->fetchStart);
     140    if (metrics)
     141        m_fetchStart = monotonicTimeToIntegerMilliseconds(metrics->fetchStart);
     142
     143    if (!m_fetchStart) {
     144        if (auto* timing = documentLoadTiming())
     145            m_fetchStart = monotonicTimeToIntegerMilliseconds(timing->startTime());
     146    }
     147
     148    // Like PerformanceResourceTiming::fetchStart, fetchStart is a required property
     149    ASSERT(m_fetchStart);
    144150    return m_fetchStart;
    145151}
Note: See TracChangeset for help on using the changeset viewer.