[WKTR] Drop TestRunner.setPrivateBrowsingEnabled_DEPRECATED()
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Sep 2019 22:12:25 +0000 (22:12 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Sep 2019 22:12:25 +0000 (22:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=201546

Reviewed by Alex Christensen.

Drop TestRunner.setPrivateBrowsingEnabled_DEPRECATED() from WebKitTestRunner as it does not do
the right thing for WebKit2 and tests have been rewritten to not use it.

Source/WebCore:

* page/PageGroup.cpp:
(WebCore::PageGroup::addPage):
(WebCore::PageGroup::setSessionIDForTesting): Deleted.
* page/PageGroup.h:
(): Deleted.

Source/WebKit:

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession): Deleted.
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleSetPrivateBrowsingEnabled): Deleted.
* WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::setPrivateBrowsingEnabled): Deleted.
* WebProcess/InjectedBundle/InjectedBundle.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::ensureLegacyPrivateBrowsingSessionInNetworkProcess): Deleted.
* WebProcess/WebProcess.h:
* WebProcess/WebStorage/StorageNamespaceImpl.cpp:
(WebKit::StorageNamespaceImpl::setSessionIDForTesting):

Tools:

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setPrivateBrowsingEnabled_DEPRECATED): Deleted.
* WebKitTestRunner/InjectedBundle/TestRunner.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249817 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
LayoutTests/platform/mac-wk2/TestExpectations
LayoutTests/platform/wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/page/PageGroup.cpp
Source/WebCore/page/PageGroup.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in
Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundle.cpp
Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp
Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.h
Source/WebKit/WebProcess/WebProcess.cpp
Source/WebKit/WebProcess/WebProcess.h
Source/WebKit/WebProcess/WebStorage/StorageNamespaceImpl.cpp
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

index 60a72d9..aba46da 100644 (file)
@@ -476,19 +476,6 @@ webkit.org/b/71298 accessibility/mac/iframe-with-title-correct-hierarchy.html
 ########################################
 ### START OF (5) Features that are not supported when NetworkProcess is enabled (i.e. they only work on Mountain Lion, and not on newer OS versions).
 
-# https://bugs.webkit.org/show_bug.cgi?id=115274
-# PPT: testRunner.setPrivateBrowsingEnabled_DEPRECATED() doesn't work with NetworkProcess
-http/tests/security/appcache-in-private-browsing.html [ Skip ]
-http/tests/security/appcache-switching-private-browsing.html [ Skip ]
-http/tests/security/cookies/first-party-cookie-allow-xslt.xml [ Skip ]
-http/tests/security/cookies/third-party-cookie-blocking-xslt.xml [ Skip ]
-http/tests/security/cross-origin-plugin-private-browsing-toggled-allowed.html [ Skip ]
-http/tests/security/cross-origin-plugin-private-browsing-toggled.html [ Skip ]
-http/tests/security/storage-blocking-loosened-private-browsing-plugin.html [ Skip ]
-http/tests/security/storage-blocking-strengthened-private-browsing-plugin.html [ Skip ]
-plugins/private-browsing-mode-2.html [ Skip ]
-storage/websql/private-browsing-noread-nowrite.html [ Skip ]
-
 # There is no network load scheduling or prioritization with NetworkProcess.
 webkit.org/b/123431 http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error.html [ Pass Failure ]
 webkit.org/b/123431 http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html [ Pass Failure ]
index ba6c3bd..0ea4294 100644 (file)
@@ -88,6 +88,19 @@ platform/mac/fast/text/attributed-substring-from-range-in-textfield.html
 platform/mac/fast/text/attributed-substring-from-range.html
 platform/mac/fast/text/justified-text-rect.html
 
