b2bda78ac4326fc15c78e6562498dd900c5c16f6
[WebKit-https.git] / Source / WebKit / UIProcess / ProvisionalPageProxy.cpp
1 /*
2  * Copyright (C) 2019 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #include "config.h"
27 #include "ProvisionalPageProxy.h"
28
29 #include "APINavigation.h"
30 #include "DrawingAreaProxy.h"
31 #include "FormDataReference.h"
32 #include "Logging.h"
33 #include "PageClient.h"
34 #include "URLSchemeTaskParameters.h"
35 #include "WebBackForwardList.h"
36 #include "WebBackForwardListItem.h"
37 #include "WebErrors.h"
38 #include "WebNavigationDataStore.h"
39 #include "WebNavigationState.h"
40 #include "WebPageMessages.h"
41 #include "WebPageProxy.h"
42 #include "WebPageProxyMessages.h"
43 #include "WebProcessMessages.h"
44 #include "WebProcessPool.h"
45 #include "WebProcessProxy.h"
46 #include <WebCore/ShouldTreatAsContinuingLoad.h>
47
48 namespace WebKit {
49
50 #define RELEASE_LOG_IF_ALLOWED(channel, fmt, ...) RELEASE_LOG_IF(m_page.isAlwaysOnLoggingAllowed(), channel, "%p - ProvisionalPageProxy::" fmt, this, ##__VA_ARGS__)
51 #define RELEASE_LOG_ERROR_IF_ALLOWED(channel, fmt, ...) RELEASE_LOG_ERROR_IF(m_page.isAlwaysOnLoggingAllowed(), channel, "%p - ProvisionalPageProxy::" fmt, this, ##__VA_ARGS__)
52
53 ProvisionalPageProxy::ProvisionalPageProxy(WebPageProxy& page, Ref<WebProcessProxy>&& process, std::unique_ptr<SuspendedPageProxy> suspendedPage, uint64_t navigationID, bool isServerRedirect, const WebCore::ResourceRequest& request, ProcessSwapRequestedByClient processSwapRequestedByClient)
54     : m_page(page)
55     , m_process(WTFMove(process))
56     , m_navigationID(navigationID)
57     , m_isServerRedirect(isServerRedirect)
58     , m_request(request)
59     , m_processSwapRequestedByClient(processSwapRequestedByClient)
60 #if PLATFORM(IOS_FAMILY)
61     , m_suspensionToken(m_process->throttler().foregroundActivityToken())
62 #endif
63 {
64     m_process->addMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_page.pageID(), *this);
65     m_process->addProvisionalPageProxy(*this);
66
67     if (m_process->state() == AuxiliaryProcessProxy::State::Running)
68         m_page.webProcessLifetimeTracker().webPageEnteringWebProcess(m_process);
69
70     if (&m_process->websiteDataStore() != &m_page.websiteDataStore())
71         m_process->processPool().pageBeginUsingWebsiteDataStore(m_page.pageID(), m_process->websiteDataStore());
72
73     // If we are reattaching to a SuspendedPage, then the WebProcess' WebPage already exists and
74     // WebPageProxy::didCreateMainFrame() will not be called to initialize m_mainFrame. In such
75     // case, we need to initialize m_mainFrame to reflect the fact the the WebProcess' WebPage
76     // already exists and already has a main frame.
77     if (suspendedPage) {
78         ASSERT(&suspendedPage->process() == m_process.ptr());
79         suspendedPage->unsuspend();
80         m_mainFrame = WebFrameProxy::create(m_page, suspendedPage->mainFrameID());
81         m_process->frameCreated(suspendedPage->mainFrameID(), *m_mainFrame);
82     }
83
84     initializeWebPage();
85 }
86
87 ProvisionalPageProxy::~ProvisionalPageProxy()
88 {
89     m_process->removeProvisionalPageProxy(*this);
90
91     if (m_wasCommitted)
92         return;
93
94     if (m_process->state() == AuxiliaryProcessProxy::State::Running)
95         m_page.webProcessLifetimeTracker().webPageLeavingWebProcess(m_process);
96
97     if (&m_process->websiteDataStore() != &m_page.websiteDataStore())
98         m_process->processPool().pageEndUsingWebsiteDataStore(m_page.pageID(), m_process->websiteDataStore());
99
100     m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_page.pageID());
101     m_process->send(Messages::WebPage::Close(), m_page.pageID());
102     m_process->removeVisitedLinkStoreUser(m_page.visitedLinkStore(), m_page.pageID());
103
104     RunLoop::main().dispatch([process = m_process.copyRef()] {
105         process->maybeShutDown();
106     });
107 }
108
109 void ProvisionalPageProxy::connectionWillOpen(IPC::Connection& connection)
110 {
111     ASSERT_UNUSED(connection, &connection == m_process->connection());
112
113     m_page.webProcessLifetimeTracker().webPageEnteringWebProcess(m_process);
114 }
115
116 void ProvisionalPageProxy::processDidTerminate()
117 {
118     RELEASE_LOG_ERROR_IF_ALLOWED(ProcessSwapping, "processDidTerminate: pageID = %" PRIu64, m_page.pageID());
119     m_page.provisionalProcessDidTerminate();
120 }
121
122 std::unique_ptr<DrawingAreaProxy> ProvisionalPageProxy::takeDrawingArea()
123 {
124     return WTFMove(m_drawingArea);
125 }
126
127 void ProvisionalPageProxy::cancel()
128 {
129     // If the provisional load started, then indicate that it failed due to cancellation by calling didFailProvisionalLoadForFrame().
130     if (m_provisionalLoadURL.isEmpty())
131         return;
132
133     RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "cancel: Simulating a didFailProvisionalLoadForFrame for pageID = %" PRIu64, m_page.pageID());
134     ASSERT(m_mainFrame);
135     auto error = WebKit::cancelledError(m_request);
136     error.setType(WebCore::ResourceError::Type::Cancellation);
137     didFailProvisionalLoadForFrame(m_mainFrame->frameID(), { }, m_navigationID, m_provisionalLoadURL, error, UserData { }); // Will delete |this|.
138 }
139
140 void ProvisionalPageProxy::initializeWebPage()
141 {
142     m_drawingArea = m_page.pageClient().createDrawingAreaProxy(m_process);
143
144     auto parameters = m_page.creationParameters(m_process, *m_drawingArea);
145     parameters.isProcessSwap = true;
146     m_process->send(Messages::WebProcess::CreateWebPage(m_page.pageID(), parameters), 0);
147     m_process->addVisitedLinkStoreUser(m_page.visitedLinkStore(), m_page.pageID());
148 }
149
150 void ProvisionalPageProxy::loadData(API::Navigation& navigation, const IPC::DataReference& data, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, Optional<WebsitePoliciesData>&& websitePolicies)
151 {
152     RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "loadData: pageID = %" PRIu64, m_page.pageID());
153
154     m_page.loadDataWithNavigationShared(m_process.copyRef(), navigation, data, MIMEType, encoding, baseURL, userData, WebCore::ShouldTreatAsContinuingLoad::Yes, WTFMove(websitePolicies));
155 }
156
157 void ProvisionalPageProxy::loadRequest(API::Navigation& navigation, WebCore::ResourceRequest&& request, WebCore::ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, API::Object* userData, Optional<WebsitePoliciesData>&& websitePolicies)
158 {
159     RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "loadRequest: pageID = %" PRIu64, m_page.pageID());
160
161     // If this is a client-side redirect continuing in a new process, then the new process will overwrite the fromItem's URL. In this case,
162     // we need to make sure we update fromItem's processIdentifier as we want future navigations to this BackForward item to happen in the
163     // new process.
164     if (navigation.fromItem() && navigation.lockBackForwardList() == WebCore::LockBackForwardList::Yes)
165         navigation.fromItem()->setLastProcessIdentifier(m_process->coreProcessIdentifier());
166
167     m_page.loadRequestWithNavigationShared(m_process.copyRef(), navigation, WTFMove(request), shouldOpenExternalURLsPolicy, userData, WebCore::ShouldTreatAsContinuingLoad::Yes, WTFMove(websitePolicies));
168 }
169
170 void ProvisionalPageProxy::goToBackForwardItem(API::Navigation& navigation, WebBackForwardListItem& item, Optional<WebsitePoliciesData>&& websitePolicies)
171 {
172     RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "goToBackForwardItem: pageID = %" PRIu64, m_page.pageID());
173
174     auto itemStates = m_page.backForwardList().filteredItemStates([this, targetItem = &item](auto& item) {
175         if (auto* page = item.suspendedPage()) {
176             if (&page->process() == m_process.ptr())
177                 return false;
178         }
179         return &item != targetItem;
180     });
181     m_process->send(Messages::WebPage::UpdateBackForwardListForReattach(WTFMove(itemStates)), m_page.pageID());
182     m_process->send(Messages::WebPage::GoToBackForwardItem(navigation.navigationID(), item.itemID(), *navigation.backForwardFrameLoadType(), WebCore::ShouldTreatAsContinuingLoad::Yes, WTFMove(websitePolicies)), m_page.pageID());
183     m_process->responsivenessTimer().start();
184 }
185
186 void ProvisionalPageProxy::didCreateMainFrame(uint64_t frameID)
187 {
188     RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "didCreateMainFrame: pageID = %" PRIu64 ", frameID = %" PRIu64, m_page.pageID(), frameID);
189     ASSERT(!m_mainFrame);
190
191     m_mainFrame = WebFrameProxy::create(m_page, frameID);
192
193     // Add the frame to the process wide map.
194     m_process->frameCreated(frameID, *m_mainFrame);
195
196     // This navigation was destroyed so no need to notify of redirect.
197     if (!m_page.navigationState().hasNavigation(m_navigationID))
198         return;
199
200     // Restore the main frame's committed URL as some clients may rely on it until the next load is committed.
201     if (auto* mainFrame = m_page.mainFrame())
202         m_mainFrame->frameLoadState().setURL(mainFrame->frameLoadState().url());
203
204     // Normally, notification of a server redirect comes from the WebContent process.
205     // If we are process swapping in response to a server redirect then that notification will not come from the new WebContent process.
206     // In this case we have the UIProcess synthesize the redirect notification at the appropriate time.
207     if (m_isServerRedirect) {
208         m_mainFrame->frameLoadState().didStartProvisionalLoad(m_request.url());
209         m_page.didReceiveServerRedirectForProvisionalLoadForFrameShared(m_process.copyRef(), m_mainFrame->frameID(), m_navigationID, WTFMove(m_request), { });
210     }
211 }
212
213 void ProvisionalPageProxy::didPerformClientRedirect(const String& sourceURLString, const String& destinationURLString, uint64_t frameID)
214 {
215     m_page.didPerformClientRedirectShared(m_process.copyRef(), sourceURLString, destinationURLString, frameID);
216 }
217
218 void ProvisionalPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, URL&& url, URL&& unreachableURL, const UserData& userData)
219 {
220     // If the previous provisional load used the same process, we may receive IPC for this previous provisional's main frame that we need to ignore.
221     if (!m_mainFrame || m_mainFrame->frameID() != frameID)
222         return;
223
224     RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "didStartProvisionalLoadForFrame: pageID = %" PRIu64 ", frameID = %" PRIu64 ", navigationID = %" PRIu64, m_page.pageID(), frameID, navigationID);
225     ASSERT(m_provisionalLoadURL.isNull());
226     m_provisionalLoadURL = url;
227
228     // Merely following a server side redirect so there is no need to send a didStartProvisionalLoad again.
229     if (m_isServerRedirect)
230         return;
231
232     // Clients expect the Page's main frame's expectedURL to be the provisional one when a provisional load is started.
233     if (auto* pageMainFrame = m_page.mainFrame())
234         pageMainFrame->didStartProvisionalLoad(url);
235
236     m_page.didStartProvisionalLoadForFrameShared(m_process.copyRef(), frameID, navigationID, WTFMove(url), WTFMove(unreachableURL), userData);
237 }
238
239 void ProvisionalPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError& error, const UserData& userData)
240 {
241     RELEASE_LOG_ERROR_IF_ALLOWED(ProcessSwapping, "didFailProvisionalLoadForFrame: pageID = %" PRIu64 ", frameID = %" PRIu64 ", navigationID = %" PRIu64, m_page.pageID(), frameID, navigationID);
242     m_provisionalLoadURL = { };
243
244     // Make sure the Page's main frame's expectedURL gets cleared since we updated it in didStartProvisionalLoad.
245     if (auto* pageMainFrame = m_page.mainFrame())
246         pageMainFrame->didFailProvisionalLoad();
247
248     m_page.didFailProvisionalLoadForFrameShared(m_process.copyRef(), frameID, frameSecurityOrigin, navigationID, provisionalURL, error, userData); // Will delete |this|.
249 }
250
251 void ProvisionalPageProxy::didCommitLoadForFrame(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)
252 {
253     // If the previous provisional load used the same process, we may receive IPC for this previous provisional's main frame that we need to ignore.
254     if (!m_mainFrame || m_mainFrame->frameID() != frameID)
255         return;
256
257     RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "didCommitLoadForFrame: pageID = %" PRIu64 ", frameID = %" PRIu64 ", navigationID = %" PRIu64, m_page.pageID(), frameID, navigationID);
258     m_provisionalLoadURL = { };
259     m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_page.pageID());
260
261     m_wasCommitted = true;
262     m_page.commitProvisionalPage(frameID, navigationID, mimeType, frameHasCustomContentProvider, frameLoadType, certificateInfo, containsPluginDocument, forcedHasInsecureContent, userData); // Will delete |this|.
263 }
264
265 void ProvisionalPageProxy::didNavigateWithNavigationData(const WebNavigationDataStore& store, uint64_t frameID)
266 {
267     m_page.didNavigateWithNavigationDataShared(m_process.copyRef(), store, frameID);
268 }
269
270 void ProvisionalPageProxy::didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, URL&& url)
271 {
272     m_page.didChangeProvisionalURLForFrameShared(m_process.copyRef(), frameID, navigationID, WTFMove(url));
273 }
274
275 void ProvisionalPageProxy::decidePolicyForNavigationActionAsync(uint64_t frameID, WebCore::SecurityOriginData&& frameSecurityOrigin, WebCore::PolicyCheckIdentifier identifier,
276     uint64_t navigationID, NavigationActionData&& navigationActionData, FrameInfoData&& frameInfoData, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest,
277     WebCore::ResourceRequest&& request, IPC::FormDataReference&& requestBody, WebCore::ResourceResponse&& redirectResponse, const UserData& userData, uint64_t listenerID)
278 {
279     ASSERT(m_mainFrame);
280     ASSERT(m_mainFrame->frameID() == frameID);
281     m_page.decidePolicyForNavigationActionAsyncShared(m_process.copyRef(), frameID, WTFMove(frameSecurityOrigin), identifier, navigationID, WTFMove(navigationActionData),
282         WTFMove(frameInfoData), originatingPageID, originalRequest, WTFMove(request), WTFMove(requestBody), WTFMove(redirectResponse), userData, listenerID);
283 }
284
285 void ProvisionalPageProxy::decidePolicyForResponse(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, WebCore::PolicyCheckIdentifier identifier,
286     uint64_t navigationID, const WebCore::ResourceResponse& response, const WebCore::ResourceRequest& request, bool canShowMIMEType, const String& downloadAttribute, uint64_t listenerID, const UserData& userData)
287 {
288     m_page.decidePolicyForResponseShared(m_process.copyRef(), frameID, frameSecurityOrigin, identifier, navigationID, response, request, canShowMIMEType, downloadAttribute, listenerID, userData);
289 }
290
291 void ProvisionalPageProxy::didPerformServerRedirect(const String& sourceURLString, const String& destinationURLString, uint64_t frameID)
292 {
293     m_page.didPerformServerRedirectShared(m_process.copyRef(), sourceURLString, destinationURLString, frameID);
294 }
295
296 void ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::ResourceRequest&& request, const UserData& userData)
297 {
298     m_page.didReceiveServerRedirectForProvisionalLoadForFrameShared(m_process.copyRef(), frameID, navigationID, WTFMove(request), userData);
299 }
300
301 void ProvisionalPageProxy::startURLSchemeTask(URLSchemeTaskParameters&& parameters)
302 {
303     m_page.startURLSchemeTaskShared(m_process.copyRef(), WTFMove(parameters));
304 }
305
306 void ProvisionalPageProxy::backForwardGoToItem(const WebCore::BackForwardItemIdentifier& identifier, CompletionHandler<void(SandboxExtension::Handle&&)>&& completionHandler)
307 {
308     m_page.backForwardGoToItemShared(m_process.copyRef(), identifier, WTFMove(completionHandler));
309 }
310
311 void ProvisionalPageProxy::decidePolicyForNavigationActionSync(uint64_t frameID, bool isMainFrame, WebCore::SecurityOriginData&& frameSecurityOrigin, WebCore::PolicyCheckIdentifier identifier,
312     uint64_t navigationID, NavigationActionData&& navigationActionData, FrameInfoData&& frameInfoData, uint64_t originatingPageID,
313     const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&& request, IPC::FormDataReference&& requestBody, WebCore::ResourceResponse&& redirectResponse,
314     const UserData& userData, Messages::WebPageProxy::DecidePolicyForNavigationActionSync::DelayedReply&& reply)
315 {
316     ASSERT(isMainFrame);
317     ASSERT(!m_mainFrame || m_mainFrame->frameID() == frameID);
318
319     if (!isMainFrame || (m_mainFrame && m_mainFrame->frameID() != frameID)) {
320         reply(identifier, WebCore::PolicyAction::Ignore, navigationID, DownloadID(), WTF::nullopt);
321         return;
322     }
323
324     if (!m_mainFrame) {
325         // This synchronous IPC message was processed before the asynchronous DidCreateMainFrame one so we do not know about this frameID yet.
326         didCreateMainFrame(frameID);
327     }
328     ASSERT(m_mainFrame);
329
330     m_page.decidePolicyForNavigationActionSyncShared(m_process.copyRef(), frameID, isMainFrame, WTFMove(frameSecurityOrigin), identifier, navigationID, WTFMove(navigationActionData),
331         WTFMove(frameInfoData), originatingPageID, originalRequest, WTFMove(request), WTFMove(requestBody), WTFMove(redirectResponse), userData, WTFMove(reply));
332 }
333
334 #if USE(QUICK_LOOK)
335 void ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame(const String& fileName)
336 {
337     m_page.didRequestPasswordForQuickLookDocumentInMainFrameShared(m_process.copyRef(), fileName);
338 }
339 #endif
340
341 #if PLATFORM(COCOA)
342 void ProvisionalPageProxy::registerWebProcessAccessibilityToken(const IPC::DataReference& data)
343 {
344     m_accessibilityToken = data.vector();
345 }
346 #endif
347
348 void ProvisionalPageProxy::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder)
349 {
350     ASSERT(decoder.messageReceiverName() == Messages::WebPageProxy::messageReceiverName());
351
352     if (decoder.messageName() == Messages::WebPageProxy::DidStartProgress::name()
353         || decoder.messageName() == Messages::WebPageProxy::DidChangeProgress::name()
354         || decoder.messageName() == Messages::WebPageProxy::BackForwardAddItem::name()
355         || decoder.messageName() == Messages::WebPageProxy::LogDiagnosticMessage::name()
356         || decoder.messageName() == Messages::WebPageProxy::LogDiagnosticMessageWithEnhancedPrivacy::name()
357         || decoder.messageName() == Messages::WebPageProxy::SetNetworkRequestsInProgress::name()
358 #if USE(QUICK_LOOK)
359         || decoder.messageName() == Messages::WebPageProxy::DidStartLoadForQuickLookDocumentInMainFrame::name()
360         || decoder.messageName() == Messages::WebPageProxy::DidFinishLoadForQuickLookDocumentInMainFrame::name()
361 #endif
362         )
363     {
364         m_page.didReceiveMessage(connection, decoder);
365         return;
366     }
367
368 #if PLATFORM(COCOA)
369     if (decoder.messageName() == Messages::WebPageProxy::RegisterWebProcessAccessibilityToken::name()) {
370         IPC::handleMessage<Messages::WebPageProxy::RegisterWebProcessAccessibilityToken>(decoder, this, &ProvisionalPageProxy::registerWebProcessAccessibilityToken);
371         return;
372     }
373 #endif
374
375     if (decoder.messageName() == Messages::WebPageProxy::StartURLSchemeTask::name()) {
376         IPC::handleMessage<Messages::WebPageProxy::StartURLSchemeTask>(decoder, this, &ProvisionalPageProxy::startURLSchemeTask);
377         return;
378     }
379
380     if (decoder.messageName() == Messages::WebPageProxy::DecidePolicyForNavigationActionAsync::name()) {
381         IPC::handleMessage<Messages::WebPageProxy::DecidePolicyForNavigationActionAsync>(decoder, this, &ProvisionalPageProxy::decidePolicyForNavigationActionAsync);
382         return;
383     }
384
385     if (decoder.messageName() == Messages::WebPageProxy::DecidePolicyForResponse::name()) {
386         IPC::handleMessage<Messages::WebPageProxy::DecidePolicyForResponse>(decoder, this, &ProvisionalPageProxy::decidePolicyForResponse);
387         return;
388     }
389
390     if (decoder.messageName() == Messages::WebPageProxy::DidChangeProvisionalURLForFrame::name()) {
391         IPC::handleMessage<Messages::WebPageProxy::DidChangeProvisionalURLForFrame>(decoder, this, &ProvisionalPageProxy::didChangeProvisionalURLForFrame);
392         return;
393     }
394
395     if (decoder.messageName() == Messages::WebPageProxy::DidNavigateWithNavigationData::name()) {
396         IPC::handleMessage<Messages::WebPageProxy::DidNavigateWithNavigationData>(decoder, this, &ProvisionalPageProxy::didNavigateWithNavigationData);
397         return;
398     }
399
400     if (decoder.messageName() == Messages::WebPageProxy::DidPerformClientRedirect::name()) {
401         IPC::handleMessage<Messages::WebPageProxy::DidPerformClientRedirect>(decoder, this, &ProvisionalPageProxy::didPerformClientRedirect);
402         return;
403     }
404
405     if (decoder.messageName() == Messages::WebPageProxy::DidCreateMainFrame::name()) {
406         IPC::handleMessage<Messages::WebPageProxy::DidCreateMainFrame>(decoder, this, &ProvisionalPageProxy::didCreateMainFrame);
407         return;
408     }
409
410     if (decoder.messageName() == Messages::WebPageProxy::DidStartProvisionalLoadForFrame::name()) {
411         IPC::handleMessage<Messages::WebPageProxy::DidStartProvisionalLoadForFrame>(decoder, this, &ProvisionalPageProxy::didStartProvisionalLoadForFrame);
412         return;
413     }
414
415     if (decoder.messageName() == Messages::WebPageProxy::DidFailProvisionalLoadForFrame::name()) {
416         IPC::handleMessage<Messages::WebPageProxy::DidFailProvisionalLoadForFrame>(decoder, this, &ProvisionalPageProxy::didFailProvisionalLoadForFrame);
417         return;
418     }
419
420     if (decoder.messageName() == Messages::WebPageProxy::DidCommitLoadForFrame::name()) {
421         IPC::handleMessage<Messages::WebPageProxy::DidCommitLoadForFrame>(decoder, this, &ProvisionalPageProxy::didCommitLoadForFrame);
422         return;
423     }
424
425     if (decoder.messageName() == Messages::WebPageProxy::DidReceiveServerRedirectForProvisionalLoadForFrame::name()) {
426         IPC::handleMessage<Messages::WebPageProxy::DidReceiveServerRedirectForProvisionalLoadForFrame>(decoder, this, &ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame);
427         return;
428     }
429
430     if (decoder.messageName() == Messages::WebPageProxy::DidPerformServerRedirect::name()) {
431         IPC::handleMessage<Messages::WebPageProxy::DidPerformServerRedirect>(decoder, this, &ProvisionalPageProxy::didPerformServerRedirect);
432         return;
433     }
434
435 #if USE(QUICK_LOOK)
436     if (decoder.messageName() == Messages::WebPageProxy::DidRequestPasswordForQuickLookDocumentInMainFrame::name()) {
437         IPC::handleMessage<Messages::WebPageProxy::DidRequestPasswordForQuickLookDocumentInMainFrame>(decoder, this, &ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame);
438         return;
439     }
440 #endif
441
442     LOG(ProcessSwapping, "Unhandled message %s::%s from provisional process", decoder.messageReceiverName().toString().data(), decoder.messageName().toString().data());
443 }
444
445 void ProvisionalPageProxy::didReceiveSyncMessage(IPC::Connection& connection, IPC::Decoder& decoder, std::unique_ptr<IPC::Encoder>& replyEncoder)
446 {
447     if (decoder.messageName() == Messages::WebPageProxy::BackForwardGoToItem::name()) {
448         IPC::handleMessageSynchronous<Messages::WebPageProxy::BackForwardGoToItem>(connection, decoder, replyEncoder, this, &ProvisionalPageProxy::backForwardGoToItem);
449         return;
450     }
451
452     if (decoder.messageName() == Messages::WebPageProxy::DecidePolicyForNavigationActionSync::name()) {
453         IPC::handleMessageSynchronous<Messages::WebPageProxy::DecidePolicyForNavigationActionSync>(connection, decoder, replyEncoder, this, &ProvisionalPageProxy::decidePolicyForNavigationActionSync);
454         return;
455     }
456
457     m_page.didReceiveSyncMessage(connection, decoder, replyEncoder);
458 }
459
460 } // namespace WebKit