Changeset 258649 in webkit


Ignore:
Timestamp:
Mar 18, 2020 10:57:45 AM (4 years ago)
Author:
Chris Dumez
Message:

[ Mac wk2 ] http/wpt/beacon/beacon-quota.html is flaky failing
https://bugs.webkit.org/show_bug.cgi?id=207894
<rdar://problem/59551688>

Reviewed by Geoffrey Garen.

Source/WebCore:

Add internals API exposing the number of inflight beacon loads for a given navigator object
so that the test can rely on it.

  • Modules/beacon/NavigatorBeacon.h:
  • testing/Internals.cpp:

(WebCore::Internals::inflightBeaconsCount const):

  • testing/Internals.h:
  • testing/Internals.idl:

LayoutTests:

Update test to address flakiness and unskip it.

  • http/wpt/beacon/beacon-quota-expected.txt:
  • http/wpt/beacon/beacon-quota.html:
  • platform/mac-wk2/TestExpectations:
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r258640 r258649  
     12020-03-18  Chris Dumez  <cdumez@apple.com>
     2
     3        [ Mac wk2 ] http/wpt/beacon/beacon-quota.html is flaky failing
     4        https://bugs.webkit.org/show_bug.cgi?id=207894
     5        <rdar://problem/59551688>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        Update test to address flakiness and unskip it.
     10
     11        * http/wpt/beacon/beacon-quota-expected.txt:
     12        * http/wpt/beacon/beacon-quota.html:
     13        * platform/mac-wk2/TestExpectations:
     14
    1152020-03-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
    216
  • trunk/LayoutTests/http/wpt/beacon/beacon-quota-expected.txt

    r220946 r258649  
    1 CONSOLE MESSAGE: line 44: Beacon API cannot load http://localhost:8800/. Reached maximum amount of queued data of 64Kb for keepalive requests
    2 CONSOLE MESSAGE: line 52: Beacon API cannot load http://localhost:8800/. Reached maximum amount of queued data of 64Kb for keepalive requests
     1CONSOLE MESSAGE: line 30: Beacon API cannot load http://localhost:8800/. Reached maximum amount of queued data of 64Kb for keepalive requests
     2CONSOLE MESSAGE: line 39: Beacon API cannot load http://localhost:8800/. Reached maximum amount of queued data of 64Kb for keepalive requests
    33
    44PASS Beacon with a body above the Quota Limit should fail.
  • trunk/LayoutTests/http/wpt/beacon/beacon-quota.html

    r220946 r258649  
    99    var expectedQuota = 65536;
    1010
    11     function checkBeaconReceived(id)
     11    function waitForBeaconCompletion()
    1212    {
    1313        return new Promise(function(resolve, reject) {
    14             var checkUrl = RESOURCES_DIR + "beacon-preflight.py?cmd=get&id=" + id;
    15             fetch(checkUrl).then(response => {
    16                 response.json().then(result => {
    17                     resolve(result['beacon'] == 1);
    18                 });
    19             }, reject);
    20         });
    21     }
    22 
    23     function waitForBeacon(id)
    24     {
    25         return new Promise(function(resolve, reject) {
    26             checkBeaconReceived(id).then(wasReceived => {
    27                 if (wasReceived) {
    28                     resolve();
    29                     return;
    30                 }
    31                 setTimeout(function() {
    32                     waitForBeacon(id).then(resolve, reject);
    33                 }, 10);
    34             });
     14            if (!internals.inflightBeaconsCount) {
     15                resolve();
     16                return;
     17            }
     18            setTimeout(function() {
     19                waitForBeaconCompletion().then(resolve, reject);
     20            }, 10);
    3521        });
    3622    }
     
    5036
    5137        assert_true(navigator.sendBeacon(target, createPayload(expectedQuota)), "Beacon with a body at the Quota Limit should succeed.");
     38        assert_equals(internals.inflightBeaconsCount, 1);
    5239        assert_false(navigator.sendBeacon("/", createPayload(1)), "Second beacon should not be sent because we reached the quota");
    53         return waitForBeacon(id).then(function() {
     40        return waitForBeaconCompletion().then(function() {
    5441            assert_true(navigator.sendBeacon(target, createPayload(1)), "Allocated quota should be returned once the beacon is no longer in flight");
    5542        });
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r258585 r258649  
    10461046webkit.org/b/207864 webgpu/whlsl/do-while-loop-continue.html [ Pass ImageOnlyFailure ]
    10471047
    1048 webkit.org/b/207894 http/wpt/beacon/beacon-quota.html [ Pass Failure ]
    1049 
    10501048webkit.org/b/207938 http/wpt/crypto/derive-hmac-key-crash.any.html [ Pass Crash ]
    10511049
  • trunk/Source/WebCore/ChangeLog

    r258648 r258649  
     12020-03-18  Chris Dumez  <cdumez@apple.com>
     2
     3        [ Mac wk2 ] http/wpt/beacon/beacon-quota.html is flaky failing
     4        https://bugs.webkit.org/show_bug.cgi?id=207894
     5        <rdar://problem/59551688>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        Add internals API exposing the number of inflight beacon loads for a given navigator object
     10        so that the test can rely on it.
     11
     12        * Modules/beacon/NavigatorBeacon.h:
     13        * testing/Internals.cpp:
     14        (WebCore::Internals::inflightBeaconsCount const):
     15        * testing/Internals.h:
     16        * testing/Internals.idl:
     17
    1182020-03-18  Frederic Wang  <fwang@igalia.com>
    219
  • trunk/Source/WebCore/Modules/beacon/NavigatorBeacon.h

    r241183 r258649  
    4747    static ExceptionOr<bool> sendBeacon(Navigator&, Document&, const String& url, Optional<FetchBody::Init>&&);
    4848
     49    size_t inflightBeaconsCount() const { return m_inflightBeacons.size(); }
     50
     51    WEBCORE_EXPORT static NavigatorBeacon* from(Navigator&);
     52
    4953private:
    5054    ExceptionOr<bool> sendBeacon(Document&, const String& url, Optional<FetchBody::Init>&&);
    5155
    52     static NavigatorBeacon* from(Navigator&);
    5356    static const char* supplementName();
    5457
  • trunk/Source/WebCore/testing/Internals.cpp

    r258635 r258649  
    134134#include "MockPageOverlay.h"
    135135#include "MockPageOverlayClient.h"
     136#include "NavigatorBeacon.h"
    136137#include "NavigatorMediaDevices.h"
    137138#include "NetworkLoadInformation.h"
     
    638639}
    639640
     641unsigned Internals::inflightBeaconsCount() const
     642{
     643    auto* document = contextDocument();
     644    if (!document)
     645        return 0;
     646
     647    auto* window = document->domWindow();
     648    if (!window)
     649        return 0;
     650
     651    auto* navigator = window->optionalNavigator();
     652    if (!navigator)
     653        return 0;
     654
     655    return NavigatorBeacon::from(*navigator)->inflightBeaconsCount();
     656}
     657
    640658unsigned Internals::workerThreadCount() const
    641659{
  • trunk/Source/WebCore/testing/Internals.h

    r258587 r258649  
    658658    void simulateSystemWake() const;
    659659
     660    unsigned inflightBeaconsCount() const;
     661
    660662    enum class PageOverlayType { View, Document };
    661663    ExceptionOr<Ref<MockPageOverlay>> installMockPageOverlay(PageOverlayType);
  • trunk/Source/WebCore/testing/Internals.idl

    r258587 r258649  
    240240    [MayThrowException] unsigned long lastSpatialNavigationCandidateCount();
    241241
     242    readonly attribute unsigned long inflightBeaconsCount;
     243
    242244    // CSS Animation testing.
    243245    unsigned long numberOfActiveAnimations();
Note: See TracChangeset for help on using the changeset viewer.