Title: [258436] trunk
Revision
258436
Author
katherine_che...@apple.com
Date
2020-03-13 14:56:56 -0700 (Fri, 13 Mar 2020)

Log Message

[ iOS and Mac wk2 ] http/tests/in-app-browser-privacy/ tests failing
https://bugs.webkit.org/show_bug.cgi?id=209016
<rdar://problem/60329530>

Reviewed by Chris Dumez.

Source/WebKit:

This patch adds a function to re-initialize app bound domains for
in-app-browser-privacy tests, since they are only initialized once
when the WebsiteDataStore is created. This causes issues if the tests
are run in parallel with other tests with different app-bound domains.

* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreReinitializeAppBoundDomains):
* UIProcess/API/C/WKWebsiteDataStoreRef.h:
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::clearAppBoundDomains):
(WebKit::WebsiteDataStore::reinitializeAppBoundDomains):
* UIProcess/WebsiteData/WebsiteDataStore.h:

Tools:

Re-initialize the app-bound domains when the correct
TestOptions parameter is set.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::reinitializeAppBoundDomains):
* WebKitTestRunner/TestController.h:

LayoutTests:

Use TestOptions to trigger the re-initialization of app-bound domains.

* http/tests/in-app-browser-privacy/app-bound-domain.html:
* http/tests/in-app-browser-privacy/switch-session-on-navigation-to-app-bound-domain.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (258435 => 258436)


--- trunk/LayoutTests/ChangeLog	2020-03-13 21:51:21 UTC (rev 258435)
+++ trunk/LayoutTests/ChangeLog	2020-03-13 21:56:56 UTC (rev 258436)
@@ -1,3 +1,16 @@
+2020-03-13  Kate Cheney  <katherine_che...@apple.com>
+
+        [ iOS and Mac wk2 ] http/tests/in-app-browser-privacy/ tests failing
+        https://bugs.webkit.org/show_bug.cgi?id=209016
+        <rdar://problem/60329530> 
+
+        Reviewed by Chris Dumez.
+
+        Use TestOptions to trigger the re-initialization of app-bound domains.
+
+        * http/tests/in-app-browser-privacy/app-bound-domain.html:
+        * http/tests/in-app-browser-privacy/switch-session-on-navigation-to-app-bound-domain.html:
+
 2020-03-13  Jason Lawrence  <lawrenc...@apple.com>
 
         [ Mac ] fast/animation/request-animation-frame-timestamps.html is flaky failing.

Modified: trunk/LayoutTests/http/tests/in-app-browser-privacy/app-bound-domain.html (258435 => 258436)


--- trunk/LayoutTests/http/tests/in-app-browser-privacy/app-bound-domain.html	2020-03-13 21:51:21 UTC (rev 258435)
+++ trunk/LayoutTests/http/tests/in-app-browser-privacy/app-bound-domain.html	2020-03-13 21:56:56 UTC (rev 258436)
@@ -1,4 +1,4 @@
-<!DOCTYPE html><!-- webkit-test-runner [ internal:IsInAppBrowserPrivacyEnabled=true applicationBundleIdentifier=testidentifier ] -->
+<!DOCTYPE html><!-- webkit-test-runner [ internal:IsInAppBrowserPrivacyEnabled=true applicationBundleIdentifier=inAppBrowserPrivacyTestIdentifier ] -->
 <html>
 <head>
     <script src=""

Modified: trunk/LayoutTests/http/tests/in-app-browser-privacy/switch-session-on-navigation-to-app-bound-domain.html (258435 => 258436)


--- trunk/LayoutTests/http/tests/in-app-browser-privacy/switch-session-on-navigation-to-app-bound-domain.html	2020-03-13 21:51:21 UTC (rev 258435)
+++ trunk/LayoutTests/http/tests/in-app-browser-privacy/switch-session-on-navigation-to-app-bound-domain.html	2020-03-13 21:56:56 UTC (rev 258436)
@@ -1,4 +1,4 @@
-<!DOCTYPE html><!-- webkit-test-runner [ internal:IsInAppBrowserPrivacyEnabled=true applicationBundleIdentifier=testidentifier ] -->
+<!DOCTYPE html><!-- webkit-test-runner [ internal:IsInAppBrowserPrivacyEnabled=true applicationBundleIdentifier=inAppBrowserPrivacyTestIdentifier ] -->
 <html lang="en">
 <head>
     <meta charset="UTF-8">