+# https://bugs.webkit.org/show_bug.cgi?id=115274
+# testRunner.setPrivateBrowsingEnabled_DEPRECATED() doesn't work with NetworkProcess and is WebKitLegacy only.
+http/tests/security/appcache-in-private-browsing.html [ Skip ]
+http/tests/security/appcache-switching-private-browsing.html [ Skip ]
+http/tests/security/cookies/first-party-cookie-allow-xslt.xml [ Skip ]
+http/tests/security/cookies/third-party-cookie-blocking-xslt.xml [ Skip ]
+http/tests/security/cross-origin-plugin-private-browsing-toggled-allowed.html [ Skip ]
+http/tests/security/cross-origin-plugin-private-browsing-toggled.html [ Skip ]
+http/tests/security/storage-blocking-loosened-private-browsing-plugin.html [ Skip ]
+http/tests/security/storage-blocking-strengthened-private-browsing-plugin.html [ Skip ]
+plugins/private-browsing-mode-2.html [ Skip ]
+storage/websql/private-browsing-noread-nowrite.html [ Skip ]
+
 # [WebKit2] WebKitTestRunner doesn't support emulating pressing a tab key during IME composition
 webkit.org/b/188428 editing/input/press-tab-during-ime-composition.html
 
index f19bdd5..1aea195 100644 (file)
@@ -1,3 +1,19 @@
+2019-09-12  Chris Dumez  <cdumez@apple.com>
+
+        [WKTR] Drop TestRunner.setPrivateBrowsingEnabled_DEPRECATED()
+        https://bugs.webkit.org/show_bug.cgi?id=201546
+
+        Reviewed by Alex Christensen.
+
+        Drop TestRunner.setPrivateBrowsingEnabled_DEPRECATED() from WebKitTestRunner as it does not do
+        the right thing for WebKit2 and tests have been rewritten to not use it.
+
+        * page/PageGroup.cpp:
+        (WebCore::PageGroup::addPage):
+        (WebCore::PageGroup::setSessionIDForTesting): Deleted.
+        * page/PageGroup.h:
+        (): Deleted.
+
 2019-09-12  Saam Barati  <sbarati@apple.com>
 
         [WHLSL] Slim down WSLMatrix and inline constructors in native code
index d4c54c4..64a3d37 100644 (file)
@@ -93,9 +93,6 @@ void PageGroup::addPage(Page& page)
 {
     ASSERT(!m_pages.contains(&page));
     m_pages.add(&page);
-    
-    if (m_isLegacyPrivateBrowsingEnabledForTesting)
-        page.setSessionID(PAL::SessionID::legacyPrivateSessionID());
 }
 
 void PageGroup::removePage(Page& page)
@@ -126,16 +123,4 @@ CaptionUserPreferences& PageGroup::captionPreferences()
 }
 #endif
 
-void PageGroup::setSessionIDForTesting(const PAL::SessionID& sessionID)
-{
-    bool legacyPrivate = sessionID == PAL::SessionID::legacyPrivateSessionID();
-    if (m_isLegacyPrivateBrowsingEnabledForTesting == legacyPrivate)
-        return;
-
-    m_isLegacyPrivateBrowsingEnabledForTesting = legacyPrivate;
-    
-    for (auto* page : m_pages)
-        page->setSessionID(sessionID);
-}
-
 } // namespace WebCore
index 863b296..d460c42 100644 (file)
@@ -62,8 +62,6 @@ public:
     WEBCORE_EXPORT CaptionUserPreferences& captionPreferences();
 #endif
 
-    WEBCORE_EXPORT void setSessionIDForTesting(const PAL::SessionID&);
-
 private:
     String m_name;
     HashSet<Page*> m_pages;
@@ -73,8 +71,6 @@ private:
 #if ENABLE(VIDEO_TRACK)
     std::unique_ptr<CaptionUserPreferences> m_captionPreferences;
 #endif
-
-    bool m_isLegacyPrivateBrowsingEnabledForTesting { false };
 };
 
 } // namespace WebCore
