Storage Access API: Refactor to make naming accurate and explicit, simplify access...
[WebKit-https.git] / Source / WebKit / UIProcess / Network / NetworkProcessProxy.cpp
1 /*
2  * Copyright (C) 2012-2016 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 "NetworkProcessProxy.h"
28
29 #include "AuthenticationChallengeProxy.h"
30 #include "DownloadProxyMessages.h"
31 #if ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER)
32 #include "LegacyCustomProtocolManagerProxyMessages.h"
33 #endif
34 #include "Logging.h"
35 #include "NetworkProcessCreationParameters.h"
36 #include "NetworkProcessMessages.h"
37 #include "SandboxExtension.h"
38 #include "StorageProcessMessages.h"
39 #include "WebPageProxy.h"
40 #include "WebProcessMessages.h"
41 #include "WebProcessPool.h"
42 #include "WebsiteData.h"
43 #include <wtf/CompletionHandler.h>
44
45 #if ENABLE(SEC_ITEM_SHIM)
46 #include "SecItemShimProxy.h"
47 #endif
48
49 #if PLATFORM(IOS)
50 #include <wtf/spi/darwin/XPCSPI.h>
51 #endif
52
53 #define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, connection())
54
55 using namespace WebCore;
56
57 namespace WebKit {
58
59 static uint64_t generateCallbackID()
60 {
61     static uint64_t callbackID;
62
63     return ++callbackID;
64 }
65
66 Ref<NetworkProcessProxy> NetworkProcessProxy::create(WebProcessPool& processPool)
67 {
68     return adoptRef(*new NetworkProcessProxy(processPool));
69 }
70
71 NetworkProcessProxy::NetworkProcessProxy(WebProcessPool& processPool)
72     : ChildProcessProxy(processPool.alwaysRunsAtBackgroundPriority())
73     , m_processPool(processPool)
74     , m_numPendingConnectionRequests(0)
75 #if ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER)
76     , m_customProtocolManagerProxy(*this)
77 #endif
78     , m_throttler(*this, processPool.shouldTakeUIBackgroundAssertion())
79 {
80     connect();
81 }
82
83 NetworkProcessProxy::~NetworkProcessProxy()
84 {
85     ASSERT(m_pendingFetchWebsiteDataCallbacks.isEmpty());
86     ASSERT(m_pendingDeleteWebsiteDataCallbacks.isEmpty());
87     ASSERT(m_pendingDeleteWebsiteDataForOriginsCallbacks.isEmpty());
88 }
89
90 void NetworkProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions)
91 {
92     launchOptions.processType = ProcessLauncher::ProcessType::Network;
93     ChildProcessProxy::getLaunchOptions(launchOptions);
94 }
95
96 void NetworkProcessProxy::connectionWillOpen(IPC::Connection& connection)
97 {
98 #if ENABLE(SEC_ITEM_SHIM)
99     SecItemShimProxy::singleton().initializeConnection(connection);
100 #else
101     UNUSED_PARAM(connection);
102 #endif
103 }
104
105 void NetworkProcessProxy::processWillShutDown(IPC::Connection& connection)
106 {
107     ASSERT_UNUSED(connection, this->connection() == &connection);
108 }
109
110 void NetworkProcessProxy::getNetworkProcessConnection(Ref<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply>&& reply)
111 {
112     m_pendingConnectionReplies.append(WTFMove(reply));
113
114     if (state() == State::Launching) {
115         m_numPendingConnectionRequests++;
116         return;
117     }
118
119     connection()->send(Messages::NetworkProcess::CreateNetworkConnectionToWebProcess(), 0, IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply);
120 }
121
122 DownloadProxy* NetworkProcessProxy::createDownloadProxy(const ResourceRequest& resourceRequest)
123 {
124     if (!m_downloadProxyMap)
125         m_downloadProxyMap = std::make_unique<DownloadProxyMap>(this);
126
127     return m_downloadProxyMap->createDownloadProxy(m_processPool, resourceRequest);
128 }
129
130 void NetworkProcessProxy::fetchWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDataType> dataTypes, OptionSet<WebsiteDataFetchOption> fetchOptions, WTF::Function<void (WebsiteData)>&& completionHandler)
131 {
132     ASSERT(canSendMessage());
133
134     uint64_t callbackID = generateCallbackID();
135     RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - NetworkProcessProxy is taking a background assertion because the Network process is fetching Website data", this);
136
137     m_pendingFetchWebsiteDataCallbacks.add(callbackID, [this, token = throttler().backgroundActivityToken(), completionHandler = WTFMove(completionHandler), sessionID](WebsiteData websiteData) {
138         completionHandler(WTFMove(websiteData));
139         RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - NetworkProcessProxy is releasing a background assertion because the Network process is done fetching Website data", this);
140     });
141
142     send(Messages::NetworkProcess::FetchWebsiteData(sessionID, dataTypes, fetchOptions, callbackID), 0);
143 }
144
145 void NetworkProcessProxy::deleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDataType> dataTypes, WallTime modifiedSince, WTF::Function<void ()>&& completionHandler)
146 {
147     auto callbackID = generateCallbackID();
148     RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - NetworkProcessProxy is taking a background assertion because the Network process is deleting Website data", this);
149
150     m_pendingDeleteWebsiteDataCallbacks.add(callbackID, [this, token = throttler().backgroundActivityToken(), completionHandler = WTFMove(completionHandler), sessionID] {
151         completionHandler();
152         RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - NetworkProcessProxy is releasing a background assertion because the Network process is done deleting Website data", this);
153     });
154     send(Messages::NetworkProcess::DeleteWebsiteData(sessionID, dataTypes, modifiedSince, callbackID), 0);
155 }
156
157 void NetworkProcessProxy::deleteWebsiteDataForOrigins(PAL::SessionID sessionID, OptionSet<WebsiteDataType> dataTypes, const Vector<WebCore::SecurityOriginData>& origins, const Vector<String>& cookieHostNames, WTF::Function<void()>&& completionHandler)
158 {
159     ASSERT(canSendMessage());
160
161     uint64_t callbackID = generateCallbackID();
162     RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - NetworkProcessProxy is taking a background assertion because the Network process is deleting Website data for several origins", this);
163
164     m_pendingDeleteWebsiteDataForOriginsCallbacks.add(callbackID, [this, token = throttler().backgroundActivityToken(), completionHandler = WTFMove(completionHandler), sessionID] {
165         completionHandler();
166         RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - NetworkProcessProxy is releasing a background assertion because the Network process is done deleting Website data for several origins", this);
167     });
168
169     send(Messages::NetworkProcess::DeleteWebsiteDataForOrigins(sessionID, dataTypes, origins, cookieHostNames, callbackID), 0);
170 }
171
172 void NetworkProcessProxy::networkProcessCrashed()
173 {
174     clearCallbackStates();
175
176     Vector<Ref<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply>> pendingReplies;
177     pendingReplies.reserveInitialCapacity(m_pendingConnectionReplies.size());
178     for (auto& reply : m_pendingConnectionReplies)
179         pendingReplies.append(WTFMove(reply));
180
181     // Tell the network process manager to forget about this network process proxy. This may cause us to be deleted.
182     m_processPool.networkProcessCrashed(*this, WTFMove(pendingReplies));
183 }
184
185 void NetworkProcessProxy::networkProcessFailedToLaunch()
186 {
187     // The network process must have crashed or exited, send any pending sync replies we might have.
188     while (!m_pendingConnectionReplies.isEmpty()) {
189         Ref<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply> reply = m_pendingConnectionReplies.takeFirst();
190
191 #if USE(UNIX_DOMAIN_SOCKETS)
192         reply->send(IPC::Attachment());
193 #elif OS(DARWIN)
194         reply->send(IPC::Attachment(0, MACH_MSG_TYPE_MOVE_SEND));
195 #else
196         notImplemented();
197 #endif
198     }
199     clearCallbackStates();
200     // Tell the network process manager to forget about this network process proxy. This may cause us to be deleted.
201     m_processPool.networkProcessFailedToLaunch(*this);
202 }
203
204 void NetworkProcessProxy::clearCallbackStates()
205 {
206     for (const auto& callback : m_pendingFetchWebsiteDataCallbacks.values())
207         callback(WebsiteData());
208     m_pendingFetchWebsiteDataCallbacks.clear();
209
210     for (const auto& callback : m_pendingDeleteWebsiteDataCallbacks.values())
211         callback();
212     m_pendingDeleteWebsiteDataCallbacks.clear();
213
214     for (const auto& callback : m_pendingDeleteWebsiteDataForOriginsCallbacks.values())
215         callback();
216     m_pendingDeleteWebsiteDataForOriginsCallbacks.clear();
217 }
218
219 void NetworkProcessProxy::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder)
220 {
221     if (dispatchMessage(connection, decoder))
222         return;
223
224     if (m_processPool.dispatchMessage(connection, decoder))
225         return;
226
227     didReceiveNetworkProcessProxyMessage(connection, decoder);
228 }
229
230 void NetworkProcessProxy::didReceiveSyncMessage(IPC::Connection& connection, IPC::Decoder& decoder, std::unique_ptr<IPC::Encoder>& replyEncoder)
231 {
232     if (dispatchSyncMessage(connection, decoder, replyEncoder))
233         return;
234
235     ASSERT_NOT_REACHED();
236 }
237
238 void NetworkProcessProxy::didClose(IPC::Connection&)
239 {
240     if (m_downloadProxyMap)
241         m_downloadProxyMap->processDidClose();
242 #if ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER)
243     m_customProtocolManagerProxy.invalidate();
244 #endif
245
246     m_tokenForHoldingLockedFiles = nullptr;
247
248     for (auto& callback : m_writeBlobToFilePathCallbackMap.values())
249         callback(false);
250     m_writeBlobToFilePathCallbackMap.clear();
251
252     // This may cause us to be deleted.
253     networkProcessCrashed();
254 }
255
256 void NetworkProcessProxy::didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference, IPC::StringReference)
257 {
258 }
259
260 void NetworkProcessProxy::didCreateNetworkConnectionToWebProcess(const IPC::Attachment& connectionIdentifier)
261 {
262     ASSERT(!m_pendingConnectionReplies.isEmpty());
263
264     // Grab the first pending connection reply.
265     RefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply> reply = m_pendingConnectionReplies.takeFirst();
266
267 #if USE(UNIX_DOMAIN_SOCKETS)
268     reply->send(connectionIdentifier);
269 #elif OS(DARWIN)
270     reply->send(IPC::Attachment(connectionIdentifier.port(), MACH_MSG_TYPE_MOVE_SEND));
271 #else
272     notImplemented();
273 #endif
274 }
275
276 void NetworkProcessProxy::didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const WebCore::AuthenticationChallenge& coreChallenge, uint64_t challengeID)
277 {
278 #if ENABLE(SERVICE_WORKER)
279     if (m_processPool.isServiceWorker(pageID)) {
280         auto authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, connection());
281         m_processPool.serviceWorkerProxy()->didReceiveAuthenticationChallenge(pageID, frameID, WTFMove(authenticationChallenge));
282         return;
283     }
284 #endif
285
286     WebPageProxy* page = WebProcessProxy::webPage(pageID);
287     MESSAGE_CHECK(page);
288
289     auto authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, connection());
290     page->didReceiveAuthenticationChallengeProxy(frameID, WTFMove(authenticationChallenge));
291 }
292
293 void NetworkProcessProxy::didFetchWebsiteData(uint64_t callbackID, const WebsiteData& websiteData)
294 {
295     auto callback = m_pendingFetchWebsiteDataCallbacks.take(callbackID);
296     callback(websiteData);
297 }
298
299 void NetworkProcessProxy::didDeleteWebsiteData(uint64_t callbackID)
300 {
301     auto callback = m_pendingDeleteWebsiteDataCallbacks.take(callbackID);
302     callback();
303 }
304
305 void NetworkProcessProxy::didDeleteWebsiteDataForOrigins(uint64_t callbackID)
306 {
307     auto callback = m_pendingDeleteWebsiteDataForOriginsCallbacks.take(callbackID);
308     callback();
309 }
310
311 void NetworkProcessProxy::grantSandboxExtensionsToStorageProcessForBlobs(uint64_t requestID, const Vector<String>& paths)
312 {
313 #if ENABLE(SANDBOX_EXTENSIONS)
314     SandboxExtension::HandleArray extensions;
315     extensions.allocate(paths.size());
316     for (size_t i = 0; i < paths.size(); ++i) {
317         // ReadWrite is required for creating hard links as well as deleting the temporary file, which the StorageProcess will do.
318         SandboxExtension::createHandle(paths[i], SandboxExtension::Type::ReadWrite, extensions[i]);
319     }
320
321     m_processPool.sendToStorageProcessRelaunchingIfNecessary(Messages::StorageProcess::GrantSandboxExtensionsForBlobs(paths, extensions));
322 #endif
323     connection()->send(Messages::NetworkProcess::DidGrantSandboxExtensionsToStorageProcessForBlobs(requestID), 0);
324 }
325
326 void NetworkProcessProxy::didFinishLaunching(ProcessLauncher* launcher, IPC::Connection::Identifier connectionIdentifier)
327 {
328     ChildProcessProxy::didFinishLaunching(launcher, connectionIdentifier);
329
330     if (IPC::Connection::identifierIsNull(connectionIdentifier)) {
331         networkProcessFailedToLaunch();
332         return;
333     }
334
335     for (unsigned i = 0; i < m_numPendingConnectionRequests; ++i)
336         connection()->send(Messages::NetworkProcess::CreateNetworkConnectionToWebProcess(), 0);
337     
338     m_numPendingConnectionRequests = 0;
339
340 #if PLATFORM(COCOA)
341     if (m_processPool.processSuppressionEnabled())
342         setProcessSuppressionEnabled(true);
343 #endif
344     
345 #if PLATFORM(IOS)
346     if (xpc_connection_t connection = this->connection()->xpcConnection())
347         m_throttler.didConnectToProcess(xpc_connection_get_pid(connection));
348 #endif
349 }
350
351 void NetworkProcessProxy::logDiagnosticMessage(uint64_t pageID, const String& message, const String& description, WebCore::ShouldSample shouldSample)
352 {
353     WebPageProxy* page = WebProcessProxy::webPage(pageID);
354     // FIXME: We do this null-check because by the time the decision to log is made, the page may be gone. We should refactor to avoid this,
355     // but for now we simply drop the message in the rare case this happens.
356     if (!page)
357         return;
358
359     page->logDiagnosticMessage(message, description, shouldSample);
360 }
361
362 void NetworkProcessProxy::logDiagnosticMessageWithResult(uint64_t pageID, const String& message, const String& description, uint32_t result, WebCore::ShouldSample shouldSample)
363 {
364     WebPageProxy* page = WebProcessProxy::webPage(pageID);
365     // FIXME: We do this null-check because by the time the decision to log is made, the page may be gone. We should refactor to avoid this,
366     // but for now we simply drop the message in the rare case this happens.
367     if (!page)
368         return;
369
370     page->logDiagnosticMessageWithResult(message, description, result, shouldSample);
371 }
372
373 void NetworkProcessProxy::logDiagnosticMessageWithValue(uint64_t pageID, const String& message, const String& description, double value, unsigned significantFigures, WebCore::ShouldSample shouldSample)
374 {
375     WebPageProxy* page = WebProcessProxy::webPage(pageID);
376     // FIXME: We do this null-check because by the time the decision to log is made, the page may be gone. We should refactor to avoid this,
377     // but for now we simply drop the message in the rare case this happens.
378     if (!page)
379         return;
380
381     page->logDiagnosticMessageWithValue(message, description, value, significantFigures, shouldSample);
382 }
383
384 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
385 void NetworkProcessProxy::canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t pageID, uint64_t frameID, const WebCore::ProtectionSpace& protectionSpace)
386 {
387     // NetworkProcess state cannot asynchronously be kept in sync with these objects
388     // like we expect WebProcess <-> UIProcess state to be kept in sync.
389     // So there's no guarantee the messaged WebPageProxy or WebFrameProxy exist here in the UIProcess.
390     // We need to validate both the page and the frame up front.
391     if (auto* page = WebProcessProxy::webPage(pageID)) {
392         if (page->process().webFrame(frameID)) {
393             page->canAuthenticateAgainstProtectionSpace(loaderID, frameID, protectionSpace);
394             return;
395         }
396 #if ENABLE(SERVICE_WORKER)
397     } else if (m_processPool.isServiceWorker(pageID)) {
398         send(Messages::NetworkProcess::ContinueCanAuthenticateAgainstProtectionSpace(loaderID, true), 0);
399         return;
400 #endif
401     }
402     // In the case where we will not be able to reply to this message with a client reply,
403     // we should message back a default to the Networking process.
404     send(Messages::NetworkProcess::ContinueCanAuthenticateAgainstProtectionSpace(loaderID, false), 0);
405 }
406 #endif
407
408 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
409 static uint64_t nextRequestStorageAccessContextId()
410 {
411     static uint64_t nextContextId = 0;
412     return ++nextContextId;
413 }
414
415 void NetworkProcessProxy::hasStorageAccessForFrame(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool)>&& callback)
416 {
417     auto contextId = nextRequestStorageAccessContextId();
418     auto addResult = m_storageAccessResponseCallbackMap.add(contextId, WTFMove(callback));
419     ASSERT_UNUSED(addResult, addResult.isNewEntry);
420     send(Messages::NetworkProcess::HasStorageAccessForFrame(sessionID, resourceDomain, firstPartyDomain, frameID, pageID, contextId), 0);
421 }
422
423 void NetworkProcessProxy::grantStorageAccessForFrame(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool)>&& callback)
424 {
425     auto contextId = nextRequestStorageAccessContextId();
426     auto addResult = m_storageAccessResponseCallbackMap.add(contextId, WTFMove(callback));
427     ASSERT_UNUSED(addResult, addResult.isNewEntry);
428     send(Messages::NetworkProcess::GrantStorageAccessForFrame(sessionID, resourceDomain, firstPartyDomain, frameID, pageID, contextId), 0);
429 }
430
431 void NetworkProcessProxy::storageAccessRequestResult(bool wasGranted, uint64_t contextId)
432 {
433     auto callback = m_storageAccessResponseCallbackMap.take(contextId);
434     callback(wasGranted);
435 }
436 #endif
437
438 void NetworkProcessProxy::sendProcessWillSuspendImminently()
439 {
440     if (!canSendMessage())
441         return;
442
443     bool handled = false;
444     sendSync(Messages::NetworkProcess::ProcessWillSuspendImminently(), Messages::NetworkProcess::ProcessWillSuspendImminently::Reply(handled), 0, 1_s);
445 }
446     
447 void NetworkProcessProxy::sendPrepareToSuspend()
448 {
449     if (canSendMessage())
450         send(Messages::NetworkProcess::PrepareToSuspend(), 0);
451 }
452
453 void NetworkProcessProxy::sendCancelPrepareToSuspend()
454 {
455     if (canSendMessage())
456         send(Messages::NetworkProcess::CancelPrepareToSuspend(), 0);
457 }
458
459 void NetworkProcessProxy::sendProcessDidResume()
460 {
461     if (canSendMessage())
462         send(Messages::NetworkProcess::ProcessDidResume(), 0);
463 }
464
465 void NetworkProcessProxy::writeBlobToFilePath(const WebCore::URL& url, const String& path, CompletionHandler<void(bool)>&& callback)
466 {
467     if (!canSendMessage()) {
468         callback(false);
469         return;
470     }
471
472     static uint64_t writeBlobToFilePathCallbackIdentifiers = 0;
473     uint64_t callbackID = ++writeBlobToFilePathCallbackIdentifiers;
474     m_writeBlobToFilePathCallbackMap.add(callbackID, WTFMove(callback));
475
476     SandboxExtension::Handle handleForWriting;
477     SandboxExtension::createHandle(path, SandboxExtension::Type::ReadWrite, handleForWriting);
478     send(Messages::NetworkProcess::WriteBlobToFilePath(url, path, handleForWriting, callbackID), 0);
479 }
480
481 void NetworkProcessProxy::didWriteBlobToFilePath(bool success, uint64_t callbackID)
482 {
483     if (auto handler = m_writeBlobToFilePathCallbackMap.take(callbackID))
484         handler(success);
485     else
486         ASSERT_NOT_REACHED();
487 }
488
489 void NetworkProcessProxy::processReadyToSuspend()
490 {
491     m_throttler.processReadyToSuspend();
492 }
493
494 void NetworkProcessProxy::didSetAssertionState(AssertionState)
495 {
496 }
497     
498 void NetworkProcessProxy::setIsHoldingLockedFiles(bool isHoldingLockedFiles)
499 {
500     if (!isHoldingLockedFiles) {
501         RELEASE_LOG(ProcessSuspension, "UIProcess is releasing a background assertion because the Network process is no longer holding locked files");
502         m_tokenForHoldingLockedFiles = nullptr;
503         return;
504     }
505     if (!m_tokenForHoldingLockedFiles) {
506         RELEASE_LOG(ProcessSuspension, "UIProcess is taking a background assertion because the Network process is holding locked files");
507         m_tokenForHoldingLockedFiles = m_throttler.backgroundActivityToken();
508     }
509 }
510
511 } // namespace WebKit