Title: [268286] trunk/Tools
Revision
268286
Author
[email protected]
Date
2020-10-09 13:53:50 -0700 (Fri, 09 Oct 2020)

Log Message

REGRESSION: [Mac Release] 2 Cookie API are failing
https://bugs.webkit.org/show_bug.cgi?id=217393

Patch by Alex Christensen <[email protected]> on 2020-10-09
Reviewed by Chris Dumez.

If bad things happen when running API tests, the TestWebKitAPI default cookie storage can get stuck with
a cookie accept policy of never, which causes future tests to fail.  All existing tests restore the cookie
accept policy to what it was before the test started, but once a machine gets into a bad state, there's nothing
to reset it to the default state.  Some of our test bots have gotten into this bad state, causing 2 cookie API
tests to fail.  To fix this, set the cookie accept policy to its default value before running these two tests.
I verified this works by getting my computer into this bad state, verifying repeated API test runs don't fix it,
and verified this brings the computer back into a good state and causes the API tests to pass again.

* TestWebKitAPI/Tests/WebKitCocoa/CookiePrivateBrowsing.mm:
(TEST):
* TestWebKitAPI/Tests/WebKitCocoa/Proxy.mm:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (268285 => 268286)


--- trunk/Tools/ChangeLog	2020-10-09 20:05:42 UTC (rev 268285)
+++ trunk/Tools/ChangeLog	2020-10-09 20:53:50 UTC (rev 268286)
@@ -1,3 +1,23 @@
+2020-10-09  Alex Christensen  <[email protected]>
+
+        REGRESSION: [Mac Release] 2 Cookie API are failing
+        https://bugs.webkit.org/show_bug.cgi?id=217393
+
+        Reviewed by Chris Dumez.
+
+        If bad things happen when running API tests, the TestWebKitAPI default cookie storage can get stuck with
+        a cookie accept policy of never, which causes future tests to fail.  All existing tests restore the cookie
+        accept policy to what it was before the test started, but once a machine gets into a bad state, there's nothing
+        to reset it to the default state.  Some of our test bots have gotten into this bad state, causing 2 cookie API
+        tests to fail.  To fix this, set the cookie accept policy to its default value before running these two tests.
+        I verified this works by getting my computer into this bad state, verifying repeated API test runs don't fix it,
+        and verified this brings the computer back into a good state and causes the API tests to pass again.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/CookiePrivateBrowsing.mm:
+        (TEST):
+        * TestWebKitAPI/Tests/WebKitCocoa/Proxy.mm:
+        (TestWebKitAPI::TEST):
+
 2020-10-09  Jonathan Bedard  <[email protected]>
 
         [webkitscmpy] Support unicode contributor names

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/CookiePrivateBrowsing.mm (268285 => 268286)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/CookiePrivateBrowsing.mm	2020-10-09 20:05:42 UTC (rev 268285)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/CookiePrivateBrowsing.mm	2020-10-09 20:53:50 UTC (rev 268286)
@@ -28,10 +28,12 @@
 #import "PlatformUtilities.h"
 #import "Test.h"
 #import "TestWKWebView.h"
+#import <WebKit/WKHTTPCookieStorePrivate.h>
 #import <WebKit/WKProcessPool.h>
 #import <WebKit/WKProcessPoolPrivate.h>
 #import <WebKit/WKWebView.h>
 #import <WebKit/WKWebViewConfiguration.h>
+#import <pal/spi/cf/CFNetworkSPI.h>
 #import <wtf/RetainPtr.h>
 #import <wtf/text/StringConcatenateNumbers.h>
 #import <wtf/text/WTFString.h>
@@ -75,6 +77,12 @@
 
 TEST(WebKit, CookieCacheSyncAcrossProcess)
 {
+    __block bool setDefaultCookieAcceptPolicy = false;
+    [[WKWebsiteDataStore defaultDataStore].httpCookieStore _setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain completionHandler:^{
+        setDefaultCookieAcceptPolicy = true;
+    }];
+    TestWebKitAPI::Util::run(&setDefaultCookieAcceptPolicy);
+
     auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
     [configuration setWebsiteDataStore:[WKWebsiteDataStore nonPersistentDataStore]];
     auto view1 = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Proxy.mm (268285 => 268286)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Proxy.mm	2020-10-09 20:05:42 UTC (rev 268285)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Proxy.mm	2020-10-09 20:53:50 UTC (rev 268286)
@@ -32,9 +32,11 @@
 #import "TestUIDelegate.h"
 #import "TestWKWebView.h"
 #import "Utilities.h"
+#import <WebKit/WKHTTPCookieStorePrivate.h>
 #import <WebKit/WKWebsiteDataStorePrivate.h>
 #import <WebKit/WebKit.h>
 #import <WebKit/_WKWebsiteDataStoreConfiguration.h>
+#import <pal/spi/cf/CFNetworkSPI.h>
 #import <wtf/RetainPtr.h>
 #import <wtf/text/StringConcatenateNumbers.h>
 
@@ -187,6 +189,12 @@
 
 TEST(WebKit, RelaxThirdPartyCookieBlocking)
 {
+    __block bool setDefaultCookieAcceptPolicy = false;
+    [[WKWebsiteDataStore defaultDataStore].httpCookieStore _setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain completionHandler:^{
+        setDefaultCookieAcceptPolicy = true;
+    }];
+    Util::run(&setDefaultCookieAcceptPolicy);
+
     auto runTest = [] (bool shouldRelaxThirdPartyCookieBlocking) {
         HTTPServer server([connectionCount = 0, shouldRelaxThirdPartyCookieBlocking] (Connection connection) mutable {
             ++connectionCount;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to