Changeset 240015 in webkit
- Timestamp:
- Jan 15, 2019 3:48:31 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r239993 r240015 1 2019-01-15 Chris Dumez <cdumez@apple.com> 2 3 Unreviewed, rolling out r239993, r239995, r239997, and 4 r239999. 5 6 Caused assertions under 7 ViewGestureController::disconnectFromProcess() 8 9 Reverted changesets: 10 11 "Regression(PSON) View becomes blank after click a cross-site 12 download link" 13 https://bugs.webkit.org/show_bug.cgi?id=193361 14 https://trac.webkit.org/changeset/239993 15 16 "Unreviewed iOS build fix after r239993." 17 https://trac.webkit.org/changeset/239995 18 19 "Fix iOS build after r239993" 20 https://bugs.webkit.org/show_bug.cgi?id=193361 21 https://trac.webkit.org/changeset/239997 22 23 "Unreviewed, revert part of r239997 as it is not needed to fix 24 the build." 25 https://trac.webkit.org/changeset/239999 26 1 27 2019-01-15 Chris Dumez <cdumez@apple.com> 2 28 -
trunk/LayoutTests/platform/wk2/TestExpectations
r239993 r240015 734 734 http/tests/resourceLoadStatistics/cap-cache-max-age-for-prevalent-resource.html [ Skip ] 735 735 736 # This feature is currently disabled by default and unfinished <rdar://problem/38925077>.737 http/tests/navigation/process-swap-window-open.html [ Skip]736 # Process swapping is only implemented on WebKit2. 737 http/tests/navigation/process-swap-window-open.html [ Pass ] 738 738 739 739 # Cross-Origin-Resource-Policy response header is only implemented in WebKit2. -
trunk/Source/WebCore/ChangeLog
r240014 r240015 1 2019-01-15 Chris Dumez <cdumez@apple.com> 2 3 Unreviewed, rolling out r239993, r239995, r239997, and 4 r239999. 5 6 Caused assertions under 7 ViewGestureController::disconnectFromProcess() 8 9 Reverted changesets: 10 11 "Regression(PSON) View becomes blank after click a cross-site 12 download link" 13 https://bugs.webkit.org/show_bug.cgi?id=193361 14 https://trac.webkit.org/changeset/239993 15 16 "Unreviewed iOS build fix after r239993." 17 https://trac.webkit.org/changeset/239995 18 19 "Fix iOS build after r239993" 20 https://bugs.webkit.org/show_bug.cgi?id=193361 21 https://trac.webkit.org/changeset/239997 22 23 "Unreviewed, revert part of r239997 as it is not needed to fix 24 the build." 25 https://trac.webkit.org/changeset/239999 26 1 27 2019-01-15 Alex Christensen <achristensen@webkit.org> 2 28 -
trunk/Source/WebCore/loader/FrameLoader.cpp
r239993 r240015 2033 2033 Optional<HasInsecureContent> hasInsecureContent = cachedPage->cachedMainFrame()->hasInsecureContent(); 2034 2034 2035 dispatchDidCommitLoad(hasInsecureContent);2036 2037 2035 // FIXME: This API should be turned around so that we ground CachedPage into the Page. 2038 2036 cachedPage->restore(*m_frame.page()); 2037 2038 dispatchDidCommitLoad(hasInsecureContent); 2039 2039 2040 2040 #if PLATFORM(IOS_FAMILY) -
trunk/Source/WebKit/ChangeLog
r240014 r240015 1 2019-01-15 Chris Dumez <cdumez@apple.com> 2 3 Unreviewed, rolling out r239993, r239995, r239997, and 4 r239999. 5 6 Caused assertions under 7 ViewGestureController::disconnectFromProcess() 8 9 Reverted changesets: 10 11 "Regression(PSON) View becomes blank after click a cross-site 12 download link" 13 https://bugs.webkit.org/show_bug.cgi?id=193361 14 https://trac.webkit.org/changeset/239993 15 16 "Unreviewed iOS build fix after r239993." 17 https://trac.webkit.org/changeset/239995 18 19 "Fix iOS build after r239993" 20 https://bugs.webkit.org/show_bug.cgi?id=193361 21 https://trac.webkit.org/changeset/239997 22 23 "Unreviewed, revert part of r239997 as it is not needed to fix 24 the build." 25 https://trac.webkit.org/changeset/239999 26 1 27 2019-01-15 Alex Christensen <achristensen@webkit.org> 2 28 -
trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp
r239993 r240015 74 74 encoder << mimeTypesWithCustomContentProviders; 75 75 encoder << controlledByAutomation; 76 encoder << is ProcessSwap;76 encoder << isSwapFromSuspended; 77 77 78 78 #if PLATFORM(MAC) … … 228 228 if (!decoder.decode(parameters.controlledByAutomation)) 229 229 return WTF::nullopt; 230 if (!decoder.decode(parameters.is ProcessSwap))230 if (!decoder.decode(parameters.isSwapFromSuspended)) 231 231 return WTF::nullopt; 232 232 -
trunk/Source/WebKit/Shared/WebPageCreationParameters.h
r239993 r240015 130 130 131 131 bool controlledByAutomation; 132 bool is ProcessSwap{ false };132 bool isSwapFromSuspended { false }; 133 133 134 134 #if PLATFORM(MAC) -
trunk/Source/WebKit/Shared/WebPolicyAction.h
r239993 r240015 30 30 namespace WebKit { 31 31 32 // FIXME: Remove this type and use WebCore::PolicyAction instead.33 32 enum class WebPolicyAction : uint8_t { 34 33 Use, 35 34 Download, 36 Ignore 35 Ignore, 36 Suspend 37 37 }; 38 38 … … 46 46 WebKit::WebPolicyAction::Use, 47 47 WebKit::WebPolicyAction::Download, 48 WebKit::WebPolicyAction::Ignore 48 WebKit::WebPolicyAction::Ignore, 49 WebKit::WebPolicyAction::Suspend 49 50 >; 50 51 }; -
trunk/Source/WebKit/Sources.txt
r240014 r240015 231 231 UIProcess/ProcessAssertion.cpp 232 232 UIProcess/ProcessThrottler.cpp 233 UIProcess/ProvisionalPageProxy.cpp234 233 UIProcess/RemoteWebInspectorProxy.cpp 235 234 UIProcess/ResponsivenessTimer.cpp -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r239993 r240015 45 45 #import "ObjCObjectGraph.h" 46 46 #import "PageClient.h" 47 #import "ProvisionalPageProxy.h"48 47 #import "RemoteLayerTreeScrollingPerformanceData.h" 49 48 #import "RemoteLayerTreeTransaction.h" … … 4702 4701 Ref<WebKit::WebProcessProxy> protectedProcessProxy(_page->process()); 4703 4702 protectedProcessProxy->requestTermination(WebKit::ProcessTerminationReason::RequestedByClient); 4704 4705 if (auto* provisionalPageProxy = _page->provisionalPageProxy()) {4706 Ref<WebKit::WebProcessProxy> protectedProcessProxy(provisionalPageProxy->process());4707 protectedProcessProxy->requestTermination(WebKit::ProcessTerminationReason::RequestedByClient);4708 }4709 4703 } 4710 4704 -
trunk/Source/WebKit/UIProcess/PageClient.h
r240010 r240015 50 50 OBJC_CLASS CALayer; 51 51 OBJC_CLASS NSFileWrapper; 52 OBJC_CLASS NSMenu;53 52 OBJC_CLASS NSSet; 54 53 OBJC_CLASS WKDrawingView; -
trunk/Source/WebKit/UIProcess/SuspendedPageProxy.cpp
r239993 r240015 101 101 // on the WebProcess side. 102 102 m_process->send(Messages::WebPage::Close(), m_page.pageID()); 103 104 if (m_suspensionState == SuspensionState::Suspending) 105 m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_page.pageID()); 103 m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_page.pageID()); 106 104 107 105 // We call maybeShutDown() asynchronously since the SuspendedPage is currently being removed from the WebProcessPool … … 137 135 138 136 m_suspensionState = SuspensionState::Resumed; 137 m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_page.pageID()); 139 138 m_process->send(Messages::WebPage::SetIsSuspended(false), m_page.pageID()); 140 139 } … … 152 151 m_suspensionToken = nullptr; 153 152 #endif 154 155 m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_page.pageID());156 153 157 154 if (m_readyToUnsuspendHandler) -
trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp
r239993 r240015 28 28 29 29 #include "APINavigation.h" 30 #include "ProvisionalPageProxy.h"31 30 #include "WebCertificateInfo.h" 32 31 #include "WebFramePolicyListenerProxy.h" … … 76 75 return false; 77 76 78 return this == m_page->mainFrame() || (m_page->provisionalPageProxy() && this == m_page->provisionalPageProxy()->mainFrame());77 return this == m_page->mainFrame(); 79 78 } 80 79 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r240010 r240015 78 78 #include "PluginProcessManager.h" 79 79 #include "PrintInfo.h" 80 #include "ProvisionalPageProxy.h"81 80 #include "SafeBrowsingWarning.h" 82 81 #include "ShareSheetCallbackID.h" … … 547 546 } 548 547 549 DrawingAreaProxy* WebPageProxy::drawingArea() const550 {551 if (m_provisionalPage && m_process.ptr() == &m_provisionalPage->process() && m_provisionalPage->drawingArea())552 return m_provisionalPage->drawingArea();553 return m_drawingArea.get();554 }555 556 548 void WebPageProxy::changeWebsiteDataStore(WebsiteDataStore& websiteDataStore) 557 549 { … … 777 769 } 778 770 779 void WebPageProxy::swapToWebProcess(Ref<WebProcessProxy>&& process, std::unique_ptr< DrawingAreaProxy>&& drawingArea, RefPtr<WebFrameProxy>&& mainFrame)771 void WebPageProxy::swapToWebProcess(Ref<WebProcessProxy>&& process, std::unique_ptr<SuspendedPageProxy>&& destinationSuspendedPage, IsSwapFromSuspended isSwapFromSuspended) 780 772 { 781 773 ASSERT(!m_isClosed); … … 783 775 784 776 m_process = WTFMove(process); 785 ASSERT(!m_drawingArea);786 setDrawingArea(WTFMove(drawingArea));787 ASSERT(!m_mainFrame);788 m_mainFrame = WTFMove(mainFrame);789 777 m_isValid = true; 778 779 // If we are reattaching to a SuspendedPage, then the WebProcess' WebPage already exists and 780 // WebPageProxy::didCreateMainFrame() will not be called to initialize m_mainFrame. In such 781 // case, we need to initialize m_mainFrame to reflect the fact the the WebProcess' WebPage 782 // already exists and already has a main frame. 783 if (destinationSuspendedPage) { 784 if (!destinationSuspendedPage->failedToSuspend()) { 785 ASSERT(!m_mainFrame); 786 ASSERT(&destinationSuspendedPage->process() == m_process.ptr()); 787 destinationSuspendedPage->unsuspend(); 788 m_mainFrame = WebFrameProxy::create(*this, destinationSuspendedPage->mainFrameID()); 789 m_process->frameCreated(destinationSuspendedPage->mainFrameID(), *m_mainFrame); 790 } else { 791 // We failed to suspend the page so destroy it now and merely reuse its WebContent process. 792 destinationSuspendedPage = nullptr; 793 } 794 } 790 795 791 796 m_process->addExistingWebPage(*this, m_pageID, WebProcessProxy::BeginsUsingDataStore::No); 792 797 m_process->addMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_pageID, *this); 793 798 794 // No need to initialize the WebPage since it was created when we created the ProvisionalPageProxy. 795 finishAttachingToWebProcess(ShouldInitializeWebPage::No); 796 } 797 798 void WebPageProxy::finishAttachingToWebProcess(ShouldInitializeWebPage shouldInitializePage) 799 finishAttachingToWebProcess(isSwapFromSuspended); 800 } 801 802 void WebPageProxy::finishAttachingToWebProcess(IsSwapFromSuspended isSwapFromSuspended) 799 803 { 800 804 ASSERT(m_process->state() != ChildProcessProxy::State::Terminated); … … 832 836 #endif 833 837 834 if (shouldInitializePage == ShouldInitializeWebPage::Yes) 835 initializeWebPage(); 838 initializeWebPage(isSwapFromSuspended); 836 839 837 840 m_inspector->updateForNewPageProcess(this); … … 898 901 } 899 902 900 void WebPageProxy::setDrawingArea(std::unique_ptr<DrawingAreaProxy>&& drawingArea) 901 { 902 m_drawingArea = WTFMove(drawingArea); 903 if (!m_drawingArea) 904 return; 903 void WebPageProxy::initializeWebPage(IsSwapFromSuspended isSwapFromSuspended) 904 { 905 ASSERT(isValid()); 906 907 m_drawingArea = pageClient().createDrawingAreaProxy(); 908 ASSERT(m_drawingArea); 905 909 906 910 #if ENABLE(ASYNC_SCROLLING) && PLATFORM(COCOA) … … 913 917 } 914 918 #endif 915 } 916 917 void WebPageProxy::initializeWebPage() 918 { 919 ASSERT(isValid()); 920 921 setDrawingArea(pageClient().createDrawingAreaProxy()); 922 ASSERT(m_drawingArea); 923 924 process().send(Messages::WebProcess::CreateWebPage(m_pageID, creationParameters()), 0); 919 920 auto parameters = creationParameters(); 921 parameters.isSwapFromSuspended = isSwapFromSuspended == IsSwapFromSuspended::Yes; 922 923 #if ENABLE(SERVICE_WORKER) 924 parameters.hasRegisteredServiceWorkers = process().processPool().mayHaveRegisteredServiceWorkers(m_websiteDataStore); 925 #endif 926 927 process().send(Messages::WebProcess::CreateWebPage(m_pageID, parameters), 0); 925 928 926 929 m_needsToFinishInitializingWebPageAfterProcessLaunch = true; … … 1074 1077 1075 1078 auto url = request.url(); 1076 if (shouldTreatAsContinuingLoad != ShouldTreatAsContinuingLoad::Yes) 1077 m_pageLoadState.setPendingAPIRequestURL(transaction, url); 1079 m_pageLoadState.setPendingAPIRequestURL(transaction, url); 1078 1080 1079 1081 if (!isValid()) … … 1293 1295 1294 1296 m_process->send(Messages::WebPage::StopLoading(), m_pageID); 1295 if (m_provisionalPage) {1296 m_provisionalPage->cancel();1297 m_provisionalPage = nullptr;1298 }1299 1297 m_process->responsivenessTimer().start(); 1300 1298 } … … 2701 2699 2702 2700 if (processForNavigation.ptr() != &process()) { 2703 policyAction = WebPolicyAction::Ignore;2701 policyAction = isPageOpenedByDOMShowingInitialEmptyDocument() ? WebPolicyAction::Ignore : WebPolicyAction::Suspend; 2704 2702 RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "decidePolicyForNavigationAction, swapping process %i with process %i for navigation, reason: %{public}s", processIdentifier(), processForNavigation->processIdentifier(), reason.utf8().data()); 2705 2703 LOG(ProcessSwapping, "(ProcessSwapping) Switching from process %i to new process (%i) for navigation %" PRIu64 " '%s'", processIdentifier(), processForNavigation->processIdentifier(), navigation->navigationID(), navigation->loggingString()); … … 2710 2708 receivedPolicyDecision(policyAction, navigation.ptr(), shouldProcessSwap ? WTF::nullopt : WTFMove(data), WTFMove(sender)); 2711 2709 2712 if (!shouldProcessSwap) 2713 return; 2714 2715 auto suspendedPage = destinationSuspendedPage ? process().processPool().takeSuspendedPage(*destinationSuspendedPage) : nullptr; 2716 if (suspendedPage && suspendedPage->failedToSuspend()) 2717 suspendedPage = nullptr; 2718 2719 continueNavigationInNewProcess(navigation, WTFMove(suspendedPage), WTFMove(processForNavigation), processSwapRequestedByClient, WTFMove(data)); 2710 if (shouldProcessSwap) 2711 continueNavigationInNewProcess(navigation, destinationSuspendedPage ? process().processPool().takeSuspendedPage(*destinationSuspendedPage) : nullptr, WTFMove(processForNavigation), processSwapRequestedByClient, WTFMove(data)); 2720 2712 }); 2721 2713 } … … 2753 2745 } 2754 2746 2755 void WebPageProxy::commitProvisionalPage(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo& certificateInfo, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData& userData) 2756 { 2757 ASSERT(m_provisionalPage); 2758 RELEASE_LOG_IF_ALLOWED(Loading, "commitProvisionalPage: previousPID = %i, newPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_provisionalPage->process().processIdentifier(), m_pageID); 2759 2760 Optional<uint64_t> mainFrameIDInPreviousProcess = m_mainFrame ? makeOptional(m_mainFrame->frameID()) : WTF::nullopt; 2761 2762 ASSERT(m_process.ptr() != &m_provisionalPage->process()); 2763 2764 processDidTerminate(ProcessTerminationReason::NavigationSwap); 2765 2766 m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_pageID); 2767 auto* navigation = navigationState().navigation(m_provisionalPage->navigationID()); 2768 bool didSuspendPreviousPage = navigation ? suspendCurrentPageIfPossible(*navigation, mainFrameIDInPreviousProcess, m_provisionalPage->processSwapRequestedByClient()) : false; 2769 m_process->removeWebPage(*this, m_pageID, WebProcessProxy::EndsUsingDataStore::No); 2770 2771 // There is no way we'll be able to return to the page in the previous page so close it. 2772 if (!didSuspendPreviousPage) 2773 m_process->send(Messages::WebPage::Close(), pageID()); 2774 2775 swapToWebProcess(m_provisionalPage->process(), m_provisionalPage->takeDrawingArea(), m_provisionalPage->mainFrame()); 2776 2777 didCommitLoadForFrame(frameID, navigationID, mimeType, frameHasCustomContentProvider, frameLoadType, certificateInfo, containsPluginDocument, forcedHasInsecureContent, userData); 2778 2779 m_provisionalPage = nullptr; 2780 } 2781 2782 void WebPageProxy::continueNavigationInNewProcess(API::Navigation& navigation, std::unique_ptr<SuspendedPageProxy>&& suspendedPageProxy, Ref<WebProcessProxy>&& newProcess, ProcessSwapRequestedByClient processSwapRequestedByClient, Optional<WebsitePoliciesData>&& websitePolicies) 2747 void WebPageProxy::continueNavigationInNewProcess(API::Navigation& navigation, std::unique_ptr<SuspendedPageProxy>&& suspendedPageProxy, Ref<WebProcessProxy>&& process, ProcessSwapRequestedByClient processSwapRequestedByClient, Optional<WebsitePoliciesData>&& websitePolicies) 2783 2748 { 2784 2749 RELEASE_LOG_IF_ALLOWED(Loading, "continueNavigationInNewProcess: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID); 2785 2750 LOG(Loading, "Continuing navigation %" PRIu64 " '%s' in a new web process", navigation.navigationID(), navigation.loggingString()); 2786 2751 2787 if (m_provisionalPage) { 2788 if (m_provisionalPage->navigationID() != navigation.navigationID()) 2789 m_provisionalPage->cancel(); 2790 m_provisionalPage = nullptr; 2791 } 2792 2793 m_provisionalPage = std::make_unique<ProvisionalPageProxy>(*this, newProcess.copyRef(), WTFMove(suspendedPageProxy), navigation.navigationID(), navigation.currentRequestIsRedirect(), navigation.currentRequest(), processSwapRequestedByClient); 2752 Ref<WebProcessProxy> previousProcess = m_process.copyRef(); 2753 Optional<uint64_t> mainFrameIDInPreviousProcess = m_mainFrame ? makeOptional(m_mainFrame->frameID()) : WTF::nullopt; 2754 auto mainFrameURL = m_mainFrame ? m_mainFrame->url() : URL(); 2755 2756 ASSERT(m_process.ptr() != process.ptr()); 2757 2758 processDidTerminate(ProcessTerminationReason::NavigationSwap); 2759 2760 m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_pageID); 2761 bool didSuspendPreviousPage = suspendCurrentPageIfPossible(navigation, mainFrameIDInPreviousProcess, processSwapRequestedByClient); 2762 m_process->removeWebPage(*this, m_pageID, WebProcessProxy::EndsUsingDataStore::No); 2763 2764 swapToWebProcess(WTFMove(process), WTFMove(suspendedPageProxy), didSuspendPreviousPage ? IsSwapFromSuspended::Yes : IsSwapFromSuspended::No); 2794 2765 2795 2766 if (auto* item = navigation.targetItem()) { … … 2799 2770 m_pageLoadState.setPendingAPIRequestURL(transaction, item->url()); 2800 2771 2801 m_provisionalPage->goToBackForwardItem(navigation, *item, WTFMove(websitePolicies)); 2772 auto itemStates = m_backForwardList->filteredItemStates([this, targetItem = item](WebBackForwardListItem& item) { 2773 if (auto* page = item.suspendedPage()) { 2774 if (&page->process() == m_process.ptr()) 2775 return false; 2776 } 2777 return &item != targetItem; 2778 }); 2779 m_process->send(Messages::WebPage::UpdateBackForwardListForReattach(WTFMove(itemStates)), m_pageID); 2780 m_process->send(Messages::WebPage::GoToBackForwardItem(navigation.navigationID(), item->itemID(), *navigation.backForwardFrameLoadType(), ShouldTreatAsContinuingLoad::Yes, WTFMove(websitePolicies)), m_pageID); 2781 m_process->responsivenessTimer().start(); 2782 2802 2783 return; 2803 2784 } … … 2806 2787 // If WebCore is supposed to lock the history for this load, then the new process needs to know about the current history item so it can update 2807 2788 // it instead of creating a new one. 2808 newProcess->send(Messages::WebPage::SetCurrentHistoryItemForReattach(m_backForwardList->currentItem()->itemState()), m_pageID);2789 m_process->send(Messages::WebPage::SetCurrentHistoryItemForReattach(m_backForwardList->currentItem()->itemState()), m_pageID); 2809 2790 } 2810 2791 … … 2812 2793 ASSERT(!navigation.currentRequest().isEmpty()); 2813 2794 if (auto& substituteData = navigation.substituteData()) 2814 m_provisionalPage->loadDataWithNavigation(navigation, { substituteData->content.data(), substituteData->content.size() }, substituteData->MIMEType, substituteData->encoding, substituteData->baseURL, substituteData->userData.get(), WTFMove(websitePolicies));2795 loadDataWithNavigation(navigation, { substituteData->content.data(), substituteData->content.size() }, substituteData->MIMEType, substituteData->encoding, substituteData->baseURL, substituteData->userData.get(), ShouldTreatAsContinuingLoad::Yes, WTFMove(websitePolicies)); 2815 2796 else 2816 m_provisionalPage->loadRequestWithNavigation(navigation, ResourceRequest { navigation.currentRequest() }, WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes, nullptr, WTFMove(websitePolicies)); 2797 loadRequestWithNavigation(navigation, ResourceRequest { navigation.currentRequest() }, WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes, nullptr, ShouldTreatAsContinuingLoad::Yes, WTFMove(websitePolicies)); 2798 2799 ASSERT(!m_mainFrame); 2800 m_mainFrameCreationHandler = [this, weakThis = makeWeakPtr(*this), navigationID = navigation.navigationID(), request = navigation.currentRequest(), mainFrameURL, isServerRedirect = navigation.currentRequestIsRedirect()]() mutable { 2801 if (!weakThis) 2802 return; 2803 2804 ASSERT(m_mainFrame); 2805 // This navigation was destroyed so no need to notify of redirect. 2806 if (!navigationState().navigation(navigationID)) 2807 return; 2808 2809 // Restore the main frame's committed URL as some clients may rely on it until the next load is committed. 2810 m_mainFrame->frameLoadState().setURL(mainFrameURL); 2811 2812 // Normally, notification of a server redirect comes from the WebContent process. 2813 // If we are process swapping in response to a server redirect then that notification will not come from the new WebContent process. 2814 // In this case we have the UIProcess synthesize the redirect notification at the appropriate time. 2815 if (isServerRedirect) { 2816 m_mainFrame->frameLoadState().didStartProvisionalLoad(request.url()); 2817 didReceiveServerRedirectForProvisionalLoadForFrame(m_mainFrame->frameID(), navigationID, WTFMove(request), { }); 2818 } 2819 }; 2820 2821 if (!m_process->processPool().configuration().processSwapsOnWindowOpenWithOpener() || !isPageOpenedByDOMShowingInitialEmptyDocument() || !mainFrameIDInPreviousProcess) { 2822 // There is no way we'll be able to return to the page in the previous page so close it. 2823 if (!didSuspendPreviousPage) 2824 previousProcess->send(Messages::WebPage::Close(), m_pageID); 2825 return; 2826 } 2827 2828 m_mainFrameWindowCreationHandler = [this, previousProcess = WTFMove(previousProcess), mainFrameIDInPreviousProcess = *mainFrameIDInPreviousProcess](const GlobalWindowIdentifier& windowIdentifier) { 2829 ASSERT(m_mainFrame); 2830 GlobalFrameIdentifier navigatedFrameIdentifierInNewProcess { pageID(), m_mainFrame->frameID() }; 2831 previousProcess->send(Messages::WebPage::FrameBecameRemote(mainFrameIDInPreviousProcess, navigatedFrameIdentifierInNewProcess, windowIdentifier), pageID()); 2832 }; 2817 2833 } 2818 2834 … … 3679 3695 // Add the frame to the process wide map. 3680 3696 m_process->frameCreated(frameID, *m_mainFrame); 3697 3698 if (m_mainFrameCreationHandler) { 3699 m_mainFrameCreationHandler(); 3700 m_mainFrameCreationHandler = nullptr; 3701 } 3681 3702 } 3682 3703 … … 3703 3724 void WebPageProxy::didCreateWindow(uint64_t frameID, GlobalWindowIdentifier&& windowIdentifier) 3704 3725 { 3726 if (m_mainFrame && m_mainFrame->frameID() == frameID) { 3727 if (auto mainFrameWindowCreationHandler = WTFMove(m_mainFrameWindowCreationHandler)) 3728 mainFrameWindowCreationHandler(windowIdentifier); 3729 } 3705 3730 } 3706 3731 … … 3754 3779 { 3755 3780 PageClientProtector protector(pageClient()); 3756 3757 // On process-swap, the previous process tries to destroy the navigation but the provisional process is actually taking over the navigation.3758 if (m_provisionalPage && m_provisionalPage->navigationID() == navigationID)3759 return;3760 3781 3761 3782 // FIXME: Message check the navigationID. … … 3775 3796 if (frame->isMainFrame() && navigationID) 3776 3797 navigation = navigationState().navigation(navigationID); 3798 3799 // If this seemingly new load is actually continuing a server redirect for a previous navigation in a new process, 3800 // then we ignore this notification. 3801 if (navigation && navigation->currentRequestIsRedirect()) { 3802 auto navigationProcessIdentifier = navigation->currentRequestProcessIdentifier(); 3803 if (navigationProcessIdentifier && *navigationProcessIdentifier != m_process->coreProcessIdentifier()) 3804 return; 3805 } 3777 3806 3778 3807 LOG(Loading, "WebPageProxy %" PRIu64 " in process pid %i didStartProvisionalLoadForFrame to frameID %" PRIu64 ", navigationID %" PRIu64 ", url %s", m_pageID, m_process->processIdentifier(), frameID, navigationID, url.string().utf8().data()); … … 3882 3911 3883 3912 PageClientProtector protector(pageClient()); 3884 3885 if (m_provisionalPage && m_provisionalPage->navigationID() == navigationID && &m_provisionalPage->process() != m_process.ptr()) {3886 // The load did not fail, it is merely happening in a new provisional process.3887 return;3888 }3889 3913 3890 3914 WebFrameProxy* frame = m_process->webFrame(frameID); … … 3926 3950 3927 3951 m_failingProvisionalLoadURL = { }; 3928 3929 // If the provisional page's load fails then we destroy the provisional page.3930 if (m_provisionalPage && m_provisionalPage->mainFrame() == frame)3931 m_provisionalPage = nullptr;3932 3952 } 3933 3953 … … 4321 4341 MESSAGE_CHECK(frame); 4322 4342 4323 decidePolicyForNavigationAction(*frame, WTFMove(frameSecurityOrigin), navigationID, WTFMove(navigationActionData), WTFMove(frameInfoData), originatingPageID, originalRequest, WTFMove(request), WTFMove(requestBody), WTFMove(redirectResponse), userData, PolicyDecisionSender::create([this, protectedThis = makeRef(*this), frameID, listenerID , process = m_process.copyRef()] (auto... args) {4324 process->send(Messages::WebPage::DidReceivePolicyDecision(frameID, listenerID, args...), m_pageID);4343 decidePolicyForNavigationAction(*frame, WTFMove(frameSecurityOrigin), navigationID, WTFMove(navigationActionData), WTFMove(frameInfoData), originatingPageID, originalRequest, WTFMove(request), WTFMove(requestBody), WTFMove(redirectResponse), userData, PolicyDecisionSender::create([this, protectedThis = makeRef(*this), frameID, listenerID] (auto... args) { 4344 m_process->send(Messages::WebPage::DidReceivePolicyDecision(frameID, listenerID, args...), m_pageID); 4325 4345 })); 4326 4346 } … … 4556 4576 4557 4577 RefPtr<API::Navigation> navigation = navigationID ? m_navigationState->navigation(navigationID) : nullptr; 4558 auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), frameID, listenerID, navigation = WTFMove(navigation) , process = m_process.copyRef()] (WebPolicyAction policyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient processSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&& safeBrowsingWarning) mutable {4578 auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), frameID, listenerID, navigation = WTFMove(navigation)] (WebPolicyAction policyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient processSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&& safeBrowsingWarning) mutable { 4559 4579 // FIXME: Assert the API::WebsitePolicies* is nullptr here once clients of WKFramePolicyListenerUseWithPolicies go away. 4560 4580 RELEASE_ASSERT(processSwapRequestedByClient == ProcessSwapRequestedByClient::No); 4561 4581 ASSERT_UNUSED(safeBrowsingWarning, !safeBrowsingWarning); 4562 receivedPolicyDecision(policyAction, navigation.get(), WTF::nullopt, PolicyDecisionSender::create([this, protectedThis = WTFMove(protectedThis), frameID, listenerID , process = WTFMove(process)] (auto... args) {4563 process->send(Messages::WebPage::DidReceivePolicyDecision(frameID, listenerID, args...), m_pageID);4582 receivedPolicyDecision(policyAction, navigation.get(), WTF::nullopt, PolicyDecisionSender::create([this, protectedThis = WTFMove(protectedThis), frameID, listenerID] (auto... args) { 4583 m_process->send(Messages::WebPage::DidReceivePolicyDecision(frameID, listenerID, args...), m_pageID); 4564 4584 })); 4565 4585 }, ShouldExpectSafeBrowsingResult::No)); … … 6384 6404 } 6385 6405 6386 void WebPageProxy::provisionalProcessDidTerminate()6387 {6388 ASSERT(m_provisionalPage);6389 m_provisionalPage->cancel();6390 m_provisionalPage = nullptr;6391 }6392 6393 6406 static bool shouldReloadAfterProcessTermination(ProcessTerminationReason reason) 6394 6407 { … … 6478 6491 { 6479 6492 m_mainFrame = nullptr; 6493 m_mainFrameCreationHandler = nullptr; 6494 m_mainFrameWindowCreationHandler = nullptr; 6480 6495 6481 6496 #if PLATFORM(COCOA) … … 6768 6783 #endif 6769 6784 6770 #if ENABLE(SERVICE_WORKER)6771 parameters.hasRegisteredServiceWorkers = process().processPool().mayHaveRegisteredServiceWorkers(m_websiteDataStore);6772 #endif6773 6774 6785 parameters.needsFontAttributes = m_needsFontAttributes; 6775 6786 … … 8533 8544 } 8534 8545 8535 WebPageProxy::PageProcessOverride::PageProcessOverride(WebPageProxy& page, WebProcessProxy& newProcess)8536 : m_page(&page)8537 , m_previousProcess(page.process())8538 {8539 page.m_process = newProcess;8540 }8541 8542 WebPageProxy::PageProcessOverride::PageProcessOverride(PageProcessOverride&&) = default;8543 8544 WebPageProxy::PageProcessOverride::~PageProcessOverride()8545 {8546 if (m_page)8547 m_page->m_process = WTFMove(m_previousProcess);8548 }8549 8550 8546 #if ENABLE(DATA_DETECTION) 8551 8547 -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r239993 r240015 226 226 class NativeWebWheelEvent; 227 227 class PageClient; 228 class ProvisionalPageProxy;229 228 class RemoteLayerTreeHost; 230 229 class RemoteLayerTreeScrollingPerformanceData; … … 358 357 WebFrameProxy* frameSetLargestFrame() const { return m_frameSetLargestFrame.get(); } 359 358 360 DrawingAreaProxy* drawingArea() const ;359 DrawingAreaProxy* drawingArea() const { return m_drawingArea.get(); } 361 360 362 361 WebNavigationState& navigationState() { return *m_navigationState.get(); } … … 381 380 bool addsVisitedLinks() const { return m_addsVisitedLinks; } 382 381 void setAddsVisitedLinks(bool addsVisitedLinks) { m_addsVisitedLinks = addsVisitedLinks; } 383 VisitedLinkStore& visitedLinkStore() { return m_visitedLinkStore; }384 382 385 383 void exitFullscreenImmediately(); … … 461 459 void setIconLoadingClient(std::unique_ptr<API::IconLoadingClient>&&); 462 460 463 void initializeWebPage();464 void setDrawingArea(std::unique_ptr<DrawingAreaProxy>&&);461 enum class IsSwapFromSuspended { No, Yes }; 462 void initializeWebPage(IsSwapFromSuspended = IsSwapFromSuspended::No); 465 463 466 464 WeakPtr<SecKeyProxyStore> secKeyProxyStore(const WebCore::AuthenticationChallenge&); … … 1000 998 void processDidBecomeResponsive(); 1001 999 void processDidTerminate(ProcessTerminationReason); 1002 void provisionalProcessDidTerminate();1003 1000 void dispatchProcessDidTerminate(ProcessTerminationReason); 1004 1001 void willChangeProcessIsResponsive(); … … 1028 1025 WebProcessProxy& process() { return m_process; } 1029 1026 ProcessID processIdentifier() const; 1030 1031 class PageProcessOverride {1032 public:1033 PageProcessOverride(WebPageProxy&, WebProcessProxy& newProcess);1034 PageProcessOverride(PageProcessOverride&&);1035 ~PageProcessOverride();1036 1037 private:1038 RefPtr<WebPageProxy> m_page;1039 Ref<WebProcessProxy> m_previousProcess;1040 };1041 1042 PageProcessOverride temporarilyOverrideProcess(WebProcessProxy& newProcess) { return PageProcessOverride(*this, newProcess); }1043 1027 1044 1028 WebPreferences& preferences() { return m_preferences; } … … 1432 1416 #endif 1433 1417 1434 ProvisionalPageProxy* provisionalPageProxy() const { return m_provisionalPage.get(); }1435 void commitProvisionalPage(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData&);1436 1437 void didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, URL&&, URL&& unreachableURL, const UserData&);1438 void didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, const UserData&);1439 void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::ResourceRequest&&, const UserData&);1440 1441 void loadDataWithNavigation(API::Navigation&, const IPC::DataReference&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, WebCore::ShouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&& = WTF::nullopt);1442 void loadRequestWithNavigation(API::Navigation&, WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy, API::Object* userData, WebCore::ShouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&& = WTF::nullopt);1443 1444 // IPC::MessageReceiver1445 // Implemented in generated WebPageProxyMessageReceiver.cpp1446 void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;1447 void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override;1448 1449 1418 private: 1450 1419 WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&); … … 1471 1440 void setUserAgent(String&&); 1472 1441 1442 // IPC::MessageReceiver 1443 // Implemented in generated WebPageProxyMessageReceiver.cpp 1444 void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; 1445 void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override; 1446 1447 1473 1448 // IPC::MessageSender 1474 1449 bool sendMessage(std::unique_ptr<IPC::Encoder>, OptionSet<IPC::SendOption>) override; … … 1492 1467 void didCreateWindow(uint64_t frameID, WebCore::GlobalWindowIdentifier&&); 1493 1468 1469 void didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, URL&&, URL&& unreachableURL, const UserData&); 1470 void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::ResourceRequest&&, const UserData&); 1494 1471 void willPerformClientRedirectForFrame(uint64_t frameID, const String& url, double delay, WebCore::LockBackForwardList); 1495 1472 void didCancelClientRedirectForFrame(uint64_t frameID); 1496 1473 void didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, URL&&); 1474 void didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, const UserData&); 1497 1475 void didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData&); 1498 1476 void didFinishDocumentLoadForFrame(uint64_t frameID, uint64_t navigationID, const UserData&); … … 1598 1576 1599 1577 void reattachToWebProcess(); 1600 void swapToWebProcess(Ref<WebProcessProxy>&&, std::unique_ptr< DrawingAreaProxy>&&, RefPtr<WebFrameProxy>&& mainFrame);1578 void swapToWebProcess(Ref<WebProcessProxy>&&, std::unique_ptr<SuspendedPageProxy>&&, IsSwapFromSuspended); 1601 1579 void didFailToSuspendAfterProcessSwap(); 1602 1580 void didSuspendAfterProcessSwap(); 1603 1581 1604 enum class ShouldInitializeWebPage { No, Yes }; 1605 void finishAttachingToWebProcess(ShouldInitializeWebPage = ShouldInitializeWebPage::Yes); 1582 void finishAttachingToWebProcess(IsSwapFromSuspended = IsSwapFromSuspended::No); 1606 1583 1607 1584 RefPtr<API::Navigation> reattachToWebProcessForReload(); 1608 1585 RefPtr<API::Navigation> reattachToWebProcessWithItem(WebBackForwardListItem&); 1586 1587 void loadDataWithNavigation(API::Navigation&, const IPC::DataReference&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, WebCore::ShouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&& = WTF::nullopt); 1588 void loadRequestWithNavigation(API::Navigation&, WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy, API::Object* userData, WebCore::ShouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&& = WTF::nullopt); 1609 1589 1610 1590 void requestNotificationPermission(uint64_t notificationID, const String& originString); … … 1973 1953 1974 1954 RefPtr<WebFrameProxy> m_mainFrame; 1955 Function<void()> m_mainFrameCreationHandler; 1956 Function<void(const WebCore::GlobalWindowIdentifier&)> m_mainFrameWindowCreationHandler; 1975 1957 1976 1958 RefPtr<WebFrameProxy> m_focusedFrame; … … 2343 2325 bool m_mayHaveUniversalFileReadSandboxExtension { false }; 2344 2326 2345 std::unique_ptr<ProvisionalPageProxy> m_provisionalPage;2346 2347 2327 #if HAVE(PENCILKIT) 2348 2328 std::unique_ptr<EditableImageController> m_editableImageController; -
trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp
r239993 r240015 35 35 #include "PluginInfoStore.h" 36 36 #include "PluginProcessManager.h" 37 #include "ProvisionalPageProxy.h"38 37 #include "TextChecker.h" 39 38 #include "TextCheckerState.h" … … 586 585 #endif 587 586 588 bool WebProcessProxy::hasProvisionalPageWithID(uint64_t pageID) const589 {590 for (auto* provisionalPage : m_provisionalPages) {591 if (provisionalPage->page().pageID() == pageID)592 return true;593 }594 return false;595 }596 597 587 void WebProcessProxy::updateBackForwardItem(const BackForwardListItemState& itemState) 598 588 { … … 602 592 // e.g. The old web process is navigating to about:blank for suspension. 603 593 // We ignore these updates. 604 if (m_pageMap.contains(item->pageID()) || hasProvisionalPageWithID(item->pageID()))594 if (m_pageMap.contains(item->pageID())) 605 595 item->setPageState(itemState.pageState); 606 596 } … … 705 695 706 696 auto pages = copyToVectorOf<RefPtr<WebPageProxy>>(m_pageMap.values()); 707 auto provisionalPages = WTF::map(m_provisionalPages, [](auto* provisionalPage) { return makeWeakPtr(provisionalPage); });708 697 709 698 shutDown(); … … 720 709 for (auto& page : pages) 721 710 page->processDidTerminate(ProcessTerminationReason::Crash); 722 723 for (auto& provisionalPage : provisionalPages) {724 if (provisionalPage)725 provisionalPage->processDidTerminate();726 }727 711 } 728 712 … … 796 780 page->processDidFinishLaunching(); 797 781 } 798 799 for (auto* provisionalPage : m_provisionalPages) {800 ASSERT(this == &provisionalPage->process());801 provisionalPage->processDidFinishLaunching();802 }803 804 782 805 783 RELEASE_ASSERT(!m_webConnection); … … 896 874 bool WebProcessProxy::canTerminateChildProcess() 897 875 { 898 if (!m_pageMap.isEmpty() || m_processPool->hasSuspendedPageFor(*this) || !m_provisionalPages.isEmpty())876 if (!m_pageMap.isEmpty() || m_processPool->hasSuspendedPageFor(*this)) 899 877 return false; 900 878 -
trunk/Source/WebKit/UIProcess/WebProcessProxy.h
r239993 r240015 71 71 class ObjCObjectGraph; 72 72 class PageClient; 73 class ProvisionalPageProxy;74 73 class UserMediaCaptureManagerProxy; 75 74 class VisitedLinkStore; … … 126 125 void removeWebPage(WebPageProxy&, uint64_t pageID, EndsUsingDataStore); 127 126 128 void addProvisionalPageProxy(ProvisionalPageProxy& provisionalPage) { ASSERT(!m_provisionalPages.contains(&provisionalPage)); m_provisionalPages.add(&provisionalPage); }129 void removeProvisionalPageProxy(ProvisionalPageProxy& provisionalPage) { ASSERT(m_provisionalPages.contains(&provisionalPage)); m_provisionalPages.remove(&provisionalPage); }130 131 127 typename WebPageProxyMap::ValuesConstIteratorRange pages() const { return m_pageMap.values(); } 132 128 unsigned pageCount() const { return m_pageMap.size(); } … … 335 331 void logDiagnosticMessageForResourceLimitTermination(const String& limitKey); 336 332 337 bool hasProvisionalPageWithID(uint64_t pageID) const;338 339 333 enum class IsWeak { No, Yes }; 340 334 template<typename T> class WeakOrStrongPtr { … … 380 374 WebPageProxyMap m_pageMap; 381 375 WebFrameProxyMap m_frameMap; 382 HashSet<ProvisionalPageProxy*> m_provisionalPages;383 376 UserInitiatedActionMap m_userInitiatedActionMap; 384 377 -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r240014 r240015 3072 3072 466BC0391FA266C9002FA9C1 /* WebSWContextManagerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWContextManagerConnection.h; sourceTree = "<group>"; }; 3073 3073 466BC03A1FA266C9002FA9C1 /* WebSWContextManagerConnection.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebSWContextManagerConnection.messages.in; sourceTree = "<group>"; }; 3074 4683569A21E81CC7006E27A3 /* ProvisionalPageProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProvisionalPageProxy.h; sourceTree = "<group>"; };3075 4683569B21E81CC7006E27A3 /* ProvisionalPageProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProvisionalPageProxy.cpp; sourceTree = "<group>"; };3076 3074 46A2B6061E5675A200C3DEDA /* BackgroundProcessResponsivenessTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BackgroundProcessResponsivenessTimer.cpp; sourceTree = "<group>"; }; 3077 3075 46A2B6071E5675A200C3DEDA /* BackgroundProcessResponsivenessTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackgroundProcessResponsivenessTimer.h; sourceTree = "<group>"; }; … … 7320 7318 86E67A21190F411800004AB7 /* ProcessThrottler.h */, 7321 7319 83048AE51ACA45DC0082C832 /* ProcessThrottlerClient.h */, 7322 4683569B21E81CC7006E27A3 /* ProvisionalPageProxy.cpp */,7323 4683569A21E81CC7006E27A3 /* ProvisionalPageProxy.h */,7324 7320 A55BA81B1BA25B1E007CD33D /* RemoteWebInspectorProxy.cpp */, 7325 7321 A55BA8191BA25B1E007CD33D /* RemoteWebInspectorProxy.h */, -
trunk/Source/WebKit/WebProcess/WebPage/WebFrame.cpp
r239993 r240015 264 264 case WebPolicyAction::Download: 265 265 return WebCore::PolicyAction::Download; 266 case WebPolicyAction::Suspend: 267 break; 266 268 } 267 269 ASSERT_NOT_REACHED(); … … 271 273 void WebFrame::didReceivePolicyDecision(uint64_t listenerID, WebPolicyAction action, uint64_t navigationID, DownloadID downloadID, Optional<WebsitePoliciesData>&& websitePolicies) 272 274 { 273 if (!m_coreFrame || !m_policyListenerID || listenerID != m_policyListenerID || !m_policyFunction) 275 if (!m_coreFrame || !m_policyListenerID || listenerID != m_policyListenerID || !m_policyFunction) { 276 if (action == WebPolicyAction::Suspend) 277 page()->send(Messages::WebPageProxy::DidFailToSuspendAfterProcessSwap()); 274 278 return; 279 } 275 280 276 281 FramePolicyFunction function = WTFMove(m_policyFunction); … … 288 293 } 289 294 295 bool shouldSuspend = false; 296 if (action == WebPolicyAction::Suspend) { 297 shouldSuspend = true; 298 action = WebPolicyAction::Ignore; 299 } 300 290 301 function(toPolicyAction(action)); 302 303 if (shouldSuspend) 304 page()->suspendForProcessSwap(); 291 305 } 292 306 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r240014 r240015 403 403 , m_cpuLimit(parameters.cpuLimit) 404 404 #if PLATFORM(MAC) 405 , m_shouldAttachDrawingAreaOnPageTransition(parameters.is ProcessSwap)405 , m_shouldAttachDrawingAreaOnPageTransition(parameters.isSwapFromSuspended) 406 406 #endif 407 407 { … … 474 474 m_drawingArea->setShouldScaleViewToFitDocument(parameters.shouldScaleViewToFitDocument); 475 475 476 if (parameters.is ProcessSwap)477 freezeLayerTree(LayerTreeFreezeReason:: ProcessSwap);476 if (parameters.isSwapFromSuspended) 477 freezeLayerTree(LayerTreeFreezeReason::SwapFromSuspended); 478 478 479 479 #if ENABLE(ASYNC_SCROLLING) … … 699 699 m_drawingArea->setPaintingEnabled(true); 700 700 #if PLATFORM(MAC) 701 m_shouldAttachDrawingAreaOnPageTransition = parameters.is ProcessSwap;701 m_shouldAttachDrawingAreaOnPageTransition = parameters.isSwapFromSuspended; 702 702 #endif 703 703 unfreezeLayerTree(LayerTreeFreezeReason::PageSuspended); … … 3056 3056 if (!frame) 3057 3057 return; 3058 if (policyAction == WebPolicyAction::Suspend) { 3059 ASSERT(frame == m_mainFrame); 3060 setIsSuspended(true); 3061 3062 WebProcess::singleton().sendPrewarmInformation(mainWebFrame()->url()); 3063 } 3058 3064 frame->didReceivePolicyDecision(listenerID, policyAction, navigationID, downloadID, WTFMove(websitePolicies)); 3059 3065 } … … 3097 3103 bool isInitialEmptyDocument = !m_mainFrame; 3098 3104 if (!isInitialEmptyDocument) 3099 unfreezeLayerTree(LayerTreeFreezeReason:: ProcessSwap);3105 unfreezeLayerTree(LayerTreeFreezeReason::SwapFromSuspended); 3100 3106 3101 3107 #if PLATFORM(MAC) … … 6309 6315 // Unfrozen on drawing area reset. 6310 6316 freezeLayerTree(LayerTreeFreezeReason::PageSuspended); 6311 6312 WebProcess::singleton().sendPrewarmInformation(mainWebFrame()->url());6313 6314 suspendForProcessSwap();6315 6317 } else 6316 6318 m_shouldResetDrawingAreaAfterSuspend = true; -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r239993 r240015 697 697 PageSuspended = 1 << 3, 698 698 Printing = 1 << 4, 699 ProcessSwap= 1 << 5,699 SwapFromSuspended = 1 << 5, 700 700 }; 701 701 void freezeLayerTree(LayerTreeFreezeReason); -
trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm
r239993 r240015 98 98 setColorSpace(parameters.colorSpace); 99 99 100 if (!parameters.is ProcessSwap)100 if (!parameters.isSwapFromSuspended) 101 101 attach(); 102 102 } -
trunk/Tools/ChangeLog
r240010 r240015 1 2019-01-15 Chris Dumez <cdumez@apple.com> 2 3 Unreviewed, rolling out r239993, r239995, r239997, and 4 r239999. 5 6 Caused assertions under 7 ViewGestureController::disconnectFromProcess() 8 9 Reverted changesets: 10 11 "Regression(PSON) View becomes blank after click a cross-site 12 download link" 13 https://bugs.webkit.org/show_bug.cgi?id=193361 14 https://trac.webkit.org/changeset/239993 15 16 "Unreviewed iOS build fix after r239993." 17 https://trac.webkit.org/changeset/239995 18 19 "Fix iOS build after r239993" 20 https://bugs.webkit.org/show_bug.cgi?id=193361 21 https://trac.webkit.org/changeset/239997 22 23 "Unreviewed, revert part of r239997 as it is not needed to fix 24 the build." 25 https://trac.webkit.org/changeset/239999 26 1 27 2019-01-15 Tim Horton <timothy_horton@apple.com> 2 28 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm
r239993 r240015 1 1 /* 2 * Copyright (C) 2017 -2019Apple Inc. All rights reserved.2 * Copyright (C) 2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 73 73 static bool willPerformClientRedirect; 74 74 static bool didPerformClientRedirect; 75 static bool shouldConvertToDownload;76 75 static RetainPtr<NSURL> clientRedirectSourceURL; 77 76 static RetainPtr<NSURL> clientRedirectDestinationURL; … … 128 127 decisionHandler(WKNavigationActionPolicyAllow); 129 128 didRepondToPolicyDecisionCall = true; 130 }131 132 - (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler133 {134 decisionHandler(shouldConvertToDownload ? _WKNavigationResponsePolicyBecomeDownload : WKNavigationResponsePolicyAllow);135 129 } 136 130 … … 1412 1406 EXPECT_FALSE(serverRedirected); 1413 1407 EXPECT_EQ(3, numberOfDecidePolicyCalls); 1414 EXPECT_EQ( 3u, seenPIDs.size());1408 EXPECT_EQ(2u, seenPIDs.size()); 1415 1409 } 1416 1410 … … 1472 1466 1473 1467 EXPECT_WK_STREQ(@"pson://www.webkit.org/main1.html", [[webView URL] absoluteString]); 1474 }1475 1476 static const char* linkToWebKitBytes = R"PSONRESOURCE(1477 <body>1478 <a id="testLink" href="pson://www.webkit.org/main.html">Link</a>1479 </body>1480 )PSONRESOURCE";1481 1482 TEST(ProcessSwap, PolicyCancelAfterServerRedirect)1483 {1484 auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]);1485 processPoolConfiguration.get().processSwapsOnNavigation = YES;1486 auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);1487 1488 auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);1489 [webViewConfiguration setProcessPool:processPool.get()];1490 auto handler = adoptNS([[PSONScheme alloc] init]);1491 [handler addMappingFromURLString:@"pson://www.google.com/main.html" toData:linkToWebKitBytes];1492 [handler addRedirectFromURLString:@"pson://www.webkit.org/main.html" toURLString:@"pson://www.apple.com/ignore.html"];1493 [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"pson"];1494 1495 auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);1496 auto navigationDelegate = adoptNS([[PSONNavigationDelegate alloc] init]);1497 [webView setNavigationDelegate:navigationDelegate.get()];1498 1499 navigationDelegate->decidePolicyForNavigationAction = ^(WKNavigationAction *action, void (^decisionHandler)(WKNavigationActionPolicy)) {1500 if ([action.request.URL.absoluteString hasSuffix:@"ignore.html"]) {1501 decisionHandler(WKNavigationActionPolicyCancel);1502 return;1503 }1504 decisionHandler(WKNavigationActionPolicyAllow);1505 };1506 1507 NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.google.com/main.html"]];1508 [webView loadRequest:request];1509 1510 TestWebKitAPI::Util::run(&done);1511 done = false;1512 auto pidAfterFirstLoad = [webView _webProcessIdentifier];1513 1514 EXPECT_EQ(1, numberOfDecidePolicyCalls);1515 1516 [webView evaluateJavaScript:@"testLink.click()" completionHandler:nil];1517 1518 TestWebKitAPI::Util::run(&failed);1519 failed = false;1520 done = false;1521 1522 EXPECT_EQ(3, numberOfDecidePolicyCalls);1523 1524 // We should still be on google.com.1525 EXPECT_EQ(pidAfterFirstLoad, [webView _webProcessIdentifier]);1526 EXPECT_WK_STREQ(@"pson://www.google.com/main.html", [[webView URL] absoluteString]);1527 1528 [webView evaluateJavaScript:@"testLink.innerText" completionHandler: [&] (id innerText, NSError *error) {1529 EXPECT_WK_STREQ(@"Link", innerText);1530 done = true;1531 }];1532 TestWebKitAPI::Util::run(&done);1533 done = false;1534 }1535 1536 TEST(ProcessSwap, CrossSiteDownload)1537 {1538 auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]);1539 processPoolConfiguration.get().processSwapsOnNavigation = YES;1540 auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);1541 1542 auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);1543 [webViewConfiguration setProcessPool:processPool.get()];1544 auto handler = adoptNS([[PSONScheme alloc] init]);1545 [handler addMappingFromURLString:@"pson://www.google.com/main.html" toData:linkToWebKitBytes];1546 [handler addMappingFromURLString:@"pson://www.webkit.org/main.html" toData:"Hello"];1547 [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"pson"];1548 1549 auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);1550 auto navigationDelegate = adoptNS([[PSONNavigationDelegate alloc] init]);1551 [webView setNavigationDelegate:navigationDelegate.get()];1552 1553 NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.google.com/main.html"]];1554 [webView loadRequest:request];1555 1556 TestWebKitAPI::Util::run(&done);1557 done = false;1558 auto pidAfterFirstLoad = [webView _webProcessIdentifier];1559 1560 shouldConvertToDownload = true;1561 [webView evaluateJavaScript:@"testLink.click()" completionHandler:nil];1562 1563 TestWebKitAPI::Util::run(&failed);1564 failed = false;1565 shouldConvertToDownload = false;1566 1567 // We should still be on google.com.1568 EXPECT_EQ(pidAfterFirstLoad, [webView _webProcessIdentifier]);1569 EXPECT_WK_STREQ(@"pson://www.google.com/main.html", [[webView URL] absoluteString]);1570 1571 [webView evaluateJavaScript:@"testLink.innerText" completionHandler: [&] (id innerText, NSError *error) {1572 EXPECT_WK_STREQ(@"Link", innerText);1573 done = true;1574 }];1575 TestWebKitAPI::Util::run(&done);1576 done = false;1577 1468 } 1578 1469 … … 2342 2233 EXPECT_EQ(7u, [receivedMessages count]); 2343 2234 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - pageshow NOT persisted", receivedMessages.get()[0]); 2344 if ([receivedMessages.get()[1] hasPrefix:@"pson://www.webkit.org/main.html"]) { 2345 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - pagehide persisted", receivedMessages.get()[1]); 2346 EXPECT_WK_STREQ(@"pson://www.apple.com/main.html - pageshow NOT persisted", receivedMessages.get()[2]); 2347 } else { 2348 EXPECT_WK_STREQ(@"pson://www.apple.com/main.html - pageshow NOT persisted", receivedMessages.get()[1]); 2349 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - pagehide persisted", receivedMessages.get()[2]); 2350 } 2351 if ([receivedMessages.get()[3] hasPrefix:@"pson://www.apple.com/main.html"]) { 2352 EXPECT_WK_STREQ(@"pson://www.apple.com/main.html - pagehide persisted", receivedMessages.get()[3]); 2353 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - pageshow persisted", receivedMessages.get()[4]); 2354 } else { 2355 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - pageshow persisted", receivedMessages.get()[3]); 2356 EXPECT_WK_STREQ(@"pson://www.apple.com/main.html - pagehide persisted", receivedMessages.get()[4]); 2357 } 2358 if ([receivedMessages.get()[5] hasPrefix:@"pson://www.webkit.org/main.html"]) { 2359 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - pagehide persisted", receivedMessages.get()[5]); 2360 EXPECT_WK_STREQ(@"pson://www.apple.com/main.html - pageshow persisted", receivedMessages.get()[6]); 2361 } else { 2362 EXPECT_WK_STREQ(@"pson://www.apple.com/main.html - pageshow persisted", receivedMessages.get()[5]); 2363 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - pagehide persisted", receivedMessages.get()[6]); 2364 } 2235 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - pagehide persisted", receivedMessages.get()[1]); 2236 EXPECT_WK_STREQ(@"pson://www.apple.com/main.html - pageshow NOT persisted", receivedMessages.get()[2]); 2237 EXPECT_WK_STREQ(@"pson://www.apple.com/main.html - pagehide persisted", receivedMessages.get()[3]); 2238 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - pageshow persisted", receivedMessages.get()[4]); 2239 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - pagehide persisted", receivedMessages.get()[5]); 2240 EXPECT_WK_STREQ(@"pson://www.apple.com/main.html - pageshow persisted", receivedMessages.get()[6]); 2365 2241 } 2366 2242 … … 2432 2308 EXPECT_EQ(7u, [receivedMessages count]); 2433 2309 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - load", receivedMessages.get()[0]); 2434 if ([receivedMessages.get()[1] hasPrefix:@"pson://www.webkit.org/main.html"]) { 2435 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - unload", receivedMessages.get()[1]); 2436 EXPECT_WK_STREQ(@"pson://www.apple.com/main.html - load", receivedMessages.get()[2]); 2437 } else { 2438 EXPECT_WK_STREQ(@"pson://www.apple.com/main.html - load", receivedMessages.get()[1]); 2439 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - unload", receivedMessages.get()[2]); 2440 } 2441 if ([receivedMessages.get()[3] hasPrefix:@"pson://www.apple.com/main.html"]) { 2442 EXPECT_WK_STREQ(@"pson://www.apple.com/main.html - unload", receivedMessages.get()[3]); 2443 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - load", receivedMessages.get()[4]); 2444 } else { 2445 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - load", receivedMessages.get()[3]); 2446 EXPECT_WK_STREQ(@"pson://www.apple.com/main.html - unload", receivedMessages.get()[4]); 2447 } 2448 if ([receivedMessages.get()[5] hasPrefix:@"pson://www.webkit.org/main.html"]) { 2449 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - unload", receivedMessages.get()[5]); 2450 EXPECT_WK_STREQ(@"pson://www.apple.com/main.html - load", receivedMessages.get()[6]); 2451 } else { 2452 EXPECT_WK_STREQ(@"pson://www.apple.com/main.html - load", receivedMessages.get()[5]); 2453 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - unload", receivedMessages.get()[6]); 2454 } 2310 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - unload", receivedMessages.get()[1]); 2311 EXPECT_WK_STREQ(@"pson://www.apple.com/main.html - load", receivedMessages.get()[2]); 2312 EXPECT_WK_STREQ(@"pson://www.apple.com/main.html - unload", receivedMessages.get()[3]); 2313 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - load", receivedMessages.get()[4]); 2314 EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html - unload", receivedMessages.get()[5]); 2315 EXPECT_WK_STREQ(@"pson://www.apple.com/main.html - load", receivedMessages.get()[6]); 2455 2316 } 2456 2317
Note: See TracChangeset
for help on using the changeset viewer.