Changeset 242209 in webkit


Ignore:
Timestamp:
Feb 28, 2019 11:09:32 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Fix Resource Timing buffer edge cases for WPT
https://bugs.webkit.org/show_bug.cgi?id=193213

Patch by Charles Vazac <cvazac@akamai.com> on 2019-02-28
Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

  • web-platform-tests/resource-timing/buffer-full-add-after-full-event.html:
  • web-platform-tests/resource-timing/buffer-full-add-entries-during-callback-that-drop-expected.txt:
  • web-platform-tests/resource-timing/buffer-full-add-then-clear-expected.txt:
  • web-platform-tests/resource-timing/buffer-full-then-increased-expected.txt:

Source/WebCore:

Test coverage by LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer*.html

  • page/Performance.cpp:

(WebCore::Performance::resourceTimingBufferFullTimerFired): Only dispatch the
resourcetimingbufferfull event if the buffer is still full (as it may have been cleared or
expanded). Also, avoid infinite loops if we aren't able to decrease the number of entries in
the secondary buffer.

Location:
trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/http/tests/performance/performance-resource-timing-resourcetimingbufferfull-shrinking-buffer-crash-expected.txt

    r227926 r242209  
    2020PASS resourcesAfterShrinkingBuffer[0] is originalResources[0]
    2121PASS resourcesAfterShrinkingBuffer[1] is originalResources[1]
    22 
    23 Inside resourcetimingbufferfull 2
    2422PASS performance.clearResourceTimings(); performance.getEntriesByType("resource").length is 0
    2523
    2624After resourcetimingbufferfull
    27 PASS resourcetimingbufferfullEventCount is 2
     25PASS resourcetimingbufferfullEventCount is 1
    2826PASS resourcesAfterClearing = performance.getEntriesByType("resource"); resourcesAfterClearing.length is 1
    2927PASS resourcesAfterClearing[0].initiatorType is "fetch"
  • trunk/LayoutTests/http/tests/performance/performance-resource-timing-resourcetimingbufferfull-shrinking-buffer-crash.html

    r227926 r242209  
    4343        shouldBe('resourcesAfterShrinkingBuffer[0]', 'originalResources[0]');
    4444        shouldBe('resourcesAfterShrinkingBuffer[1]', 'originalResources[1]');
    45     } else if (resourcetimingbufferfullEventCount == 2) {
    4645        shouldBe('performance.clearResourceTimings(); performance.getEntriesByType("resource").length', '0');
    4746        setTimeout(() => {
    4847            debug('');
    4948            debug('After resourcetimingbufferfull');
    50             shouldBe('resourcetimingbufferfullEventCount', '2');
     49            shouldBe('resourcetimingbufferfullEventCount', '1');
    5150            shouldBe('resourcesAfterClearing = performance.getEntriesByType("resource"); resourcesAfterClearing.length', '1');
    5251            shouldBeEqualToString('resourcesAfterClearing[0].initiatorType', 'fetch');
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r242112 r242209  
     12019-02-28  Charles Vazac  <cvazac@akamai.com>
     2
     3        Fix Resource Timing buffer edge cases for WPT
     4        https://bugs.webkit.org/show_bug.cgi?id=193213
     5
     6        Reviewed by Youenn Fablet.
     7
     8        * web-platform-tests/resource-timing/buffer-full-add-after-full-event.html:
     9        * web-platform-tests/resource-timing/buffer-full-add-entries-during-callback-that-drop-expected.txt:
     10        * web-platform-tests/resource-timing/buffer-full-add-then-clear-expected.txt:
     11        * web-platform-tests/resource-timing/buffer-full-then-increased-expected.txt:
     12
    1132019-02-26  Youenn Fablet  <youenn@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-then-clear-expected.txt

    r239959 r242209  
    1 CONSOLE MESSAGE: line 2659: Error: assert_unreached: resourcetimingbufferfull should not fire Reached unreachable code
    21
    3 Harness Error (FAIL), message = Error: assert_unreached: resourcetimingbufferfull should not fire Reached unreachable code
     2PASS Test that if the buffer is cleared after entries were added to the secondary buffer, those entries make it into the primary one
    43
    5 FAIL Test that if the buffer is cleared after entries were added to the secondary buffer, those entries make it into the primary one assert_equals: the last 3 resources should be in the buffer, since the first one was cleared expected 3 but got 0
    6 
  • trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-then-increased-expected.txt

    r239959 r242209  
    1 CONSOLE MESSAGE: line 2659: Error: assert_unreached: resourcetimingbufferfull should not fire Reached unreachable code
    21
    3 Harness Error (FAIL), message = Error: assert_unreached: resourcetimingbufferfull should not fire Reached unreachable code
     2PASS Test that overflowing the buffer and immediately increasing its limit does not trigger the resourcetimingbufferfull event
    43
    5 FAIL Test that overflowing the buffer and immediately increasing its limit does not trigger the resourcetimingbufferfull event assert_equals: All resources should be in the buffer, since its size was increased expected 3 but got 1
    6 
  • trunk/Source/WebCore/ChangeLog

    r242207 r242209  
     12019-02-28  Charles Vazac  <cvazac@akamai.com>
     2
     3        Fix Resource Timing buffer edge cases for WPT
     4        https://bugs.webkit.org/show_bug.cgi?id=193213
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Test coverage by LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer*.html
     9
     10        * page/Performance.cpp:
     11        (WebCore::Performance::resourceTimingBufferFullTimerFired): Only dispatch the
     12        resourcetimingbufferfull event if the buffer is still full (as it may have been cleared or
     13        expanded). Also, avoid infinite loops if we aren't able to decrease the number of entries in
     14        the secondary buffer.
     15
    1162019-02-28  Takashi Komori  <Takashi.Komori@sony.com>
    217
  • trunk/Source/WebCore/page/Performance.cpp

    r241598 r242209  
    215215
    216216    while (!m_backupResourceTimingBuffer.isEmpty()) {
     217        auto beforeCount = m_backupResourceTimingBuffer.size();
     218
    217219        auto backupBuffer = WTFMove(m_backupResourceTimingBuffer);
    218220        ASSERT(m_backupResourceTimingBuffer.isEmpty());
    219221
    220         m_resourceTimingBufferFullFlag = true;
    221         dispatchEvent(Event::create(eventNames().resourcetimingbufferfullEvent, Event::CanBubble::No, Event::IsCancelable::No));
     222        if (isResourceTimingBufferFull()) {
     223            m_resourceTimingBufferFullFlag = true;
     224            dispatchEvent(Event::create(eventNames().resourcetimingbufferfullEvent, Event::CanBubble::No, Event::IsCancelable::No));
     225        }
    222226
    223227        if (m_resourceTimingBufferFullFlag) {
     
    242246                m_backupResourceTimingBuffer.append(entry.copyRef());
    243247        }
     248
     249        auto afterCount = m_backupResourceTimingBuffer.size();
     250
     251        if (beforeCount <= afterCount) {
     252            m_backupResourceTimingBuffer.clear();
     253            break;
     254        }
    244255    }
    245256    m_waitingForBackupBufferToBeProcessed = false;
Note: See TracChangeset for help on using the changeset viewer.