index 9a6218d..e89ae98 100644 (file)
@@ -1,3 +1,29 @@
+2019-09-12  Chris Dumez  <cdumez@apple.com>
+
+        [WKTR] Drop TestRunner.setPrivateBrowsingEnabled_DEPRECATED()
+        https://bugs.webkit.org/show_bug.cgi?id=201546
+
+        Reviewed by Alex Christensen.
+
+        Drop TestRunner.setPrivateBrowsingEnabled_DEPRECATED() from WebKitTestRunner as it does not do
+        the right thing for WebKit2 and tests have been rewritten to not use it.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession): Deleted.
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+        * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+        (WKBundleSetPrivateBrowsingEnabled): Deleted.
+        * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::setPrivateBrowsingEnabled): Deleted.
+        * WebProcess/InjectedBundle/InjectedBundle.h:
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::ensureLegacyPrivateBrowsingSessionInNetworkProcess): Deleted.
+        * WebProcess/WebProcess.h:
+        * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
+        (WebKit::StorageNamespaceImpl::setSessionIDForTesting):
+
 2019-09-12  Adrian Perez de Castro  <aperez@igalia.com>
 
         [GTK][WPE] webkit_settings_set_user_agent() allows content forbidden in HTTP headers
index c7eab44..6b7cee5 100644 (file)
@@ -679,11 +679,6 @@ void NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled(boo
         loader->disableExtraNetworkLoadMetricsCapture();
 }
 
