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, WebCore::WillContinueLoading::No, 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 | inline bool ProvisionalPageProxy::validateInput(uint64_t frameID, const Optional<uint64_t>& navigationID) |
187 | { |
188 | // If the previous provisional load used an existing process, we may receive leftover IPC for a previous navigation, which we need to ignore. |
189 | if (!m_mainFrame || m_mainFrame->frameID() != frameID) |
190 | return false; |
191 | |
192 | return !navigationID || !*navigationID || *navigationID == m_navigationID; |
193 | } |
194 | |
195 | void ProvisionalPageProxy::didCreateMainFrame(uint64_t frameID) |
196 | { |
197 | RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "didCreateMainFrame: pageID = %" PRIu64 ", frameID = %" PRIu64, m_page.pageID(), frameID); |
198 | ASSERT(!m_mainFrame); |
199 | |
200 | m_mainFrame = WebFrameProxy::create(m_page, frameID); |
201 | |
202 | // Add the frame to the process wide map. |
203 | m_process->frameCreated(frameID, *m_mainFrame); |
204 | |
205 | // This navigation was destroyed so no need to notify of redirect. |
206 | if (!m_page.navigationState().hasNavigation(m_navigationID)) |
207 | return; |
208 | |
209 | // Restore the main frame's committed URL as some clients may rely on it until the next load is committed. |
210 | if (auto* mainFrame = m_page.mainFrame()) |
211 | m_mainFrame->frameLoadState().setURL(mainFrame->frameLoadState().url()); |
212 | |
213 | // Normally, notification of a server redirect comes from the WebContent process. |
214 | // If we are process swapping in response to a server redirect then that notification will not come from the new WebContent process. |
215 | // In this case we have the UIProcess synthesize the redirect notification at the appropriate time. |
216 | if (m_isServerRedirect) { |
217 | m_mainFrame->frameLoadState().didStartProvisionalLoad(m_request.url()); |
218 | m_page.didReceiveServerRedirectForProvisionalLoadForFrameShared(m_process.copyRef(), m_mainFrame->frameID(), m_navigationID, WTFMove(m_request), { }); |
219 | } |
220 | } |
221 | |
222 | void ProvisionalPageProxy::didPerformClientRedirect(const String& sourceURLString, const String& destinationURLString, uint64_t frameID) |
223 | { |
224 | if (!validateInput(frameID)) |
225 | return; |
226 | |
227 | m_page.didPerformClientRedirectShared(m_process.copyRef(), sourceURLString, destinationURLString, frameID); |
228 | } |
229 | |
230 | void ProvisionalPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, URL&& url, URL&& unreachableURL, const UserData& userData) |
231 | { |
232 | if (!validateInput(frameID, navigationID)) |
233 | return; |
234 | |
235 | RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "didStartProvisionalLoadForFrame: pageID = %" PRIu64 ", frameID = %" PRIu64 ", navigationID = %" PRIu64, m_page.pageID(), frameID, navigationID); |
236 | ASSERT(m_provisionalLoadURL.isNull()); |
237 | m_provisionalLoadURL = url; |
238 | |
239 | // Merely following a server side redirect so there is no need to send a didStartProvisionalLoad again. |
240 | if (m_isServerRedirect) |
241 | return; |
242 | |
243 | // Clients expect the Page's main frame's expectedURL to be the provisional one when a provisional load is started. |
244 | if (auto* pageMainFrame = m_page.mainFrame()) |
245 | pageMainFrame->didStartProvisionalLoad(url); |
246 | |
247 | m_page.didStartProvisionalLoadForFrameShared(m_process.copyRef(), frameID, navigationID, WTFMove(url), WTFMove(unreachableURL), userData); |
248 | } |
249 | |
250 | void ProvisionalPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError& error, WebCore::WillContinueLoading willContinueLoading, const UserData& userData) |
251 | { |
252 | if (!validateInput(frameID, navigationID)) |
253 | return; |
254 | |
255 | RELEASE_LOG_ERROR_IF_ALLOWED(ProcessSwapping, "didFailProvisionalLoadForFrame: pageID = %" PRIu64 ", frameID = %" PRIu64 ", navigationID = %" PRIu64, m_page.pageID(), frameID, navigationID); |
256 | ASSERT(!m_provisionalLoadURL.isNull()); |
257 | m_provisionalLoadURL = { }; |
258 | |
259 | // Make sure the Page's main frame's expectedURL gets cleared since we updated it in didStartProvisionalLoad. |
260 | if (auto* pageMainFrame = m_page.mainFrame()) |
261 | pageMainFrame->didFailProvisionalLoad(); |
262 | |
263 | m_page.didFailProvisionalLoadForFrameShared(m_process.copyRef(), frameID, frameSecurityOrigin, navigationID, provisionalURL, error, willContinueLoading, userData); // May delete |this|. |
264 | } |
265 | |
266 | 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) |
267 | { |
268 | if (!validateInput(frameID, navigationID)) |
269 | return; |
270 | |
271 | RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "didCommitLoadForFrame: pageID = %" PRIu64 ", frameID = %" PRIu64 ", navigationID = %" PRIu64, m_page.pageID(), frameID, navigationID); |
272 | m_provisionalLoadURL = { }; |
273 | m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_page.pageID()); |
274 | |
275 | m_wasCommitted = true; |
276 | m_page.commitProvisionalPage(frameID, navigationID, mimeType, frameHasCustomContentProvider, frameLoadType, certificateInfo, containsPluginDocument, forcedHasInsecureContent, userData); // Will delete |this|. |
277 | } |
278 | |
279 | void ProvisionalPageProxy::didNavigateWithNavigationData(const WebNavigationDataStore& store, uint64_t frameID) |
280 | { |
281 | if (!validateInput(frameID)) |
282 | return; |
283 | |
284 | m_page.didNavigateWithNavigationDataShared(m_process.copyRef(), store, frameID); |
285 | } |
286 | |
287 | void ProvisionalPageProxy::didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, URL&& url) |
288 | { |
289 | if (!validateInput(frameID, navigationID)) |
290 | return; |
291 | |
292 | m_page.didChangeProvisionalURLForFrameShared(m_process.copyRef(), frameID, navigationID, WTFMove(url)); |
293 | } |
294 | |
295 | void ProvisionalPageProxy::decidePolicyForNavigationActionAsync(uint64_t frameID, WebCore::SecurityOriginData&& frameSecurityOrigin, WebCore::PolicyCheckIdentifier identifier, |
296 | uint64_t navigationID, NavigationActionData&& navigationActionData, FrameInfoData&& frameInfoData, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, |
297 | WebCore::ResourceRequest&& request, IPC::FormDataReference&& requestBody, WebCore::ResourceResponse&& redirectResponse, const UserData& userData, uint64_t listenerID) |
298 | { |
299 | if (!validateInput(frameID, navigationID)) |
300 | return; |
301 | |
302 | m_page.decidePolicyForNavigationActionAsyncShared(m_process.copyRef(), frameID, WTFMove(frameSecurityOrigin), identifier, navigationID, WTFMove(navigationActionData), |
303 | WTFMove(frameInfoData), originatingPageID, originalRequest, WTFMove(request), WTFMove(requestBody), WTFMove(redirectResponse), userData, listenerID); |
304 | } |
305 | |
306 | void ProvisionalPageProxy::decidePolicyForResponse(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, WebCore::PolicyCheckIdentifier identifier, |
307 | uint64_t navigationID, const WebCore::ResourceResponse& response, const WebCore::ResourceRequest& request, bool canShowMIMEType, const String& downloadAttribute, uint64_t listenerID, const UserData& userData) |
308 | { |
309 | if (!validateInput(frameID, navigationID)) |
310 | return; |
311 | |
312 | m_page.decidePolicyForResponseShared(m_process.copyRef(), frameID, frameSecurityOrigin, identifier, navigationID, response, request, canShowMIMEType, downloadAttribute, listenerID, userData); |
313 | } |
314 | |
315 | void ProvisionalPageProxy::didPerformServerRedirect(const String& sourceURLString, const String& destinationURLString, uint64_t frameID) |
316 | { |
317 | if (!validateInput(frameID)) |
318 | return; |
319 | |
320 | m_page.didPerformServerRedirectShared(m_process.copyRef(), sourceURLString, destinationURLString, frameID); |
321 | } |
322 | |
323 | void ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::ResourceRequest&& request, const UserData& userData) |
324 | { |
325 | if (!validateInput(frameID, navigationID)) |
326 | return; |
327 | |
328 | m_page.didReceiveServerRedirectForProvisionalLoadForFrameShared(m_process.copyRef(), frameID, navigationID, WTFMove(request), userData); |
329 | } |
330 | |
331 | void ProvisionalPageProxy::startURLSchemeTask(URLSchemeTaskParameters&& parameters) |
332 | { |
333 | m_page.startURLSchemeTaskShared(m_process.copyRef(), WTFMove(parameters)); |
334 | } |
335 | |
336 | void ProvisionalPageProxy::backForwardGoToItem(const WebCore::BackForwardItemIdentifier& identifier, CompletionHandler<void(SandboxExtension::Handle&&)>&& completionHandler) |
337 | { |
338 | m_page.backForwardGoToItemShared(m_process.copyRef(), identifier, WTFMove(completionHandler)); |
339 | } |
340 | |
341 | void ProvisionalPageProxy::decidePolicyForNavigationActionSync(uint64_t frameID, bool isMainFrame, WebCore::SecurityOriginData&& frameSecurityOrigin, WebCore::PolicyCheckIdentifier identifier, |
342 | uint64_t navigationID, NavigationActionData&& navigationActionData, FrameInfoData&& frameInfoData, uint64_t originatingPageID, |
343 | const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&& request, IPC::FormDataReference&& requestBody, WebCore::ResourceResponse&& redirectResponse, |
344 | const UserData& userData, Messages::WebPageProxy::DecidePolicyForNavigationActionSync::DelayedReply&& reply) |
345 | { |
346 | if (!isMainFrame || (m_mainFrame && m_mainFrame->frameID() != frameID) || navigationID != m_navigationID) { |
347 | reply(identifier, WebCore::PolicyAction::Ignore, navigationID, DownloadID(), WTF::nullopt); |
348 | return; |
349 | } |
350 | |
351 | if (!m_mainFrame) { |
352 | // This synchronous IPC message was processed before the asynchronous DidCreateMainFrame one so we do not know about this frameID yet. |
353 | didCreateMainFrame(frameID); |
354 | } |
355 | ASSERT(m_mainFrame); |
356 | |
357 | m_page.decidePolicyForNavigationActionSyncShared(m_process.copyRef(), frameID, isMainFrame, WTFMove(frameSecurityOrigin), identifier, navigationID, WTFMove(navigationActionData), |
358 | WTFMove(frameInfoData), originatingPageID, originalRequest, WTFMove(request), WTFMove(requestBody), WTFMove(redirectResponse), userData, WTFMove(reply)); |
359 | } |
360 | |
361 | #if USE(QUICK_LOOK) |
362 | void ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame(const String& fileName) |
363 | { |
364 | m_page.didRequestPasswordForQuickLookDocumentInMainFrameShared(m_process.copyRef(), fileName); |
365 | } |
366 | #endif |
367 | |
368 | #if PLATFORM(COCOA) |
369 | void ProvisionalPageProxy::registerWebProcessAccessibilityToken(const IPC::DataReference& data) |
370 | { |
371 | m_accessibilityToken = data.vector(); |
372 | } |
373 | #endif |
374 | |
375 | void ProvisionalPageProxy::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder) |
376 | { |
377 | ASSERT(decoder.messageReceiverName() == Messages::WebPageProxy::messageReceiverName()); |
378 | |
379 | if (decoder.messageName() == Messages::WebPageProxy::DidStartProgress::name() |
380 | || decoder.messageName() == Messages::WebPageProxy::DidChangeProgress::name() |
381 | || decoder.messageName() == Messages::WebPageProxy::DidDestroyNavigation::name() |
382 | || decoder.messageName() == Messages::WebPageProxy::DidFinishProgress::name() |
383 | || decoder.messageName() == Messages::WebPageProxy::BackForwardAddItem::name() |
384 | || decoder.messageName() == Messages::WebPageProxy::LogDiagnosticMessage::name() |
385 | || decoder.messageName() == Messages::WebPageProxy::LogDiagnosticMessageWithEnhancedPrivacy::name() |
386 | || decoder.messageName() == Messages::WebPageProxy::LogDiagnosticMessageWithValueDictionary::name() |
387 | || decoder.messageName() == Messages::WebPageProxy::SetNetworkRequestsInProgress::name() |
388 | || decoder.messageName() == Messages::WebPageProxy::WillGoToBackForwardListItem::name() |
389 | #if USE(QUICK_LOOK) |
390 | || decoder.messageName() == Messages::WebPageProxy::DidStartLoadForQuickLookDocumentInMainFrame::name() |
391 | || decoder.messageName() == Messages::WebPageProxy::DidFinishLoadForQuickLookDocumentInMainFrame::name() |
392 | #endif |
393 | ) |
394 | { |
395 | m_page.didReceiveMessage(connection, decoder); |
396 | return; |
397 | } |
398 | |
399 | #if PLATFORM(COCOA) |
400 | if (decoder.messageName() == Messages::WebPageProxy::RegisterWebProcessAccessibilityToken::name()) { |
401 | IPC::handleMessage<Messages::WebPageProxy::RegisterWebProcessAccessibilityToken>(decoder, this, &ProvisionalPageProxy::registerWebProcessAccessibilityToken); |
402 | return; |
403 | } |
404 | #endif |
405 | |
406 | if (decoder.messageName() == Messages::WebPageProxy::StartURLSchemeTask::name()) { |
407 | IPC::handleMessage<Messages::WebPageProxy::StartURLSchemeTask>(decoder, this, &ProvisionalPageProxy::startURLSchemeTask); |
408 | return; |
409 | } |
410 | |
411 | if (decoder.messageName() == Messages::WebPageProxy::DecidePolicyForNavigationActionAsync::name()) { |
412 | IPC::handleMessage<Messages::WebPageProxy::DecidePolicyForNavigationActionAsync>(decoder, this, &ProvisionalPageProxy::decidePolicyForNavigationActionAsync); |
413 | return; |
414 | } |
415 | |
416 | if (decoder.messageName() == Messages::WebPageProxy::DecidePolicyForResponse::name()) { |
417 | IPC::handleMessage<Messages::WebPageProxy::DecidePolicyForResponse>(decoder, this, &ProvisionalPageProxy::decidePolicyForResponse); |
418 | return; |
419 | } |
420 | |
421 | if (decoder.messageName() == Messages::WebPageProxy::DidChangeProvisionalURLForFrame::name()) { |
422 | IPC::handleMessage<Messages::WebPageProxy::DidChangeProvisionalURLForFrame>(decoder, this, &ProvisionalPageProxy::didChangeProvisionalURLForFrame); |
423 | return; |
424 | } |
425 | |
426 | if (decoder.messageName() == Messages::WebPageProxy::DidNavigateWithNavigationData::name()) { |
427 | IPC::handleMessage<Messages::WebPageProxy::DidNavigateWithNavigationData>(decoder, this, &ProvisionalPageProxy::didNavigateWithNavigationData); |
428 | return; |
429 | } |
430 | |
431 | if (decoder.messageName() == Messages::WebPageProxy::DidPerformClientRedirect::name()) { |
432 | IPC::handleMessage<Messages::WebPageProxy::DidPerformClientRedirect>(decoder, this, &ProvisionalPageProxy::didPerformClientRedirect); |
433 | return; |
434 | } |
435 | |
436 | if (decoder.messageName() == Messages::WebPageProxy::DidCreateMainFrame::name()) { |
437 | IPC::handleMessage<Messages::WebPageProxy::DidCreateMainFrame>(decoder, this, &ProvisionalPageProxy::didCreateMainFrame); |
438 | return; |
439 | } |
440 | |
441 | if (decoder.messageName() == Messages::WebPageProxy::DidStartProvisionalLoadForFrame::name()) { |
442 | IPC::handleMessage<Messages::WebPageProxy::DidStartProvisionalLoadForFrame>(decoder, this, &ProvisionalPageProxy::didStartProvisionalLoadForFrame); |
443 | return; |
444 | } |
445 | |
446 | if (decoder.messageName() == Messages::WebPageProxy::DidFailProvisionalLoadForFrame::name()) { |
447 | IPC::handleMessage<Messages::WebPageProxy::DidFailProvisionalLoadForFrame>(decoder, this, &ProvisionalPageProxy::didFailProvisionalLoadForFrame); |
448 | return; |
449 | } |
450 | |
451 | if (decoder.messageName() == Messages::WebPageProxy::DidCommitLoadForFrame::name()) { |
452 | IPC::handleMessage<Messages::WebPageProxy::DidCommitLoadForFrame>(decoder, this, &ProvisionalPageProxy::didCommitLoadForFrame); |
453 | return; |
454 | } |
455 | |
456 | if (decoder.messageName() == Messages::WebPageProxy::DidReceiveServerRedirectForProvisionalLoadForFrame::name()) { |
457 | IPC::handleMessage<Messages::WebPageProxy::DidReceiveServerRedirectForProvisionalLoadForFrame>(decoder, this, &ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame); |
458 | return; |
459 | } |
460 | |
461 | if (decoder.messageName() == Messages::WebPageProxy::DidPerformServerRedirect::name()) { |
462 | IPC::handleMessage<Messages::WebPageProxy::DidPerformServerRedirect>(decoder, this, &ProvisionalPageProxy::didPerformServerRedirect); |
463 | return; |
464 | } |
465 | |
466 | #if USE(QUICK_LOOK) |
467 | if (decoder.messageName() == Messages::WebPageProxy::DidRequestPasswordForQuickLookDocumentInMainFrame::name()) { |
468 | IPC::handleMessage<Messages::WebPageProxy::DidRequestPasswordForQuickLookDocumentInMainFrame>(decoder, this, &ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame); |
469 | return; |
470 | } |
471 | #endif |
472 | |
473 | LOG(ProcessSwapping, "Unhandled message %s::%s from provisional process" , decoder.messageReceiverName().toString().data(), decoder.messageName().toString().data()); |
474 | } |
475 | |
476 | void ProvisionalPageProxy::didReceiveSyncMessage(IPC::Connection& connection, IPC::Decoder& decoder, std::unique_ptr<IPC::Encoder>& replyEncoder) |
477 | { |
478 | if (decoder.messageName() == Messages::WebPageProxy::BackForwardGoToItem::name()) { |
479 | IPC::handleMessageSynchronous<Messages::WebPageProxy::BackForwardGoToItem>(connection, decoder, replyEncoder, this, &ProvisionalPageProxy::backForwardGoToItem); |
480 | return; |
481 | } |
482 | |
483 | if (decoder.messageName() == Messages::WebPageProxy::DecidePolicyForNavigationActionSync::name()) { |
484 | IPC::handleMessageSynchronous<Messages::WebPageProxy::DecidePolicyForNavigationActionSync>(connection, decoder, replyEncoder, this, &ProvisionalPageProxy::decidePolicyForNavigationActionSync); |
485 | return; |
486 | } |
487 | |
488 | m_page.didReceiveSyncMessage(connection, decoder, replyEncoder); |
489 | } |
490 | |
491 | } // namespace WebKit |
492 | |