Title: [293244] branches/safari-613.2.7.0-branch

Diff

Modified: branches/safari-613.2.7.0-branch/Source/WebKit/ChangeLog (293243 => 293244)


--- branches/safari-613.2.7.0-branch/Source/WebKit/ChangeLog	2022-04-22 20:35:46 UTC (rev 293243)
+++ branches/safari-613.2.7.0-branch/Source/WebKit/ChangeLog	2022-04-22 20:35:51 UTC (rev 293244)
@@ -208,74 +208,6 @@
 
 2022-04-19  Alan Coon  <alanc...@apple.com>
 
-        Cherry-pick r291606. rdar://problem/91446317
-
-    Website policies are not respected when doing COOP based process swap
-    https://bugs.webkit.org/show_bug.cgi?id=238036
-    <rdar://89616625>
-    
-    Reviewed by Chris Dumez.
-    
-    Source/WebKit:
-    
-    In case of normal process swap, we make use of website policies so everything is fine.
-    For COOP based process swap, this happens later on, at a point where we lost website policies.
-    To overcome this, we store the website policies used by a navigation inside the API::Navigation object.
-    It is used by continueNavigationInNewProcess to correctly initialize the new WebPage website policies.
-    We then set the website policies in the navigation object just before continuing the load in the same process,
-    as process swap may happen later when inspecting the response.
-    Minor refactoring in continueNavigationInNewProcess to get the policies directly from the given Navigation object.
-    Minor refactoring in receivedNavigationPolicyDecision to make the code doing process swap clearer.
-    
-    Covered by API test.
-    
-    * UIProcess/API/APINavigation.h:
-    (API::Navigation::setWebsitePoliciesForProcessSwap):
-    (API::Navigation::takeWebsitePoliciesForProcessSwap):
-    * UIProcess/WebPageProxy.cpp:
-    (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
-    (WebKit::WebPageProxy::receivedPolicyDecision):
-    (WebKit::WebPageProxy::continueNavigationInNewProcess):
-    (WebKit::WebPageProxy::triggerBrowsingContextGroupSwitchForNavigation):
-    * UIProcess/WebPageProxy.h:
-    
-    Tools:
-    
-    * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
-    
-    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291606 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
-    2022-03-22  Youenn Fablet  <you...@apple.com>
-
-            Website policies are not respected when doing COOP based process swap
-            https://bugs.webkit.org/show_bug.cgi?id=238036
-            <rdar://89616625>
-
-            Reviewed by Chris Dumez.
-
-            In case of normal process swap, we make use of website policies so everything is fine.
-            For COOP based process swap, this happens later on, at a point where we lost website policies.
-            To overcome this, we store the website policies used by a navigation inside the API::Navigation object.
-            It is used by continueNavigationInNewProcess to correctly initialize the new WebPage website policies.
-            We then set the website policies in the navigation object just before continuing the load in the same process,
-            as process swap may happen later when inspecting the response.
-            Minor refactoring in continueNavigationInNewProcess to get the policies directly from the given Navigation object.
-            Minor refactoring in receivedNavigationPolicyDecision to make the code doing process swap clearer.
-
-            Covered by API test.
-
-            * UIProcess/API/APINavigation.h:
-            (API::Navigation::setWebsitePoliciesForProcessSwap):
-            (API::Navigation::takeWebsitePoliciesForProcessSwap):
-            * UIProcess/WebPageProxy.cpp:
-            (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
-            (WebKit::WebPageProxy::receivedPolicyDecision):
-            (WebKit::WebPageProxy::continueNavigationInNewProcess):
-            (WebKit::WebPageProxy::triggerBrowsingContextGroupSwitchForNavigation):
-            * UIProcess/WebPageProxy.h:
-
-2022-04-19  Alan Coon  <alanc...@apple.com>
-
         Cherry-pick r291689. rdar://problem/88461772
 
     REGRESSION (iOS 15.1 / r280824) QuickLook - model not loading when passing extra parameters

Modified: branches/safari-613.2.7.0-branch/Source/WebKit/UIProcess/API/APINavigation.h (293243 => 293244)


--- branches/safari-613.2.7.0-branch/Source/WebKit/UIProcess/API/APINavigation.h	2022-04-22 20:35:46 UTC (rev 293243)
+++ branches/safari-613.2.7.0-branch/Source/WebKit/UIProcess/API/APINavigation.h	2022-04-22 20:35:51 UTC (rev 293244)
@@ -26,7 +26,6 @@
 #pragma once
 
 #include "APIObject.h"
-#include "APIWebsitePolicies.h"
 #include "DataReference.h"
 #include "FrameInfoData.h"
 #include "NavigationActionData.h"
@@ -172,9 +171,6 @@
     void setIsLoadedWithNavigationShared(bool value) { m_isLoadedWithNavigationShared = value; }
     bool isLoadedWithNavigationShared() const { return m_isLoadedWithNavigationShared; }
 
-    void setWebsitePolicies(RefPtr<API::WebsitePolicies>&& policies) { m_websitePolicies = WTFMove(policies); }
-    API::WebsitePolicies* websitePolicies() { return m_websitePolicies.get(); }
-
 private:
     explicit Navigation(WebKit::WebNavigationState&);
     Navigation(WebKit::WebNavigationState&, WebKit::WebBackForwardListItem*);
@@ -201,7 +197,6 @@
     WebKit::WebContentMode m_effectiveContentMode { WebKit::WebContentMode::Recommended };
     WebKit::ProcessThrottler::TimedActivity m_clientNavigationActivity;
     bool m_isLoadedWithNavigationShared { false };
-    RefPtr<API::WebsitePolicies> m_websitePolicies;
 };
 
 } // namespace API

