Diff
Modified: branches/safari-608.1.5.1-branch/Source/WebKit/ChangeLog (241957 => 241958)
--- branches/safari-608.1.5.1-branch/Source/WebKit/ChangeLog 2019-02-22 20:31:07 UTC (rev 241957)
+++ branches/safari-608.1.5.1-branch/Source/WebKit/ChangeLog 2019-02-22 20:31:13 UTC (rev 241958)
@@ -1,3 +1,7 @@
+2019-02-22 Babak Shafiei <[email protected]>
+
+ Revert r241752. rdar://problem/48055151
+
2019-02-19 Kocsen Chung <[email protected]>
Cherry-pick r241584. rdar://problem/46793397
Modified: branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp (241957 => 241958)
--- branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp 2019-02-22 20:31:07 UTC (rev 241957)
+++ branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp 2019-02-22 20:31:13 UTC (rev 241958)
@@ -284,16 +284,6 @@
m_page.decidePolicyForResponseShared(m_process.copyRef(), frameID, frameSecurityOrigin, identifier, navigationID, response, request, canShowMIMEType, listenerID, userData);
}
-void ProvisionalPageProxy::didPerformServerRedirect(const String& sourceURLString, const String& destinationURLString, uint64_t frameID)
-{
- m_page.didPerformServerRedirectShared(m_process.copyRef(), sourceURLString, destinationURLString, frameID);
-}
-
-void ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::ResourceRequest&& request, const UserData& userData)
-{
- m_page.didReceiveServerRedirectForProvisionalLoadForFrameShared(m_process.copyRef(), frameID, navigationID, WTFMove(request), userData);
-}
-
void ProvisionalPageProxy::startURLSchemeTask(URLSchemeTaskParameters&& parameters)
{
m_page.startURLSchemeTaskShared(m_process.copyRef(), WTFMove(parameters));
@@ -384,16 +374,6 @@
return;
}
- if (decoder.messageName() == Messages::WebPageProxy::DidReceiveServerRedirectForProvisionalLoadForFrame::name()) {
- IPC::handleMessage<Messages::WebPageProxy::DidReceiveServerRedirectForProvisionalLoadForFrame>(decoder, this, &ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame);
- return;
- }
-
- if (decoder.messageName() == Messages::WebPageProxy::DidPerformServerRedirect::name()) {
- IPC::handleMessage<Messages::WebPageProxy::DidPerformServerRedirect>(decoder, this, &ProvisionalPageProxy::didPerformServerRedirect);
- return;
- }
-
LOG(ProcessSwapping, "Unhandled message %s::%s from provisional process", decoder.messageReceiverName().toString().data(), decoder.messageName().toString().data());
}
Modified: branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/ProvisionalPageProxy.h (241957 => 241958)
--- branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/ProvisionalPageProxy.h 2019-02-22 20:31:07 UTC (rev 241957)
+++ branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/ProvisionalPageProxy.h 2019-02-22 20:31:13 UTC (rev 241958)
@@ -52,7 +52,6 @@
WebProcessProxy& process() { return m_process.get(); }
ProcessSwapRequestedByClient processSwapRequestedByClient() const { return m_processSwapRequestedByClient; }
uint64_t navigationID() const { return m_navigationID; }
- const URL& provisionalURL() const { return m_provisionalLoadURL; }
DrawingAreaProxy* drawingArea() const { return m_drawingArea.get(); }
std::unique_ptr<DrawingAreaProxy> takeDrawingArea();
@@ -80,8 +79,6 @@
void decidePolicyForResponse(uint64_t frameID, const WebCore::SecurityOriginData&, WebCore::PolicyCheckIdentifier, uint64_t navigationID, const WebCore::ResourceResponse&,
const WebCore::ResourceRequest&, bool canShowMIMEType, uint64_t listenerID, const UserData&);
void didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, URL&&);
- void didPerformServerRedirect(const String& sourceURLString, const String& destinationURLString, uint64_t frameID);
- void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::ResourceRequest&&, const UserData&);
void didNavigateWithNavigationData(const WebNavigationDataStore&, uint64_t frameID);
void didPerformClientRedirect(const String& sourceURLString, const String& destinationURLString, uint64_t frameID);
void didCreateMainFrame(uint64_t frameID);
Modified: branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (241957 => 241958)
--- branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-02-22 20:31:07 UTC (rev 241957)
+++ branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-02-22 20:31:13 UTC (rev 241958)
@@ -2727,17 +2727,7 @@
return;
}
- Ref<WebProcessProxy> sourceProcess = process();
- URL sourceURL = URL { URL(), pageLoadState().url() };
- if (auto* provisionalPage = provisionalPageProxy()) {
- if (provisionalPage->navigationID() == navigation->navigationID()) {
- ASSERT(navigation->currentRequestIsRedirect());
- sourceProcess = provisionalPage->process();
- sourceURL = provisionalPage->provisionalURL();
- }
- }
-
- process().processPool().processForNavigation(*this, *navigation, sourceProcess.copyRef(), sourceURL, processSwapRequestedByClient, [this, protectedThis = makeRef(*this), policyAction, navigation = makeRef(*navigation), sourceProcess = sourceProcess.copyRef(),
+ process().processPool().processForNavigation(*this, *navigation, processSwapRequestedByClient, [this, protectedThis = makeRef(*this), policyAction, navigation = makeRef(*navigation),
data = "" 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())) {
@@ -2745,8 +2735,7 @@
return;
}
- bool shouldProcessSwap = processForNavigation.ptr() != sourceProcess.ptr();
- if (shouldProcessSwap) {
+ if (processForNavigation.ptr() != &process()) {
policyAction = PolicyAction::StopAllLoads;
RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "decidePolicyForNavigationAction, swapping process %i with process %i for navigation, reason: %{public}s", processIdentifier(), processForNavigation->processIdentifier(), reason.utf8().data());
LOG(ProcessSwapping, "(ProcessSwapping) Switching from process %i to new process (%i) for navigation %" PRIu64 " '%s'", processIdentifier(), processForNavigation->processIdentifier(), navigation->navigationID(), navigation->loggingString());
@@ -2753,6 +2742,7 @@
} else
RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "decidePolicyForNavigationAction: keep using process %i for navigation, reason: %{public}s", processIdentifier(), reason.utf8().data());
+ bool shouldProcessSwap = processForNavigation.ptr() != &process();
receivedPolicyDecision(policyAction, navigation.ptr(), shouldProcessSwap ? WTF::nullopt : WTFMove(data), WTFMove(sender), shouldProcessSwap ? WillContinueLoadInNewProcess::Yes : WillContinueLoadInNewProcess::No);
if (!shouldProcessSwap)
@@ -4780,28 +4770,23 @@
void WebPageProxy::didPerformServerRedirect(const String& sourceURLString, const String& destinationURLString, uint64_t frameID)
{
- didPerformServerRedirectShared(m_process.copyRef(), sourceURLString, destinationURLString, frameID);
-}
+ RELEASE_LOG_IF_ALLOWED(Loading, "didPerformServerRedirect: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID);
-void WebPageProxy::didPerformServerRedirectShared(Ref<WebProcessProxy>&& process, const String& sourceURLString, const String& destinationURLString, uint64_t frameID)
-{
- RELEASE_LOG_IF_ALLOWED(Loading, "didPerformServerRedirect: webPID = %i, pageID = %" PRIu64, process->processIdentifier(), m_pageID);
-
PageClientProtector protector(pageClient());
if (sourceURLString.isEmpty() || destinationURLString.isEmpty())
return;
- WebFrameProxy* frame = process->webFrame(frameID);
- MESSAGE_CHECK(process, frame);
- MESSAGE_CHECK(process, frame->page() == this);
+ WebFrameProxy* frame = m_process->webFrame(frameID);
+ MESSAGE_CHECK(m_process, frame);
+ MESSAGE_CHECK(m_process, frame->page() == this);
- MESSAGE_CHECK_URL(process, sourceURLString);
- MESSAGE_CHECK_URL(process, destinationURLString);
+ MESSAGE_CHECK_URL(m_process, sourceURLString);
+ MESSAGE_CHECK_URL(m_process, destinationURLString);
if (frame->isMainFrame())
m_historyClient->didPerformServerRedirect(*this, sourceURLString, destinationURLString);
- process->processPool().historyClient().didPerformServerRedirect(process->processPool(), *this, sourceURLString, destinationURLString, *frame);
+ process().processPool().historyClient().didPerformServerRedirect(process().processPool(), *this, sourceURLString, destinationURLString, *frame);
}
void WebPageProxy::didUpdateHistoryTitle(const String& title, const String& url, uint64_t frameID)
Modified: branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/WebPageProxy.h (241957 => 241958)
--- branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/WebPageProxy.h 2019-02-22 20:31:07 UTC (rev 241957)
+++ branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/WebPageProxy.h 2019-02-22 20:31:13 UTC (rev 241958)
@@ -1436,7 +1436,6 @@
void didStartProvisionalLoadForFrameShared(Ref<WebProcessProxy>&&, uint64_t frameID, uint64_t navigationID, URL&&, URL&& unreachableURL, const UserData&);
void didFailProvisionalLoadForFrameShared(Ref<WebProcessProxy>&&, uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, const UserData&);
void didReceiveServerRedirectForProvisionalLoadForFrameShared(Ref<WebProcessProxy>&&, uint64_t frameID, uint64_t navigationID, WebCore::ResourceRequest&&, const UserData&);
- void didPerformServerRedirectShared(Ref<WebProcessProxy>&&, const String& sourceURLString, const String& destinationURLString, uint64_t frameID);
void didPerformClientRedirectShared(Ref<WebProcessProxy>&&, const String& sourceURLString, const String& destinationURLString, uint64_t frameID);
void didNavigateWithNavigationDataShared(Ref<WebProcessProxy>&&, const WebNavigationDataStore&, uint64_t frameID);
void didChangeProvisionalURLForFrameShared(Ref<WebProcessProxy>&&, uint64_t frameID, uint64_t navigationID, URL&&);
Modified: branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/WebProcessPool.cpp (241957 => 241958)
--- branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/WebProcessPool.cpp 2019-02-22 20:31:07 UTC (rev 241957)
+++ branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/WebProcessPool.cpp 2019-02-22 20:31:13 UTC (rev 241958)
@@ -2106,14 +2106,14 @@
}
#endif
-void WebProcessPool::addProcessToOriginCacheSet(WebProcessProxy& process, const URL& url)
+void WebProcessPool::addProcessToOriginCacheSet(WebPageProxy& page)
{
- auto registrableDomain = toRegistrableDomain(url);
- auto result = m_swappedProcessesPerRegistrableDomain.add(registrableDomain, &process);
+ auto registrableDomain = toRegistrableDomain({ { }, page.pageLoadState().url() });
+ auto result = m_swappedProcessesPerRegistrableDomain.add(registrableDomain, &page.process());
if (!result.isNewEntry)
- result.iterator->value = &process;
+ result.iterator->value = &page.process();
- LOG(ProcessSwapping, "(ProcessSwapping) Registrable domain %s just saved a cached process with pid %i", registrableDomain.utf8().data(), process.processIdentifier());
+ LOG(ProcessSwapping, "(ProcessSwapping) Registrable domain %s just saved a cached process with pid %i", registrableDomain.utf8().data(), page.process().processIdentifier());
if (!result.isNewEntry)
LOG(ProcessSwapping, "(ProcessSwapping) Note: It already had one saved");
}
@@ -2133,25 +2133,25 @@
m_swappedProcessesPerRegistrableDomain.remove(registrableDomain);
}
-void WebProcessPool::processForNavigation(WebPageProxy& page, const API::Navigation& navigation, Ref<WebProcessProxy>&& sourceProcess, const URL& sourceURL, ProcessSwapRequestedByClient processSwapRequestedByClient, CompletionHandler<void(Ref<WebProcessProxy>&&, SuspendedPageProxy*, const String&)>&& completionHandler)
+void WebProcessPool::processForNavigation(WebPageProxy& page, const API::Navigation& navigation, ProcessSwapRequestedByClient processSwapRequestedByClient, CompletionHandler<void(Ref<WebProcessProxy>&&, SuspendedPageProxy*, const String&)>&& completionHandler)
{
- processForNavigationInternal(page, navigation, sourceProcess.copyRef(), sourceURL, processSwapRequestedByClient, [this, page = makeRefPtr(page), navigation = makeRef(navigation), sourceProcess = sourceProcess.copyRef(), sourceURL, processSwapRequestedByClient, completionHandler = WTFMove(completionHandler)](Ref<WebProcessProxy>&& process, SuspendedPageProxy* suspendedPage, const String& reason) mutable {
+ processForNavigationInternal(page, navigation, processSwapRequestedByClient, [this, page = makeRefPtr(page), navigation = makeRef(navigation), processSwapRequestedByClient, completionHandler = WTFMove(completionHandler)](Ref<WebProcessProxy>&& process, SuspendedPageProxy* suspendedPage, const String& reason) mutable {
// We are process-swapping so automatic process prewarming would be beneficial if the client has not explicitly enabled / disabled it.
- bool doingAnAutomaticProcessSwap = processSwapRequestedByClient == ProcessSwapRequestedByClient::No && process.ptr() != sourceProcess.ptr();
+ bool doingAnAutomaticProcessSwap = processSwapRequestedByClient == ProcessSwapRequestedByClient::No && process.ptr() != &page->process();
if (doingAnAutomaticProcessSwap && !configuration().wasAutomaticProcessWarmingSetByClient() && !configuration().clientWouldBenefitFromAutomaticProcessPrewarming()) {
RELEASE_LOG(PerformanceLogging, "Automatically turning on process prewarming because the client would benefit from it");
configuration().setClientWouldBenefitFromAutomaticProcessPrewarming(true);
}
- if (m_configuration->alwaysKeepAndReuseSwappedProcesses() && process.ptr() != sourceProcess.ptr()) {
+ if (m_configuration->alwaysKeepAndReuseSwappedProcesses() && process.ptr() != &page->process()) {
static std::once_flag onceFlag;
std::call_once(onceFlag, [] {
WTFLogAlways("WARNING: The option to always keep swapped web processes alive is active. This is meant for debugging and testing only.");
});
- addProcessToOriginCacheSet(sourceProcess, sourceURL);
+ addProcessToOriginCacheSet(*page);
- LOG(ProcessSwapping, "(ProcessSwapping) Navigating from %s to %s, keeping around old process. Now holding on to old processes for %u origins.", sourceURL.string().utf8().data(), navigation->currentRequest().url().string().utf8().data(), m_swappedProcessesPerRegistrableDomain.size());
+ LOG(ProcessSwapping, "(ProcessSwapping) Navigating from %s to %s, keeping around old process. Now holding on to old processes for %u origins.", page->currentURL().utf8().data(), navigation->currentRequest().url().string().utf8().data(), m_swappedProcessesPerRegistrableDomain.size());
}
completionHandler(WTFMove(process), suspendedPage, reason);
@@ -2158,7 +2158,7 @@
});
}
-void WebProcessPool::processForNavigationInternal(WebPageProxy& page, const API::Navigation& navigation, Ref<WebProcessProxy>&& sourceProcess, const URL& pageSourceURL, ProcessSwapRequestedByClient processSwapRequestedByClient, CompletionHandler<void(Ref<WebProcessProxy>&&, SuspendedPageProxy*, const String&)>&& completionHandler)
+void WebProcessPool::processForNavigationInternal(WebPageProxy& page, const API::Navigation& navigation, ProcessSwapRequestedByClient processSwapRequestedByClient, CompletionHandler<void(Ref<WebProcessProxy>&&, SuspendedPageProxy*, const String&)>&& completionHandler)
{
auto& targetURL = navigation.currentRequest().url();
auto registrableDomain = toRegistrableDomain(targetURL);
@@ -2184,30 +2184,30 @@
};
if (usesSingleWebProcess())
- return completionHandler(WTFMove(sourceProcess), nullptr, "Single WebProcess mode is enabled"_s);
+ return completionHandler(page.process(), nullptr, "Single WebProcess mode is enabled"_s);
if (processSwapRequestedByClient == ProcessSwapRequestedByClient::Yes)
return completionHandler(createNewProcess(), nullptr, "Process swap was requested by the client"_s);
if (!m_configuration->processSwapsOnNavigation())
- return completionHandler(WTFMove(sourceProcess), nullptr, "Feature is disabled"_s);
+ return completionHandler(page.process(), nullptr, "Feature is disabled"_s);
if (m_automationSession)
- return completionHandler(WTFMove(sourceProcess), nullptr, "An automation session is active"_s);
+ return completionHandler(page.process(), nullptr, "An automation session is active"_s);
- if (!sourceProcess->hasCommittedAnyProvisionalLoads()) {
- tryPrewarmWithDomainInformation(sourceProcess, targetURL);
- return completionHandler(WTFMove(sourceProcess), nullptr, "Process has not yet committed any provisional loads"_s);
+ if (!page.process().hasCommittedAnyProvisionalLoads()) {
+ tryPrewarmWithDomainInformation(page.process(), targetURL);
+ return completionHandler(page.process(), nullptr, "Process has not yet committed any provisional loads"_s);
}
// FIXME: We should support process swap when a window has been opened via window.open() without 'noopener'.
// The issue is that the opener has a handle to the WindowProxy.
if (navigation.openedByDOMWithOpener() && !m_configuration->processSwapsOnWindowOpenWithOpener())
- return completionHandler(WTFMove(sourceProcess), nullptr, "Browsing context been opened by DOM without 'noopener'"_s);
+ return completionHandler(page.process(), nullptr, "Browsing context been opened by DOM without 'noopener'"_s);
// FIXME: We should support process swap when a window has opened other windows via window.open.
if (navigation.hasOpenedFrames())
- return completionHandler(WTFMove(sourceProcess), nullptr, "Browsing context has opened other windows"_s);
+ return completionHandler(page.process(), nullptr, "Browsing context has opened other windows"_s);
if (auto* targetItem = navigation.targetItem()) {
if (auto* suspendedPage = targetItem->suspendedPage()) {
@@ -2236,13 +2236,13 @@
}
if (navigation.treatAsSameOriginNavigation())
- return completionHandler(WTFMove(sourceProcess), nullptr, "The treatAsSameOriginNavigation flag is set"_s);
+ return completionHandler(page.process(), nullptr, "The treatAsSameOriginNavigation flag is set"_s);
URL sourceURL;
if (page.isPageOpenedByDOMShowingInitialEmptyDocument() && !navigation.requesterOrigin().isEmpty())
sourceURL = URL { URL(), navigation.requesterOrigin().toString() };
else
- sourceURL = pageSourceURL;
+ sourceURL = URL { { }, page.pageLoadState().url() };
if (sourceURL.isEmpty() && page.configuration().relatedPage()) {
sourceURL = URL { { }, page.configuration().relatedPage()->pageLoadState().url() };
@@ -2250,7 +2250,7 @@
}
if (!sourceURL.isValid() || !targetURL.isValid() || sourceURL.isEmpty() || sourceURL.protocolIsAbout() || registrableDomainsAreEqual(sourceURL, targetURL))
- return completionHandler(WTFMove(sourceProcess), nullptr, "Navigation is same-site"_s);
+ return completionHandler(page.process(), nullptr, "Navigation is same-site"_s);
String reason = "Navigation is cross-site"_s;
Modified: branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/WebProcessPool.h (241957 => 241958)
--- branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/WebProcessPool.h 2019-02-22 20:31:07 UTC (rev 241957)
+++ branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/WebProcessPool.h 2019-02-22 20:31:13 UTC (rev 241958)
@@ -445,7 +445,7 @@
BackgroundWebProcessToken backgroundWebProcessToken() const { return BackgroundWebProcessToken(m_backgroundWebProcessCounter.count()); }
#endif
- void processForNavigation(WebPageProxy&, const API::Navigation&, Ref<WebProcessProxy>&& sourceProcess, const URL& sourceURL, ProcessSwapRequestedByClient, CompletionHandler<void(Ref<WebProcessProxy>&&, SuspendedPageProxy*, const String&)>&&);
+ void processForNavigation(WebPageProxy&, const API::Navigation&, ProcessSwapRequestedByClient, CompletionHandler<void(Ref<WebProcessProxy>&&, SuspendedPageProxy*, const String&)>&&);
// SuspendedPageProxy management.
void addSuspendedPage(std::unique_ptr<SuspendedPageProxy>&&);
@@ -484,7 +484,7 @@
void platformInitializeWebProcess(WebProcessCreationParameters&);
void platformInvalidateContext();
- void processForNavigationInternal(WebPageProxy&, const API::Navigation&, Ref<WebProcessProxy>&& sourceProcess, const URL& sourceURL, ProcessSwapRequestedByClient, CompletionHandler<void(Ref<WebProcessProxy>&&, SuspendedPageProxy*, const String&)>&&);
+ void processForNavigationInternal(WebPageProxy&, const API::Navigation&, ProcessSwapRequestedByClient, CompletionHandler<void(Ref<WebProcessProxy>&&, SuspendedPageProxy*, const String&)>&&);
RefPtr<WebProcessProxy> tryTakePrewarmedProcess(WebsiteDataStore&);
@@ -547,7 +547,7 @@
void resolvePathsForSandboxExtensions();
void platformResolvePathsForSandboxExtensions();
- void addProcessToOriginCacheSet(WebProcessProxy&, const URL&);
+ void addProcessToOriginCacheSet(WebPageProxy&);
void removeProcessFromOriginCacheSet(WebProcessProxy&);
void tryPrewarmWithDomainInformation(WebProcessProxy&, const URL&);
Modified: branches/safari-608.1.5.1-branch/Tools/ChangeLog (241957 => 241958)
--- branches/safari-608.1.5.1-branch/Tools/ChangeLog 2019-02-22 20:31:07 UTC (rev 241957)
+++ branches/safari-608.1.5.1-branch/Tools/ChangeLog 2019-02-22 20:31:13 UTC (rev 241958)
@@ -1,3 +1,7 @@
+2019-02-22 Babak Shafiei <[email protected]>
+
+ Revert r241752. rdar://problem/48055151
+
2019-02-19 Alan Coon <[email protected]>
Cherry-pick r241752. rdar://problem/48055151
Modified: branches/safari-608.1.5.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (241957 => 241958)
--- branches/safari-608.1.5.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm 2019-02-22 20:31:07 UTC (rev 241957)
+++ branches/safari-608.1.5.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm 2019-02-22 20:31:13 UTC (rev 241958)
@@ -1403,15 +1403,11 @@
serverRedirected = false;
seenPIDs.add([webView _webProcessIdentifier]);
- if (auto provisionalPID = [webView _provisionalWebProcessIdentifier])
- seenPIDs.add(provisionalPID);
TestWebKitAPI::Util::run(&done);
done = false;
seenPIDs.add([webView _webProcessIdentifier]);
- if (auto provisionalPID = [webView _provisionalWebProcessIdentifier])
- seenPIDs.add(provisionalPID);
EXPECT_FALSE(serverRedirected);
EXPECT_EQ(3, numberOfDecidePolicyCalls);
@@ -1456,15 +1452,11 @@
serverRedirected = false;
seenPIDs.add([webView _webProcessIdentifier]);
- if (auto provisionalPID = [webView _provisionalWebProcessIdentifier])
- seenPIDs.add(provisionalPID);
TestWebKitAPI::Util::run(&done);
done = false;
seenPIDs.add([webView _webProcessIdentifier]);
- if (auto provisionalPID = [webView _provisionalWebProcessIdentifier])
- seenPIDs.add(provisionalPID);
EXPECT_FALSE(serverRedirected);
EXPECT_EQ(3, numberOfDecidePolicyCalls);
@@ -1480,87 +1472,6 @@
EXPECT_WK_STREQ(@"pson://www.webkit.org/main1.html", [[webView URL] absoluteString]);
}
-enum class ShouldCacheProcessFirst { No, Yes };
-static void runSameOriginServerRedirectTest(ShouldCacheProcessFirst shouldCacheProcessFirst)
-{
- auto processPoolConfiguration = psonProcessPoolConfiguration();
- processPoolConfiguration.get().processSwapsOnNavigation = YES;
- auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
-
- auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
- [webViewConfiguration setProcessPool:processPool.get()];
- auto handler = adoptNS([[PSONScheme alloc] init]);
- [handler addMappingFromURLString:@"pson://www.webkit.org/main.html" toData:crossSiteClientSideRedirectBytes];
- [handler addRedirectFromURLString:@"pson://www.apple.com/main.html" toURLString:@"pson://www.apple.com/main2.html"];
- [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"pson"];
-
- auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
- auto delegate = adoptNS([[PSONNavigationDelegate alloc] init]);
- [webView setNavigationDelegate:delegate.get()];
-
- NSURLRequest *request;
-
- if (shouldCacheProcessFirst == ShouldCacheProcessFirst::Yes) {
- request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.apple.com/main3.html"]];
- [webView loadRequest:request];
-
- TestWebKitAPI::Util::run(&done);
- done = false;
- }
-
- delegate->didStartProvisionalNavigationHandler = ^{
- seenPIDs.add([webView _webProcessIdentifier]);
- if (auto provisionalPID = [webView _provisionalWebProcessIdentifier])
- seenPIDs.add(provisionalPID);
- };
-
- willPerformClientRedirect = false;
- didPerformClientRedirect = false;
- serverRedirected = false;
- request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]];
- [webView loadRequest:request];
-
- TestWebKitAPI::Util::run(&willPerformClientRedirect);
-
- seenPIDs.add([webView _webProcessIdentifier]);
- if (auto provisionalPID = [webView _provisionalWebProcessIdentifier])
- seenPIDs.add(provisionalPID);
-
- TestWebKitAPI::Util::run(&didPerformClientRedirect);
- didPerformClientRedirect = false;
- willPerformClientRedirect = false;
-
- seenPIDs.add([webView _webProcessIdentifier]);
- if (auto provisionalPID = [webView _provisionalWebProcessIdentifier])
- seenPIDs.add(provisionalPID);
-
- TestWebKitAPI::Util::run(&serverRedirected);
- serverRedirected = false;
-
- seenPIDs.add([webView _webProcessIdentifier]);
- if (auto provisionalPID = [webView _provisionalWebProcessIdentifier])
- seenPIDs.add(provisionalPID);
-
- TestWebKitAPI::Util::run(&done);
- done = false;
-
- seenPIDs.add([webView _webProcessIdentifier]);
- if (auto provisionalPID = [webView _provisionalWebProcessIdentifier])
- seenPIDs.add(provisionalPID);
-
- EXPECT_EQ(2u, seenPIDs.size());
-}
-
-TEST(ProcessSwap, SameOriginServerRedirect)
-{
- runSameOriginServerRedirectTest(ShouldCacheProcessFirst::No);
-}
-
-TEST(ProcessSwap, SameOriginServerRedirectFromCachedProcess)
-{
- runSameOriginServerRedirectTest(ShouldCacheProcessFirst::Yes);
-}
-
TEST(ProcessSwap, TerminateProcessRightAfterSwap)
{
auto processPoolConfiguration = psonProcessPoolConfiguration();