Title: [258649] trunk
Revision
258649
Author
[email protected]
Date
2020-03-18 10:57:45 -0700 (Wed, 18 Mar 2020)

Log 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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (258648 => 258649)


--- trunk/LayoutTests/ChangeLog	2020-03-18 17:55:12 UTC (rev 258648)
+++ trunk/LayoutTests/ChangeLog	2020-03-18 17:57:45 UTC (rev 258649)
@@ -1,3 +1,17 @@
+2020-03-18  Chris Dumez  <[email protected]>
+
+        [ 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.
+
+        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:
+
 2020-03-18  Said Abou-Hallawa  <[email protected]>
 
         Default attachment icon is not necessarily the same as the file attachment icon whose extension is ".dat"

Modified: trunk/LayoutTests/http/wpt/beacon/beacon-quota-expected.txt (258648 => 258649)


--- trunk/LayoutTests/http/wpt/beacon/beacon-quota-expected.txt	2020-03-18 17:55:12 UTC (rev 258648)
+++ trunk/LayoutTests/http/wpt/beacon/beacon-quota-expected.txt	2020-03-18 17:57:45 UTC (rev 258649)
@@ -1,5 +1,5 @@
-CONSOLE MESSAGE: line 44: Beacon API cannot load http://localhost:8800/. Reached maximum amount of queued data of 64Kb for keepalive requests
-CONSOLE MESSAGE: line 52: Beacon API cannot load http://localhost:8800/. Reached maximum amount of queued data of 64Kb for keepalive requests
+CONSOLE MESSAGE: line 30: Beacon API cannot load http://localhost:8800/. Reached maximum amount of queued data of 64Kb for keepalive requests
+CONSOLE MESSAGE: line 39: Beacon API cannot load http://localhost:8800/. Reached maximum amount of queued data of 64Kb for keepalive requests
 
 PASS Beacon with a body above the Quota Limit should fail. 
 PASS Multiple Beacons Quota Limit 

Modified: trunk/LayoutTests/http/wpt/beacon/beacon-quota.html (258648 => 258649)


--- trunk/LayoutTests/http/wpt/beacon/beacon-quota.html	2020-03-18 17:55:12 UTC (rev 258648)
+++ trunk/LayoutTests/http/wpt/beacon/beacon-quota.html	2020-03-18 17:57:45 UTC (rev 258649)
@@ -8,33 +8,19 @@
     // We should expect 64KiB of rolling quota for any type of keep-alive request sent.
     var expectedQuota = 65536;
 
-    function checkBeaconReceived(id)
+    function waitForBeaconCompletion()
     {
         return new Promise(function(resolve, reject) {
-            var checkUrl = RESOURCES_DIR + "beacon-preflight.py?cmd=get&id=" + id;
-            fetch(checkUrl).then(response => {
-                response.json().then(result => {
-                    resolve(result['beacon'] == 1);
-                });
-            }, reject);
+            if (!internals.inflightBeaconsCount) {
+                resolve();
+                return;
+            }
+            setTimeout(function() {
+                waitForBeaconCompletion().then(resolve, reject);
+            }, 10);
         });
     }
 
-    function waitForBeacon(id)
-    {
-        return new Promise(function(resolve, reject) {
-            checkBeaconReceived(id).then(wasReceived => {
-                if (wasReceived) {
-                    resolve();
-                    return;
-                }
-                setTimeout(function() {
-                    waitForBeacon(id).then(resolve, reject);
-                }, 10);
-            });
-        });
-    }
-
     function createPayload(payloadSize)
     {
         return new Blob(["*".repeat(payloadSize)]);
@@ -49,8 +35,9 @@
         var target = RESOURCES_DIR + "beacon-preflight.py?allowCors=1&cmd=put&id=" + id;
 
         assert_true(navigator.sendBeacon(target, createPayload(expectedQuota)), "Beacon with a body at the Quota Limit should succeed.");
+        assert_equals(internals.inflightBeaconsCount, 1);
         assert_false(navigator.sendBeacon("/", createPayload(1)), "Second beacon should not be sent because we reached the quota");
-        return waitForBeacon(id).then(function() {
+        return waitForBeaconCompletion().then(function() {
             assert_true(navigator.sendBeacon(target, createPayload(1)), "Allocated quota should be returned once the beacon is no longer in flight");
         });
     }, "Multiple Beacons Quota Limit");

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (258648 => 258649)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2020-03-18 17:55:12 UTC (rev 258648)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2020-03-18 17:57:45 UTC (rev 258649)
@@ -1045,8 +1045,6 @@
 
 webkit.org/b/207864 webgpu/whlsl/do-while-loop-continue.html [ Pass ImageOnlyFailure ]
 
-webkit.org/b/207894 http/wpt/beacon/beacon-quota.html [ Pass Failure ]
-
 webkit.org/b/207938 http/wpt/crypto/derive-hmac-key-crash.any.html [ Pass Crash ]
 
 webkit.org/b/207953 [ Release ] fast/scrolling/latching/scroll-iframe-in-overflow.html [ Pass Failure ]
@@ -1101,4 +1099,4 @@
 
 webkit.org/b/209183 webrtc/concurrentVideoPlayback.html [ Pass Timeout ]
 
-webkit.org/b/209189 http/tests/IndexedDB/storage-limit.https.html [ Pass Failure ]
\ No newline at end of file
+webkit.org/b/209189 http/tests/IndexedDB/storage-limit.https.html [ Pass Failure ]

Modified: trunk/Source/WebCore/ChangeLog (258648 => 258649)


--- trunk/Source/WebCore/ChangeLog	2020-03-18 17:55:12 UTC (rev 258648)
+++ trunk/Source/WebCore/ChangeLog	2020-03-18 17:57:45 UTC (rev 258649)
@@ -1,3 +1,20 @@
+2020-03-18  Chris Dumez  <[email protected]>
+
+        [ 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.
+
+        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:
+
 2020-03-18  Frederic Wang  <[email protected]>
 
         [intersection-observer] Accept a Document as an explicit root

Modified: trunk/Source/WebCore/Modules/beacon/NavigatorBeacon.h (258648 => 258649)


--- trunk/Source/WebCore/Modules/beacon/NavigatorBeacon.h	2020-03-18 17:55:12 UTC (rev 258648)
+++ trunk/Source/WebCore/Modules/beacon/NavigatorBeacon.h	2020-03-18 17:57:45 UTC (rev 258649)
@@ -46,10 +46,13 @@
     ~NavigatorBeacon();
     static ExceptionOr<bool> sendBeacon(Navigator&, Document&, const String& url, Optional<FetchBody::Init>&&);
 
+    size_t inflightBeaconsCount() const { return m_inflightBeacons.size(); }
+
+    WEBCORE_EXPORT static NavigatorBeacon* from(Navigator&);
+
 private:
     ExceptionOr<bool> sendBeacon(Document&, const String& url, Optional<FetchBody::Init>&&);
 
-    static NavigatorBeacon* from(Navigator&);
     static const char* supplementName();
 
     void notifyFinished(CachedResource&) final;

Modified: trunk/Source/WebCore/testing/Internals.cpp (258648 => 258649)


--- trunk/Source/WebCore/testing/Internals.cpp	2020-03-18 17:55:12 UTC (rev 258648)
+++ trunk/Source/WebCore/testing/Internals.cpp	2020-03-18 17:57:45 UTC (rev 258649)
@@ -133,6 +133,7 @@
 #include "MockLibWebRTCPeerConnection.h"
 #include "MockPageOverlay.h"
 #include "MockPageOverlayClient.h"
+#include "NavigatorBeacon.h"
 #include "NavigatorMediaDevices.h"
 #include "NetworkLoadInformation.h"
 #include "Page.h"
@@ -637,6 +638,23 @@
     return InternalSettings::from(page);
 }
 
+unsigned Internals::inflightBeaconsCount() const
+{
+    auto* document = contextDocument();
+    if (!document)
+        return 0;
+
+    auto* window = document->domWindow();
+    if (!window)
+        return 0;
+
+    auto* navigator = window->optionalNavigator();
+    if (!navigator)
+        return 0;
+
+    return NavigatorBeacon::from(*navigator)->inflightBeaconsCount();
+}
+
 unsigned Internals::workerThreadCount() const
 {
     return WorkerThread::workerThreadCount();

Modified: trunk/Source/WebCore/testing/Internals.h (258648 => 258649)


--- trunk/Source/WebCore/testing/Internals.h	2020-03-18 17:55:12 UTC (rev 258648)
+++ trunk/Source/WebCore/testing/Internals.h	2020-03-18 17:57:45 UTC (rev 258649)
@@ -657,6 +657,8 @@
     void simulateSystemSleep() const;
     void simulateSystemWake() const;
 
+    unsigned inflightBeaconsCount() const;
+
     enum class PageOverlayType { View, Document };
     ExceptionOr<Ref<MockPageOverlay>> installMockPageOverlay(PageOverlayType);
     ExceptionOr<String> pageOverlayLayerTreeAsText(unsigned short flags) const;

Modified: trunk/Source/WebCore/testing/Internals.idl (258648 => 258649)


--- trunk/Source/WebCore/testing/Internals.idl	2020-03-18 17:55:12 UTC (rev 258648)
+++ trunk/Source/WebCore/testing/Internals.idl	2020-03-18 17:57:45 UTC (rev 258649)
@@ -239,6 +239,8 @@
     // Spatial Navigation testing
     [MayThrowException] unsigned long lastSpatialNavigationCandidateCount();
 
+    readonly attribute unsigned long inflightBeaconsCount;
+
     // CSS Animation testing.
     unsigned long numberOfActiveAnimations();
     [MayThrowException] void suspendAnimations();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to