Modified: branches/safari-613.2.7.0-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (293243 => 293244)


--- branches/safari-613.2.7.0-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2022-04-22 20:35:46 UTC (rev 293243)
+++ branches/safari-613.2.7.0-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2022-04-22 20:35:51 UTC (rev 293244)
@@ -3400,12 +3400,12 @@
 #endif
 }
 
-void WebPageProxy::receivedNavigationPolicyDecision(PolicyAction policyAction, API::Navigation* navigation, Ref<API::NavigationAction>&& navigationAction, ProcessSwapRequestedByClient processSwapRequestedByClient, WebFrameProxy& frame, const FrameInfoData& frameInfo, Ref<PolicyDecisionSender>&& sender)
+void WebPageProxy::receivedNavigationPolicyDecision(PolicyAction policyAction, API::Navigation* navigation, Ref<API::NavigationAction>&& navigationAction, ProcessSwapRequestedByClient processSwapRequestedByClient, WebFrameProxy& frame, const FrameInfoData& frameInfo, RefPtr<API::WebsitePolicies>&& policies, Ref<PolicyDecisionSender>&& sender)
 {
     WEBPAGEPROXY_RELEASE_LOG(Loading, "receivedNavigationPolicyDecision: frameID=%llu, navigationID=%llu, policyAction=%u", frame.frameID().toUInt64(), navigation ? navigation->navigationID() : 0, (unsigned)policyAction);
 
     Ref<WebsiteDataStore> websiteDataStore = m_websiteDataStore.copyRef();
-    if (auto* policies = navigation->websitePolicies()) {
+    if (policies) {
         if (policies->websiteDataStore() && policies->websiteDataStore() != websiteDataStore.ptr()) {
             websiteDataStore = *policies->websiteDataStore();
             processSwapRequestedByClient = ProcessSwapRequestedByClient::Yes;
@@ -3415,18 +3415,18 @@
     }
 
     if (navigation && !navigation->userContentExtensionsEnabled()) {
-        if (!navigation->websitePolicies())
-            navigation->setWebsitePolicies(API::WebsitePolicies::create());
-        navigation->websitePolicies()->setContentBlockersEnabled(false);
+        if (!policies)
+            policies = API::WebsitePolicies::create();
+        policies->setContentBlockersEnabled(false);
     }
 
 #if ENABLE(DEVICE_ORIENTATION)
-    if (navigation && (!navigation->websitePolicies() || navigation->websitePolicies()->deviceOrientationAndMotionAccessState() == WebCore::DeviceOrientationOrMotionPermissionState::Prompt)) {
+    if (navigation && (!policies || policies->deviceOrientationAndMotionAccessState() == WebCore::DeviceOrientationOrMotionPermissionState::Prompt)) {
         auto deviceOrientationPermission = websiteDataStore->deviceOrientationAndMotionAccessController().cachedDeviceOrientationPermission(SecurityOriginData::fromURL(navigation->currentRequest().url()));
         if (deviceOrientationPermission != WebCore::DeviceOrientationOrMotionPermissionState::Prompt) {
-            if (!navigation->websitePolicies())
-                navigation->setWebsitePolicies(API::WebsitePolicies::create());
-            navigation->websitePolicies()->setDeviceOrientationAndMotionAccessState(deviceOrientationPermission);
+            if (!policies)
+                policies = API::WebsitePolicies::create();
+            policies->setDeviceOrientationAndMotionAccessState(deviceOrientationPermission);
         }
     }
 #endif
@@ -3440,7 +3440,7 @@
         policyAction = PolicyAction::Download;
 
     if (policyAction != PolicyAction::Use || !frame.isMainFrame() || !navigation) {
-        receivedPolicyDecision(policyAction, navigation, navigation->websitePolicies(), WTFMove(navigationAction), WTFMove(sender));
+        receivedPolicyDecision(policyAction, navigation, WTFMove(policies), WTFMove(navigationAction), WTFMove(sender));
         return;
     }
 
@@ -3453,12 +3453,13 @@
         }
     }
 
-    m_isCaptivePortalModeExplicitlySet = (navigation->websitePolicies() && navigation->websitePolicies()->isCaptivePortalModeExplicitlySet()) || m_configuration->isCaptivePortalModeExplicitlySet();
-    auto captivePortalMode = (navigation->websitePolicies() ? navigation->websitePolicies()->captivePortalModeEnabled() : shouldEnableCaptivePortalMode()) ? WebProcessProxy::CaptivePortalMode::Enabled : WebProcessProxy::CaptivePortalMode::Disabled;
-    process().processPool().processForNavigation(*this, *navigation, sourceProcess.copyRef(), sourceURL, processSwapRequestedByClient, captivePortalMode, frameInfo, WTFMove(websiteDataStore), [this, protectedThis = Ref { *this }, policyAction, navigation = Ref { *navigation }, navigationAction = WTFMove(navigationAction), sourceProcess = sourceProcess.copyRef(), sender = WTFMove(sender), processSwapRequestedByClient] (Ref<WebProcessProxy>&& processForNavigation, SuspendedPageProxy* destinationSuspendedPage, const String& reason) mutable {
+    m_isCaptivePortalModeExplicitlySet = (policies && policies->isCaptivePortalModeExplicitlySet()) || m_configuration->isCaptivePortalModeExplicitlySet();
+    auto captivePortalMode = (policies ? policies->captivePortalModeEnabled() : shouldEnableCaptivePortalMode()) ? WebProcessProxy::CaptivePortalMode::Enabled : WebProcessProxy::CaptivePortalMode::Disabled;
+    process().processPool().processForNavigation(*this, *navigation, sourceProcess.copyRef(), sourceURL, processSwapRequestedByClient, captivePortalMode, frameInfo, WTFMove(websiteDataStore), [this, protectedThis = Ref { *this }, policyAction, navigation = Ref { *navigation }, navigationAction = WTFMove(navigationAction), sourceProcess = sourceProcess.copyRef(),
+        policies = WTFMove(policies), sender = WTFMove(sender), processSwapRequestedByClient] (Ref<WebProcessProxy>&& processForNavigation, SuspendedPageProxy* destinationSuspendedPage, const String& reason) mutable {
         // If the navigation has been destroyed, then no need to proceed.
         if (isClosed() || !navigationState().hasNavigation(navigation->navigationID())) {
-            receivedPolicyDecision(policyAction, navigation.ptr(), navigation->websitePolicies(), WTFMove(navigationAction), WTFMove(sender));
+            receivedPolicyDecision(policyAction, navigation.ptr(), WTFMove(policies), WTFMove(navigationAction), WTFMove(sender));
             return;
         }
 
@@ -3470,6 +3471,7 @@
         } else
             WEBPAGEPROXY_RELEASE_LOG(ProcessSwapping, "decidePolicyForNavigationAction: keep using process %i for navigation, reason=%" PUBLIC_LOG_STRING, processIdentifier(), reason.utf8().data());
 
+        std::optional<SandboxExtension::Handle> optionalHandle;
         if (shouldProcessSwap) {
             // Make sure the process to be used for the navigation does not get shutDown now due to destroying SuspendedPageProxy or ProvisionalPageProxy objects.
             auto preventNavigationProcessShutdown = processForNavigation->shutdownPreventingScope();
@@ -3487,28 +3489,24 @@
             if (suspendedPage && suspendedPage->pageIsClosedOrClosing())
                 suspendedPage = nullptr;
 
-            continueNavigationInNewProcess(navigation, WTFMove(suspendedPage), WTFMove(processForNavigation), processSwapRequestedByClient, ShouldTreatAsContinuingLoad::YesAfterNavigationPolicyDecision);
-
-            receivedPolicyDecision(policyAction, navigation.ptr(), nullptr, WTFMove(navigationAction), WTFMove(sender), WillContinueLoadInNewProcess::Yes);
-            return;
-        }
-
-        auto item = navigation->reloadItem() ? navigation->reloadItem() : navigation->targetItem();
-        std::optional<SandboxExtension::Handle> optionalHandle;
-        if (policyAction == PolicyAction::Use && item) {
-            URL fullURL { item->url() };
-            if (fullURL.protocolIs("file"_s)) {
-                SandboxExtension::Handle sandboxExtensionHandle;
-                maybeInitializeSandboxExtensionHandle(processForNavigation.get(), fullURL, item->resourceDirectoryURL(), sandboxExtensionHandle);
-                optionalHandle = WTFMove(sandboxExtensionHandle);
+            continueNavigationInNewProcess(navigation, WTFMove(suspendedPage), WTFMove(processForNavigation), processSwapRequestedByClient, ShouldTreatAsContinuingLoad::YesAfterNavigationPolicyDecision, std::exchange(policies, nullptr));
+        } else {
+            auto item = navigation->reloadItem() ? navigation->reloadItem() : navigation->targetItem();
+            if (policyAction == PolicyAction::Use && item) {
+                auto fullURL = URL { URL(), item->url() };
+                if (fullURL.protocolIs("file"_s)) {
+                    SandboxExtension::Handle sandboxExtensionHandle;
+                    maybeInitializeSandboxExtensionHandle(processForNavigation.get(), fullURL, item->resourceDirectoryURL(), sandboxExtensionHandle);
+                    optionalHandle = WTFMove(sandboxExtensionHandle);
+                }
             }
         }
 
-        receivedPolicyDecision(policyAction, navigation.ptr(), navigation->websitePolicies(), WTFMove(navigationAction), WTFMove(sender), WillContinueLoadInNewProcess::No, WTFMove(optionalHandle));
+        receivedPolicyDecision(policyAction, navigation.ptr(), shouldProcessSwap ? nullptr : WTFMove(policies), WTFMove(navigationAction), WTFMove(sender), WTFMove(optionalHandle), shouldProcessSwap ? WillContinueLoadInNewProcess::Yes : WillContinueLoadInNewProcess::No);
     });
 }
 
-void WebPageProxy::receivedPolicyDecision(PolicyAction action, API::Navigation* navigation, RefPtr<API::WebsitePolicies>&& websitePolicies, std::variant<Ref<API::NavigationResponse>, Ref<API::NavigationAction>>&& navigationActionOrResponse, Ref<PolicyDecisionSender>&& sender, WillContinueLoadInNewProcess willContinueLoadInNewProcess, std::optional<SandboxExtension::Handle> sandboxExtensionHandle)
+void WebPageProxy::receivedPolicyDecision(PolicyAction action, API::Navigation* navigation, RefPtr<API::WebsitePolicies>&& websitePolicies, std::variant<Ref<API::NavigationResponse>, Ref<API::NavigationAction>>&& navigationActionOrResponse, Ref<PolicyDecisionSender>&& sender, std::optional<SandboxExtension::Handle> sandboxExtensionHandle, WillContinueLoadInNewProcess willContinueLoadInNewProcess)
 {
     if (!hasRunningProcess()) {
         sender->send(PolicyDecision { sender->identifier(), isNavigatingToAppBoundDomain(), PolicyAction::Ignore, 0, std::nullopt, std::nullopt });
@@ -3598,7 +3596,7 @@
     m_provisionalPage = nullptr;
 }
 
-void WebPageProxy::continueNavigationInNewProcess(API::Navigation& navigation, std::unique_ptr<SuspendedPageProxy>&& suspendedPage, Ref<WebProcessProxy>&& newProcess, ProcessSwapRequestedByClient processSwapRequestedByClient, ShouldTreatAsContinuingLoad shouldTreatAsContinuingLoad, std::optional<NetworkResourceLoadIdentifier> existingNetworkResourceLoadIdentifierToResume)
+void WebPageProxy::continueNavigationInNewProcess(API::Navigation& navigation, std::unique_ptr<SuspendedPageProxy>&& suspendedPage, Ref<WebProcessProxy>&& newProcess, ProcessSwapRequestedByClient processSwapRequestedByClient, ShouldTreatAsContinuingLoad shouldTreatAsContinuingLoad, RefPtr<API::WebsitePolicies>&& websitePolicies, std::optional<NetworkResourceLoadIdentifier> existingNetworkResourceLoadIdentifierToResume)
 {
     WEBPAGEPROXY_RELEASE_LOG(Loading, "continueNavigationInNewProcess: newProcessPID=%i, hasSuspendedPage=%i", newProcess->processIdentifier(), !!suspendedPage);
     LOG(Loading, "Continuing navigation %" PRIu64 " '%s' in a new web process", navigation.navigationID(), navigation.loggingString());
@@ -3612,7 +3610,6 @@
         m_provisionalPage = nullptr;
     }
 
-    RefPtr websitePolicies = navigation.websitePolicies();
     bool isServerSideRedirect = shouldTreatAsContinuingLoad == ShouldTreatAsContinuingLoad::YesAfterNavigationPolicyDecision && navigation.currentRequestIsRedirect();
     bool isProcessSwappingOnNavigationResponse = shouldTreatAsContinuingLoad == ShouldTreatAsContinuingLoad::YesAfterProvisionalLoadStarted;
     m_provisionalPage = makeUnique<ProvisionalPageProxy>(*this, WTFMove(newProcess), WTFMove(suspendedPage), navigation.navigationID(), isServerSideRedirect, navigation.currentRequest(), processSwapRequestedByClient, isProcessSwappingOnNavigationResponse, websitePolicies.get());
@@ -5475,17 +5472,16 @@
     Ref listener = frame.setUpPolicyListenerProxy([this, protectedThis = Ref { *this }, frame = Ref { frame }, sender = WTFMove(sender), navigation, navigationAction, frameInfo, userDataObject = process->transformHandlesToObjects(userData.object()).get()] (PolicyAction policyAction, API::WebsitePolicies* policies, ProcessSwapRequestedByClient processSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&& safeBrowsingWarning, std::optional<NavigatingToAppBoundDomain> isAppBoundDomain) mutable {
         WEBPAGEPROXY_RELEASE_LOG(Loading, "decidePolicyForNavigationAction: listener called: frameID=%llu, navigationID=%llu, policyAction=%u, safeBrowsingWarning=%d, isAppBoundDomain=%d", frame->frameID().toUInt64(), navigation ? navigation->navigationID() : 0, (unsigned)policyAction, !!safeBrowsingWarning, !!isAppBoundDomain);
 
-        navigation->setWebsitePolicies(WTFMove(policies));
-        auto completionHandler = [this, protectedThis, frame, frameInfo, sender = WTFMove(sender), navigation, navigationAction = WTFMove(navigationAction), processSwapRequestedByClient] (PolicyAction policyAction) mutable {
+        auto completionHandler = [this, protectedThis, frame, frameInfo, sender = WTFMove(sender), navigation, navigationAction = WTFMove(navigationAction), processSwapRequestedByClient, policies = RefPtr { policies }] (PolicyAction policyAction) mutable {
             if (frame->isMainFrame()) {
-                if (!navigation->websitePolicies()) {
+                if (!policies) {
                     if (auto* defaultPolicies = m_configuration->defaultWebsitePolicies())
-                        navigation->setWebsitePolicies(defaultPolicies->copy());
+                        policies = defaultPolicies->copy();
                 }
-                if (auto* policies = navigation->websitePolicies())
+                if (policies)
                     navigation->setEffectiveContentMode(effectiveContentModeAfterAdjustingPolicies(*policies, navigation->currentRequest()));
             }
-            receivedNavigationPolicyDecision(policyAction, navigation.get(), WTFMove(navigationAction), processSwapRequestedByClient, frame, frameInfo, WTFMove(sender));
+            receivedNavigationPolicyDecision(policyAction, navigation.get(), WTFMove(navigationAction), processSwapRequestedByClient, frame, frameInfo, WTFMove(policies), WTFMove(sender));
         };
 
 #if ENABLE(APP_BOUND_DOMAINS)
@@ -5743,7 +5739,7 @@
     else
         processForNavigation = m_process->processPool().processForRegistrableDomain(websiteDataStore(), responseDomain, m_process->captivePortalMode());
 
-    continueNavigationInNewProcess(*navigation, nullptr, processForNavigation.releaseNonNull(), ProcessSwapRequestedByClient::No, ShouldTreatAsContinuingLoad::YesAfterProvisionalLoadStarted, existingNetworkResourceLoadIdentifierToResume);
+    continueNavigationInNewProcess(*navigation, nullptr, processForNavigation.releaseNonNull(), ProcessSwapRequestedByClient::No, ShouldTreatAsContinuingLoad::YesAfterProvisionalLoadStarted, nullptr, existingNetworkResourceLoadIdentifierToResume);
     completionHandler(true);
 }
 

Modified: branches/safari-613.2.7.0-branch/Source/WebKit/UIProcess/WebPageProxy.h (293243 => 293244)


--- branches/safari-613.2.7.0-branch/Source/WebKit/UIProcess/WebPageProxy.h	2022-04-22 20:35:46 UTC (rev 293243)
+++ branches/safari-613.2.7.0-branch/Source/WebKit/UIProcess/WebPageProxy.h	2022-04-22 20:35:51 UTC (rev 293244)
@@ -1248,8 +1248,8 @@
 
     class PolicyDecisionSender;
     enum class WillContinueLoadInNewProcess : bool { No, Yes };
-    void receivedPolicyDecision(WebCore::PolicyAction, API::Navigation*, RefPtr<API::WebsitePolicies>&&, std::variant<Ref<API::NavigationResponse>, Ref<API::NavigationAction>>&&, Ref<PolicyDecisionSender>&&, WillContinueLoadInNewProcess = WillContinueLoadInNewProcess::No, std::optional<SandboxExtension::Handle> = { });
-    void receivedNavigationPolicyDecision(WebCore::PolicyAction, API::Navigation*, Ref<API::NavigationAction>&&, ProcessSwapRequestedByClient, WebFrameProxy&, const FrameInfoData&, Ref<PolicyDecisionSender>&&);
+    void receivedPolicyDecision(WebCore::PolicyAction, API::Navigation*, RefPtr<API::WebsitePolicies>&&, std::variant<Ref<API::NavigationResponse>, Ref<API::NavigationAction>>&&, Ref<PolicyDecisionSender>&&, std::optional<SandboxExtension::Handle> = { }, WillContinueLoadInNewProcess = WillContinueLoadInNewProcess::No);
+    void receivedNavigationPolicyDecision(WebCore::PolicyAction, API::Navigation*, Ref<API::NavigationAction>&&, ProcessSwapRequestedByClient, WebFrameProxy&, const FrameInfoData&, RefPtr<API::WebsitePolicies>&&, Ref<PolicyDecisionSender>&&);
 
     void backForwardRemovedItem(const WebCore::BackForwardItemIdentifier&);
 
@@ -2511,7 +2511,7 @@
 
     void reportPageLoadResult(const WebCore::ResourceError& = { });
 
-    void continueNavigationInNewProcess(API::Navigation&, std::unique_ptr<SuspendedPageProxy>&&, Ref<WebProcessProxy>&&, ProcessSwapRequestedByClient, WebCore::ShouldTreatAsContinuingLoad, std::optional<NetworkResourceLoadIdentifier> existingNetworkResourceLoadIdentifierToResume = std::nullopt);
+    void continueNavigationInNewProcess(API::Navigation&, std::unique_ptr<SuspendedPageProxy>&&, Ref<WebProcessProxy>&&, ProcessSwapRequestedByClient, WebCore::ShouldTreatAsContinuingLoad, RefPtr<API::WebsitePolicies>&&, std::optional<NetworkResourceLoadIdentifier> existingNetworkResourceLoadIdentifierToResume = std::nullopt);
 
     void setNeedsFontAttributes(bool);
     void updateFontAttributesAfterEditorStateChange();

Modified: branches/safari-613.2.7.0-branch/Tools/ChangeLog (293243 => 293244)


--- branches/safari-613.2.7.0-branch/Tools/ChangeLog	2022-04-22 20:35:46 UTC (rev 293243)
+++ branches/safari-613.2.7.0-branch/Tools/ChangeLog	2022-04-22 20:35:51 UTC (rev 293244)
@@ -68,55 +68,6 @@
             * TestWebKitAPI/Tests/WebKitCocoa/YoutubeReplacementPlugin.mm: Added.
             (TEST):
 
-2022-04-19  Alan Coon  <alanc...@apple.com>
-
-        Cherry-pick r291606. rdar://problem/91446317
-
-    Website policies are not respected when doing COOP based process swap
-    https://bugs.webkit.org/show_bug.cgi?id=238036
-    <rdar://89616625>
-    
-    Reviewed by Chris Dumez.
-    
-    Source/WebKit:
-    
-    In case of normal process swap, we make use of website policies so everything is fine.
-    For COOP based process swap, this happens later on, at a point where we lost website policies.
-    To overcome this, we store the website policies used by a navigation inside the API::Navigation object.
-    It is used by continueNavigationInNewProcess to correctly initialize the new WebPage website policies.
-    We then set the website policies in the navigation object just before continuing the load in the same process,
-    as process swap may happen later when inspecting the response.
-    Minor refactoring in continueNavigationInNewProcess to get the policies directly from the given Navigation object.
-    Minor refactoring in receivedNavigationPolicyDecision to make the code doing process swap clearer.
-    
-    Covered by API test.
-    
-    * UIProcess/API/APINavigation.h:
-    (API::Navigation::setWebsitePoliciesForProcessSwap):
-    (API::Navigation::takeWebsitePoliciesForProcessSwap):
-    * UIProcess/WebPageProxy.cpp:
-    (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
-    (WebKit::WebPageProxy::receivedPolicyDecision):
-    (WebKit::WebPageProxy::continueNavigationInNewProcess):
-    (WebKit::WebPageProxy::triggerBrowsingContextGroupSwitchForNavigation):
-    * UIProcess/WebPageProxy.h:
-    
-    Tools:
-    
-    * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
-    
-    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291606 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
-    2022-03-22  Youenn Fablet  <you...@apple.com>
-
-            Website policies are not respected when doing COOP based process swap
-            https://bugs.webkit.org/show_bug.cgi?id=238036
-            <rdar://89616625>
-
-            Reviewed by Chris Dumez.
-
-            * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
-
 2022-04-18  Kocsen Chung  <kocsen_ch...@apple.com>
 
         Cherry-pick r292401. rdar://problem/83168970

Modified: branches/safari-613.2.7.0-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (293243 => 293244)


--- branches/safari-613.2.7.0-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2022-04-22 20:35:46 UTC (rev 293243)
+++ branches/safari-613.2.7.0-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2022-04-22 20:35:51 UTC (rev 293244)
@@ -8258,152 +8258,3 @@
 }
 
 #endif
-
-#if PLATFORM(IOS_FAMILY)
-TEST(ProcessSwap, ContentModeInCaseOfCoopProcessSwap)
-{
-    using namespace TestWebKitAPI;
-
-    HTTPServer server({
-        { "/source.html", { "foo" } },
-        { "/destination.html", { { { "Content-Type", "text/html" }, { "Cross-Origin-Opener-Policy", "same-origin" } }, "bar" } },
-    }, HTTPServer::Protocol::Https);
-
-    auto processPoolConfiguration = psonProcessPoolConfiguration();
-    auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
-
-    auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
-    [webViewConfiguration setProcessPool:processPool.get()];
-
-    auto webpagePreferences = adoptNS([[WKWebpagePreferences alloc] init]);
-    [webpagePreferences setPreferredContentMode:WKContentModeDesktop];
-    [webViewConfiguration setDefaultWebpagePreferences:webpagePreferences.get()];
-
-    auto webView = adoptNS([[WKWebView alloc] initWithFrame:CGRectMake(0, 0, 1024, 768) configuration:webViewConfiguration.get()]);
-    auto navigationDelegate = adoptNS([[PSONNavigationDelegate alloc] init]);
-    [webView setNavigationDelegate:navigationDelegate.get()];
-
-    done = false;
-    [webView loadRequest:server.request("/source.html")];
-    Util::run(&done);
-    done = false;
-
-    [webView evaluateJavaScript:@"navigator.userAgent;" completionHandler:^(id _Nullable response, NSError * _Nullable error) {
-        done = true;
-
-        ASSERT_TRUE(!error);
-        NSString *userAgent = (NSString *)response;
-        ASSERT_TRUE([userAgent containsString:@"Macintosh; Intel Mac"]);
-    }];
-    Util::run(&done);
-    done = false;
-
-    auto pid1 = [webView _webProcessIdentifier];
-
-    [webView loadRequest:server.request("/destination.html")];
-    Util::run(&done);
-    done = false;
-
-    [webView evaluateJavaScript:@"navigator.userAgent;" completionHandler:^(id _Nullable response, NSError * _Nullable error) {
-        done = true;
-
-        ASSERT_TRUE(!error);
-        NSString *userAgent = (NSString *)response;
-        ASSERT_TRUE([userAgent containsString:@"Macintosh; Intel Mac"]);
-    }];
-    Util::run(&done);
-    done = false;
-
-    auto pid2 = [webView _webProcessIdentifier];
-    EXPECT_NE(pid1, pid2);
-
-    [webView goBack]; // Back to source.html.
-    Util::run(&done);
-    done = false;
-
-    [webView evaluateJavaScript:@"navigator.userAgent;" completionHandler:^(id _Nullable response, NSError * _Nullable error) {
-        done = true;
-
-        ASSERT_TRUE(!error);
-        NSString *userAgent = (NSString *)response;
-        ASSERT_TRUE([userAgent containsString:@"Macintosh; Intel Mac"]);
-    }];
-    Util::run(&done);
-    done = false;
-}
-
-TEST(ProcessSwap, ContentModeInCaseOfPSONThenCoopProcessSwap)
-{
-    using namespace TestWebKitAPI;
-
-    HTTPServer server1({
-        { "/source.html", { "foo" } },
-    }, HTTPServer::Protocol::Https);
-
-    HTTPServer server2({
-        { "/destination.html", { { { "Content-Type", "text/html" }, { "Cross-Origin-Opener-Policy", "same-origin" } }, "bar" } },
-    }, HTTPServer::Protocol::Http);
-
-    auto processPoolConfiguration = psonProcessPoolConfiguration();
-    auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
-
-    auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
-    [webViewConfiguration setProcessPool:processPool.get()];
-
-    auto webpagePreferences = adoptNS([[WKWebpagePreferences alloc] init]);
-    [webpagePreferences setPreferredContentMode:WKContentModeDesktop];
-    [webViewConfiguration setDefaultWebpagePreferences:webpagePreferences.get()];
-
-    auto webView = adoptNS([[WKWebView alloc] initWithFrame:CGRectMake(0, 0, 1024, 768) configuration:webViewConfiguration.get()]);
-    auto navigationDelegate = adoptNS([[PSONNavigationDelegate alloc] init]);
-    [webView setNavigationDelegate:navigationDelegate.get()];
-
-    done = false;
-    [webView loadRequest:server1.request("/source.html")];
-    Util::run(&done);
-    done = false;
-
-    [webView evaluateJavaScript:@"navigator.userAgent;" completionHandler:^(id _Nullable response, NSError * _Nullable error) {
-        done = true;
-
-        ASSERT_TRUE(!error);
-        NSString *userAgent = (NSString *)response;
-        ASSERT_TRUE([userAgent containsString:@"Macintosh; Intel Mac"]);
-    }];
-    Util::run(&done);
-    done = false;
-
-    auto pid1 = [webView _webProcessIdentifier];
-
-    [webView loadRequest:server2.request("/destination.html")];
-    Util::run(&done);
-    done = false;
-
-    [webView evaluateJavaScript:@"navigator.userAgent;" completionHandler:^(id _Nullable response, NSError * _Nullable error) {
-        done = true;
-
-        ASSERT_TRUE(!error);
-        NSString *userAgent = (NSString *)response;
-        ASSERT_TRUE([userAgent containsString:@"Macintosh; Intel Mac"]);
-    }];
-    Util::run(&done);
-    done = false;
-
-    auto pid2 = [webView _webProcessIdentifier];
-    EXPECT_NE(pid1, pid2);
-
-    [webView goBack]; // Back to source.html.
-    Util::run(&done);
-    done = false;
-
-    [webView evaluateJavaScript:@"navigator.userAgent;" completionHandler:^(id _Nullable response, NSError * _Nullable error) {
-        done = true;
-
-        ASSERT_TRUE(!error);
-        NSString *userAgent = (NSString *)response;
-        ASSERT_TRUE([userAgent containsString:@"Macintosh; Intel Mac"]);
-    }];
-    Util::run(&done);
-    done = false;
-}
-#endif // PLATFORM(IOS_FAMILY)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to