Modified: trunk/Source/WebKit/ChangeLog (258435 => 258436)


--- trunk/Source/WebKit/ChangeLog	2020-03-13 21:51:21 UTC (rev 258435)
+++ trunk/Source/WebKit/ChangeLog	2020-03-13 21:56:56 UTC (rev 258436)
@@ -1,3 +1,24 @@
+2020-03-13  Kate Cheney  <katherine_che...@apple.com>
+
+        [ iOS and Mac wk2 ] http/tests/in-app-browser-privacy/ tests failing
+        https://bugs.webkit.org/show_bug.cgi?id=209016
+        <rdar://problem/60329530> 
+
+        Reviewed by Chris Dumez.
+
+        This patch adds a function to re-initialize app bound domains for
+        in-app-browser-privacy tests, since they are only initialized once
+        when the WebsiteDataStore is created. This causes issues if the tests
+        are run in parallel with other tests with different app-bound domains.
+
+        * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
+        (WKWebsiteDataStoreReinitializeAppBoundDomains):
+        * UIProcess/API/C/WKWebsiteDataStoreRef.h:
+        * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+        (WebKit::WebsiteDataStore::clearAppBoundDomains):
+        (WebKit::WebsiteDataStore::reinitializeAppBoundDomains):
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+
 2020-03-13  Ryan Haddad  <ryanhad...@apple.com>
 
         Unreviewed, reverting r258391.

Modified: trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp (258435 => 258436)


--- trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp	2020-03-13 21:51:21 UTC (rev 258435)
+++ trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp	2020-03-13 21:56:56 UTC (rev 258436)
@@ -725,3 +725,10 @@
         completionHandler(context);
     });
 }
+
+void WKWebsiteDataStoreReinitializeAppBoundDomains(WKWebsiteDataStoreRef dataStoreRef)
+{
+#if PLATFORM(COCOA)
+    WebKit::toImpl(dataStoreRef)->reinitializeAppBoundDomains();
+#endif
+}

Modified: trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h (258435 => 258436)


--- trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h	2020-03-13 21:51:21 UTC (rev 258435)
+++ trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h	2020-03-13 21:56:56 UTC (rev 258436)
@@ -164,6 +164,8 @@
 typedef void (*WKWebsiteDataStoreSetInAppBrowserPrivacyEnabledFunction)(void* functionContext);
 WK_EXPORT void WKWebsiteDataStoreSetInAppBrowserPrivacyEnabled(WKWebsiteDataStoreRef dataStoreRef, bool enabled, void* context, WKWebsiteDataStoreSetInAppBrowserPrivacyEnabledFunction completionHandler);
 
+WK_EXPORT void WKWebsiteDataStoreReinitializeAppBoundDomains(WKWebsiteDataStoreRef dataStoreRef);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (258435 => 258436)


--- trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm	2020-03-13 21:51:21 UTC (rev 258435)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm	2020-03-13 21:56:56 UTC (rev 258436)
@@ -448,22 +448,25 @@
     return appBoundDomains;
 }
 
