Modified: trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp (236029 => 236030)
--- trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp 2018-09-15 00:46:47 UTC (rev 236029)
+++ trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp 2018-09-15 01:20:27 UTC (rev 236030)
@@ -177,11 +177,11 @@
m_title = title;
}
-WebFramePolicyListenerProxy& WebFrameProxy::setUpPolicyListenerProxy(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient, Vector<Ref<SafeBrowsingResult>>&&)>&& completionHandler, ShouldExpectSafeBrowsingResult expect)
+WebFramePolicyListenerProxy& WebFrameProxy::setUpPolicyListenerProxy(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient, Vector<SafeBrowsingResult>&&)>&& completionHandler, ShouldExpectSafeBrowsingResult expect)
{
if (m_activeListener)
m_activeListener->ignore();
- m_activeListener = WebFramePolicyListenerProxy::create([this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)] (WebCore::PolicyAction action, API::WebsitePolicies* policies, ProcessSwapRequestedByClient processSwapRequestedByClient, Vector<Ref<SafeBrowsingResult>>&& safeBrowsingResults) mutable {
+ m_activeListener = WebFramePolicyListenerProxy::create([this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)] (WebCore::PolicyAction action, API::WebsitePolicies* policies, ProcessSwapRequestedByClient processSwapRequestedByClient, Vector<SafeBrowsingResult>&& safeBrowsingResults) mutable {
completionHandler(action, policies, processSwapRequestedByClient, WTFMove(safeBrowsingResults));
m_activeListener = nullptr;
}, expect);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (236029 => 236030)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-09-15 00:46:47 UTC (rev 236029)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-09-15 01:20:27 UTC (rev 236030)
@@ -2431,36 +2431,7 @@
SendFunction m_sendFunction;
};
-
-void WebPageProxy::receivedNavigationPolicyDecision(PolicyAction policyAction, API::Navigation& navigation, ProcessSwapRequestedByClient processSwapRequestedByClient, WebFrameProxy& frame, API::WebsitePolicies* policies, Ref<PolicyDecisionSender>&& sender)
-{
- std::optional<WebsitePoliciesData> data;
- if (policies) {
- data = ""
- if (policies->websiteDataStore())
- changeWebsiteDataStore(policies->websiteDataStore()->websiteDataStore());
- }
- if (policyAction == PolicyAction::Use && frame.isMainFrame()) {
- String reason;
- auto proposedProcess = process().processPool().processForNavigation(*this, navigation, processSwapRequestedByClient, policyAction, reason);
- ASSERT(!reason.isNull());
-
- if (proposedProcess.ptr() != &process()) {
- RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "%p - WebPageProxy::decidePolicyForNavigationAction, swapping process %i with process %i for navigation, reason: %{public}s", this, processIdentifier(), proposedProcess->processIdentifier(), reason.utf8().data());
- LOG(ProcessSwapping, "(ProcessSwapping) Switching from process %i to new process (%i) for navigation %" PRIu64 " '%s'", processIdentifier(), proposedProcess->processIdentifier(), navigation.navigationID(), navigation.loggingString());
-
- RunLoop::main().dispatch([this, protectedThis = makeRef(*this), navigation = makeRef(navigation), proposedProcess = WTFMove(proposedProcess)]() mutable {
- continueNavigationInNewProcess(navigation, WTFMove(proposedProcess));
- });
- } else
- RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "%p - WebPageProxy::decidePolicyForNavigationAction, keep using process %i for navigation, reason: %{public}s", this, processIdentifier(), reason.utf8().data());
- }
-
- receivedPolicyDecision(policyAction, &navigation, WTFMove(data), WTFMove(sender));
-
-}
-
void WebPageProxy::receivedPolicyDecision(PolicyAction action, API::Navigation* navigation, std::optional<WebsitePoliciesData>&& websitePolicies, Ref<PolicyDecisionSender>&& sender)
{
if (!isValid()) {
@@ -4062,9 +4033,33 @@
UNUSED_PARAM(newNavigationID);
#endif
- auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), frame = makeRef(*frame), sender = WTFMove(sender), navigation = navigation.releaseNonNull()] (WebCore::PolicyAction policyAction, API::WebsitePolicies* policies, ProcessSwapRequestedByClient processSwapRequestedByClient, Vector<Ref<SafeBrowsingResult>>&&) mutable {
+ auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), frame = makeRef(*frame), sender = sender.copyRef(), navigation] (WebCore::PolicyAction policyAction, API::WebsitePolicies* policies, ProcessSwapRequestedByClient processSwapRequestedByClient, Vector<SafeBrowsingResult>&&) mutable {
// FIXME: do something with the SafeBrowsingResults.
- receivedNavigationPolicyDecision(policyAction, navigation, processSwapRequestedByClient, frame, policies, WTFMove(sender));
+
+ std::optional<WebsitePoliciesData> data;
+ if (policies) {
+ data = ""
+ if (policies->websiteDataStore())
+ changeWebsiteDataStore(policies->websiteDataStore()->websiteDataStore());
+ }
+
+ if (policyAction == PolicyAction::Use && frame->isMainFrame()) {
+ String reason;
+ auto proposedProcess = process().processPool().processForNavigation(*this, *navigation, processSwapRequestedByClient, policyAction, reason);
+ ASSERT(!reason.isNull());
+
+ if (proposedProcess.ptr() != &process()) {
+ RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "%p - WebPageProxy::decidePolicyForNavigationAction, swapping process %i with process %i for navigation, reason: %{public}s", this, processIdentifier(), proposedProcess->processIdentifier(), reason.utf8().data());
+ LOG(ProcessSwapping, "(ProcessSwapping) Switching from process %i to new process (%i) for navigation %" PRIu64 " '%s'", processIdentifier(), proposedProcess->processIdentifier(), navigation->navigationID(), navigation->loggingString());
+
+ RunLoop::main().dispatch([this, protectedThis = WTFMove(protectedThis), navigation = makeRef(*navigation), proposedProcess = WTFMove(proposedProcess)]() mutable {
+ continueNavigationInNewProcess(navigation.get(), WTFMove(proposedProcess));
+ });
+ } else
+ RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "%p - WebPageProxy::decidePolicyForNavigationAction, keep using process %i for navigation, reason: %{public}s", this, processIdentifier(), reason.utf8().data());
+ }
+
+ receivedPolicyDecision(policyAction, navigation.get(), WTFMove(data), WTFMove(sender));
}, shouldSkipSafeBrowsingCheck == ShouldSkipSafeBrowsingCheck::Yes ? ShouldExpectSafeBrowsingResult::No : ShouldExpectSafeBrowsingResult::Yes));
if (shouldSkipSafeBrowsingCheck == ShouldSkipSafeBrowsingCheck::No)
beginSafeBrowsingCheck(request.url(), listener);
@@ -4113,7 +4108,7 @@
MESSAGE_CHECK(frame);
MESSAGE_CHECK_URL(request.url());
- auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), listenerID, frameID] (WebCore::PolicyAction policyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient processSwapRequestedByClient, Vector<Ref<SafeBrowsingResult>>&& safeBrowsingResults) mutable {
+ auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), listenerID, frameID] (WebCore::PolicyAction policyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient processSwapRequestedByClient, Vector<SafeBrowsingResult>&& safeBrowsingResults) mutable {
// FIXME: Assert the API::WebsitePolicies* is nullptr here once clients of WKFramePolicyListenerUseWithPolicies go away.
RELEASE_ASSERT(processSwapRequestedByClient == ProcessSwapRequestedByClient::No);
ASSERT_UNUSED(safeBrowsingResults, safeBrowsingResults.isEmpty());
@@ -4149,7 +4144,7 @@
MESSAGE_CHECK_URL(response.url());
RefPtr<API::Navigation> navigation = navigationID ? &m_navigationState->navigation(navigationID) : nullptr;
- auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), frameID, listenerID, navigation = WTFMove(navigation)] (WebCore::PolicyAction policyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient processSwapRequestedByClient, Vector<Ref<SafeBrowsingResult>>&& safeBrowsingResults) mutable {
+ auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), frameID, listenerID, navigation = WTFMove(navigation)] (WebCore::PolicyAction policyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient processSwapRequestedByClient, Vector<SafeBrowsingResult>&& safeBrowsingResults) mutable {
// FIXME: Assert the API::WebsitePolicies* is nullptr here once clients of WKFramePolicyListenerUseWithPolicies go away.
RELEASE_ASSERT(processSwapRequestedByClient == ProcessSwapRequestedByClient::No);
ASSERT_UNUSED(safeBrowsingResults, safeBrowsingResults.isEmpty());