-void NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession()
-{
-    m_networkProcess->addWebsiteDataStore(WebsiteDataStoreParameters::legacyPrivateSessionParameters());
-}
-
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
 void NetworkConnectionToWebProcess::removeStorageAccessForFrame(PAL::SessionID sessionID, FrameIdentifier frameID, PageIdentifier pageID)
 {
index 66a62f3..380b3e9 100644 (file)
@@ -201,8 +201,6 @@ private:
 
     void createSocketChannel(PAL::SessionID, const WebCore::ResourceRequest&, const String& protocol, uint64_t identifier);
 
-    void ensureLegacyPrivateBrowsingSession();
-
 #if ENABLE(INDEXED_DATABASE)
     // Messages handlers (Modern IDB).
     void establishIDBConnectionToServer(PAL::SessionID);
index 978f000..3212070 100644 (file)
@@ -55,8 +55,6 @@ messages -> NetworkConnectionToWebProcess LegacyReceiver {
     CreateSocketStream(URL url, PAL::SessionID sessionID, String cachePartition, uint64_t identifier)
     CreateSocketChannel(PAL::SessionID sessionID, WebCore::ResourceRequest request, String protocol, uint64_t identifier)
 
-    EnsureLegacyPrivateBrowsingSession()
-
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
     RemoveStorageAccessForFrame(PAL::SessionID sessionID, WebCore::FrameIdentifier frameID, WebCore::PageIdentifier pageID);
     ClearPageSpecificDataForResourceLoadStatistics(PAL::SessionID sessionID, WebCore::PageIdentifier pageID);
index f2ec1ae..6c15341 100644 (file)
@@ -166,11 +166,6 @@ void WKBundleSetJavaScriptCanAccessClipboard(WKBundleRef bundleRef, WKBundlePage
     WebKit::toImpl(bundleRef)->setJavaScriptCanAccessClipboard(WebKit::toImpl(pageGroupRef), enabled);
 }
 
-void WKBundleSetPrivateBrowsingEnabled(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundlePageRef pageRef, bool enabled)
-{
-    WebKit::toImpl(bundleRef)->setPrivateBrowsingEnabled(WebKit::toImpl(pageGroupRef), WebKit::toImpl(pageRef), enabled);
-}
-
 void WKBundleSetPopupBlockingEnabled(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled)
 {
     WebKit::toImpl(bundleRef)->setPopupBlockingEnabled(WebKit::toImpl(pageGroupRef), enabled);
index 380361b..4607d69 100644 (file)
@@ -49,7 +49,6 @@ WK_EXPORT void WKBundleSetAllowStorageAccessFromFileURLS(WKBundleRef bundle, WKB
 WK_EXPORT void WKBundleSetMinimumLogicalFontSize(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, int size);
 WK_EXPORT void WKBundleSetFrameFlatteningEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
 WK_EXPORT void WKBundleSetJavaScriptCanAccessClipboard(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
-WK_EXPORT void WKBundleSetPrivateBrowsingEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundlePageRef pageRef, bool enabled);
 WK_EXPORT void WKBundleSetPopupBlockingEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
 WK_EXPORT void WKBundleSetAuthorAndUserStylesEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
 WK_EXPORT void WKBundleSetSpatialNavigationEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
index 1f68d24..546b51a 100644 (file)
@@ -346,29 +346,6 @@ void InjectedBundle::setJavaScriptCanAccessClipboard(WebPageGroupProxy* pageGrou
         (*iter)->settings().setJavaScriptCanAccessClipboard(enabled);
 }
 
-void InjectedBundle::setPrivateBrowsingEnabled(WebPageGroupProxy* pageGroup, WebPage* page, bool enabled)
-{
-    ASSERT(!hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies));
-
-    PAL::SessionID newSessionID = PAL::SessionID::legacyPrivateSessionID();
-    if (enabled) {
-        auto currentSessionID = page->corePage()->sessionID();
-        if (currentSessionID == PAL::SessionID::legacyPrivateSessionID())
-            return;
-        m_initialSessionID = currentSessionID;
-        WebProcess::singleton().ensureLegacyPrivateBrowsingSessionInNetworkProcess();
-    } else {
-        if (!m_initialSessionID)
-            return;
-        newSessionID = *std::exchange(m_initialSessionID, WTF::nullopt);
-    }
-
-    PageGroup::pageGroup(pageGroup->identifier())->setSessionIDForTesting(newSessionID);
-
-    auto webStorageNameSpaceProvider = WebStorageNamespaceProvider::getOrCreate(*pageGroup);
-    webStorageNameSpaceProvider->setSessionIDForTesting(newSessionID);
-}
-
 void InjectedBundle::setPopupBlockingEnabled(WebPageGroupProxy* pageGroup, bool enabled)
 {
     const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages();
index 66299a4..3370c1c 100644 (file)
@@ -105,7 +105,6 @@ public:
     void setAsyncFrameScrollingEnabled(WebPageGroupProxy*, bool);
     void setPluginsEnabled(WebPageGroupProxy*, bool);
     void setJavaScriptCanAccessClipboard(WebPageGroupProxy*, bool);
-    void setPrivateBrowsingEnabled(WebPageGroupProxy*, WebPage*, bool);
     void setPopupBlockingEnabled(WebPageGroupProxy*, bool);
     void setAuthorAndUserStylesEnabled(WebPageGroupProxy*, bool);
     void setSpatialNavigationEnabled(WebPageGroupProxy*, bool);
@@ -174,8 +173,6 @@ private:
 
     std::unique_ptr<API::InjectedBundle::Client> m_client;
 
-    Optional<PAL::SessionID> m_initialSessionID;
-
 #if PLATFORM(COCOA)
     RetainPtr<WKWebProcessBundleParameters> m_bundleParameters;
     RetainPtr<NSSet> m_classesForCoder;
index dd0a600..66e7efd 100644 (file)
@@ -599,11 +599,6 @@ void WebProcess::fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled)
     m_fullKeyboardAccessEnabled = fullKeyboardAccessEnabled;
 }
 
-void WebProcess::ensureLegacyPrivateBrowsingSessionInNetworkProcess()
-{
-    ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::EnsureLegacyPrivateBrowsingSession(), 0);
-}
-
 #if ENABLE(NETSCAPE_PLUGIN_API)
 PluginProcessConnectionManager& WebProcess::pluginProcessConnectionManager()
 {
index be71301..76b8cc7 100644 (file)
@@ -207,8 +207,6 @@ public:
 
     void setCacheModel(CacheModel);
 
-    void ensureLegacyPrivateBrowsingSessionInNetworkProcess();
-
     void pageDidEnterWindow(WebCore::PageIdentifier);
     void pageWillLeaveWindow(WebCore::PageIdentifier);
 
index e1e3a74..0cbe770 100644 (file)
@@ -122,11 +122,9 @@ Ref<StorageNamespace> StorageNamespaceImpl::copy(Page& newPage)
     return adoptRef(*new StorageNamespaceImpl(m_storageType, WebPage::fromCorePage(newPage).sessionStorageNamespaceIdentifier(), WebPage::fromCorePage(newPage).identifier(), m_topLevelOrigin.get(), m_quotaInBytes, newPage.sessionID()));
 }
 
-void StorageNamespaceImpl::setSessionIDForTesting(PAL::SessionID sessionID)
+void StorageNamespaceImpl::setSessionIDForTesting(PAL::SessionID)
 {
-    m_sessionID = sessionID;
-    for (auto storageAreaMap : m_storageAreaMaps.values())
-        storageAreaMap->disconnect();
+    ASSERT_NOT_REACHED();
 }
 
 PageIdentifier StorageNamespaceImpl::sessionStoragePageID() const
index 52e2d20..c624221 100644 (file)
@@ -1,3 +1,18 @@
+2019-09-12  Chris Dumez  <cdumez@apple.com>
+
+        [WKTR] Drop TestRunner.setPrivateBrowsingEnabled_DEPRECATED()
+        https://bugs.webkit.org/show_bug.cgi?id=201546
+
+        Reviewed by Alex Christensen.
+
+        Drop TestRunner.setPrivateBrowsingEnabled_DEPRECATED() from WebKitTestRunner as it does not do
+        the right thing for WebKit2 and tests have been rewritten to not use it.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setPrivateBrowsingEnabled_DEPRECATED): Deleted.
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+
 2019-09-12  Brady Eidson  <beidson@apple.com>
 
         PDF exporting on iOS should include URL rects.