-void WebsiteDataStore::initializeAppBoundDomains()
+void WebsiteDataStore::initializeAppBoundDomains(ForceReinitialization forceReinitialization)
 {
     ASSERT(RunLoop::isMain());
 
-    if (hasInitializedAppBoundDomains)
+    if (hasInitializedAppBoundDomains && forceReinitialization != ForceReinitialization::Yes)
         return;
     
     static const auto maxAppBoundDomainCount = 10;
     
-    appBoundDomainQueue().dispatch([] () mutable {
-        if (hasInitializedAppBoundDomains)
+    appBoundDomainQueue().dispatch([forceReinitialization] () mutable {
+        if (hasInitializedAppBoundDomains && forceReinitialization != ForceReinitialization::Yes)
             return;
         
         NSArray<NSString *> *domains = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"WKAppBoundDomains"];
         
-        RunLoop::main().dispatch([domains = retainPtr(domains)] {
+        RunLoop::main().dispatch([forceReinitialization , domains = retainPtr(domains)] {
+            if (forceReinitialization == ForceReinitialization::Yes)
+                appBoundDomains().clear();
+
             for (NSString *domain in domains.get()) {
                 URL url { URL(), domain };
                 if (!url.isValid())
@@ -512,4 +515,10 @@
     });
 }
 
+void WebsiteDataStore::reinitializeAppBoundDomains()
+{
+    hasInitializedAppBoundDomains = false;
+    initializeAppBoundDomains(ForceReinitialization::Yes);
 }
+
+}

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (258435 => 258436)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h	2020-03-13 21:51:21 UTC (rev 258435)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h	2020-03-13 21:56:56 UTC (rev 258436)
@@ -286,9 +286,12 @@
     void beginAppBoundDomainCheck(WebCore::RegistrableDomain&&, WebFramePolicyListenerProxy&);
     void appBoundDomainsForTesting(CompletionHandler<void(const HashSet<WebCore::RegistrableDomain>&)>&&) const;
     void ensureAppBoundDomains(CompletionHandler<void(const HashSet<WebCore::RegistrableDomain>&)>&&) const;
+    void reinitializeAppBoundDomains();
 
 private:
-    void initializeAppBoundDomains();
+    enum class ForceReinitialization : bool { No, Yes };
+    void initializeAppBoundDomains(ForceReinitialization = ForceReinitialization::No);
+
     void fetchDataAndApply(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, RefPtr<WorkQueue>&&, Function<void(Vector<WebsiteDataRecord>)>&& apply);
 
     void platformInitialize();

Modified: trunk/Tools/ChangeLog (258435 => 258436)


--- trunk/Tools/ChangeLog	2020-03-13 21:51:21 UTC (rev 258435)
+++ trunk/Tools/ChangeLog	2020-03-13 21:56:56 UTC (rev 258436)
@@ -1,5 +1,21 @@
 2020-03-13  Kate Cheney  <katherine_che...@apple.com>
 
+        [ iOS and Mac wk2 ] http/tests/in-app-browser-privacy/ tests failing
+        https://bugs.webkit.org/show_bug.cgi?id=209016
+        <rdar://problem/60329530> 
+
+        Reviewed by Chris Dumez.
+
+        Re-initialize the app-bound domains when the correct
+        TestOptions parameter is set.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::createWebViewWithOptions):
+        (WTR::TestController::reinitializeAppBoundDomains):
+        * WebKitTestRunner/TestController.h:
+
+2020-03-13  Kate Cheney  <katherine_che...@apple.com>
+
         Report all third party loads on a per-page basis
         https://bugs.webkit.org/show_bug.cgi?id=209032
         <rdar://problem/60397323>

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (258435 => 258436)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2020-03-13 21:51:21 UTC (rev 258435)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2020-03-13 21:56:56 UTC (rev 258436)
@@ -791,6 +791,9 @@
     // Generally, the tests should default to running at 1x. updateWindowScaleForTest() will adjust the scale to
     // something else for specific tests that need to run at a different window scale.
     m_mainWebView->changeWindowScaleIfNeeded(1);
+    
+    if (!options.applicationBundleIdentifier.isEmpty())
+        reinitializeAppBoundDomains();
 }
 
 void TestController::ensureViewSupportsOptionsForTest(const TestInvocation& test)
@@ -3782,6 +3785,11 @@
     m_currentInvocation->didSetInAppBrowserPrivacyEnabled();
 }
 
+void TestController::reinitializeAppBoundDomains()
+{
+    WKWebsiteDataStoreReinitializeAppBoundDomains(TestController::websiteDataStore());
+}
+
 #if !PLATFORM(COCOA)
 void TestController::platformAddTestOptions(TestOptions&) const
 {

Modified: trunk/Tools/WebKitTestRunner/TestController.h (258435 => 258436)


--- trunk/Tools/WebKitTestRunner/TestController.h	2020-03-13 21:51:21 UTC (rev 258435)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2020-03-13 21:56:56 UTC (rev 258436)
@@ -269,6 +269,7 @@
     void clearLoadedThirdPartyDomains();
     void getWebViewCategory();
     void setInAppBrowserPrivacyEnabled(bool);
+    void reinitializeAppBoundDomains();
 
     WKArrayRef openPanelFileURLs() const { return m_openPanelFileURLs.get(); }
     void setOpenPanelFileURLs(WKArrayRef fileURLs) { m_openPanelFileURLs = fileURLs; }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to