index 42d3660..f534bb0 100644 (file)
@@ -104,10 +104,6 @@ interface TestRunner {
     void setNavigationGesturesEnabled(boolean value);
     void setIgnoresViewportScaleLimits(boolean value);
     void setShouldDownloadUndisplayableMIMETypes(boolean value);
-    
-    // DEPRECATED: Use <!-- webkit-test-runner [ useEphemeralSession=true ] --> instead, or
-    // testRunner.setShouldSwapToEphemeralSessionOnNextNavigation() / testRunner.setShouldSwapToDefaultSessionOnNextNavigation().
-    void setPrivateBrowsingEnabled_DEPRECATED(boolean value);
 
     // Special DOM functions.
     void clearBackForwardList();
index a93eb0f..7339afc 100644 (file)
@@ -497,7 +497,6 @@ void InjectedBundle::beginTesting(WKDictionaryRef settings, BegingTestingMode te
     // Don't change experimental or internal features here; those should be set in TestController::resetPreferencesToConsistentValues().
     WKBundleSetAllowUniversalAccessFromFileURLs(m_bundle, m_pageGroup, true);
     WKBundleSetJavaScriptCanAccessClipboard(m_bundle, m_pageGroup, true);
-    WKBundleSetPrivateBrowsingEnabled(m_bundle, m_pageGroup, page()->page(), false);
     WKBundleSetAuthorAndUserStylesEnabled(m_bundle, m_pageGroup, true);
     WKBundleSetFrameFlatteningEnabled(m_bundle, m_pageGroup, false);
     WKBundleSetMinimumLogicalFontSize(m_bundle, m_pageGroup, 9);
index 07cac60..1574ec4 100644 (file)
@@ -549,12 +549,6 @@ void TestRunner::setJavaScriptCanAccessClipboard(bool enabled)
     WKBundleSetJavaScriptCanAccessClipboard(injectedBundle.bundle(), injectedBundle.pageGroup(), enabled);
 }
 
-void TestRunner::setPrivateBrowsingEnabled_DEPRECATED(bool enabled)
-{
-    auto& injectedBundle = InjectedBundle::singleton();
-    WKBundleSetPrivateBrowsingEnabled(injectedBundle.bundle(), injectedBundle.pageGroup(), injectedBundle.page()->page(), enabled);
-}
-
 void TestRunner::setPopupBlockingEnabled(bool enabled)
 {
     auto& injectedBundle = InjectedBundle::singleton();
index 09af3bd..939b6be 100644 (file)
@@ -112,7 +112,6 @@ public:
     void setNeedsStorageAccessFromFileURLsQuirk(bool);
     void setPluginsEnabled(bool);
     void setJavaScriptCanAccessClipboard(bool);
-    void setPrivateBrowsingEnabled_DEPRECATED(bool);
     void setPopupBlockingEnabled(bool);
     void setAuthorAndUserStylesEnabled(bool);
     void setCustomPolicyDelegate(bool enabled, bool permissive = false);