[iOS] Block access to backboardd service
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
2
3         [iOS] Block access to backboardd service
4         https://bugs.webkit.org/show_bug.cgi?id=195484
5
6         Reviewed by Brent Fulgham.
7
8         This patch is addressing blocking the backboardd service "com.apple.backboard.hid.services". Getting the
9         backlight level in the WebContent process will initiate a connection with this service. To be able to
10         block the service, the backlight level is queried in the UI process and sent to the WebContent process
11         when the WebContent process is started, and when the backlight level is changed. On the WebContent side,
12         the method getting the backlight level is swizzled to return the value sent from the UI process.
13
14         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
15         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
16         (WebKit::WebProcessPool::displayBrightness):
17         (WebKit::WebProcessPool::backlightLevelDidChangeCallback):
18         (WebKit::WebProcessPool::registerNotificationObservers):
19         (WebKit::WebProcessPool::unregisterNotificationObservers):
20         * UIProcess/WebProcessPool.cpp:
21         (WebKit::WebProcessPool::initializeNewWebProcess):
22         * UIProcess/WebProcessPool.h:
23         * WebProcess/WebProcess.h:
24         * WebProcess/WebProcess.messages.in:
25         * WebProcess/cocoa/WebProcessCocoa.mm:
26         (WebKit::currentBacklightLevel):
27         (WebKit::WebProcess::backlightLevelDidChange):
28
29 2019-03-11  Brent Fulgham  <bfulgham@apple.com>
30
31         Remove obsolete runtime flag for StorageAccess API Prompt
32         https://bugs.webkit.org/show_bug.cgi?id=195564
33         <rdar://problem/37279014>
34
35         Reviewed by Chris Dumez.
36
37         This bug tracks the work of removing the obsolete flag that had been used to optionally
38         prevent display of the StorageAccess API prompt. We have since shipped the final version
39         of this feature with an always-on prompt, and should have removed this runtime flag.
40
41         No test changes because this has no change in behavior. Tests already assume the prompt
42         behavior, and did not test turning the flag off.
43
44         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
45         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
46         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
47         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
48         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
49         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
50         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal):
51         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
52         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
53         (WebKit::ResourceLoadStatisticsStore::debugModeEnabled const):
54         (WebKit::ResourceLoadStatisticsStore::storageAccessPromptsEnabled const): Deleted.
55         (WebKit::ResourceLoadStatisticsStore::setStorageAccessPromptsEnabled): Deleted.
56         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
57         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted):
58         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
59         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
60         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
61         (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
62         * NetworkProcess/NetworkConnectionToWebProcess.h:
63         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
64         * NetworkProcess/NetworkProcess.cpp:
65         (WebKit::NetworkProcess::requestStorageAccess):
66         (WebKit::NetworkProcess::requestStorageAccessGranted):
67         * NetworkProcess/NetworkProcess.h:
68         * NetworkProcess/NetworkProcess.messages.in:
69         * Shared/WebPreferences.yaml:
70         * UIProcess/API/C/WKPreferences.cpp:
71         (WKPreferencesSetStorageAccessPromptsEnabled): Deleted.
72         (WKPreferencesGetStorageAccessPromptsEnabled): Deleted.
73         * UIProcess/API/C/WKPreferencesRef.h:
74         * UIProcess/API/Cocoa/WKPreferences.mm:
75         (-[WKPreferences _storageAccessPromptsEnabled]): Deleted.
76         (-[WKPreferences _setStorageAccessPromptsEnabled:]): Deleted.
77         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
78         * UIProcess/Network/NetworkProcessProxy.cpp:
79         (WebKit::NetworkProcessProxy::requestStorageAccess):
80         * UIProcess/Network/NetworkProcessProxy.h:
81         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
82         (WebKit::WebsiteDataStore::requestStorageAccess):
83         * UIProcess/WebsiteData/WebsiteDataStore.h:
84         * WebProcess/WebPage/WebPage.cpp:
85         (WebKit::WebPage::requestStorageAccess):
86
87 2019-03-11  Alex Christensen  <achristensen@webkit.org>
88
89         Add a WKContentRuleList variant that uses copied memory instead of mmap'd shared memory for class A containerized apps
90         https://bugs.webkit.org/show_bug.cgi?id=195511
91         <rdar://problem/44873269>
92
93         Reviewed by Darin Adler.
94
95         * NetworkProcess/NetworkContentRuleListManager.cpp:
96         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
97         * NetworkProcess/NetworkContentRuleListManager.h:
98         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
99         (WebKit::NetworkCache::pathRegisteredAsUnsafeToMemoryMapForTesting):
100         (WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting):
101         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
102         * NetworkProcess/cache/NetworkCacheFileSystem.h:
103         * Shared/WebCompiledContentRuleList.cpp:
104         (WebKit::WebCompiledContentRuleList::usesCopiedMemory const):
105         (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
106         (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode const):
107         (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode const):
108         (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode const):
109         (WebKit::WebCompiledContentRuleList::actions const):
110         * Shared/WebCompiledContentRuleList.h:
111         * Shared/WebCompiledContentRuleListData.cpp:
112         (WebKit::WebCompiledContentRuleListData::size const):
113         (WebKit::WebCompiledContentRuleListData::dataPointer const):
114         (WebKit::WebCompiledContentRuleListData::encode const):
115         (WebKit::WebCompiledContentRuleListData::decode):
116         * Shared/WebCompiledContentRuleListData.h:
117         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
118         * UIProcess/API/APIContentRuleList.cpp:
119         (API::ContentRuleList::usesCopiedMemory const):
120         * UIProcess/API/APIContentRuleList.h:
121         * UIProcess/API/APIContentRuleListStore.cpp:
122         (API::getData):
123         (API::decodeContentRuleListMetaData):
124         (API::ContentRuleListStore::readContentsOfFile):
125         (API::MappedOrCopiedData::dataPointer const):
126         (API::openAndMapOrCopyContentRuleList):
127         (API::compiledToFile):
128         (API::createExtension):
129         (API::ContentRuleListStore::lookupContentRuleList):
130         (API::ContentRuleListStore::compileContentRuleList):
131         (API::ContentRuleListStore::getContentRuleListSource):
132         (API::openAndMapContentRuleList): Deleted.
133         * UIProcess/API/APIContentRuleListStore.h:
134         * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
135         (API::ContentRuleListStore::readContentsOfFile):
136         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
137         (+[WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:]):
138         * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
139         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
140         (-[_WKUserContentFilter usesCopiedMemory]):
141         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
142         * WebProcess/UserContent/WebUserContentController.cpp:
143         (WebKit::WebUserContentController::addContentRuleLists):
144         * WebProcess/UserContent/WebUserContentController.h:
145         * WebProcess/WebPage/WebPage.cpp:
146         (WebKit::m_hostFileDescriptor):
147
148 2019-03-11  Chris Dumez  <cdumez@apple.com>
149
150         Unreviewed, fix assertions in layout tests on iOS Simulator after r242666.
151
152         Log an error but do not crash if we fail to acquire a ProcessAssertion.
153
154         * UIProcess/ios/ProcessAssertionIOS.mm:
155         (WebKit::ProcessAssertion::ProcessAssertion):
156
157 2019-03-11  Chris Dumez  <cdumez@apple.com>
158
159         WebProcessCache should keep track of processes being added
160         https://bugs.webkit.org/show_bug.cgi?id=195538
161
162         Reviewed by Geoffrey Garen.
163
164         WebProcessCache should keep track of processes being added, while they are being
165         checked for responsiveness. This is useful so that:
166         - Requests to clear the cache also clear processes being added
167         - Requests to remove a given process from the cache (either because it crashed
168           or because it is being used for a history navigation) actually remove the
169           process if it is still being checked for responsiveness.
170         - The cached process eviction timer applies to such processes in case something
171           goes wrong with the code and the pending request does not get processed.
172
173         * UIProcess/WebProcessCache.cpp:
174         (WebKit::generateAddRequestIdentifier):
175         (WebKit::WebProcessCache::addProcessIfPossible):
176         (WebKit::WebProcessCache::addProcess):
177         (WebKit::WebProcessCache::clear):
178         (WebKit::WebProcessCache::clearAllProcessesForSession):
179         (WebKit::WebProcessCache::removeProcess):
180         (WebKit::WebProcessCache::CachedProcess::evictionTimerFired):
181         (WebKit::WebProcessCache::evictProcess): Deleted.
182         * UIProcess/WebProcessCache.h:
183         (WebKit::WebProcessCache::size const):
184         * UIProcess/WebProcessPool.cpp:
185         (WebKit::WebProcessPool::processForNavigationInternal):
186         * UIProcess/WebProcessProxy.cpp:
187         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
188
189 2019-03-11  Alex Christensen  <achristensen@webkit.org>
190
191         REGRESSION: ( r240978-r240985 ) [ iOS Release ] Layout Test imported/w3c/web-platform-tests/xhr/send-redirect-post-upload.htm is crashing
192         https://bugs.webkit.org/show_bug.cgi?id=194523
193
194         Reviewed by Alexey Proskuryakov.
195
196         Attempt another workaround to prevent crashes.
197
198         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
199         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
200         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
201         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
202         (-[WKNetworkSessionDelegate URLSession:task:needNewBodyStream:]):
203
204 2019-03-11  Ryan Haddad  <ryanhaddad@apple.com>
205
206         Unreviewed, rolling out r242688, r242643, r242624.
207
208         Caused multiple layout test failures and crashes on iOS and macOS.
209
210         Reverted changeset:
211
212         "requestAnimationFrame should execute before the next frame"
213         https://bugs.webkit.org/show_bug.cgi?id=177484
214         https://trac.webkit.org/changeset/242624/webkit
215
216         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
217         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
218         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
219         (WebKit::DrawingAreaCoordinatedGraphics::display):
220         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
221         (WebKit::LayerTreeHost::layerFlushTimerFired):
222         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
223         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
224         * WebProcess/WebPage/WebPage.cpp:
225         (WebKit::WebPage::layoutIfNeeded):
226         (WebKit::WebPage::willDisplayPage):
227         (WebKit::WebPage::renderingUpdate): Deleted.
228         * WebProcess/WebPage/WebPage.h:
229         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
230         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
231
232 2019-03-11  Darin Adler  <darin@apple.com>
233
234         Specify fixed precision explicitly to prepare to change String::number and StringBuilder::appendNumber floating point behavior
235         https://bugs.webkit.org/show_bug.cgi?id=195533
236
237         Reviewed by Brent Fulgham.
238
239         * NetworkProcess/cache/NetworkCache.cpp:
240         (WebKit::NetworkCache::Cache::dumpContentsToFile): Use appendFixedPrecisionNumber.
241         * NetworkProcess/cache/NetworkCacheEntry.cpp:
242         (WebKit::NetworkCache::Entry::asJSON const): Ditto.
243         * Shared/Gamepad/GamepadData.cpp:
244         (WebKit::GamepadData::loggingString const): Ditto.
245         * UIProcess/WebPageProxy.cpp:
246         (WebKit::WebPageProxy::logDiagnosticMessageWithValue): Use numberToStringFixedPrecision.
247
248 2019-03-11  John Wilander  <wilander@apple.com>
249
250         Resource Load Statistics: Make it possible exclude localhost from classification
251         https://bugs.webkit.org/show_bug.cgi?id=195474
252         <rdar://problem/47520577>
253
254         Reviewed by Brent Fulgham.
255
256         This patch allows for localhost to be excluded from classification and
257         treatment as a prevalent resource.
258
259         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
260         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
261         (WebKit::ResourceLoadStatisticsDatabaseStore::reclassifyResources):
262             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
263         (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
264             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
265         (WebKit::ResourceLoadStatisticsDatabaseStore::isPrevalentResource const):
266             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
267         (WebKit::ResourceLoadStatisticsDatabaseStore::isVeryPrevalentResource const):
268             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
269         (WebKit::ResourceLoadStatisticsDatabaseStore::setVeryPrevalentResource):
270             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
271         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
272         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
273         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
274         (WebKit::ResourceLoadStatisticsMemoryStore::classifyPrevalentResources):
275             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
276         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResource):
277             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
278         (WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentResource const):
279             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
280         (WebKit::ResourceLoadStatisticsMemoryStore::isVeryPrevalentResource const):
281             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
282         (WebKit::ResourceLoadStatisticsMemoryStore::setVeryPrevalentResource):
283             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
284         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
285         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
286         (WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore):
287             Now takes a ShouldIncludeLocalhost parameter.
288         (WebKit::ResourceLoadStatisticsStore::shouldSkip const):
289             Convenience function, currently supporting the localhost exclusion.
290         (WebKit::ResourceLoadStatisticsStore::setIsRunningTest):
291             Test infrastructure.
292         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
293         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
294         (WebKit::WebResourceLoadStatisticsStore::setIsRunningTest):
295             Test infrastructure.
296         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
297             Now takes a ShouldIncludeLocalhost parameter.
298         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
299             Defines the new ShouldIncludeLocalhost boolean enum.
300         * NetworkProcess/NetworkProcess.cpp:
301         (WebKit::NetworkProcess::setIsRunningResourceLoadStatisticsTest):
302             Test infrastructure.
303         * NetworkProcess/NetworkProcess.h:
304         * NetworkProcess/NetworkProcess.messages.in:
305         * NetworkProcess/NetworkSession.cpp:
306         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
307             Forwards the localhost setting to the create function.
308         * NetworkProcess/NetworkSession.h:
309         * NetworkProcess/NetworkSessionCreationParameters.cpp:
310         (WebKit::NetworkSessionCreationParameters::encode const):
311         (WebKit::NetworkSessionCreationParameters::decode):
312         * NetworkProcess/NetworkSessionCreationParameters.h:
313             New parameter called shouldIncludeLocalhostInResourceLoadStatistics.
314         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
315         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
316             Picks up the localhost setting from the parameters.
317         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
318         (WKWebsiteDataStoreSetStatisticsIsRunningTest):
319             Test infrastructure.
320         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
321         * UIProcess/Network/NetworkProcessProxy.cpp:
322         (WebKit::NetworkProcessProxy::setIsRunningResourceLoadStatisticsTest):
323             Test infrastructure.
324         * UIProcess/Network/NetworkProcessProxy.h:
325         * UIProcess/WebProcessPool.cpp:
326         (WebKit::WebProcessPool::ensureNetworkProcess):
327             Picks up the localhost setting from the WebsiteDataStore parameters.
328         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
329         (WebKit::WebsiteDataStore::parameters):
330             Makes sure Safari does not exclude localhost.
331         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
332         (WebKit::WebsiteDataStore::setIsRunningResourceLoadStatisticsTest):
333             Test infrastructure.
334         * UIProcess/WebsiteData/WebsiteDataStore.h:
335
336 2019-03-11  Alex Christensen  <achristensen@webkit.org>
337
338         Unreviewed, rolling out r242698.
339
340         API test crashes on bots.
341
342         Reverted changeset:
343
344         "Add a WKContentRuleList variant that uses copied memory
345         instead of mmap'd shared memory for class A containerized
346         apps"
347         https://bugs.webkit.org/show_bug.cgi?id=195511
348         https://trac.webkit.org/changeset/242698
349
350 2019-03-11  Michael Catanzaro  <mcatanzaro@igalia.com>
351
352         [WPE] Enable web process sandbox
353         https://bugs.webkit.org/show_bug.cgi?id=195169
354
355         Reviewed by Daniel Bates.
356
357         * PlatformWPE.cmake:
358         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
359         (WebKit::bubblewrapSpawn):
360
361 2019-03-11  Truitt Savell  <tsavell@apple.com>
362
363         Unreviewed, rolling out r242697.
364
365         Broke internal builders.
366
367         Reverted changeset:
368
369         "Optimizing loads when creating new pages"
370         https://bugs.webkit.org/show_bug.cgi?id=195516
371         https://trac.webkit.org/changeset/242697
372
373 2019-03-10  Alex Christensen  <achristensen@webkit.org>
374
375         Add a WKContentRuleList variant that uses copied memory instead of mmap'd shared memory for class A containerized apps
376         https://bugs.webkit.org/show_bug.cgi?id=195511
377         <rdar://problem/44873269>
378
379         Reviewed by Darin Adler.
380
381         * NetworkProcess/NetworkContentRuleListManager.cpp:
382         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
383         * NetworkProcess/NetworkContentRuleListManager.h:
384         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
385         (WebKit::NetworkCache::pathRegisteredAsUnsafeToMemoryMapForTesting):
386         (WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting):
387         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
388         * NetworkProcess/cache/NetworkCacheFileSystem.h:
389         * Shared/WebCompiledContentRuleList.cpp:
390         (WebKit::WebCompiledContentRuleList::usesCopiedMemory const):
391         (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
392         (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode const):
393         (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode const):
394         (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode const):
395         (WebKit::WebCompiledContentRuleList::actions const):
396         * Shared/WebCompiledContentRuleList.h:
397         * Shared/WebCompiledContentRuleListData.cpp:
398         (WebKit::WebCompiledContentRuleListData::size const):
399         (WebKit::WebCompiledContentRuleListData::dataPointer const):
400         (WebKit::WebCompiledContentRuleListData::encode const):
401         (WebKit::WebCompiledContentRuleListData::decode):
402         * Shared/WebCompiledContentRuleListData.h:
403         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
404         * UIProcess/API/APIContentRuleList.cpp:
405         (API::ContentRuleList::usesCopiedMemory const):
406         * UIProcess/API/APIContentRuleList.h:
407         * UIProcess/API/APIContentRuleListStore.cpp:
408         (API::getData):
409         (API::decodeContentRuleListMetaData):
410         (API::ContentRuleListStore::readContentsOfFile):
411         (API::MappedOrCopiedData::dataPointer const):
412         (API::openAndMapOrCopyContentRuleList):
413         (API::compiledToFile):
414         (API::createExtension):
415         (API::ContentRuleListStore::lookupContentRuleList):
416         (API::ContentRuleListStore::compileContentRuleList):
417         (API::ContentRuleListStore::getContentRuleListSource):
418         (API::openAndMapContentRuleList): Deleted.
419         * UIProcess/API/APIContentRuleListStore.h:
420         * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
421         (API::ContentRuleListStore::readContentsOfFile):
422         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
423         (+[WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:]):
424         * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
425         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
426         (-[_WKUserContentFilter usesCopiedMemory]):
427         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
428         * WebProcess/UserContent/WebUserContentController.cpp:
429         (WebKit::WebUserContentController::addContentRuleLists):
430         * WebProcess/UserContent/WebUserContentController.h:
431         * WebProcess/WebPage/WebPage.cpp:
432         (WebKit::m_hostFileDescriptor):
433
434 2019-03-10  Jiewen Tan  <jiewen_tan@apple.com>
435
436         Optimizing loads when creating new pages
437         https://bugs.webkit.org/show_bug.cgi?id=195516
438         <rdar://problem/48738086>
439
440         Reviewed by Darin Adler.
441
442         This patch adds hooks in WebPageProxy::createNewPage to optimize loads, and moves the creationParameters
443         of API::NavigationAction from UI clients to WebPageProxy::createNewPage. Also, we now pass the whole
444         API::NavigationAction to the load optimizer instead of the request within.
445
446         * UIProcess/API/APINavigationAction.h:
447         * UIProcess/API/APIUIClient.h:
448         (API::UIClient::createNewPage):
449         * UIProcess/API/C/WKPage.cpp:
450         (WKPageSetPageUIClient):
451         * UIProcess/API/glib/WebKitUIClient.cpp:
452         * UIProcess/Cocoa/NavigationState.mm:
453         (WebKit::tryOptimizingLoad):
454         (WebKit::tryInterceptNavigation):
455         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
456         * UIProcess/Cocoa/UIDelegate.h:
457         * UIProcess/Cocoa/UIDelegate.mm:
458         (WebKit::UIDelegate::UIClient::createNewPage):
459         * UIProcess/WebPageProxy.cpp:
460         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
461         (WebKit::tryOptimizingLoad):
462         (WebKit::WebPageProxy::createNewPage):
463         * UIProcess/WebPageProxy.h:
464
465 2019-03-10  Tim Horton  <timothy_horton@apple.com>
466
467         Add SPI to retrieve the set of text inputs in a given rect, and later focus one
468         https://bugs.webkit.org/show_bug.cgi?id=195499
469
470         Reviewed by Darin Adler.
471
472         * Scripts/webkit/messages.py:
473         * Shared/TextInputContext.cpp: Added.
474         (IPC::ArgumentCoder<WebKit::TextInputContext>::encode):
475         (IPC::ArgumentCoder<WebKit::TextInputContext>::decode):
476         * Shared/TextInputContext.h: Added.
477         (WebKit::TextInputContext::operator== const):
478         Add TextInputContext, which represents a minimal set of information
479         about a text field.
480
481         * Sources.txt:
482         * SourcesCocoa.txt:
483         * UIProcess/API/Cocoa/WKWebView.mm:
484         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]):
485         (-[WKWebView _focusTextInputContext:completionHandler:]):
486         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
487         Add SPI that allows clients to asynchronously request text input
488         contexts for a given rect, and later focus a given context.
489
490         * UIProcess/API/Cocoa/_WKTextInputContext.h: Added.
491         * UIProcess/API/Cocoa/_WKTextInputContext.mm: Added.
492         (-[_WKTextInputContext _initWithTextInputContext:]):
493         (-[_WKTextInputContext boundingRect]):
494         (-[_WKTextInputContext _textInputContext]):
495         (-[_WKTextInputContext isEqual:]):
496         (-[_WKTextInputContext hash]):
497         (-[_WKTextInputContext copyWithZone:]):
498         * UIProcess/API/Cocoa/_WKTextInputContextInternal.h: Added.
499         Add an SPI object that exposes a read-only window on a TextInputContext to clients.
500
501         * UIProcess/WebPageProxy.cpp:
502         (WebKit::WebPageProxy::textInputContextsInRect):
503         (WebKit::WebPageProxy::focusTextInputContext):
504         * UIProcess/WebPageProxy.h:
505         Plumbing from WKWebView<->WebPage.
506
507         * WebKit.xcodeproj/project.pbxproj:
508         * WebProcess/WebPage/WebPage.cpp:
509         (WebKit::elementRectInWindowCoordinates):
510         (WebKit::isEditableTextInputElement):
511         (WebKit::WebPage::textInputContextsInRect):
512         Search the DOM for text input contexts: <input type='text'> (or other
513         form fields that fall back on text field behavior), <textarea>, and
514         contenteditable roots. Store the WebPage, Document, and Element identifiers
515         so that we can find the element again later.
516
517         (WebKit::WebPage::focusTextInputContext):
518         Find the element for a given (web page, document, element) triple and focus it,
519         if it's still available.
520
521         * WebProcess/WebPage/WebPage.h:
522         * WebProcess/WebPage/WebPage.messages.in:
523
524 2019-03-10  Tim Horton  <timothy_horton@apple.com>
525
526         iOS: Using ⌥ to scroll horizontally is no different than arrow key
527         https://bugs.webkit.org/show_bug.cgi?id=195268
528         <rdar://problem/48326682>
529
530         Reviewed by Brent Fulgham.
531
532         * UIProcess/ios/WKContentViewInteraction.mm:
533         (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:inDirection:]):
534         (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:]): Deleted.
535         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
536         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
537         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
538         (-[WKKeyboardScrollViewAnimator setDelegate:]):
539         (-[WKKeyboardScrollViewAnimator distanceForIncrement:inDirection:]):
540         (-[WKKeyboardScrollViewAnimator distanceForIncrement:]): Deleted.
541         Add a direction parameter to -distanceForIncrement:, so the client
542         can return a different page/document size based on the scrolling axis.
543         Adopt it both in the default implementation and in WKContentViewInteraction.
544         Make the option key scroll by page when scrolling horizontally, like it
545         does when scrolling vertically.
546
547 2019-03-10  David Quesada  <david_quesada@apple.com>
548
549         ASSERT(m_downloads.isEmpty()) fails in DownloadProxyMap::~DownloadProxyMap()
550         https://bugs.webkit.org/show_bug.cgi?id=152480
551
552         Reviewed by Chris Dumez.
553
554         * UIProcess/Downloads/DownloadProxyMap.cpp:
555         (WebKit::DownloadProxyMap::downloadFinished):
556             If the DownloadProxy is holding the last reference to the process pool, then
557             invalidating the proxy will cause the process pool, the network process proxy,
558             and this DownloadProxyMap to deallocate. Ensure that doesn't happen until this
559             method has done everything it wants to do to clean up.
560
561 2019-03-10  Wenson Hsieh  <wenson_hsieh@apple.com>
562
563         Fix some misleading function and variable names in WKContentViewInteraction.mm
564         https://bugs.webkit.org/show_bug.cgi?id=195536
565
566         Reviewed by Tim Horton.
567
568         * UIProcess/ios/WKContentViewInteraction.mm:
569         (shouldDeferZoomingToSelectionWhenRevealingFocusedElement):
570
571         Rename shouldZoomToRevealSelectionRect to shouldDeferZoomingToSelectionWhenRevealingFocusedElement; this
572         function is used to determine whether we should zoom to the selection rect when revealing the focused element,
573         and therefore affects whether we need to defer zooming until we get selection information.
574
575         (rectToRevealWhenZoomingToFocusedElement):
576         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
577
578         Rename shouldShowKeyboard to shouldShowInputView; this boolean indicates whether we should show not only the
579         keyboard, but other UI for user input such as date and select pickers.
580
581         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]):
582         (shouldZoomToRevealSelectionRect): Deleted.
583
584 2019-03-10  Simon Fraser  <simon.fraser@apple.com>
585
586         ScrollingTree should have the final say on where layers go
587         https://bugs.webkit.org/show_bug.cgi?id=195507
588
589         Reviewed by Antti Koivisto.
590
591         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
592         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
593         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
594         (WebKit::RemoteScrollingCoordinatorProxy::applyScrollingTreeLayerPositions):
595         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
596         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
597         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
598
599 2019-03-09  Darin Adler  <darin@apple.com>
600
601         [Cocoa] Code signing fails because services are copied into XPCServices after the framework is signed
602         https://bugs.webkit.org/show_bug.cgi?id=195523
603
604         Reviewed by Dan Bernstein.
605
606         * WebKit.xcodeproj/project.pbxproj: Make symbolic links while building the WebKit
607         framework instead of copying in the services after the framework is built.
608
609 2019-03-09  Wenson Hsieh  <wenson_hsieh@apple.com>
610
611         REGRESSION (r242551): Sporadic hangs when tapping to change selection on iOS
612         https://bugs.webkit.org/show_bug.cgi?id=195475
613         <rdar://problem/48721153>
614
615         Reviewed by Chris Dumez.
616
617         r242551 refactored synchronous autocorrection context requests to send an async IPC message and then use
618         waitForAndDispatchImmediately, instead of calling sendSync. However, this exposes a couple of existing issues in
619         the implementation of waitForAndDispatchImmediately that causes sporadic IPC deadlocks when changing selection.
620
621         First, passing in InterruptWaitingIfSyncMessageArrives when synchronously waiting for an IPC message currently
622         does not fulfill its intended behavior of interrupting waiting when a sync message arrives. This is because sync
623         IPC messages, by default, may be dispatched while the receiver is waiting for a sync reply. This means that the
624         logic in Connection::SyncMessageState::processIncomingMessage to dispatch an incoming sync message on the main
625         thread will attempt to handle the incoming message by enqueueing it on the main thread, and then waking up the
626         client runloop (i.e. signaling m_waitForSyncReplySemaphore). This works in the case of sendSync since the sync
627         reply semaphore is used to block the main thread, but in the case of waitForAndDispatchImmediately, a different
628         m_waitForMessageCondition is used instead, so SyncMessageState::processIncomingMessage will only enqueue the
629         incoming sync message on the main thread, and not actually invoke it.
630
631         To fix this first issue, observe that there is pre-existing logic to enqueue the incoming message and signal
632         m_waitForMessageCondition in Connection::processIncomingMessage. This codepath is currently not taken because we
633         end up bailing early in the call to SyncMessageState::processIncomingMessage. Instead, we can move this early
634         return further down in the function, such that if there is an incoming sync message and we're waiting with the
635         InterruptWaitingIfSyncMessageArrives option, we will correctly enqueue the incoming message, wake the runloop,
636         and proceed to handle the incoming message.
637
638         The second issue is more subtle; consider the scenario in which we send a sync message A from the web process to
639         the UI process, and simultaneously, in the UI process, we schedule some work to be done on the main thread.
640         Let's additionally suppose that this scheduled work will send an IPC message B to the web process and
641         synchronously wait for a reply (in the case of this particular bug, this is the sync autocorrection context
642         request). What happens upon receiving sync message A is that the IPC thread in the UI process will schedule A on
643         the main thread; however, before the scheduled response to A is invoked, we will first invoke previously
644         scheduled work that attempts to block synchronously until a message B is received. In summary:
645
646         1. (Web process)    sends sync IPC message A to UI process.
647         2. (UI process)     schedules some main runloop task that will block synchronously on IPC message B.
648         3. (UI process)     receives sync IPC message A and schedules A on the main runloop.
649         4. (UI process)     carry out the task scheduled in (2) and block on B.
650
651         ...and then, the UI process and web process are now deadlocked because the UI process is waiting for B to
652         arrive, but the web process can't send B because it's waiting for a reply for IPC message A! To fix this second
653         deadlock, we first make an important observation: when using sendSync, we don't run into this problem because
654         immediately before sending sync IPC, we will attempt to handle any incoming sync IPC messages that have been
655         queued up. However, when calling waitForAndDispatchImmediately, we don't have this extra step, so a deadlock may
656         occur in the manner described above. To fix this, we make waitForAndDispatchImmediately behave more like
657         sendSync, by handling all incoming sync messages prior to blocking on an IPC response.
658
659         Test: editing/selection/ios/change-selection-by-tapping.html
660
661         * Platform/IPC/Connection.cpp:
662         (IPC::Connection::waitForMessage):
663         (IPC::Connection::processIncomingMessage):
664
665 2019-03-09  Andy Estes  <aestes@apple.com>
666
667         [Apple Pay] CanMakePaymentsWithActiveCard and OpenPaymentSetup should be async messages
668         https://bugs.webkit.org/show_bug.cgi?id=195526
669         <rdar://problem/48745636>
670
671         Reviewed by Chris Dumez.
672
673         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
674         (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard):
675         (WebKit::WebPaymentCoordinatorProxy::openPaymentSetup):
676         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
677         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
678         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
679         (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCard):
680         (WebKit::WebPaymentCoordinator::openPaymentSetup):
681         (WebKit::generateCanMakePaymentsWithActiveCardReplyID): Deleted.
682         (WebKit::generateOpenPaymentSetupReplyID): Deleted.
683         (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCardReply): Deleted.
684         (WebKit::WebPaymentCoordinator::openPaymentSetupReply): Deleted.
685         * WebProcess/ApplePay/WebPaymentCoordinator.h:
686         * WebProcess/ApplePay/WebPaymentCoordinator.messages.in:
687
688 2019-03-09  Andy Estes  <aestes@apple.com>
689
690         [iOS] Remove unneeded entitlements and sandbox allowances from the Networking service
691         https://bugs.webkit.org/show_bug.cgi?id=195527
692
693         Reviewed by Eric Carlson.
694
695         * Configurations/Network-iOS.entitlements:
696         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
697
698 2019-03-09  Chris Dumez  <cdumez@apple.com>
699
700         Use modern async IPC with reply for device orientation permission
701         https://bugs.webkit.org/show_bug.cgi?id=195529
702
703         Reviewed by Ryosuke Niwa.
704
705         * UIProcess/WebPageProxy.cpp:
706         (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
707         * UIProcess/WebPageProxy.h:
708         * UIProcess/WebPageProxy.messages.in:
709         * WebProcess/WebPage/WebPage.cpp:
710         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
711         (WebKit::nextDeviceOrientationAndMotionPermissionCallbackID): Deleted.
712         (WebKit::WebPage::didReceiveDeviceOrientationAndMotionAccessDecision): Deleted.
713         * WebProcess/WebPage/WebPage.h:
714         * WebProcess/WebPage/WebPage.messages.in:
715
716 2019-03-09  Zalan Bujtas  <zalan@apple.com>
717
718         [ContentChangeObserver] Start observing for content change between touchEnd and mouseMoved start
719         https://bugs.webkit.org/show_bug.cgi?id=195510
720         <rdar://problem/48735695>
721
722         Reviewed by Simon Fraser.
723
724         * WebProcess/WebPage/ios/WebPageIOS.mm:
725         (WebKit::WebPage::cancelPotentialTapInFrame):
726
727 2019-03-08  Chris Dumez  <cdumez@apple.com>
728
729         Enable ProcessAssertions on iOS Simulator
730         https://bugs.webkit.org/show_bug.cgi?id=195479
731
732         Reviewed by Alexey Proskuryakov.
733
734         Enable ProcessAssertions on iOS Simulator. We have some layout tests timing out in the
735         iOS Simulator due to the WebContent process suspending. Turning on ProcessAssertions in
736         the iOS Simulator seems to make those tests pass.
737
738         * UIProcess/ProcessAssertion.cpp:
739         * UIProcess/ProcessAssertion.h:
740         * UIProcess/ios/ProcessAssertionIOS.mm:
741
742 2019-03-08  Chris Dumez  <cdumez@apple.com>
743
744         Add support for Device Orientation / Motion permission API
745         https://bugs.webkit.org/show_bug.cgi?id=195329
746         <rdar://problem/47645367>
747
748         Reviewed by Geoffrey Garen.
749
750         Add support for Device Orientation / Motion permission API:
751         - https://github.com/w3c/deviceorientation/issues/57
752
753         This adds new SPI to WKUIDelegatePrivate, until we can make this API.
754
755         * Shared/WebPreferences.yaml:
756         * UIProcess/API/APIUIClient.h:
757         (API::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
758         * UIProcess/API/C/WKPage.cpp:
759         (WKPageSetPageUIClient):
760         * UIProcess/API/C/WKPageUIClient.h:
761         * UIProcess/API/Cocoa/WKUIDelegate.h:
762         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
763         * UIProcess/Cocoa/UIDelegate.h:
764         * UIProcess/Cocoa/UIDelegate.mm:
765         (WebKit::UIDelegate::setDelegate):
766         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
767         * UIProcess/WebPageProxy.cpp:
768         (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
769         * UIProcess/WebPageProxy.h:
770         * UIProcess/WebPageProxy.messages.in:
771         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
772         (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
773         * WebProcess/WebCoreSupport/WebChromeClient.h:
774         * WebProcess/WebPage/WebPage.cpp:
775         (WebKit::nextDeviceOrientationAndMotionPermissionCallbackID):
776         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
777         (WebKit::WebPage::didReceiveDeviceOrientationAndMotionAccessDecision):
778         * WebProcess/WebPage/WebPage.h:
779         * WebProcess/WebPage/WebPage.messages.in:
780
781 2019-03-08  Brady Eidson  <beidson@apple.com>
782
783         Have the UIProcess take the UnboundedNetworking assertion when downloads are in progress.
784         https://bugs.webkit.org/show_bug.cgi?id=195468
785
786         Reviewed by Andy Estes.
787
788         * UIProcess/Downloads/DownloadProxyMap.cpp:
789         (WebKit::DownloadProxyMap::DownloadProxyMap):
790         (WebKit::DownloadProxyMap::createDownloadProxy): If this is the first download, and the process has the entitlement,
791           take the assertion.
792         (WebKit::DownloadProxyMap::downloadFinished):
793         (WebKit::DownloadProxyMap::processDidClose):
794         * UIProcess/Downloads/DownloadProxyMap.h:
795
796 2019-03-08  Chris Dumez  <cdumez@apple.com>
797
798         Add assertions to help debug a WebProcessCache crash
799         https://bugs.webkit.org/show_bug.cgi?id=195469
800
801         Reviewed by Brady Eidson.
802
803         I suspect the process's registrableDomain in null when evictProcess() gets
804         called, thus crashing when lookup it up in the HashMap. Confirm this and
805         how this could happen via assertions.
806
807         * UIProcess/WebProcessCache.cpp:
808         (WebKit::WebProcessCache::evictProcess):
809         * UIProcess/WebProcessProxy.cpp:
810         (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
811
812 2019-03-08  Brady Eidson  <beidson@apple.com>
813
814         Rename AssertionState::Download.
815         https://bugs.webkit.org/show_bug.cgi?id=195465
816
817         Reviewed by Andy Estes.
818
819         It's (currently) about uploads and downloads.
820         Let's call it "UnboundedNetworking"
821
822         * NetworkProcess/Downloads/DownloadMap.cpp:
823         (WebKit::DownloadMap::add):
824
825         * UIProcess/ProcessAssertion.h:
826
827         * UIProcess/WebProcessProxy.cpp:
828         (WebKit::WebProcessProxy::didSetAssertionState):
829
830         * UIProcess/ios/ProcessAssertionIOS.mm:
831         (WebKit::flagsForState):
832         (WebKit::reasonForState):
833
834 2019-03-08  Simon Fraser  <simon.fraser@apple.com>
835
836         [macOS UI-side compositing] Mouse handling can trigger a crash before we have a scrolling tree root
837         https://bugs.webkit.org/show_bug.cgi?id=195467
838
839         Reviewed by Antti Koivisto.
840         
841         When launching MiniBrowser with UI-side compositing enabled in a state where the window
842         appears under the mouse, we can hit RemoteScrollingTree::handleMouseEvent() for a mouseEnter
843         event before we have a scrolling tree root node, so add a null check.
844
845         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
846         (WebKit::RemoteScrollingTree::handleMouseEvent):
847
848 2019-03-08  Carlos Garcia Campos  <cgarcia@igalia.com>
849
850         REGRESSION(r242624): [GTK] New rAF code path assumes AC mode
851         https://bugs.webkit.org/show_bug.cgi?id=195459
852
853         Reviewed by Žan Doberšek.
854
855         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
856         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
857         The refresh monitor now calls scheduleLayerFlush() but when AC
858         mode is disabled this method does nothing, so setNeedsDisplay()
859         needs to be called instead.
860
861 2019-03-07  Tim Horton  <timothy_horton@apple.com>
862
863         Crash under RemoteLayerTreePropertyApplier::applyProperties
864         https://bugs.webkit.org/show_bug.cgi?id=195448
865         <rdar://problem/48588226>
866
867         Reviewed by Simon Fraser.
868
869         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
870         (WebKit::RemoteLayerTreeHost::updateLayerTree):
871         Under some currently-unknown circumstances, the UI process is receiving
872         commits referring to layers that it does not know about.
873         One understood case of this was fixed in r241899, but there seem to be
874         cases remaining that are not understood.
875         Also, add a release log so that we can identify any downstream effects.
876
877 2019-03-07  Zalan Bujtas  <zalan@apple.com>
878
879         [ContentChangeObserver] Introduce fixed duration content observation
880         https://bugs.webkit.org/show_bug.cgi?id=195295
881         <rdar://problem/48579913>
882
883         Reviewed by Simon Fraser.
884
885         * WebProcess/WebPage/ios/WebPageIOS.mm:
886         (WebKit::WebPage::handleSyntheticClick):
887         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
888
889 2019-03-07  Fujii Hironori  <Hironori.Fujii@sony.com>
890
891         [WinCairo][WebKit] Nothing is drawn after Web process crashed
892         https://bugs.webkit.org/show_bug.cgi?id=195399
893
894         Reviewed by Alex Christensen.
895
896         PageClientImpl::viewSize returned 0x0 size after Web process
897         crashed. Restored the original implementation using GetClientRect
898         (Bug 52175).
899
900         * UIProcess/win/PageClientImpl.cpp:
901         (WebKit::PageClientImpl::viewSize):
902
903 2019-03-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
904
905         requestAnimationFrame should execute before the next frame
906         https://bugs.webkit.org/show_bug.cgi?id=177484
907
908         Reviewed by Simon Fraser.
909
910         Replace the calls to Page::layoutIfNeeded() and willDisplayPage() by
911         a single call to Page::renderingUpdate(). This new function implements 
912         "Update the rendering" step of the HTML Event Loop specification
913         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
914
915         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
916         (WebKit::AcceleratedDrawingArea::updateBackingStoreState):
917         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
918         (WebKit::LayerTreeHost::layerFlushTimerFired):
919         * WebProcess/WebPage/DrawingAreaImpl.cpp:
920         (WebKit::DrawingAreaImpl::display):
921         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
922         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
923         * WebProcess/WebPage/WebPage.cpp:
924         (WebKit::WebPage::layoutIfNeeded):
925         (WebKit::WebPage::renderingUpdate):
926         (WebKit::WebPage::willDisplayPage): Deleted.
927         * WebProcess/WebPage/WebPage.h:
928         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
929         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
930
931 2019-03-07  Zalan Bujtas  <zalan@apple.com>
932
933         [ContentChangeObserver] Add a setting to be able to turn content change observation on/off
934         https://bugs.webkit.org/show_bug.cgi?id=195353
935         <rdar://problem/48626394>
936
937         Reviewed by Simon Fraser.
938
939         * Shared/WebPreferences.yaml:
940         * UIProcess/API/C/WKPreferences.cpp:
941         (WKPreferencesSetContentChangeObserverEnabled):
942         (WKPreferencesGetContentChangeObserverEnabled):
943         * UIProcess/API/C/WKPreferencesRefPrivate.h:
944         * UIProcess/API/Cocoa/WKPreferences.mm:
945         (-[WKPreferences _contentChangeObserverEnabled]):
946         (-[WKPreferences _setContentChangeObserverEnabled:]):
947         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
948         * WebProcess/WebPage/ios/WebPageIOS.mm:
949         (WebKit::WebPage::handleSyntheticClick):
950
951 2019-03-07  Andy Estes  <aestes@apple.com>
952
953         [Apple Pay] Untangle PKPaymentAuthorizationViewController from WebPaymentCoordinatorProxy
954         https://bugs.webkit.org/show_bug.cgi?id=195349
955         <rdar://problem/48625510>
956
957         Reviewed by Alex Christensen.
958
959         Introduced PaymentAuthorizationPresenter and WKPaymentAuthorizationDelegate to encapsulate
960         PKPaymentAuthorizationViewController and its delegate. Taught WebPaymentCoordinatorProxy to
961         interact with PaymentAuthorizationPresenter rather than PKPAVC directly.
962
963         These changes will allow us to swap out PKPaymentAuthorizationViewController with PKPaymentAuthorizationController in a follow-on patch.
964
965         * Platform/cocoa/PaymentAuthorizationPresenter.h: Added. Defined the abstract interface for
966         payment authorization presenters that use PKPA(V)C.
967         * Platform/cocoa/PaymentAuthorizationPresenter.mm: Added.
968         (WebKit::toPKPaymentAuthorizationStatus): Moved from WebPaymentCoordinatorProxyCocoa.mm.
969         (WebKit::toPKPaymentErrorCode): Ditto.
970         (WebKit::toNSError): Ditto.
971         (WebKit::toNSErrors): Ditto.
972         (WebKit::toPKShippingMethods): Ditto.
973         (WebKit::PaymentAuthorizationPresenter::completeMerchantValidation): Added. Implements the
974         logic previously in WebPaymentCoordinatorProxy::platformCompleteMerchantValidation.
975         (WebKit::PaymentAuthorizationPresenter::completePaymentMethodSelection): Ditto for
976         WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection.
977         (WebKit::PaymentAuthorizationPresenter::completePaymentSession): Ditto for 
978         (WebKit::PaymentAuthorizationPresenter::completeShippingContactSelection): Ditto for
979         WebPaymentCoordinatorProxy::platformCompletePaymentSession.
980         (WebKit::PaymentAuthorizationPresenter::completeShippingMethodSelection): Ditto for
981         WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection.
982         * Platform/cocoa/PaymentAuthorizationViewController.h: Added. Defined a subclass of PaymentAuthorizationPresenter for PKPaymentAuthorizationViewController.
983         * Platform/cocoa/PaymentAuthorizationViewController.mm: Added.
984         (-[WKPaymentAuthorizationViewControllerDelegate initWithPresenter:]): Added a PKPAVC
985         delegate that's a subclass of WKPaymentAuthorizationDelegate.
986         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]):
987         Called -[WKPaymentAuthorizationDelegate _didFinish].
988         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:handler:]): Called
989         -[WKPaymentAuthorizationDelegate _didAuthorizePayment:completion:].
990         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]): Called
991         -[WKPaymentAuthorizationDelegate _didSelectShippingMethod:completion:].
992         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]): Called
993         -[WKPaymentAuthorizationDelegate _didSelectShippingContact:completion:].
994         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]): Called
995         -[WKPaymentAuthorizationDelegate _didSelectPaymentMethod:completion:].
996         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:willFinishWithError:]):
997         Called -[WKPaymentAuthorizationDelegate _willFinishWithError:].
998         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didRequestMerchantSession:]): Called
999         -[WKPaymentAuthorizationDelegate _didRequestMerchantSession:].
1000         * Platform/cocoa/WKPaymentAuthorizationDelegate.h: Added.
1001         * Platform/cocoa/WKPaymentAuthorizationDelegate.mm: Added.
1002         (-[WKPaymentAuthorizationDelegate summaryItems]): Added a summaryItems getter.
1003         (-[WKPaymentAuthorizationDelegate shippingMethods]): Ditto for shippingMethods.
1004         (-[WKPaymentAuthorizationDelegate completeMerchantValidation:error:]): Called
1005         _didRequestMerchantSessionCompletion then set it to nil.
1006         (-[WKPaymentAuthorizationDelegate completePaymentMethodSelection:]): Ditto for
1007         _didSelectPaymentMethodCompletion.
1008         (-[WKPaymentAuthorizationDelegate completePaymentSession:errors:didReachFinalState:]): Ditto
1009         for _didAuthorizePaymentCompletion.
1010         (-[WKPaymentAuthorizationDelegate completeShippingContactSelection:summaryItems:shippingMethods:errors:]):
1011         Ditto for _didSelectShippingContactCompletion.
1012         (-[WKPaymentAuthorizationDelegate completeShippingMethodSelection:]): Ditto for
1013         _didSelectShippingMethodCompletion.
1014         (-[WKPaymentAuthorizationDelegate invalidate]): If there's an outstanding authorization
1015         callback, called -completePaymentSession:errors:didReachFinalState: with a state of
1016         PKPaymentAuthorizationStatusFailure.
1017         (-[WKPaymentAuthorizationDelegate _initWithPresenter:]):
1018         (-[WKPaymentAuthorizationDelegate _didAuthorizePayment:completion:]): Added. Implements the
1019         logic previously in WKPaymentAuthorizationViewControllerDelegate.
1020         (-[WKPaymentAuthorizationDelegate _didFinish]): Ditto.
1021         (-[WKPaymentAuthorizationDelegate _didRequestMerchantSession:]): Ditto.
1022         (-[WKPaymentAuthorizationDelegate _didSelectPaymentMethod:completion:]): Ditto.
1023         (-[WKPaymentAuthorizationDelegate _didSelectShippingContact:completion:]): Ditto.
1024         (toShippingMethod): Moved from WebPaymentCoordinatorProxyCocoa.mm.
1025         (-[WKPaymentAuthorizationDelegate _didSelectShippingMethod:completion:]): Added. Implements
1026         the logic previously in WKPaymentAuthorizationViewControllerDelegate.
1027         (-[WKPaymentAuthorizationDelegate _willFinishWithError:]): Ditto.
1028         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
1029         (WebKit::WebPaymentCoordinatorProxy::presenterWillValidateMerchant): To conform to
1030         PaymentAuthorizationPresenter::Client, renamed from validateMerchant.
1031         (WebKit::WebPaymentCoordinatorProxy::presenterDidAuthorizePayment): Renamed from
1032         didAuthorizePayment.
1033         (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish): Moved logic here that previously
1034         existed in WKPaymentAuthorizationViewControllerDelegate.
1035         (WebKit::WebPaymentCoordinatorProxy::presenterDidSelectShippingMethod): Renamed from
1036         didSelectShippingMethod.
1037         (WebKit::WebPaymentCoordinatorProxy::presenterDidSelectShippingContact): Renamed from
1038         didSelectShippingContact.
1039         (WebKit::WebPaymentCoordinatorProxy::presenterDidSelectPaymentMethod): Renamed from
1040         didSelectPaymentMethod.
1041         (WebKit::WebPaymentCoordinatorProxy::validateMerchant): Renamed to
1042         presenterWillValidateMerchant.
1043         (WebKit::WebPaymentCoordinatorProxy::didAuthorizePayment): Renamed to
1044         presenterDidAuthorizePayment.
1045         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingMethod): Renamed to
1046         presenterDidSelectShippingMethod.
1047         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingContact): Renamed to
1048         presenterDidSelectShippingContact.
1049         (WebKit::WebPaymentCoordinatorProxy::didSelectPaymentMethod): Renamed to
1050         didSelectPaymentMethod.
1051         * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Changed WebPaymentCoordinatorProxy to
1052         subclass PaymentAuthorizationPresenter::Client.
1053         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: Removed WKPaymentAuthorizationViewControllerDelegate interface and declared some helper functions
1054         needed by PaymentAuthorizationPresenter.
1055         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1056         (WebKit::toPKPaymentSummaryItemType): Removed static keyword.
1057         (WebKit::toDecimalNumber): Ditto.
1058         (WebKit::toPKPaymentSummaryItem): Ditto.
1059         (WebKit::toPKPaymentSummaryItems): Ditto.
1060         (WebKit::toPKShippingMethod): Ditto.
1061         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Changed to call
1062         m_authorizationPresenter.
1063         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession): Ditto.
1064         (WebKit::WebPaymentCoordinatorProxy::platformCompleteMerchantValidation): Ditto.
1065         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection): Ditto.
1066         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection): Ditto.
1067         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection): Ditto.
1068         (-[WKPaymentAuthorizationViewControllerDelegate initWithPaymentCoordinatorProxy:]): Deleted.
1069         (-[WKPaymentAuthorizationViewControllerDelegate invalidate]): Deleted.
1070         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:willFinishWithError:]): Deleted.
1071         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didRequestMerchantSession:]): Deleted.
1072         (toShippingMethod): Deleted.
1073         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:handler:]): Deleted.
1074         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]): Deleted.
1075         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]): Deleted.
1076         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]): Deleted.
1077         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:completion:]): Deleted.
1078         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:completion:]): Deleted.
1079         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:completion:]): Deleted.
1080         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:completion:]): Deleted.
1081         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]): Deleted.
1082         (WebKit::toPKPaymentAuthorizationStatus): Moved to PaymentAuthorizationPresenter.mm.
1083         (WebKit::toPKPaymentErrorCode): Ditto.
1084         (WebKit::toNSError): Ditto.
1085         (WebKit::toNSErrors): Ditto.
1086         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
1087         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Changed to present a
1088         PaymentAuthorizationPresenter rather than a PKPAVC.
1089         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Changed to dismiss a
1090         PaymentAuthorizationPresenter rather than a PKPAVC.
1091         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
1092         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Ditto.
1093         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Ditto.
1094         * SourcesCocoa.txt:
1095         * UIProcess/WebPageProxy.h:
1096         * UIProcess/ios/WebPageProxyIOS.mm:
1097         (WebKit::WebPageProxy::paymentCoordinatorAuthorizationPresenter): Added. Returns a new
1098         PaymentAuthorizationViewController.
1099         * WebKit.xcodeproj/project.pbxproj:
1100
1101 2019-03-07  Chris Dumez  <cdumez@apple.com>
1102
1103         Regression(r242580) WebKit.NetworkProcessCrashWithPendingConnection API is crashing on iOS debug
1104         https://bugs.webkit.org/show_bug.cgi?id=195416
1105
1106         Reviewed by Antti Koivisto.
1107
1108         Drop ASSERT_NOT_REACHED() in WebPage::didCompletePageTransition() when the tree is still frozen due to
1109         LayerTreeFreezeReason::ProcessSuspended. As demonstrated by this API test, nothing prevents a load from
1110         completing and WebPage::didCompletePageTransition() to get called *after* WebProcess::prepareToSuspend()
1111         has been called. From the logging during the test, I can tell that WebProcess::processDidResume() gets
1112         called later on and the LayerTreeFreezeReason::ProcessSuspended freezing reason gets dropped, as expected.
1113
1114         * WebProcess/WebPage/WebPage.cpp:
1115         (WebKit::WebPage::didCompletePageTransition):
1116
1117 2019-03-07  Chris Dumez  <cdumez@apple.com>
1118
1119         Clean up / simplify ProcessAssertion code
1120         https://bugs.webkit.org/show_bug.cgi?id=195394
1121
1122         Reviewed by Geoffrey Garen.
1123
1124         Clean up / simplify ProcessAssertion code to facilitate its maintenance and make it
1125         less error-prone.
1126
1127         * Platform/IPC/mac/ConnectionMac.mm:
1128         (IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog):
1129         * UIProcess/ProcessAssertion.cpp:
1130         (WebKit::ProcessAssertion::ProcessAssertion):
1131         (WebKit::ProcessAssertion::setState):
1132         * UIProcess/ProcessAssertion.h:
1133         (WebKit::ProcessAssertion::Client::~Client):
1134         (WebKit::ProcessAssertion::setClient):
1135         (WebKit::ProcessAssertion::client):
1136         * UIProcess/ProcessThrottler.cpp:
1137         (WebKit::ProcessThrottler::didConnectToProcess):
1138         * UIProcess/ProcessThrottler.h:
1139         * UIProcess/ios/ProcessAssertionIOS.mm:
1140         (-[WKProcessAssertionBackgroundTaskManager dealloc]):
1141         (-[WKProcessAssertionBackgroundTaskManager addAssertionNeedingBackgroundTask:]):
1142         (-[WKProcessAssertionBackgroundTaskManager removeAssertionNeedingBackgroundTask:]):
1143         (-[WKProcessAssertionBackgroundTaskManager _notifyAssertionsOfImminentSuspension]):
1144         (-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]):
1145         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
1146         (WebKit::ProcessAssertion::ProcessAssertion):
1147         (WebKit::ProcessAssertion::processAssertionWasInvalidated):
1148         (WebKit::ProcessAssertion::setState):
1149         (WebKit::ProcessAndUIAssertion::updateRunInBackgroundCount):
1150         (WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion):
1151         (WebKit::ProcessAndUIAssertion::~ProcessAndUIAssertion):
1152         (WebKit::ProcessAndUIAssertion::processAssertionWasInvalidated):
1153         (WebKit::ProcessAndUIAssertion::setState):
1154         (WebKit::ProcessAndUIAssertion::uiAssertionWillExpireImminently):
1155
1156 2019-03-07  Commit Queue  <commit-queue@webkit.org>
1157
1158         Unreviewed, rolling out r242297.
1159         https://bugs.webkit.org/show_bug.cgi?id=195430
1160
1161         Broke Microsoft Visio. (Requested by dydz on #webkit).
1162
1163         Reverted changeset:
1164
1165         "[iOS] Turn mouse event simulation on by default"
1166         https://bugs.webkit.org/show_bug.cgi?id=195218
1167         https://trac.webkit.org/changeset/242297
1168
1169 2019-03-07  John Wilander  <wilander@apple.com>
1170
1171         Resource Load Statistics: Log first-party navigations with link decoration
1172         https://bugs.webkit.org/show_bug.cgi?id=195301
1173         <rdar://problem/48569971>
1174
1175         Reviewed by Brent Fulgham.
1176
1177         This patch adds a call to the network process' resource load statistics to
1178         log cross-site navigations with link decoration. The logging checks if the
1179         source of the navigation is a prevalent resource and if so, sets the
1180         appropriate flag for the destination.
1181
1182         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1183         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
1184         (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema):
1185         (WebKit::ResourceLoadStatisticsDatabaseStore::logSubresourceRedirect):
1186         (WebKit::ResourceLoadStatisticsDatabaseStore::logCrossSiteLoadWithLinkDecoration):
1187         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
1188         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1189         (WebKit::ResourceLoadStatisticsMemoryStore::logCrossSiteLoadWithLinkDecoration):
1190         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
1191         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
1192         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1193         (WebKit::WebResourceLoadStatisticsStore::logCrossSiteLoadWithLinkDecoration):
1194         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1195         * NetworkProcess/NetworkProcess.cpp:
1196         (WebKit::NetworkProcess::committedCrossSiteLoadWithLinkDecoration):
1197             This now receives a completion handler. This is in preparation for
1198             test cases where we need to log such an event and wait for it to
1199             finish before continuing.
1200         * NetworkProcess/NetworkProcess.h:
1201         * NetworkProcess/NetworkProcess.messages.in:
1202         * UIProcess/Network/NetworkProcessProxy.cpp:
1203         (WebKit::NetworkProcessProxy::committedCrossSiteLoadWithLinkDecoration):
1204         * UIProcess/Network/NetworkProcessProxy.h:
1205         * UIProcess/WebPageProxy.cpp:
1206         (WebKit::WebPageProxy::didCommitLoadForFrame):
1207         * UIProcess/WebProcessPool.cpp:
1208         (WebKit::WebProcessPool::committedCrossSiteLoadWithLinkDecoration):
1209         * UIProcess/WebProcessPool.h:
1210
1211 2019-03-07  Per Arne Vollan  <pvollan@apple.com>
1212
1213         [iOS] Disable permissive call logging in sandbox
1214         https://bugs.webkit.org/show_bug.cgi?id=195288
1215         <rdar://problem/47683804>
1216
1217         Reviewed by Brent Fulgham.
1218
1219         As on macOS, we should enable strict call filtering in sandbox on iOS.
1220
1221         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1222
1223 2019-03-07  Youenn Fablet  <youenn@apple.com>
1224
1225         Introduce a quota manager for Cache API/Service Worker/IDB storage
1226         https://bugs.webkit.org/show_bug.cgi?id=195283
1227
1228         Reviewed by Chris Dumez.
1229
1230         Remove quota handling from Cache API storage and use StorageQuotaManager/StorageQuotaUser.
1231         CacheStorage::Caches becomes a quota user and has a StorageQuotaManager to check for space for any cache API write task.
1232         NetworkProcess is responsible to manage the quota managers.
1233         Quota managers will go through network process to ask UIProcess for quota extension.
1234
1235         Remove pending callback handling from CacheStorage since they are queued in QuotaManager now.
1236
1237         * NetworkProcess/NetworkProcess.cpp:
1238         (WebKit::NetworkProcess::~NetworkProcess):
1239         (WebKit::NetworkProcess::destroySession):
1240         (WebKit::NetworkProcess::cacheStorageRootPath):
1241         (WebKit::NetworkProcess::setCacheStorageParameters):
1242         (WebKit::NetworkProcess::storageQuotaManager):
1243         * NetworkProcess/NetworkProcess.h:
1244         * NetworkProcess/cache/CacheStorageEngine.cpp:
1245         (WebKit::CacheStorage::Engine::from):
1246         (WebKit::CacheStorage::Engine::Engine):
1247         (WebKit::CacheStorage::Engine::readCachesFromDisk):
1248         * NetworkProcess/cache/CacheStorageEngine.h:
1249         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
1250         (WebKit::CacheStorage::Cache::put):
1251         * NetworkProcess/cache/CacheStorageEngineCache.h:
1252         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1253         (WebKit::CacheStorage::Caches::Caches):
1254         (WebKit::CacheStorage::Caches::~Caches):
1255         (WebKit::CacheStorage::Caches::requestSpace):
1256         (WebKit::CacheStorage::Caches::writeRecord):
1257         * NetworkProcess/cache/CacheStorageEngineCaches.h:
1258
1259 2019-03-07  John Wilander  <wilander@apple.com>
1260
1261         Resource Load Statistics: Make it possible to purge only script-accessible cookies
1262         https://bugs.webkit.org/show_bug.cgi?id=195383
1263         <rdar://problem/48570136>
1264
1265         Reviewed by Brent Fulgham.
1266
1267         This patch provides the ability to purge all script-accessible cookies while leaving
1268         HttpOnly cookies in place.
1269
1270         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
1271         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
1272         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1273         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
1274             Support for a new boolean flag on whether or not to include HttpOnly Cookies.
1275         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1276         * NetworkProcess/NetworkProcess.cpp:
1277         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
1278             Support for a new boolean flag on whether or not to include HttpOnly Cookies.
1279         (WebKit::NetworkProcess::deleteCookiesForTesting):
1280             Test infrastructure.
1281         * NetworkProcess/NetworkProcess.h:
1282         * NetworkProcess/NetworkProcess.messages.in:
1283         * NetworkProcess/NetworkSession.cpp:
1284         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
1285             Support for a new boolean flag on whether or not to include HttpOnly Cookies.
1286         * NetworkProcess/NetworkSession.h:
1287         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1288         (WKWebsiteDataStoreStatisticsDeleteCookiesForTesting):
1289             Test infrastructure.
1290         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1291         * UIProcess/Network/NetworkProcessProxy.cpp:
1292         (WebKit::NetworkProcessProxy::deleteCookiesForTesting):
1293             Test infrastructure.
1294         * UIProcess/Network/NetworkProcessProxy.h:
1295         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1296         (WebKit::WebsiteDataStore::deleteCookiesForTesting):
1297             Test infrastructure.
1298         * UIProcess/WebsiteData/WebsiteDataStore.h:
1299
1300 2019-03-07  Carlos Garcia Campos  <cgarcia@igalia.com>
1301
1302         REGRESSION(r242364): [WPE] Do not stop the compositing run loop update timer on suspend
1303         https://bugs.webkit.org/show_bug.cgi?id=195410
1304
1305         Reviewed by Žan Doberšek.
1306
1307         Calling CompositingRunLoop::stopUpdates() on suspend is leaving the threaded compositor in an inconsistent
1308         state, failing to resume and stopping the updates forever. This is causing timeouts in WPE layout tests. Instead
1309         of calling stopUpdates(), a new suspend() is called, that stops the update timer, without changing the current
1310         updae tha compositing state. A new method resume() is also added to schedule an update if needed.
1311
1312         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
1313         (WebKit::CompositingRunLoop::suspend): Set state as suspended and stop the update timer.
1314         (WebKit::CompositingRunLoop::resume): Set state as not suspended and start the update timer if it was scheduled
1315         while suspended.
1316         (WebKit::CompositingRunLoop::scheduleUpdate): Do not start the update timer when suspended.
1317         (WebKit::CompositingRunLoop::compositionCompleted): Ditto.
1318         (WebKit::CompositingRunLoop::updateCompleted): Ditto.
1319         (WebKit::CompositingRunLoop::updateTimerFired): Add an assert to ensure the update timer is not fired while suspended.
1320         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
1321         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1322         (WebKit::ThreadedCompositor::suspend): Call CompositingRunLoop::suspend() instead of stopUpdates().
1323         (WebKit::ThreadedCompositor::resume): Call CompositingRunLoop::resume().
1324
1325 2019-03-06  Mark Lam  <mark.lam@apple.com>
1326
1327         Exception is a JSCell, not a JSObject.
1328         https://bugs.webkit.org/show_bug.cgi?id=195392
1329
1330         Reviewed by Saam Barati.
1331
1332         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
1333         (WebKit::JSNPObject::throwInvalidAccessError):
1334         * WebProcess/Plugins/Netscape/JSNPObject.h:
1335
1336 2019-03-07  Commit Queue  <commit-queue@webkit.org>
1337
1338         Unreviewed, rolling out r242354.
1339         https://bugs.webkit.org/show_bug.cgi?id=195402
1340
1341         breaks layout tests in all configurations (Requested by
1342         zdobersek on #webkit).
1343
1344         Reverted changeset:
1345
1346         "[WPE] Enable web process sandbox"
1347         https://bugs.webkit.org/show_bug.cgi?id=195169
1348         https://trac.webkit.org/changeset/242354
1349
1350 2019-03-06  Ross Kirsling  <ross.kirsling@sony.com>
1351
1352         [Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t.
1353         https://bugs.webkit.org/show_bug.cgi?id=195346
1354
1355         Reviewed by Fujii Hironori.
1356
1357         * Platform/IPC/win/ConnectionWin.cpp:
1358         (IPC::Connection::createServerAndClientIdentifiers):
1359         * Platform/win/ModuleWin.cpp:
1360         (WebKit::Module::load):
1361         * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
1362         (WebKit::ProcessLauncher::launchProcess):
1363         * UIProcess/win/WebContextMenuProxyWin.cpp:
1364         (WebKit::createMenuItem):
1365         * UIProcess/win/WebView.cpp:
1366         (WebKit::WebView::setToolTip):
1367         * WebProcess/InjectedBundle/win/InjectedBundleWin.cpp:
1368         (WebKit::InjectedBundle::initialize):
1369         Use wchar helpers as needed.
1370
1371 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1372
1373         Crash when attempting to change input type while dismissing datalist suggestions
1374         https://bugs.webkit.org/show_bug.cgi?id=195384
1375         <rdar://problem/48563718>
1376
1377         Reviewed by Brent Fulgham.
1378
1379         See WebCore ChangeLog for more details.
1380
1381         * WebProcess/WebPage/WebPage.cpp:
1382         (WebKit::WebPage::setActiveDataListSuggestionPicker):
1383         (WebKit::WebPage::didSelectDataListOption):
1384         (WebKit::WebPage::didCloseSuggestions):
1385         * WebProcess/WebPage/WebPage.h:
1386
1387         Turn m_activeDataListSuggestionPicker from a raw pointer into a WeakPtr.
1388
1389 2019-03-06  Chris Dumez  <cdumez@apple.com>
1390
1391         [iOS] ProcessDidResume() IPC should be sent upon resuming when ProcessWillSuspendImminently() IPC was sent
1392         https://bugs.webkit.org/show_bug.cgi?id=195382
1393         <rdar://problem/48642739>
1394
1395         Reviewed by Geoffrey Garen.
1396
1397         ProcessDidResume() IPC should be sent upon resuming when ProcessWillSuspendImminently() IPC was sent. Previously,
1398         we only send ProcessDidResume() to the WebProcess if PrepareToSuspend() was sent, not when the more urgent
1399         ProcessWillSuspendImminently() IPC was sent.
1400
1401         This mismatch has lead to bugs because the WebProcess does not know it got resumed and failed to unfreeze the
1402         layers it froze upon suspension.
1403
1404         * UIProcess/ProcessAssertion.h:
1405         (WebKit::ProcessAssertionClient::~ProcessAssertionClient):
1406
1407         * UIProcess/ProcessThrottler.cpp:
1408         (WebKit::ProcessThrottler::updateAssertion):
1409         (WebKit::ProcessThrottler::uiAssertionWillExpireImminently):
1410         (WebKit::ProcessThrottler::assertionWillExpireImminently): Deleted.
1411
1412         * UIProcess/ProcessThrottler.h:
1413         * UIProcess/ios/ProcessAssertionIOS.mm:
1414         (-[WKProcessAssertionBackgroundTaskManager _notifyClientsOfImminentSuspension]):
1415         (WebKit::ProcessAssertion::~ProcessAssertion):
1416         (WebKit::ProcessAndUIAssertion::~ProcessAndUIAssertion):
1417         (WebKit::ProcessAndUIAssertion::setClient):
1418
1419         * WebProcess/WebPage/WebPage.cpp:
1420         (WebKit::WebPage::didCompletePageTransition):
1421         Revert change that was landed in r242098 to work around this ProcessThrottler bug.
1422
1423         * WebProcess/WebPage/ios/WebPageIOS.mm:
1424         (WebKit::WebPage::applicationWillEnterForeground):
1425         Revert change that was landed in r242554 to work around this ProcessThrottler bug.
1426
1427 2019-03-06  Alex Christensen  <achristensen@webkit.org>
1428
1429         Add gettid to allowed syscalls on Mac
1430         https://bugs.webkit.org/show_bug.cgi?id=195386
1431         <rdar://problem/48651255>
1432
1433         Reviewed by Brent Fulgham.
1434
1435         * WebProcess/com.apple.WebProcess.sb.in:
1436
1437 2019-03-06  Per Arne Vollan  <pvollan@apple.com>
1438
1439         [macOS] Sandbox call violation causes WebContent process to crash
1440         https://bugs.webkit.org/show_bug.cgi?id=195379
1441         <rdar://problem/48647263>
1442
1443         Reviewed by Brent Fulgham.
1444
1445         A new call needs to be added to the allow list in the WebContent process' sandbox.
1446
1447         * WebProcess/com.apple.WebProcess.sb.in:
1448
1449 2019-03-06  Antti Koivisto  <antti@apple.com>
1450
1451         [iOS] Basic hit testing for content overlapping fast-scrollable overflow
1452         https://bugs.webkit.org/show_bug.cgi?id=195360
1453
1454         Reviewed by Simon Fraser.
1455
1456         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1457         (WebKit::RemoteLayerTreeHost::makeNode):
1458
1459         Use new UIView subclass for tiled layer hosting (so we know they have content even when contents property is nil).
1460
1461         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
1462         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1463         (collectDescendantViewsAtPoint):
1464
1465         Factor collection step into a function.
1466         Do basic skipping of event-transparent layers.
1467
1468         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
1469
1470         To handle overlap cases, find the scroll view that has the deepest non-transparent view hit as its descendant.
1471
1472         (-[UIView _web_recursiveFindDescendantInteractibleViewAtPoint:withEvent:]): Deleted.
1473
1474 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1475
1476         Move RenderObject::isTransparentOrFullyClippedRespectingParentFrames() to RenderLayer
1477         https://bugs.webkit.org/show_bug.cgi?id=195300
1478
1479         Reviewed by Simon Fraser.
1480
1481         Refactor some logic to use isTransparentOrFullyClippedRespectingParentFrames on RenderLayer rather than
1482         RenderObject; introduce a helper method to ask whether the enclosing layer of a renderer is transparent or
1483         clipped.
1484
1485         * WebProcess/WebPage/ios/WebPageIOS.mm:
1486         (WebKit::enclosingLayerIsTransparentOrFullyClipped):
1487         (WebKit::WebPage::platformEditorState const):
1488         (WebKit::WebPage::requestEvasionRectsAboveSelection):
1489         (WebKit::WebPage::getFocusedElementInformation):
1490
1491 2019-03-06  Chris Dumez  <cdumez@apple.com>
1492
1493         REGRESSION (r238490): YouTube.com: Returning PiP to Safari after sleeping device loses page
1494         https://bugs.webkit.org/show_bug.cgi?id=195364
1495         <rdar://problem/48538837>
1496
1497         Reviewed by Geoffrey Garen.
1498
1499         Make sure we unset the LayerTreeFreezeReason::ProcessSuspended layer tree freeze reason
1500         when WebPage::applicationWillEnterForeground() is called. This restores pre-r238490
1501         behavior and addresses the issue with PiP on youtube.com.
1502
1503         * WebProcess/WebPage/ios/WebPageIOS.mm:
1504         (WebKit::WebPage::applicationWillEnterForeground):
1505
1506 2019-03-05  Dean Jackson  <dino@apple.com>
1507
1508         Fix WKPasswordView compilation on iOS
1509         https://bugs.webkit.org/show_bug.cgi?id=195344
1510         <rdar://problem/48620066>
1511
1512         Reviewed by Dan Bates.
1513
1514         Use WebKitAdditions.
1515
1516         * UIProcess/ios/WKPasswordView.mm:
1517         (-[WKPasswordView showInScrollView:]):
1518
1519 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1520
1521         [iOS] Frequent 1 second IPC deadlocks when showing a paste callout
1522         https://bugs.webkit.org/show_bug.cgi?id=195354
1523         <rdar://problem/48624675>
1524
1525         Reviewed by Tim Horton.
1526
1527         When triggering programmatic paste, we frequently hit deadlocks due to sync IPC going from the UI process to the
1528         web process and vice versa. What happens in this scenario is that prior to triggering programmatic paste, the
1529         page may try to move focus to a different element (e.g. a hidden editable area) before calling `execCommand`.
1530         This causes us to send an ElementDidFocus message to the UI process, followed by RequestDOMPasteAccess.
1531
1532         However, upon receiving ElementDidFocus, we reload input views and (in the process) UIKit requests the
1533         autocorrection context, which we implement in WebKit using a sync message to the web process due to
1534         <rdar://problem/16207002> and its blocking bug <rdar://problem/48383001>. This means we'll end up in a state
1535         where both the UI process and web process are blocked on each other waiting for a sync IPC response, and the UI
1536         process is hung for a second until the IPC message times out.
1537
1538         Ideally, we should fix this by addressing <rdar://problem/16207002>. However, this requires potentially large
1539         changes in UIKit (<rdar://problem/48383001>); for the time being, work around this deadlock by refactoring
1540         synchronous autocorrection context requests such that they can be resolved by an out-of-band IPC response
1541         (HandleAutocorrectionContext). Then prior to requesting DOM paste access, preemptively send a
1542         HandleAutocorrectionContext message to the UI process to unblock any pending synchronous autocorrection context
1543         requests.
1544
1545         * UIProcess/PageClient.h:
1546         * UIProcess/WebPageProxy.h:
1547         * UIProcess/WebPageProxy.messages.in:
1548         * UIProcess/ios/PageClientImplIOS.h:
1549         * UIProcess/ios/PageClientImplIOS.mm:
1550         (WebKit::PageClientImpl::handleAutocorrectionContext):
1551         * UIProcess/ios/WKContentViewInteraction.h:
1552
1553         Make it possible for WKContentView to remember its current pending autocorrection context completion handler.
1554         This is invoked and cleared out in `-_invokePendingAutocorrectionContextHandler:`.
1555
1556         * UIProcess/ios/WKContentViewInteraction.mm:
1557         (-[WKContentView _invokePendingAutocorrectionContextHandler:]):
1558         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
1559         (-[WKContentView _handleAutocorrectionContext:]):
1560
1561         Handle an autocorrection context response. This is invoked when the web process either handles an autocorrection
1562         context message, or when it preemptively sends an autocorrection context before requesting DOM paste access.
1563
1564         (+[WKAutocorrectionContext emptyAutocorrectionContext]):
1565
1566         Add a helper to create an empty autocorrection context.
1567
1568         * UIProcess/ios/WebPageProxyIOS.mm:
1569         (WebKit::WebPageProxy::requestAutocorrectionContext):
1570         (WebKit::WebPageProxy::handleAutocorrectionContext):
1571         (WebKit::WebPageProxy::autocorrectionContextSync): Deleted.
1572
1573         Removed this sync version, since we now only have requestAutocorrectionContext.
1574
1575         * WebProcess/WebPage/WebPage.cpp:
1576         (WebKit::WebPage::requestDOMPasteAccess):
1577
1578         Send WebPageProxy::HandleAutocorrectionContext, and add a FIXME referencing <rdar://problem/16207002>.
1579
1580         * WebProcess/WebPage/WebPage.h:
1581         * WebProcess/WebPage/WebPage.messages.in:
1582
1583         Split AutocorrectionContextSync into RequestAutocorrectionContext and HandleAutocorrectionContext; additionally,
1584         remove the existing RequestAutocorrectionContext message.
1585
1586         * WebProcess/WebPage/ios/WebPageIOS.mm:
1587         (WebKit::WebPage::requestAutocorrectionContext):
1588         (WebKit::WebPage::autocorrectionContextSync): Deleted.
1589
1590 2019-03-06  Rob Buis  <rbuis@igalia.com>
1591
1592         Consider supporting the `referrerpolicy` attribute.
1593         https://bugs.webkit.org/show_bug.cgi?id=179053
1594
1595         Reviewed by Darin Adler.
1596
1597         Add a runtime flag for referrerpolicy attribute.
1598
1599         * Shared/WebPreferences.yaml:
1600         * UIProcess/API/C/WKPreferences.cpp:
1601         (WKPreferencesSetReferrerPolicyAttributeEnabled):
1602         (WKPreferencesGetReferrerPolicyAttributeEnabled):
1603         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1604         * WebProcess/Network/WebLoaderStrategy.cpp:
1605         (WebKit::WebLoaderStrategy::loadResource): do not hardcode choosing
1606         the document referrer policy.
1607
1608 2019-03-06  Philippe Normand  <pnormand@igalia.com>
1609
1610         Unreviewed, WPE build fix after r242503
1611
1612         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
1613         ServiceWorker messages moved from network process to another
1614         header, so it needs to be included.
1615
1616 2019-03-05  David Quesada  <david_quesada@apple.com>
1617
1618         [WK2] It should be possible to follow links with 'download' attributes
1619         https://bugs.webkit.org/show_bug.cgi?id=195145
1620         rdar://problem/48462642
1621
1622         Reviewed by Alex Christensen.
1623
1624         When a link with a 'download' attribute is clicked and the navigation client
1625         says to allow the navigation (i.e. provides PolicyAction::Use),
1626         WebPageProxy::receivedNavigationPolicyDecision() should stop overriding this
1627         decision and downloading the link instead. Instead, web view should honor the
1628         policy chosen by the navigation delegate. This supports clients that want to
1629         offer the user the ability to view, rather than download, the contents of
1630         such links, which is permitted per the HTML spec.
1631
1632         This change is only made on Cocoa platforms for now since no other ports
1633         expose an API on their navigation action to express whether the page intends
1634         to download the linked resource.
1635
1636         * UIProcess/API/APINavigation.h:
1637         (API::Navigation::shouldPerformDownload const):
1638             Rename this to be in line with APINavigationAction's shouldPerformDownload()
1639             for consistency. 'Force' seems like too strong of a word for this property
1640             considering that 'forcing' the download isn't really an attribute inherent
1641             to the navigation, but a behavior implemented by the web page proxy.
1642         (API::Navigation::shouldForceDownload const): Deleted.
1643         * UIProcess/Cocoa/VersionChecks.h:
1644         * UIProcess/WebPageProxy.cpp:
1645         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1646
1647 2019-03-05  Takashi Komori  <Takashi.Komori@sony.com>
1648
1649         [Curl] Implement Cookie Accept Policy.
1650         https://bugs.webkit.org/show_bug.cgi?id=191645
1651
1652         Reviewed by Fujii Hironori.
1653
1654         * NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp:
1655         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
1656         (WebKit::WebCookieManager::platformGetHTTPCookieAcceptPolicy):
1657         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
1658         (WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):
1659         (WebKit::NetworkDataTaskCurl::handleCookieHeaders):
1660         * NetworkProcess/curl/NetworkDataTaskCurl.h:
1661
1662 2019-03-05  Youenn Fablet  <youenn@apple.com>
1663
1664         Introduce ServiceWorkerFetchTask
1665         https://bugs.webkit.org/show_bug.cgi?id=195130
1666
1667         Reviewed by Chris Dumez.
1668
1669         ServiceWorkerFetchTask is added to represent NetworkProcess side of an ongoing fetch intercepted by service worker.
1670         This patch should not change existing behavior.
1671
1672         * CMakeLists.txt:
1673         * DerivedSources-input.xcfilelist:
1674         * DerivedSources-output.xcfilelist:
1675         * DerivedSources.make:
1676         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1677         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
1678         * NetworkProcess/NetworkProcess.cpp:
1679         (WebKit::NetworkProcess::didFailFetch): Deleted.
1680         (WebKit::NetworkProcess::didNotHandleFetch): Deleted.
1681         (WebKit::NetworkProcess::didReceiveFetchRedirectResponse): Deleted.
1682         (WebKit::NetworkProcess::didReceiveFetchResponse): Deleted.
1683         (WebKit::NetworkProcess::didReceiveFetchData): Deleted.
1684         (WebKit::NetworkProcess::didReceiveFetchFormData): Deleted.
1685         (WebKit::NetworkProcess::didFinishFetch): Deleted.
1686         * NetworkProcess/NetworkProcess.h:
1687         * NetworkProcess/NetworkProcess.messages.in:
1688         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
1689         (WebKit::WebSWServerConnection::cancelFetch):
1690         (WebKit::WebSWServerConnection::continueDidReceiveFetchResponse):
1691         (WebKit::WebSWServerConnection::startFetch):
1692         (WebKit::WebSWServerConnection::didReceiveFetchRedirectResponse): Deleted.
1693         (WebKit::WebSWServerConnection::didReceiveFetchResponse): Deleted.
1694         (WebKit::WebSWServerConnection::didReceiveFetchData): Deleted.
1695         (WebKit::WebSWServerConnection::didReceiveFetchFormData): Deleted.
1696         (WebKit::WebSWServerConnection::didFinishFetch): Deleted.
1697         (WebKit::WebSWServerConnection::didFailFetch): Deleted.
1698         (WebKit::WebSWServerConnection::didNotHandleFetch): Deleted.
1699         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
1700         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1701         (WebKit::WebSWServerToContextConnection::connectionClosed):
1702         (WebKit::WebSWServerToContextConnection::startFetch):
1703         (WebKit::WebSWServerToContextConnection::cancelFetch):
1704         (WebKit::WebSWServerToContextConnection::continueDidReceiveFetchResponse):
1705         (WebKit::WebSWServerToContextConnection::didReceiveFetchTaskMessage):
1706         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
1707         * SourcesCocoa.txt:
1708         * WebKit.xcodeproj/project.pbxproj:
1709         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1710         (WebKit::WebSWContextManagerConnection::startFetch):
1711         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
1712         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveRedirection):
1713         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveResponse):
1714         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
1715         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish):
1716         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveBlobChunk):
1717         (WebKit::WebServiceWorkerFetchTaskClient::didFail):
1718         (WebKit::WebServiceWorkerFetchTaskClient::didFinish):
1719         (WebKit::WebServiceWorkerFetchTaskClient::didNotHandle):
1720         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp: Added.
1721         (WebKit::ServiceWorkerFetchTask::didReceiveRedirectResponse):
1722         (WebKit::ServiceWorkerFetchTask::didReceiveResponse):
1723         (WebKit::ServiceWorkerFetchTask::didReceiveData):
1724         (WebKit::ServiceWorkerFetchTask::didReceiveFormData):
1725         (WebKit::ServiceWorkerFetchTask::didFinish):
1726         (WebKit::ServiceWorkerFetchTask::didFail):
1727         (WebKit::ServiceWorkerFetchTask::didNotHandle):
1728         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h: Added.
1729         (WebKit::ServiceWorkerFetchTask::create):
1730         (WebKit::ServiceWorkerFetchTask::Identifier::hash const):
1731         (WebKit::ServiceWorkerFetchTask::identifier const):
1732         (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask):
1733         (WebKit::operator==):
1734         (WTF::ServiceWorkerFetchTaskIdentifierHash::hash):
1735         (WTF::ServiceWorkerFetchTaskIdentifierHash::equal):
1736         (WTF::HashTraits<WebKit::ServiceWorkerFetchTask::Identifier>::emptyValue):
1737         (WTF::HashTraits<WebKit::ServiceWorkerFetchTask::Identifier>::constructDeletedValue):
1738         (WTF::HashTraits<WebKit::ServiceWorkerFetchTask::Identifier>::isDeletedValue):
1739         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.messages.in: Added.
1740
1741 2019-03-05  Youenn Fablet  <youenn@apple.com>
1742
1743         Rename requestCacheStorageSpace to requestStorageSpace
1744         https://bugs.webkit.org/show_bug.cgi?id=195282
1745
1746         Reviewed by Chris Dumez.
1747
1748         Make the name more abstract as it might be used in the future for other storage
1749         like IDB or service worker registrations.
1750
1751         * NetworkProcess/NetworkProcess.cpp:
1752         (WebKit::NetworkProcess::requestStorageSpace):
1753         (WebKit::NetworkProcess::requestCacheStorageSpace): Deleted.
1754         * NetworkProcess/NetworkProcess.h:
1755         * NetworkProcess/cache/CacheStorageEngine.cpp:
1756         (WebKit::CacheStorage::Engine::requestSpace):
1757         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1758         (WebsiteDataStoreClient::WebsiteDataStoreClient):
1759         * UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h:
1760         * UIProcess/Network/NetworkProcessProxy.cpp:
1761         (WebKit::NetworkProcessProxy::requestStorageSpace):
1762         (WebKit::NetworkProcessProxy::requestCacheStorageSpace): Deleted.
1763         * UIProcess/Network/NetworkProcessProxy.h:
1764         * UIProcess/Network/NetworkProcessProxy.messages.in:
1765         * UIProcess/WebsiteData/WebsiteDataStoreClient.h:
1766         (WebKit::WebsiteDataStoreClient::requestStorageSpace):
1767         (WebKit::WebsiteDataStoreClient::requestCacheStorageSpace): Deleted.
1768
1769 2019-03-05  Chris Dumez  <cdumez@apple.com>
1770
1771         Drop cached WebProcesses for a given session when this session is destroyed
1772         https://bugs.webkit.org/show_bug.cgi?id=195212
1773         <rdar://problem/48301483>
1774
1775         Reviewed by Geoffrey Garen.
1776
1777         Drop cached WebProcesses for a give session when this session is destroyed. This way, when you close
1778         your private browsing window, all the processes it used get cleared and it cannot leave any state
1779         behind.
1780
1781         * UIProcess/WebProcessCache.cpp:
1782         (WebKit::WebProcessCache::canCacheProcess const):
1783         (WebKit::WebProcessCache::addProcessIfPossible):
1784         (WebKit::WebProcessCache::addProcess):
1785         (WebKit::WebProcessCache::clearAllProcessesForSession):
1786         * UIProcess/WebProcessCache.h:
1787         (WebKit::WebProcessCache::capacity const):
1788         * UIProcess/WebProcessPool.cpp:
1789         (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
1790         (WebKit::WebProcessPool::hasPagesUsingWebsiteDataStore const):
1791         * UIProcess/WebProcessPool.h:
1792
1793 2019-03-05  Brady Eidson  <beidson@apple.com>
1794
1795         Correctly handle sandbox extensions when the same WKWebView loads multiple file:// URLs.
1796         <rdar://problem/47820581> and https://bugs.webkit.org/show_bug.cgi?id=195291
1797
1798         Reviewed by Tim Horton.
1799
1800         * WebProcess/WebPage/WebPage.cpp:
1801         (WebKit::WebPage::SandboxExtensionTracker::shouldReuseCommittedSandboxExtension): If there is a pendingProvisionalSandboxExtension
1802           then its existence should override our willingness to reuse the existing committed extension.
1803         (WebKit::shouldReuseCommittedSandboxExtension): Deleted.
1804         * WebProcess/WebPage/WebPage.h:
1805
1806 2019-03-05  Ryan Haddad  <ryanhaddad@apple.com>
1807
1808         Unreviewed, rolling out r242403.
1809
1810         Caused layout test crashes on iOS simulator.
1811
1812         Reverted changeset:
1813
1814         "[ContentChangeObserver] Introduce fixed duration content
1815         observation"
1816         https://bugs.webkit.org/show_bug.cgi?id=195295
1817         https://trac.webkit.org/changeset/242403
1818
1819 2019-03-05  Loïc Yhuel  <loic.yhuel@softathome.com>
1820
1821         [WPE] Do not create a PlatformDisplay in the Service Worker process
1822         https://bugs.webkit.org/show_bug.cgi?id=194830
1823
1824         Reviewed by Žan Doberšek.
1825
1826         It avoids opening the Wayland socket in this WPEWebProcess, which might cause issues
1827         depending on the platform, and allocates unneeded resources.
1828
1829         * Shared/WebProcessCreationParameters.cpp:
1830         (WebKit::WebProcessCreationParameters::encode const):
1831         (WebKit::WebProcessCreationParameters::decode):
1832         * Shared/WebProcessCreationParameters.h: Add new isServiceWorkerProcess parameter.
1833         * UIProcess/WebProcessPool.cpp:
1834         (WebKit::WebProcessPool::initializeNewWebProcess): Set isServiceWorkerProcess parameter.
1835         * UIProcess/glib/WebProcessPoolGLib.cpp:
1836         (WebKit::WebProcessPool::platformInitializeWebProcess): No implementationLibraryName and hostClientFileDescriptor for Service Worker.
1837         * WebProcess/glib/WebProcessGLib.cpp:
1838         (WebKit::WebProcess::platformInitializeWebProcess): No wpe_loader_init nor PlatformDisplayLibWPE for Service Worker.
1839
1840 2019-03-04  Brady Eidson  <beidson@apple.com>
1841
1842         Unreviewed, rolling out r242376.
1843
1844         Broke some tests
1845
1846         Reverted changeset:
1847
1848         "Correctly handle sandbox extensions when the same WKWebView
1849         loads multiple file:// URLs."
1850         https://bugs.webkit.org/show_bug.cgi?id=195291
1851         https://trac.webkit.org/changeset/242376
1852
1853 2019-03-04  Fujii Hironori  <Hironori.Fujii@sony.com>
1854
1855         Use a SQLite database to hold the ResourceLoadStatistics data
1856         https://bugs.webkit.org/show_bug.cgi?id=194867
1857         <rdar://problem/24240854>
1858
1859         Unreviewed build fix for WinCairo.
1860
1861         ResourceLoadStatisticsDebug and RELEASE_LOG_INFO_IF are not
1862         defined because WinCairo port defines RELEASE_LOG_DISABLED.
1863
1864         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1865         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess): Enclosed RELEASE_LOG_INFO_IF with #if !RELEASE_LOG_DISABLED.
1866         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener): Ditto.
1867         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking): Ditto.
1868
1869 2019-03-04  Brent Fulgham  <bfulgham@apple.com>
1870
1871         Use a SQLite database to hold the ResourceLoadStatistics data
1872         https://bugs.webkit.org/show_bug.cgi?id=194867
1873         <rdar://problem/24240854>
1874
1875         Reviewed by Chris Dumez.
1876
1877         The ResourceLoadStatistics database plist is inefficient. It requires more memory use
1878         than it needs, and forces lots of looping and string comparisons to find information.
1879
1880         This problem has already been solved in the form of relational databases. We use them
1881         elsewhere in WebKit, and should do so for this storage as well.
1882
1883         This patch creates an optional SQLite database to handle ITP operations.
1884
1885         1. It adds a new internal experimental feature flag to activate it. It requires the user
1886            exit and restart the process to take effect.
1887         2. It populates itself from the existing plist file (if it exists).
1888         3. It stops using the plist in favor of the database.
1889         4. It does queries and other operations using the database instead of the old hash table
1890            implementation.
1891
1892         This patch refactors the exisiting ResourceLoadStatisticsMemoryStore class into a base
1893         ResourceLoadStatisticsStore class, which ResourceLoadStatisticsMemoryStore is based on.
1894         It adds a new ResourceLoadStatisticsDatabaseStore that is implemented in terms of SQL
1895         operations.
1896
1897         These code changes should not have any impact on existing operations, and when enabled
1898         should produce the same test results.
1899
1900         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: Added.
1901         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
1902         (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema):
1903         (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements):
1904         (WebKit::ResourceLoadStatisticsDatabaseStore::insertObservedDomain):
1905         (WebKit::ResourceLoadStatisticsDatabaseStore::relationshipExists const):
1906         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationship):
1907         (WebKit::ResourceLoadStatisticsDatabaseStore::confirmDomainDoesNotExist const):
1908         (WebKit::ResourceLoadStatisticsDatabaseStore::domainIDFromString const):
1909         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships):
1910         (WebKit::ResourceLoadStatisticsDatabaseStore::databaseIsEmpty const):
1911         (WebKit::ResourceLoadStatisticsDatabaseStore::populateFromMemoryStore):
1912         (WebKit::ResourceLoadStatisticsDatabaseStore::calculateAndSubmitTelemetry const):
1913         (WebKit::ResourceLoadStatisticsDatabaseStore::incrementRecordsDeletedCountForDomains):
1914         (WebKit::ResourceLoadStatisticsDatabaseStore::recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain):
1915         (WebKit::buildList):
1916         (WebKit::ResourceLoadStatisticsDatabaseStore::markAsPrevalentIfHasRedirectedToPrevalent):
1917         (WebKit::listToString):
1918         (WebKit::ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources):
1919         (WebKit::ResourceLoadStatisticsDatabaseStore::reclassifyResources):
1920         (WebKit::ResourceLoadStatisticsDatabaseStore::classifyPrevalentResources):
1921         (WebKit::ResourceLoadStatisticsDatabaseStore::syncStorageIfNeeded):
1922         (WebKit::ResourceLoadStatisticsDatabaseStore::syncStorageImmediately):
1923         (WebKit::ResourceLoadStatisticsDatabaseStore::hasStorageAccess):
1924         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
1925         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):
1926         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
1927         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
1928         (WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains):
1929         (WebKit::ResourceLoadStatisticsDatabaseStore::ensurePrevalentResourcesForDebugMode):
1930         (WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation):
1931         (WebKit::ResourceLoadStatisticsDatabaseStore::logSubresourceLoading):
1932         (WebKit::ResourceLoadStatisticsDatabaseStore::logSubresourceRedirect):
1933         (WebKit::ResourceLoadStatisticsDatabaseStore::setUserInteraction):
1934         (WebKit::ResourceLoadStatisticsDatabaseStore::logUserInteraction):
1935         (WebKit::ResourceLoadStatisticsDatabaseStore::clearUserInteraction):
1936         (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):
1937         (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
1938         (WebKit::ResourceLoadStatisticsDatabaseStore::setDomainsAsPrevalent):
1939         (WebKit::ResourceLoadStatisticsDatabaseStore::dumpResourceLoadStatistics const):
1940         (WebKit::ResourceLoadStatisticsDatabaseStore::predicateValueForDomain const):
1941         (WebKit::ResourceLoadStatisticsDatabaseStore::isPrevalentResource const):
1942         (WebKit::ResourceLoadStatisticsDatabaseStore::isVeryPrevalentResource const):
1943         (WebKit::ResourceLoadStatisticsDatabaseStore::isRegisteredAsSubresourceUnder const):
1944         (WebKit::ResourceLoadStatisticsDatabaseStore::isRegisteredAsSubFrameUnder const):
1945         (WebKit::ResourceLoadStatisticsDatabaseStore::isRegisteredAsRedirectingTo const):
1946         (WebKit::ResourceLoadStatisticsDatabaseStore::clearPrevalentResource):
1947         (WebKit::ResourceLoadStatisticsDatabaseStore::setGrandfathered):
1948         (WebKit::ResourceLoadStatisticsDatabaseStore::isGrandfathered const):
1949         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubframeUnderTopFrameOrigin):
1950         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUnderTopFrameOrigin):
1951         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectTo):
1952         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectFrom):
1953         (WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectTo):
1954         (WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectFrom):
1955         (WebKit::ResourceLoadStatisticsDatabaseStore::ensureResourceStatisticsForPrimaryDomain):
1956         (WebKit::ResourceLoadStatisticsDatabaseStore::clear):
1957         (WebKit::ResourceLoadStatisticsDatabaseStore::cookieTreatmentForOrigin const):
1958         (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt):
1959         (WebKit::ResourceLoadStatisticsDatabaseStore::domainsToBlock const):
1960         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking):
1961         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlockingForDomains):
1962         (WebKit::ResourceLoadStatisticsDatabaseStore::clearBlockingStateForDomains):
1963         (WebKit::ResourceLoadStatisticsDatabaseStore::processStatistics const):
1964         (WebKit::ResourceLoadStatisticsDatabaseStore::prevalentDomains const):
1965         (WebKit::ResourceLoadStatisticsDatabaseStore::findExpiredUserInteractions const):
1966         (WebKit::ResourceLoadStatisticsDatabaseStore::clearExpiredUserInteractions):
1967         (WebKit::ResourceLoadStatisticsDatabaseStore::clearGrandfathering):
1968         (WebKit::ResourceLoadStatisticsDatabaseStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
1969         (WebKit::ResourceLoadStatisticsDatabaseStore::pruneStatisticsIfNeeded):
1970         (WebKit::ResourceLoadStatisticsDatabaseStore::updateLastSeen):
1971         (WebKit::ResourceLoadStatisticsDatabaseStore::setLastSeen):
1972         (WebKit::ResourceLoadStatisticsDatabaseStore::setVeryPrevalentResource):
1973         (WebKit::ResourceLoadStatisticsDatabaseStore::removeAllStorageAccess):
1974         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: Added.
1975         (WebKit::ResourceLoadStatisticsDatabaseStore::isEmpty const):
1976         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1977         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
1978         (WebKit::ResourceLoadStatisticsMemoryStore::incrementRecordsDeletedCountForDomains):
1979         (WebKit::ResourceLoadStatisticsMemoryStore::classifyPrevalentResources):
1980         (WebKit::ResourceLoadStatisticsMemoryStore::syncStorageIfNeeded):
1981         (WebKit::ResourceLoadStatisticsMemoryStore::syncStorageImmediately):
1982         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherDataForDomains):
1983         (WebKit::domainsToString): Deleted.
1984         (WebKit::OperatingDate::fromWallTime): Deleted.
1985         (WebKit::OperatingDate::today): Deleted.
1986         (WebKit::OperatingDate::secondsSinceEpoch const): Deleted.
1987         (WebKit::OperatingDate::operator== const): Deleted.
1988         (WebKit::OperatingDate::operator< const): Deleted.
1989         (WebKit::OperatingDate::operator<= const): Deleted.
1990         (WebKit::OperatingDate::OperatingDate): Deleted.
1991         (WebKit::mergeOperatingDates): Deleted.
1992         (WebKit::computeImportance): Deleted.
1993         (WebKit::ResourceLoadStatisticsMemoryStore::~ResourceLoadStatisticsMemoryStore): Deleted.
1994         (WebKit::ResourceLoadStatisticsMemoryStore::setNotifyPagesWhenDataRecordsWereScanned): Deleted.
1995         (WebKit::ResourceLoadStatisticsMemoryStore::setShouldClassifyResourcesBeforeDataRecordsRemoval): Deleted.
1996         (WebKit::ResourceLoadStatisticsMemoryStore::setShouldSubmitTelemetry): Deleted.
1997         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords): Deleted.
1998         (WebKit::ResourceLoadStatisticsMemoryStore::processStatisticsAndDataRecords): Deleted.
1999         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherExistingWebsiteData): Deleted.
2000         (WebKit::ResourceLoadStatisticsMemoryStore::setResourceLoadStatisticsDebugMode): Deleted.
2001         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode): Deleted.
2002         (WebKit::ResourceLoadStatisticsMemoryStore::scheduleStatisticsProcessingRequestIfNecessary): Deleted.
2003         (WebKit::ResourceLoadStatisticsMemoryStore::cancelPendingStatisticsProcessingRequest): Deleted.
2004         (WebKit::ResourceLoadStatisticsMemoryStore::setTimeToLiveUserInteraction): Deleted.
2005         (WebKit::ResourceLoadStatisticsMemoryStore::setMinimumTimeBetweenDataRecordsRemoval): Deleted.
2006         (WebKit::ResourceLoadStatisticsMemoryStore::setGrandfatheringTime): Deleted.
2007         (WebKit::ResourceLoadStatisticsMemoryStore::setCacheMaxAgeCap): Deleted.
2008         (WebKit::ResourceLoadStatisticsMemoryStore::updateCacheMaxAgeCap): Deleted.
2009         (WebKit::ResourceLoadStatisticsMemoryStore::setAgeCapForClientSideCookies): Deleted.
2010         (WebKit::ResourceLoadStatisticsMemoryStore::updateClientSideCookiesAgeCap): Deleted.
2011         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveDataRecords const): Deleted.
2012         (WebKit::ResourceLoadStatisticsMemoryStore::setDataRecordsBeingRemoved): Deleted.
2013         (WebKit::debugLogDomainsInBatches): Deleted.
2014         (WebKit::ResourceLoadStatisticsMemoryStore::includeTodayAsOperatingDateIfNecessary): Deleted.
2015         (WebKit::ResourceLoadStatisticsMemoryStore::hasStatisticsExpired const): Deleted.
2016         (WebKit::ResourceLoadStatisticsMemoryStore::setMaxStatisticsEntries): Deleted.
2017         (WebKit::ResourceLoadStatisticsMemoryStore::setPruneEntriesDownTo): Deleted.
2018         (WebKit::ResourceLoadStatisticsMemoryStore::resetParametersToDefaultValues): Deleted.
2019         (WebKit::ResourceLoadStatisticsMemoryStore::logTestingEvent): Deleted.
2020         (WebKit::ResourceLoadStatisticsMemoryStore::didCreateNetworkProcess): Deleted.
2021         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
2022         (WebKit::ResourceLoadStatisticsMemoryStore::data const):
2023         (WebKit::ResourceLoadStatisticsMemoryStore::isDebugModeEnabled const): Deleted.
2024         (WebKit::ResourceLoadStatisticsMemoryStore::store const): Deleted.
2025         (WebKit::ResourceLoadStatisticsMemoryStore::setStorageAccessPromptsEnabled): Deleted.
2026         (WebKit::ResourceLoadStatisticsMemoryStore::setDebugLogggingEnabled): Deleted.
2027         (): Deleted.
2028         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: Added.
2029         (WebKit::domainsToString):
2030         (WebKit::OperatingDate::fromWallTime):
2031         (WebKit::OperatingDate::today):
2032         (WebKit::OperatingDate::secondsSinceEpoch const):
2033         (WebKit::OperatingDate::operator== const):
2034         (WebKit::OperatingDate::operator< const):
2035         (WebKit::OperatingDate::operator<= const):
2036         (WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore):
2037         (WebKit::ResourceLoadStatisticsStore::~ResourceLoadStatisticsStore):
2038         (WebKit::ResourceLoadStatisticsStore::calculateAndSubmitTelemetry const):
2039         (WebKit::ResourceLoadStatisticsStore::computeImportance):
2040         (WebKit::ResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
2041         (WebKit::ResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
2042         (WebKit::ResourceLoadStatisticsStore::setShouldSubmitTelemetry):
2043         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
2044         (WebKit::ResourceLoadStatisticsStore::processStatisticsAndDataRecords):
2045         (WebKit::ResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
2046         (WebKit::ResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
2047         (WebKit::ResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
2048         (WebKit::ResourceLoadStatisticsStore::scheduleStatisticsProcessingRequestIfNecessary):
2049         (WebKit::ResourceLoadStatisticsStore::cancelPendingStatisticsProcessingRequest):
2050         (WebKit::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
2051         (WebKit::ResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
2052         (WebKit::ResourceLoadStatisticsStore::setGrandfatheringTime):
2053         (WebKit::ResourceLoadStatisticsStore::setCacheMaxAgeCap):
2054         (WebKit::ResourceLoadStatisticsStore::updateCacheMaxAgeCap):
2055         (WebKit::ResourceLoadStatisticsStore::setAgeCapForClientSideCookies):
2056         (WebKit::ResourceLoadStatisticsStore::updateClientSideCookiesAgeCap):
2057         (WebKit::ResourceLoadStatisticsStore::shouldRemoveDataRecords const):
2058         (WebKit::ResourceLoadStatisticsStore::setDataRecordsBeingRemoved):
2059         (WebKit::ResourceLoadStatisticsStore::updateCookieBlockingForDomains):
2060         (WebKit::ResourceLoadStatisticsStore::clearBlockingStateForDomains):
2061         (WebKit::ResourceLoadStatisticsStore::processStatistics const):
2062         (WebKit::ResourceLoadStatisticsStore::statisticsEpirationTime const):
2063         (WebKit::ResourceLoadStatisticsStore::mergeOperatingDates):
2064         (WebKit::ResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary):
2065         (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired const):
2066         (WebKit::ResourceLoadStatisticsStore::setMaxStatisticsEntries):
2067         (WebKit::ResourceLoadStatisticsStore::setPruneEntriesDownTo):
2068         (WebKit::ResourceLoadStatisticsStore::resetParametersToDefaultValues):
2069         (WebKit::ResourceLoadStatisticsStore::logTestingEvent):
2070         (WebKit::ResourceLoadStatisticsStore::removeAllStorageAccess):
2071         (WebKit::ResourceLoadStatisticsStore::didCreateNetworkProcess):
2072         (WebKit::ResourceLoadStatisticsStore::debugLogDomainsInBatches):
2073         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: Copied from Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h.
2074         (WebKit::OperatingDate::OperatingDate):
2075         (WebKit::ResourceLoadStatisticsStore::isEmpty const):
2076         (WebKit::ResourceLoadStatisticsStore::data const):
2077         (WebKit::ResourceLoadStatisticsStore::isDebugModeEnabled const):
2078         (WebKit::ResourceLoadStatisticsStore::store const):
2079         (WebKit::ResourceLoadStatisticsStore::setStorageAccessPromptsEnabled):
2080         (WebKit::ResourceLoadStatisticsStore::setDebugLogggingEnabled):
2081         * NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm: Renamed from Source/WebKit/UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm.
2082         (WebKit::ResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
2083         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2084         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
2085         (WebKit::WebResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
2086         (WebKit::WebResourceLoadStatisticsStore::setShouldSubmitTelemetry):
2087         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
2088         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
2089         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
2090         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
2091         (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
2092         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
2093         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
2094         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
2095         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
2096         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
2097         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
2098         (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading):
2099         (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading):
2100         (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect):
2101         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
2102         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
2103         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
2104         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
2105         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
2106         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
2107         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
2108         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
2109         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder):
2110         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
2111         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
2112         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
2113         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
2114         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
2115         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
2116         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
2117         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
2118         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
2119         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
2120         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
2121         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdate):
2122         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains):
2123         (WebKit::WebResourceLoadStatisticsStore::scheduleClearBlockingStateForDomains):
2124         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
2125         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
2126         (WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
2127         (WebKit::WebResourceLoadStatisticsStore::setGrandfatheringTime):
2128         (WebKit::WebResourceLoadStatisticsStore::setMaxStatisticsEntries):
2129         (WebKit::WebResourceLoadStatisticsStore::setPruneEntriesDownTo):
2130         (WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues):
2131         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2132         * NetworkProcess/NetworkProcess.cpp:
2133         (WebKit::NetworkProcess::initializeNetworkProcess):
2134         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2135         (WebKit::NetworkProcessCreationParameters::encode const):
2136         (WebKit::NetworkProcessCreationParameters::decode):
2137         * NetworkProcess/NetworkProcessCreationParameters.h:
2138         * Platform/classifier/ResourceLoadStatisticsClassifier.cpp:
2139         (WebKit::ResourceLoadStatisticsClassifier::calculateResourcePrevalence):
2140         * Platform/classifier/ResourceLoadStatisticsClassifier.h:
2141         * Shared/WebPreferences.yaml:
2142         * Sources.txt:
2143         * SourcesCocoa.txt:
2144         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2145         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2146         * UIProcess/WebProcessPool.cpp:
2147         * WebKit.xcodeproj/project.pbxproj:
2148
2149 2019-03-04  Zalan Bujtas  <zalan@apple.com>
2150
2151         [ContentChangeObserver] Introduce fixed duration content observation
2152         https://bugs.webkit.org/show_bug.cgi?id=195295
2153         <rdar://problem/48579913>
2154
2155         Reviewed by Simon Fraser.
2156
2157         * WebProcess/WebPage/ios/WebPageIOS.mm:
2158         (WebKit::WebPage::handleSyntheticClick):
2159
2160 2019-03-04  Truitt Savell  <tsavell@apple.com>
2161
2162         Unreviewed, rolling out r242396.
2163
2164         Found issue to be unrelated. reverting my rollout.
2165
2166         Reverted changeset:
2167
2168         "Unreviewed, rolling out r242222."
2169         https://bugs.webkit.org/show_bug.cgi?id=193683
2170         https://trac.webkit.org/changeset/242396
2171
2172 2019-03-04  Jiewen Tan  <jiewen_tan@apple.com>
2173
2174         Unreviewed, a followup after r242336
2175
2176         * UIProcess/WebPageProxy.cpp:
2177         (WebKit::WebPageProxy::webViewDidMoveToWindow):
2178         Copy the list of observers before iterating it to avoid observers modifying the list.
2179
2180 2019-03-04  Truitt Savell  <tsavell@apple.com>
2181
2182         Unreviewed, rolling out r242222.
2183
2184         Broke internal debug testing
2185
2186         Reverted changeset:
2187
2188         "[iOS] Move calls to [UIKeyboard isInHardwareKeyboardMode] to
2189         the UI process."
2190         https://bugs.webkit.org/show_bug.cgi?id=193683
2191         https://trac.webkit.org/changeset/242222
2192
2193 2019-03-04  Brent Fulgham  <bfulgham@apple.com>
2194
2195         Unreviewed build fix after r242378
2196
2197         * UIProcess/ios/EditableImageController.mm:
2198         (WebKit::EditableImageController::associateWithAttachment):
2199
2200 2019-03-04  Brent Fulgham  <bfulgham@apple.com>
2201
2202         Check contextIDs when handling WebContent messages
2203         https://bugs.webkit.org/show_bug.cgi?id=195289
2204         <rdar://problem/48475870>
2205
2206         Reviewed by Alex Christensen.
2207
2208         The WebContent process is untrusted because it handles arbitrary markup and javascript from untrusted sources.
2209         We should handle its messages with suspicion, and make sure the arguments are valid and usable before honoring them.
2210
2211         This patch hardens the message passing layer by performing MESSAGE_CHECK in places that had been overlooked.
2212
2213         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
2214         (WebKit::PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID):
2215         (WebKit::PlaybackSessionManagerProxy::currentTimeChanged):
2216         (WebKit::PlaybackSessionManagerProxy::bufferedTimeChanged):
2217         (WebKit::PlaybackSessionManagerProxy::seekableRangesVectorChanged):
2218         (WebKit::PlaybackSessionManagerProxy::canPlayFastReverseChanged):
2219         (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionOptionsChanged):
2220         (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionOptionsChanged):
2221         (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionIndexChanged):
2222         (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionIndexChanged):
2223         (WebKit::PlaybackSessionManagerProxy::externalPlaybackPropertiesChanged):
2224         (WebKit::PlaybackSessionManagerProxy::wirelessVideoPlaybackDisabledChanged):
2225         (WebKit::PlaybackSessionManagerProxy::mutedChanged):
2226         (WebKit::PlaybackSessionManagerProxy::volumeChanged):
2227         (WebKit::PlaybackSessionManagerProxy::durationChanged):
2228         (WebKit::PlaybackSessionManagerProxy::playbackStartedTimeChanged):
2229         (WebKit::PlaybackSessionManagerProxy::rateChanged):
2230         (WebKit::PlaybackSessionManagerProxy::pictureInPictureSupportedChanged):
2231         (WebKit::PlaybackSessionManagerProxy::pictureInPictureActiveChanged):
2232         (WebKit::PlaybackSessionManagerProxy::handleControlledElementIDResponse const):
2233         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2234         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
2235         (WebKit::UserMediaCaptureManagerProxy::startProducingData):
2236         (WebKit::UserMediaCaptureManagerProxy::stopProducingData):
2237         (WebKit::UserMediaCaptureManagerProxy::end):
2238         (WebKit::UserMediaCaptureManagerProxy::capabilities):
2239         (WebKit::UserMediaCaptureManagerProxy::setMuted):
2240         (WebKit::UserMediaCaptureManagerProxy::applyConstraints):
2241         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2242         (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID):
2243         (WebKit::VideoFullscreenManagerProxy::setHasVideo):
2244         (WebKit::VideoFullscreenManagerProxy::setVideoDimensions):
2245         (WebKit::VideoFullscreenManagerProxy::enterFullscreen):
2246         (WebKit::VideoFullscreenManagerProxy::exitFullscreen):
2247         (WebKit::VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode):
2248         (WebKit::VideoFullscreenManagerProxy::setInlineRect):
2249         (WebKit::VideoFullscreenManagerProxy::setHasVideoContentLayer):
2250         (WebKit::VideoFullscreenManagerProxy::cleanupFullscreen):
2251         (WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline):
2252         (WebKit::VideoFullscreenManagerProxy::preparedToExitFullscreen):
2253         * UIProcess/ios/EditableImageController.mm:
2254         (WebKit::EditableImageController::didCreateEditableImage):
2255         (WebKit::EditableImageController::didDestroyEditableImage):
2256         (WebKit::EditableImageController::associateWithAttachment):
2257
2258 2019-03-04  Alex Christensen  <achristensen@webkit.org>
2259
2260         Fix crashes when NetworkResourceLoader/NetworkLoadChecker are destroyed during HTTPS upgrade check
2261         https://bugs.webkit.org/show_bug.cgi?id=195238
2262         <rdar://problem/47598656>
2263
2264         Reviewed by Chris Dumez.
2265
2266         * NetworkProcess/NetworkLoadChecker.cpp:
2267         (WebKit::NetworkLoadChecker::checkRequest):
2268
2269 2019-03-04  Brady Eidson  <beidson@apple.com>
2270
2271         Correctly handle sandbox extensions when the same WKWebView loads multiple file:// URLs.
2272         <rdar://problem/47820581> and https://bugs.webkit.org/show_bug.cgi?id=195291
2273
2274         Reviewed by Andy Estes.
2275
2276         * WebProcess/WebPage/WebPage.cpp:
2277         (WebKit::shouldReuseCommittedSandboxExtension): Only retain the previous sandbox extension if the file URL
2278           we're currently loading is functionally equivalent to the previous one.
2279
2280 2019-03-04  Chris Dumez  <cdumez@apple.com>
2281
2282         Drop legacy userAgentForURL injected bundle SPI
2283         https://bugs.webkit.org/show_bug.cgi?id=195222
2284         <rdar://problem/46734147>
2285
2286         Reviewed by Darin Adler.
2287
2288         Drop legacy userAgentForURL injected bundle SPI. There are no longer any clients, and using
2289         WebsitePolicies.customUserAgent is the way to go nowadays.
2290
2291         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
2292         (API::InjectedBundle::PageLoaderClient::willDestroyFrame):
2293         (API::InjectedBundle::PageLoaderClient::userAgentForURL const): Deleted.
2294         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
2295         * WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h:
2296         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2297         (setUpPageLoaderClient):
2298         (userAgentForURL): Deleted.
2299         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
2300         (WebKit::InjectedBundlePageLoaderClient::userAgentForURL const): Deleted.
2301         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
2302         * WebProcess/WebPage/WebPage.cpp:
2303         (WebKit::WebPage::userAgent const):
2304
2305 2019-03-04  Chris Dumez  <cdumez@apple.com>
2306
2307         Do not share WebProcesses between private and regular sessions
2308         https://bugs.webkit.org/show_bug.cgi?id=195189
2309         <rdar://problem/48421064>
2310
2311         Reviewed by Alex Christensen.
2312
2313         Do not share WebProcesses between private and regular sessions. There are some privacy concerns.
2314         Also, some of the WebsiteDataStore informations are passed via WebProcessCreationParameters (e.g.
2315         ApplicationCache path) and cannot be updated later.
2316
2317         There were 2 cases where this could happen and that are fixed in the patch:
2318         - A process may be prewarmed with a given website data store and then later on used for a page
2319           associated with a different data store. We now prevent this. While this is not necessary for
2320           privacy reasons, it is still useful because our code currently does not support well uses
2321           different sessions inside a single WebProcess, as mentioned above.
2322         - The client can force a WebsiteDataStore swap when responding to the decidePolicyForNavigationAction,
2323           via the WebsitePolicies. To address the issue, we now force a process swap whenever the client
2324           makes such a change.
2325
2326         As a result, WebProcessProxy::websiteDataStore() now makes sense and is always correct. It can
2327         also only contains pages whose WebPageProxy::websiteDataStore() returns the same store.
2328
2329         * UIProcess/API/C/WKContext.cpp:
2330         (WKContextWarmInitialProcess):
2331         * UIProcess/API/Cocoa/WKProcessPool.mm:
2332         (-[WKProcessPool _warmInitialProcess]):
2333         * UIProcess/ProvisionalPageProxy.cpp:
2334         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
2335         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
2336         * UIProcess/WebPageProxy.cpp:
2337         (WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
2338         (WebKit::WebPageProxy::reattachToWebProcess):
2339         (WebKit::WebPageProxy::swapToWebProcess):
2340         (WebKit::WebPageProxy::close):
2341         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
2342         (WebKit::WebPageProxy::commitProvisionalPage):
2343         (WebKit::WebPageProxy::creationParameters):
2344         * UIProcess/WebPageProxy.h:
2345         (WebKit::WebPageProxy::websiteDataStore):
2346         * UIProcess/WebProcessPool.cpp:
2347         (WebKit::WebProcessPool::ensureNetworkProcess):
2348         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
2349         (WebKit::WebProcessPool::prewarmProcess):
2350         (WebKit::WebProcessPool::createWebPage):
2351         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
2352         (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
2353         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
2354         (WebKit::WebProcessPool::processForNavigation):
2355         (WebKit::WebProcessPool::processForNavigationInternal):
2356         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
2357         * UIProcess/WebProcessPool.h:
2358         (WebKit::WebProcessPool::sendToOneProcess):
2359         * UIProcess/WebProcessProxy.cpp:
2360         (WebKit::WebProcessProxy::createWebPage):
2361         (WebKit::WebProcessProxy::addExistingWebPage):
2362         (WebKit::WebProcessProxy::removeWebPage):
2363         * UIProcess/WebProcessProxy.h:
2364
2365 2019-03-04  Chris Dumez  <cdumez@apple.com>
2366
2367         [iOS] Improve our file picker
2368         https://bugs.webkit.org/show_bug.cgi?id=195284
2369         <rdar://problem/45655856>
2370
2371         Reviewed by Tim Horton and Wenson Hsieh.
2372
2373         Improve our file picker on iOS so that:
2374         - Accepted file extensions specified in the HTML (e.g. <input type="file"> accept=".pdf">) are now
2375           properly reflected in the file picker. Previously, we only we only supported MIME types in the
2376           accept attribute that only Image / Video ones.
2377         - If accepted types are specified in the HTML and not of them are Video or Image types, then bypass
2378           the UIDocumentMenuViewController and show the file picker directly (as if the user had tapped on
2379           "Browse..." on that menu). Other menu items such as "Take Photo or Video" and "Photo Library" do
2380           not make sense if the page only accepts PDF files for example.
2381
2382         Things that we should do but are not fixed in this patch:
2383         - Stop using UIDocumentMenuViewController entirely since it was deprecated in favor of using
2384           UIDocumentPickerViewController directly.
2385         - Add multiple selection support, which is supported both on the HTML side and in the
2386           UIDocumentPickerViewController API.
2387
2388         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2389         (arrayContainsUTIThatConformsTo):
2390         (-[WKFileUploadPanel dealloc]):
2391         (-[WKFileUploadPanel presentWithParameters:resultListener:]):
2392         (UTIsForMIMETypes):
2393         (-[WKFileUploadPanel _mediaTypesForPickerSourceType:]):
2394         (-[WKFileUploadPanel _cameraButtonLabelAllowingPhoto:allowingVideo:]):
2395         (-[WKFileUploadPanel _showDocumentPickerMenu]):
2396
2397 2019-03-04  Alex Christensen  <achristensen@webkit.org>
2398
2399         REGRESSION: ( r240978-r240985 ) [ iOS Release ] Layout Test imported/w3c/web-platform-tests/xhr/send-redirect-post-upload.htm is crashing
2400         https://bugs.webkit.org/show_bug.cgi?id=194523
2401
2402         Reviewed by Ryosuke Niwa.
2403
2404         Attempt to work around a CFNetwork bug in the timing of tearing down tasks with upload streams.
2405         See rdar://problem/28233746.
2406
2407         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2408         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2409         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
2410         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2411         (-[WKNetworkSessionDelegate URLSession:task:needNewBodyStream:]):
2412
2413 2019-03-04  Carlos Garcia Campos  <cgarcia@igalia.com>
2414
2415         [CoordinatedGraphics] The compositing loop is still running even after exiting AC mode
2416         https://bugs.webkit.org/show_bug.cgi?id=195270
2417
2418         Reviewed by Don Olmstead.
2419
2420         Suspend the threaded compositor when the painting is paused or layer flush disabled, and resume it again when
2421         painting is resumed and layer flush enabled.
2422
2423         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2424         (WebKit::ThreadedCompositor::suspend): Increment the suspend counter and mark the scene as inactive if it was suspended.
2425         (WebKit::ThreadedCompositor::resume): Decrement the suspend counter and mark the scene as active if it's now resumed.
2426         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2427         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
2428         (WebKit::DrawingAreaCoordinatedGraphics::forceRepaint): Return early if layer tree state is frozen.
2429         (WebKit::DrawingAreaCoordinatedGraphics::forceRepaintAsync): Ditto.
2430         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
2431         (WebKit::LayerTreeHost::setLayerFlushSchedulingEnabled): Call ThreadedCompositor::suspend()/resume().
2432         (WebKit::LayerTreeHost::pauseRendering): Call ThreadedCompositor::suspend.
2433         (WebKit::LayerTreeHost::resumeRendering): Call ThreadedCompositor::resume().
2434
2435 2019-03-04  Simon Fraser  <simon.fraser@apple.com>
2436
2437         Share more code between overflow and frame scrolling nodes, fixing overflow scrollbar display
2438         https://bugs.webkit.org/show_bug.cgi?id=195258
2439
2440         Reviewed by Antti Koivisto.
2441
2442         This patch moves management of scrollbar layers and scrollbar painters ("NSScrollerImp") down to
2443         ScrollingStateScrollingNode to be shared between frame and overflow nodes, allowing for
2444         scrolling thread updates of overflow scrollbars. It also moves some scrolling tree-side code
2445         to ScrollingTreeScrollingNodeDelegateMac to be shared between the "tree" nodes for overflow and frames.
2446
2447         Layers for scrollbars are given to scrolling state nodes via setNodeLayers() now, and
2448         RenderLayerCompositor::updateScrollingNodeLayers() is added to provide a bottleneck to call that.
2449         At some point AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange() should be relieved
2450         of the responsibility of pushing scrollbar layers (but the scrolling state tree needs to hold
2451         references to GraphicsLayers before that becomes safe).
2452         
2453         The actual fix that allows overflow scrollbars to show is the change in
2454         AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange() that calls scrollableArea.*ScrollbarLayerDidChange()
2455         for all ScrollableAreas. This ensures that the CALayer is pushed onto the NSScrollerImp.
2456
2457         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
2458         (ArgumentCoder<ScrollingStateScrollingNode>::encode):
2459         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
2460         (ArgumentCoder<ScrollingStateScrollingNode>::decode):
2461         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
2462         * SourcesCocoa.txt:
2463         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2464         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
2465         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
2466         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
2467         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp:
2468         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::commitStateBeforeChildren):
2469         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::repositionRelatedLayers):
2470         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleMouseEvent):
2471         * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.cpp: Copied from Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp.
2472         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::create):
2473         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::ScrollingTreeOverflowScrollingNodeRemoteMac):
2474         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::~ScrollingTreeOverflowScrollingNodeRemoteMac):
2475         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::commitStateBeforeChildren):
2476         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::repositionRelatedLayers):
2477         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::handleWheelEvent):
2478         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::handleMouseEvent):
2479         * WebKit.xcodeproj/project.pbxproj:
2480
2481 2019-03-04  Andy Estes  <aestes@apple.com>
2482
2483         [Apple Pay] Move WebPaymentCoordinatorProxy from Source/WebKit/UIProcess to Source/WebKit/Shared
2484         https://bugs.webkit.org/show_bug.cgi?id=195080
2485         <rdar://problem/48421558>
2486
2487         Reviewed by Antti Koivisto.
2488
2489         * CMakeLists.txt:
2490         * DerivedSources-input.xcfilelist:
2491         * DerivedSources.make:
2492         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp: Renamed from Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp.
2493         * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Renamed from Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h.
2494         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: Renamed from Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in.
2495         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: Renamed from Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h.
2496         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: Renamed from Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm.
2497         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: Renamed from Source/WebKit/UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm.
2498         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: Renamed from Source/WebKit/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm.
2499         * Shared/mac/WebHitTestResultData.mm:
2500         * SourcesCocoa.txt:
2501         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h:
2502         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
2503         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
2504         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
2505         * WebKit.xcodeproj/project.pbxproj:
2506
2507 2019-03-04  Jer Noble  <jer.noble@apple.com>
2508
2509         [iOS] Fullscreen "stay in page" option breaks video playback
2510         https://bugs.webkit.org/show_bug.cgi?id=195277
2511         <rdar://problem/48537317>
2512
2513         Reviewed by Eric Carlson.
2514
2515         Make sure we resume media playback when the user chooses "stay in page" from the deceptive
2516         website warning dialog.
2517
2518         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
2519         (-[WKFullScreenViewController _showPhishingAlert]):
2520
2521 2019-03-04  Michael Catanzaro  <mcatanzaro@igalia.com>
2522
2523         [WPE] Enable web process sandbox
2524         https://bugs.webkit.org/show_bug.cgi?id=195169
2525
2526         Reviewed by Daniel Bates.
2527
2528         * PlatformWPE.cmake:
2529         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
2530         (WebKit::bubblewrapSpawn):
2531         * UIProcess/glib/WebProcessPoolGLib.cpp:
2532         (WebKit::WebProcessPool::platformInitialize):
2533
2534 2019-03-04  Adrian Perez de Castro  <aperez@igalia.com>
2535
2536         [GTK][WPE] Wrong license header in WebKit{,WebExtension}Autocleanups.h
2537         https://bugs.webkit.org/show_bug.cgi?id=195245
2538
2539         Reviewed by Carlos Garcia Campos.
2540
2541         Changed license headers to contain the LGPL, which is the correct one for the GTK
2542         and WPE ports. The change was agreed by the contributors to the files involved.
2543
2544         * UIProcess/API/gtk/WebKitAutocleanups.h:
2545         * UIProcess/API/wpe/WebKitAutocleanups.h:
2546         * WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionAutocleanups.h:
2547         * WebProcess/InjectedBundle/API/wpe/WebKitWebExtensionAutocleanups.h:
2548
2549 2019-03-04  Commit Queue  <commit-queue@webkit.org>
2550
2551         Unreviewed, rolling out r242045.
2552         https://bugs.webkit.org/show_bug.cgi?id=195273
2553
2554         WE not ready to enable PSON yet (Requested by KaL on #webkit).
2555
2556         Reverted changeset:
2557
2558         "[GTK] Enable PSON"
2559         https://bugs.webkit.org/show_bug.cgi?id=194979
2560         https://trac.webkit.org/changeset/242045
2561
2562 2019-03-04  Carlos Garcia Campos  <cgarcia@igalia.com>
2563
2564         [CoordinatedGraphics] Unify DrawingArea classes
2565         https://bugs.webkit.org/show_bug.cgi?id=195167
2566
2567         Reviewed by Žan Doberšek.
2568
2569         Add DrawingAreaProxyCoordinatedGraphics and DrawingAreaCoordinatedGraphics.
2570
2571         * PlatformGTK.cmake:
2572         * PlatformWPE.cmake:
2573         * PlatformWin.cmake:
2574         * Shared/DrawingAreaInfo.h:
2575         * SourcesGTK.txt:
2576         * SourcesWPE.txt:
2577         * UIProcess/API/gtk/PageClientImpl.cpp:
2578         (WebKit::PageClientImpl::createDrawingAreaProxy):
2579         (WebKit::PageClientImpl::viewSize):
2580         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2581         (webkitWebViewBaseRealize):
2582         (webkitWebViewBaseUnrealize):
2583         (webkitWebViewBaseDraw):
2584         (webkitWebViewBaseSizeAllocate):
2585         (webkitWebViewBaseDidRelaunchWebProcess):
2586         (webkitWebViewBasePageClosed):
2587         * UIProcess/API/wpe/PageClientImpl.cpp:
2588         (WebKit::PageClientImpl::createDrawingAreaProxy):
2589         * UIProcess/AcceleratedDrawingAreaProxy.cpp: Removed.
2590         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp: Added.
2591         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingAreaProxyCoordinatedGraphics):
2592         (WebKit::DrawingAreaProxyCoordinatedGraphics::~DrawingAreaProxyCoordinatedGraphics):
2593         (WebKit::DrawingAreaProxyCoordinatedGraphics::paint):
2594         (WebKit::DrawingAreaProxyCoordinatedGraphics::sizeDidChange):
2595         (WebKit::DrawingAreaProxyCoordinatedGraphics::deviceScaleFactorDidChange):
2596         (WebKit::DrawingAreaProxyCoordinatedGraphics::waitForBackingStoreUpdateOnNextPaint):
2597         (WebKit::DrawingAreaProxyCoordinatedGraphics::setBackingStoreIsDiscardable):
2598         (WebKit::DrawingAreaProxyCoordinatedGraphics::update):
2599         (WebKit::DrawingAreaProxyCoordinatedGraphics::didUpdateBackingStoreState):
2600         (WebKit::DrawingAreaProxyCoordinatedGraphics::enterAcceleratedCompositingMode):
2601         (WebKit::DrawingAreaProxyCoordinatedGraphics::exitAcceleratedCompositingMode):
2602         (WebKit::DrawingAreaProxyCoordinatedGraphics::updateAcceleratedCompositingMode):
2603         (WebKit::DrawingAreaProxyCoordinatedGraphics::incorporateUpdate):
2604         (WebKit::DrawingAreaProxyCoordinatedGraphics::alwaysUseCompositing const):
2605         (WebKit::DrawingAreaProxyCoordinatedGraphics::backingStoreStateDidChange):
2606         (WebKit::DrawingAreaProxyCoordinatedGraphics::sendUpdateBackingStoreState):
2607         (WebKit::DrawingAreaProxyCoordinatedGraphics::waitForAndDispatchDidUpdateBackingStoreState):
2608         (WebKit::DrawingAreaProxyCoordinatedGraphics::discardBackingStoreSoon):
2609         (WebKit::DrawingAreaProxyCoordinatedGraphics::discardBackingStore):
2610         (WebKit::DrawingAreaProxyCoordinatedGraphics::setNativeSurfaceHandleForCompositing):
2611         (WebKit::DrawingAreaProxyCoordinatedGraphics::destroyNativeSurfaceHandleForCompositing):
2612         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::DrawingMonitor):
2613         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::~DrawingMonitor):
2614         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::webViewDrawCallback):
2615         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::start):
2616         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::stop):
2617         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::didDraw):
2618         (WebKit::DrawingAreaProxyCoordinatedGraphics::dispatchAfterEnsuringDrawing):
2619         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h: Renamed from Source/WebKit/UIProcess/AcceleratedDrawingAreaProxy.h.
2620         * UIProcess/DrawingAreaProxyImpl.cpp: Removed.
2621         * UIProcess/DrawingAreaProxyImpl.h: Removed.
2622         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
2623         (WebKit::AcceleratedBackingStoreX11::update):
2624         * UIProcess/win/PageClientImpl.cpp:
2625         (WebKit::PageClientImpl::createDrawingAreaProxy):
2626         * UIProcess/win/WebView.cpp:
2627         (WebKit::WebView::paint):
2628         * WebProcess/WebPage/AcceleratedDrawingArea.cpp: Removed.
2629         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: Added.
2630         (WebKit::DrawingAreaCoordinatedGraphics::DrawingAreaCoordinatedGraphics):
2631         (WebKit::DrawingAreaCoordinatedGraphics::~DrawingAreaCoordinatedGraphics):
2632         (WebKit::DrawingAreaCoordinatedGraphics::setNeedsDisplay):
2633         (WebKit::DrawingAreaCoordinatedGraphics::setNeedsDisplayInRect):
2634         (WebKit::DrawingAreaCoordinatedGraphics::scroll):
2635         (WebKit::DrawingAreaCoordinatedGraphics::forceRepaint):
2636         (WebKit::DrawingAreaCoordinatedGraphics::forceRepaintAsync):
2637         (WebKit::DrawingAreaCoordinatedGraphics::setLayerTreeStateIsFrozen):
2638         (WebKit::DrawingAreaCoordinatedGraphics::updatePreferences):
2639         (WebKit::DrawingAreaCoordinatedGraphics::mainFrameContentSizeChanged):
2640         (WebKit::DrawingAreaCoordinatedGraphics::deviceOrPageScaleFactorChanged):
2641         (WebKit::DrawingAreaCoordinatedGraphics::didChangeViewportAttributes):
2642         (WebKit::DrawingAreaCoordinatedGraphics::graphicsLayerFactory):
2643         (WebKit::DrawingAreaCoordinatedGraphics::setRootCompositingLayer):
2644         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
2645         (WebKit::DrawingAreaCoordinatedGraphics::layerHostDidFlushLayers):
2646         (WebKit::DrawingAreaCoordinatedGraphics::createDisplayRefreshMonitor):
2647         (WebKit::DrawingAreaCoordinatedGraphics::setNativeSurfaceHandleForCompositing):
2648         (WebKit::DrawingAreaCoordinatedGraphics::destroyNativeSurfaceHandleForCompositing):
2649         (WebKit::DrawingAreaCoordinatedGraphics::activityStateDidChange):
2650         (WebKit::DrawingAreaCoordinatedGraphics::attachViewOverlayGraphicsLayer):
2651         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
2652         (WebKit::DrawingAreaCoordinatedGraphics::didUpdate):
2653         (WebKit::DrawingAreaCoordinatedGraphics::sendDidUpdateBackingStoreState):
2654         (WebKit::DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingModeSoon):
2655         (WebKit::DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingModeNow):
2656         (WebKit::DrawingAreaCoordinatedGraphics::discardPreviousLayerTreeHost):
2657         (WebKit::DrawingAreaCoordinatedGraphics::suspendPainting):
2658         (WebKit::DrawingAreaCoordinatedGraphics::resumePainting):
2659         (WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode):
2660         (WebKit::DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingMode):
2661         (WebKit::DrawingAreaCoordinatedGraphics::scheduleDisplay):
2662         (WebKit::DrawingAreaCoordinatedGraphics::displayTimerFired):
2663         (WebKit::DrawingAreaCoordinatedGraphics::display):
2664         (WebKit::shouldPaintBoundsRect):
2665         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h: Renamed from Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h.
2666         * WebProcess/WebPage/DrawingArea.cpp:
2667         (WebKit::DrawingArea::create):
2668         * WebProcess/WebPage/DrawingArea.h:
2669         (WebKit::DrawingArea::layerFlushThrottlingIsActive const):
2670         * WebProcess/WebPage/DrawingAreaImpl.cpp: Removed.
2671         * WebProcess/WebPage/DrawingAreaImpl.h: Removed.
2672
2673 2019-03-03  Zalan Bujtas  <zalan@apple.com>
2674
2675         [ContentChangeObserver] Content observation should be limited to the current document.
2676         https://bugs.webkit.org/show_bug.cgi?id=195256
2677         <rdar://problem/48544402>
2678
2679         Reviewed by Simon Fraser.
2680
2681         * WebProcess/WebPage/WebPage.h:
2682         * WebProcess/WebPage/ios/WebPageIOS.mm:
2683         (WebKit::WebPage::handleSyntheticClick):
2684         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
2685         (WebKit::WebPage::completeSyntheticClick):
2686         (WebKit::WebPage::handleTap):
2687         (WebKit::WebPage::handleTwoFingerTapAtPoint):
2688         (WebKit::WebPage::commitPotentialTap):
2689
2690 2019-03-03  Tim Horton  <timothy_horton@apple.com>
2691
2692         Rid the world of WK_API_ENABLED
2693         https://bugs.webkit.org/show_bug.cgi?id=195263
2694
2695         Reviewed by Dan Bernstein.
2696
2697         List of changed files elided because it's useless.
2698
2699 2019-03-03  Jiewen Tan  <jiewen_tan@apple.com>
2700
2701         Add a WebViewDidMoveToWindowObserver for WKWebView
2702         https://bugs.webkit.org/show_bug.cgi?id=195223
2703         <rdar://problem/48520161>
2704
2705         Reviewed by Darin Adler.
2706
2707         The load optimizer would only allow itself to optimize loads whenever the web view
2708         who owns the page is (visible && focused), otherwises it will wait until the web view
2709         becomes (visible && focused). Therefore, we need a way to notify the load optimizer
2710         changes of statuses.
2711
2712         * UIProcess/API/Cocoa/WKWebView.mm:
2713         (-[WKWebView didMoveToWindow]):
2714         * UIProcess/Cocoa/WebViewImpl.mm:
2715         (WebKit::WebViewImpl::viewDidMoveToWindow):
2716         * UIProcess/WebPageProxy.cpp:
2717         (WebKit::WebPageProxy::addWebViewDidMoveToWindowObserver):
2718         (WebKit::WebPageProxy::removeWebViewDidMoveToWindowObserver):
2719         (WebKit::WebPageProxy::webViewDidMoveToWindow):
2720         * UIProcess/WebPageProxy.h:
2721         * UIProcess/WebViewDidMoveToWindowObserver.h: Added.
2722         * WebKit.xcodeproj/project.pbxproj:
2723
2724 2019-03-03  Andy Estes  <aestes@apple.com>
2725
2726         [Apple Pay] Untangle WebPageProxy and WebPaymentCoordinatorProxy
2727         https://bugs.webkit.org/show_bug.cgi?id=195219
2728         <rdar://problem/48518082>
2729
2730         Reviewed by Darin Adler.
2731
2732         Rather than having WebPaymentCoordinatorProxy know about WebPageProxy, give
2733         WebPaymentCoordinatorProxy a client interface that WebPageProxy conforms to.
2734
2735         In a follow-on patch, WebPaymentCoordinatorProxy will have a non-WebPageProxy client.
2736
2737         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
2738         (WebKit::WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy): Replaced use of
2739         m_webPageProxy with m_client.
2740         (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy): Ditto.
2741         (WebKit::WebPaymentCoordinatorProxy::messageSenderConnection const): Implemented
2742         IPC::MessageSender via m_client.
2743         (WebKit::WebPaymentCoordinatorProxy::messageSenderDestinationID const): Ditto.
2744         (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard): Replaced use of
2745         m_webPageProxy with m_client.
2746         (WebKit::WebPaymentCoordinatorProxy::openPaymentSetup): Ditto.
2747         (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession): Called our own
2748         MessageSender::send rather than going through m_webPageProxy.
2749         (WebKit::WebPaymentCoordinatorProxy::validateMerchant): Ditto.
2750         (WebKit::WebPaymentCoordinatorProxy::didAuthorizePayment): Ditto.
2751         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingMethod): Ditto.
2752         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingContact): Ditto.
2753         (WebKit::WebPaymentCoordinatorProxy::didSelectPaymentMethod): Ditto.
2754         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h: Defined the Client abstract class and
2755         changed m_webPageProxy to m_client.
2756         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
2757         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2758         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard): Replaced use of
2759         m_webPageProxy with m_client.
2760         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Renamed from toPKPaymentRequest.
2761         (WebKit::toPKPaymentRequest): Renamed to WebPaymentCoordinatorProxy::platformPaymentRequest.
2762         * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
2763         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Replaced use of m_webPageProxy
2764         with m_client.
2765         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
2766         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Ditto.
2767         * UIProcess/AuxiliaryProcessProxy.h:
2768         (WebKit::AuxiliaryProcessProxy::messageReceiverMap): Added.
2769         * UIProcess/WebPageProxy.cpp:
2770         (WebKit::WebPageProxy::paymentCoordinatorConnection): Implemented WebPaymentCoordinatorProxy::Client.
2771         (WebKit::WebPageProxy::paymentCoordinatorMessageReceiver): Ditto.
2772         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
2773         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
2774         (WebKit::WebPageProxy::paymentCoordinatorDestinationID): Ditto.
2775         * UIProcess/WebPageProxy.h: Made WebPageProxy derive from WebPaymentCoordinatorProxy::Client.
2776         * UIProcess/ios/WebPageProxyIOS.mm:
2777         (WebKit::WebPageProxy::paymentCoordinatorPresentingViewController): Implemented WebPaymentCoordinatorProxy::Client.
2778         (WebKit::WebPageProxy::paymentCoordinatorCTDataConnectionServiceType): Ditto.
2779         * UIProcess/mac/WebPageProxyMac.mm:
2780         (WebKit::WebPageProxy::paymentCoordinatorPresentingWindow): Ditto.
2781         * WebKit.xcodeproj/project.pbxproj:
2782
2783 2019-03-03  Tim Horton  <timothy_horton@apple.com>
2784
2785         Remove some more unused 32-bit code
2786         https://bugs.webkit.org/show_bug.cgi?id=195255
2787
2788         Reviewed by Darin Adler.
2789
2790         * Platform/Module.cpp:
2791         (WebKit::Module::Module):
2792         * Platform/Module.h:
2793         * Platform/cf/ModuleCF.cpp:
2794         (WebKit::Module::unload):
2795         (WebKit::Module::bundleResourceMap): Deleted.
2796         * PluginProcess/mac/PluginProcessMac.mm:
2797         (WebKit::initializeShim):
2798         (WebKit::PluginProcess::platformInitializeProcess):
2799         (WebKit::shouldCallRealDebugger): Deleted.
2800         (WebKit::isWindowActive): Deleted.
2801         (WebKit::getCurrentEventButtonState): Deleted.
2802         (WebKit::carbonWindowShown): Deleted.
2803         (WebKit::carbonWindowHidden): Deleted.
2804         (WebKit::openCFURLRef): Deleted.
2805         (WebKit::isMallocTinyMemoryTag): Deleted.
2806         (WebKit::shouldMapMemoryExecutable): Deleted.
2807         * PluginProcess/mac/PluginProcessShim.h:
2808         * PluginProcess/mac/PluginProcessShim.mm:
2809         (WebKit::shimDebugger): Deleted.
2810         (WebKit::shimGetCurrentEventButtonState): Deleted.
2811         (WebKit::shimIsWindowActive): Deleted.
2812         (WebKit::shimModalDialog): Deleted.
2813         (WebKit::shimAlert): Deleted.
2814         (WebKit::shimShowWindow): Deleted.
2815         (WebKit::shimHideWindow): Deleted.
2816         (WebKit::shimLSOpenCFURLRef): Deleted.
2817         (WebKit::shimMachVMMap): Deleted.
2818         * Shared/API/Cocoa/WKFoundation.h:
2819         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
2820         (WebKit::XPCServiceMain):
2821         * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
2822         (WebKit::NetscapePluginModule::tryLoad):
2823         * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
2824         (WebKit::getPluginArchitecture):
2825         (WebKit::NetscapePluginModule::determineQuirks):
2826         * Shared/Plugins/PluginQuirks.h:
2827         * Shared/cf/ArgumentCodersCF.cpp:
2828         (IPC::sizeForNumberType):
2829         * Shared/mac/WebEventFactory.mm:
2830         (WebKit::mouseButtonForEvent):
2831         (WebKit::globalPointForEvent):
2832         (WebKit::pointForEvent):
2833         (WebKit::WebEventFactory::createWebMouseEvent):
2834         * UIProcess/API/C/mac/WKPagePrivateMac.h:
2835         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
2836         (WKPageLoadFileReturningNavigation):
2837         * UIProcess/Cocoa/WebViewImpl.mm:
2838         (WebKit::WebViewImpl::pressureChangeWithEvent):
2839         * UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm:
2840         (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider):
2841         * UIProcess/mac/ServicesController.mm:
2842         (WebKit::ServicesController::ServicesController):
2843         * UIProcess/mac/WebContextMenuProxyMac.mm:
2844         (WebKit::WebContextMenuProxyMac::setupServicesMenu):
2845         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
2846         (WebKit::NPN_GetValue):
2847         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
2848         (WebKit::NetscapePlugin::NetscapePlugin):
2849         * WebProcess/Plugins/Netscape/NetscapePlugin.h:
2850         (WebKit::NetscapePlugin::isWindowActive const): Deleted.
2851         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
2852         (WebKit::NetscapePlugin::setDrawingModel):
2853         (WebKit::NetscapePlugin::setEventModel):
2854         (WebKit::NetscapePlugin::platformPostInitialize):
2855         (WebKit::NetscapePlugin::platformDestroy):
2856         (WebKit::NetscapePlugin::platformGeometryDidChange):
2857         (WebKit::NetscapePlugin::platformPaint):
2858         (WebKit::NetscapePlugin::platformHandleMouseEvent):
2859         (WebKit::NetscapePlugin::platformHandleWheelEvent):
2860         (WebKit::NetscapePlugin::platformHandleMouseEnterEvent):
2861         (WebKit::NetscapePlugin::platformHandleMouseLeaveEvent):
2862         (WebKit::NetscapePlugin::platformHandleKeyboardEvent):
2863         (WebKit::NetscapePlugin::platformSetFocus):
2864         (WebKit::NetscapePlugin::windowFocusChanged):
2865         (WebKit::NetscapePlugin::windowAndViewFramesChanged):
2866         (WebKit::NetscapePlugin::sendComplexTextInput):
2867         (): Deleted.
2868         (WebKit::windowMap): Deleted.
2869         (WebKit::NetscapePlugin::netscapePluginFromWindow): Deleted.
2870         (WebKit::NetscapePlugin::windowRef const): Deleted.
2871         (WebKit::NetscapePlugin::updateFakeWindowBounds): Deleted.
2872         (WebKit::NetscapePlugin::buttonState): Deleted.
2873         (WebKit::initializeEventRecord): Deleted.
2874         (WebKit::anyMouseButtonIsDown): Deleted.
2875         (WebKit::rightMouseButtonIsDown): Deleted.
2876         (WebKit::modifiersForEvent): Deleted.
2877         (WebKit::convertStringToKeyCodes): Deleted.
2878         (WebKit::scriptCodeFromCurrentKeyboardInputSource): Deleted.
2879         (WebKit::NetscapePlugin::nullEventTimerFired): Deleted.
2880
2881 2019-03-02  Zalan Bujtas  <zalan@apple.com>
2882
2883         [ContentChangeObserver] Introduce ContentChangeObserver::MouseMovedScope
2884         https://bugs.webkit.org/show_bug.cgi?id=195252
2885         <rdar://problem/48539446>
2886
2887         Reviewed by Simon Fraser.
2888
2889         * WebProcess/WebPage/ios/WebPageIOS.mm:
2890         (WebKit::WebPage::handleSyntheticClick):
2891
2892 2019-03-02  Tim Horton  <timothy_horton@apple.com>
2893
2894         Move EditingRange <-> Range methods to EditingRange instead of WebPage
2895         https://bugs.webkit.org/show_bug.cgi?id=195201
2896
2897         Reviewed by Sam Weinig.
2898
2899         * Shared/EditingRange.h:
2900         * Shared/EditingRange.cpp:
2901         Also, modernize the coders.
2902
2903         * Sources.txt:
2904         * WebKit.xcodeproj/project.pbxproj:
2905         * WebProcess/WebPage/WebPage.cpp:
2906         (WebKit::WebPage::insertTextAsync):
2907         (WebKit::WebPage::getMarkedRangeAsync):
2908         (WebKit::WebPage::getSelectedRangeAsync):
2909         (WebKit::WebPage::characterIndexForPointAsync):
2910         (WebKit::WebPage::firstRectForCharacterRangeAsync):
2911         (WebKit::WebPage::setCompositionAsync):
2912         (WebKit::WebPage::rangeFromEditingRange): Deleted.
2913         * WebProcess/WebPage/mac/WebPageMac.mm:
2914         (WebKit::WebPage::insertDictatedTextAsync):
2915         (WebKit::WebPage::attributedSubstringForCharacterRangeAsync):
2916
2917 2019-03-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2918
2919         [iOS] Programmatic paste access should be granted when copying and pasting within the same origin
2920         https://bugs.webkit.org/show_bug.cgi?id=195053
2921         <rdar://problem/48134710>
2922
2923         Reviewed by Ryosuke Niwa.
2924
2925         Add support for automatically granting programmatic pasteboard access when the pasteboard identifier of the
2926         document requesting programmatic paste matches the identifier in the custom pasteboard data blob in the
2927         UIPasteboard. To do this, we send the pasteboard identifier of the document requesting the DOM paste to the UI
2928         process, and check this against the pasteboard identifiers for each item on the platform pasteboard. If all
2929         items in the platform pasteboard match the given pasteboard identifier (since we don't support writing multiple
2930         pasteboard items via bindings, this should only be a single item), we skip showing the paste callout and
2931         immediately invoke the programmatic paste handler.
2932
2933         * Scripts/webkit/messages.py:
2934         * UIProcess/API/gtk/PageClientImpl.cpp:
2935         (WebKit::PageClientImpl::requestDOMPasteAccess):
2936         * UIProcess/API/gtk/PageClientImpl.h:
2937         * UIProcess/API/wpe/PageClientImpl.cpp:
2938         (WebKit::PageClientImpl::requestDOMPasteAccess):
2939         * UIProcess/API/wpe/PageClientImpl.h:
2940         * UIProcess/PageClient.h:
2941         * UIProcess/WebPageProxy.cpp:
2942         (WebKit::WebPageProxy::requestDOMPasteAccess):
2943         * UIProcess/WebPageProxy.h:
2944         * UIProcess/WebPageProxy.messages.in:
2945
2946         Add plumbing to deliver the pasteboard identifier to the client when requesting DOM paste.
2947
2948         * UIProcess/ios/PageClientImplIOS.h:
2949         * UIProcess/ios/PageClientImplIOS.mm:
2950         (WebKit::PageClientImpl::requestDOMPasteAccess):
2951         * UIProcess/ios/WKContentViewInteraction.h:
2952         * UIProcess/ios/WKContentViewInteraction.mm:
2953         (-[WKContentView cleanupInteraction]):
2954         (-[WKContentView resignFirstResponderForWebView]):
2955         (-[WKContentView _webTouchEventsRecognized:]):
2956         (-[WKContentView _willHideMenu:]):
2957         (-[WKContentView pasteForWebView:]):
2958         (-[WKContentView _handleDOMPasteRequestWithResult:]):
2959         (-[WKContentView _willPerformAction:sender:]):
2960         (-[WKContentView _didPerformAction:sender:]):
2961         (-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
2962         (allPasteboardItemOriginsMatchOrigin):
2963         (-[WKContentView _requestDOMPasteAccessWithElementRect:originIdentifier:completionHandler:]):
2964         (-[WKContentView _requestDOMPasteAccessWithElementRect:completionHandler:]): Deleted.
2965
2966         Bail early in the case where all items' pasteboard identifiers (read via custom pasteboard data) match. When
2967         this happens, we only grant access for the current paste command, rather than granting access for the user
2968         gesture token.
2969
2970         * UIProcess/mac/PageClientImplMac.h:
2971         * UIProcess/win/PageClientImpl.cpp:
2972         (WebKit::PageClientImpl::requestDOMPasteAccess):
2973         * UIProcess/win/PageClientImpl.h:
2974         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
2975         (WebKit::WebEditorClient::requestDOMPasteAccess):
2976         * WebProcess/WebCoreSupport/WebEditorClient.h:
2977         * WebProcess/WebPage/WebPage.cpp:
2978         (WebKit::WebPage::requestDOMPasteAccess):
2979         * WebProcess/WebPage/WebPage.h:
2980
2981 2019-02-27  Darin Adler  <darin@apple.com>
2982
2983         Fixed makeString(float) to do shortest-form serialization without first converting to double
2984         https://bugs.webkit.org/show_bug.cgi?id=195142
2985
2986         Reviewed by Daniel Bates.
2987
2988         * UIProcess/PerActivityStateCPUUsageSampler.cpp: Removed unneeded include of DecimalNumber.h.
2989
2990 2019-03-02  Adrian Perez de Castro  <aperez@igalia.com>
2991
2992         [WPE] Public API headers are missing autocleanup definitions
2993         https://bugs.webkit.org/show_bug.cgi?id=195211
2994
2995         Reviewed by Philippe Normand.
2996
2997         * PlatformWPE.cmake: List new API headers as installable.
2998         * UIProcess/API/wpe/WebKitAutocleanups.h: Added. This is a copy of the header from the GTK
2999         port, adapted to fit the WPE port.
3000         * UIProcess/API/wpe/webkit.h: Add inclusion of WebKitAutocleanups.h
3001         * WebProcess/InjectedBundle/API/wpe/WebKitWebExtensionAutocleanups.h: Added. Also adapted
3002         from the equivalent header of the GTK port.
3003         * WebProcess/InjectedBundle/API/wpe/webkit-web-extension.h: Add inclusion of
3004         WebKitWebExtensionAutocleanups.h
3005
3006 2019-03-02  Michael Catanzaro  <mcatanzaro@igalia.com>
3007
3008         Remove unused WebPageProxy::m_navigationID
3009         https://bugs.webkit.org/show_bug.cgi?id=195209
3010
3011         Reviewed by Darin Adler.
3012
3013         WebPageProxy::m_navigationID is never assigned to and is only used once by mistake in a
3014         debug LOG(). It must be a refactoring mistake.
3015
3016         * UIProcess/WebPageProxy.cpp:
3017         (WebKit::WebPageProxy::didCommitLoadForFrame):
3018         * UIProcess/WebPageProxy.h:
3019
3020 2019-03-01  Darin Adler  <darin@apple.com>
3021
3022         Finish removing String::format
3023         https://bugs.webkit.org/show_bug.cgi?id=194893
3024
3025         Reviewed by Daniel Bates.
3026
3027         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
3028         (WebKit::LocalAuthenticator::getAssertion): Use makeString, attempting to fix
3029         a problem where we passed an NSData * to format with a "%s"."
3030
3031 2019-03-01  Chris Dumez  <cdumez@apple.com>
3032
3033         Unreviewed Windows build fix after r242302.
3034
3035         * UIProcess/WebProcessPool.cpp:
3036         (WebKit::WebProcessPool::ensureNetworkProcess):
3037
3038 2019-03-01  Alex Christensen  <achristensen@webkit.org>
3039
3040         NetworkDataTask redirection should not keep alive its NetworkSession
3041         https://bugs.webkit.org/show_bug.cgi?id=194927
3042
3043         Reviewed by Darin Adler.
3044
3045         This should fix rdar://problem/47580502
3046
3047         * NetworkProcess/NetworkDataTask.h:
3048         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3049         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
3050
3051 2019-03-01  Alex Christensen  <achristensen@webkit.org>
3052
3053         Revert r241223, r241235, and r241287
3054         https://bugs.webkit.org/show_bug.cgi?id=194427
3055         <rdar://48045861>
3056
3057         This caused crashes, and feature design has evolved away from needing the daemon in this form.
3058
3059         * NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.mm:
3060         (WebKit::DaemonMain):
3061         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
3062         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
3063         (WebKit::XPCServiceEventHandler):
3064         (WebKit::XPCServiceMain):
3065         (WebKit::XPCEventHandler): Deleted.
3066         (WebKit::XPCInitializationHandler): Deleted.
3067         * UIProcess/API/APIProcessPoolConfiguration.h:
3068         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3069         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3070         (-[_WKProcessPoolConfiguration usesNetworkingDaemon]): Deleted.
3071         (-[_WKProcessPoolConfiguration setUsesNetworkingDaemon:]): Deleted.
3072         * UIProcess/AuxiliaryProcessProxy.cpp:
3073         (WebKit::AuxiliaryProcessProxy::getLaunchOptions):
3074         * UIProcess/Launcher/ProcessLauncher.h:
3075         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
3076         (WebKit::serviceName):
3077         (WebKit::ProcessLauncher::launchProcess):
3078         * UIProcess/Network/NetworkProcessProxy.cpp:
3079         (WebKit::NetworkProcessProxy::getLaunchOptions):
3080         * UIProcess/WebProcessPool.cpp:
3081         (WebKit::WebProcessPool::usesNetworkingDaemon const): Deleted.
3082         * UIProcess/WebProcessPool.h:
3083
3084 2019-03-01  Alex Christensen  <achristensen@webkit.org>
3085
3086         Add setters on WKWebsiteDataStore for sourceApplicationBundleIdentifier and sourceApplicationSecondaryIdentifier
3087         https://bugs.webkit.org/show_bug.cgi?id=195229
3088         <rdar://problem/48520362>
3089
3090         Reviewed by Chris Dumez.
3091
3092         Just like _setBoundInterfaceIdentifier, we need a way to set these properties after instantiation of a WKWebsiteDataStore,
3093         but we need to make sure we don't set it after the parameters have been copied to the NetworkProcess.
3094
3095         Functionality verified by manual testing.  See radar.
3096         Added an API test that verifies the setter restrictions work as expected.
3097
3098         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3099         (-[WKWebsiteDataStore _sourceApplicationBundleIdentifier]):
3100         (-[WKWebsiteDataStore _setSourceApplicationBundleIdentifier:]):
3101         (-[WKWebsiteDataStore _sourceApplicationSecondaryIdentifier]):
3102         (-[WKWebsiteDataStore _setSourceApplicationSecondaryIdentifier:]):
3103         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3104         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3105         (WebKit::toPKPaymentRequest):
3106         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3107         (WebKit::WebsiteDataStore::parameters):
3108         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3109         (WebKit::WebsiteDataStore::WebsiteDataStore):
3110         (WebKit::WebsiteDataStore::setSourceApplicationSecondaryIdentifier):
3111         (WebKit::WebsiteDataStore::setSourceApplicationBundleIdentifier):
3112         * UIProcess/WebsiteData/WebsiteDataStore.h:
3113         (WebKit::WebsiteDataStore::sourceApplicationBundleIdentifier):
3114         (WebKit::WebsiteDataStore::sourceApplicationSecondaryIdentifier):
3115
3116 2019-03-01  Antoine Quint  <graouts@apple.com>
3117
3118         [iOS] Turn mouse event simulation on by default
3119         https://bugs.webkit.org/show_bug.cgi?id=195218
3120         <rdar://problem/48516794>
3121
3122         Reviewed by Dean Jackson.
3123
3124         * Shared/WebPreferences.yaml:
3125
3126 2019-03-01  Ross Kirsling  <ross.kirsling@sony.com>
3127
3128         EnvironmentUtilities::stripValuesEndingWithString isn't thread-safe
3129         https://bugs.webkit.org/show_bug.cgi?id=194612
3130
3131         Reviewed by Alex Christensen.
3132
3133         This API test really shouldn't be verifying that the actual environment was successfully modified.
3134
3135         At its core, stripValuesEndingWithString is really just split-filter-join. By replacing it with a pair of
3136         simple functions -- one for string processing, one for environment processing -- the API test only needs to
3137         worry about the former.
3138
3139         * Platform/unix/EnvironmentUtilities.cpp:
3140         (WebKit::EnvironmentUtilities::stripEntriesEndingWith):
3141         (WebKit::EnvironmentUtilities::removeValuesEndingWith):
3142         (WebKit::EnvironmentUtilities::stripValuesEndingWithString): Deleted.
3143         * Platform/unix/EnvironmentUtilities.h:
3144         Replace old function with a pair of simpler ones.
3145
3146         * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkServiceEntryPoint.mm:
3147         (NetworkServiceInitializer):
3148         * PluginProcess/EntryPoint/Cocoa/XPCService/PluginServiceEntryPoint.mm:
3149         (PluginServiceInitializer):
3150         * WebProcess/EntryPoint/Cocoa/XPCService/WebContentServiceEntryPoint.mm:
3151         (WebContentServiceInitializer):
3152         Update function name.
3153
3154 2019-03-01  Don Olmstead  <don.olmstead@sony.com>
3155
3156         Unify WebsiteDataStore::defaultDataStoreConfiguration across ports
3157         https://bugs.webkit.org/show_bug.cgi?id=194844
3158
3159         Reviewed by Youenn Fablet.
3160
3161         Move the Cocoa implementation into APIWebsiteDataStore.cpp as the source of truth and
3162         append configuration for Glib's DeviceIdHashSalts storage directory. This also fixes
3163         a crash in Windows when running a Service Worker.
3164
3165         * UIProcess/API/APIWebsiteDataStore.cpp:
3166         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
3167         (API::WebsiteDataStore::defaultDataStoreConfiguration):
3168         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
3169         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory): Deleted.
3170         (API::WebsiteDataStore::defaultDataStoreConfiguration): Deleted.
3171         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
3172         (API::WebsiteDataStore::defaultDataStoreConfiguration): Deleted.
3173         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp:
3174         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory): Deleted.
3175         (API::WebsiteDataStore::defaultDataStoreConfiguration): Deleted.
3176
3177 2019-03-01  John Wilander  <wilander@apple.com>
3178
3179         Resource Load Statistics: Further restrict client-side cookie persistence after cross-site navigations with link decoration
3180         https://bugs.webkit.org/show_bug.cgi?id=195196
3181         <rdar://problem/48006419>
3182
3183         Reviewed by Brent Fulgham.
3184
3185         Trackers abuse link query parameters to transport user identifiers cross-site.
3186         This patch detects such navigations and applies further restrictions to
3187         client-site cookies on the destination page.
3188
3189         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3190         (WebKit::NetworkConnectionToWebProcess::clearPageSpecificDataForResourceLoadStatistics):
3191         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage): Deleted.
3192             Renamed NetworkConnectionToWebProcess::clearPageSpecificDataForResourceLoadStatistics().
3193         * NetworkProcess/NetworkConnectionToWebProcess.h:
3194         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3195         * NetworkProcess/NetworkProcess.cpp:
3196         (WebKit::NetworkProcess::committedCrossSiteLoadWithLinkDecoration):
3197             Reporting IPC message when a link decorated cross-site navigation happens.
3198         (WebKit::NetworkProcess::resetCrossSiteLoadsWithLinkDecorationForTesting):
3199         * NetworkProcess/NetworkProcess.h:
3200         * NetworkProcess/NetworkProcess.messages.in:
3201         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3202         (WKWebsiteDataStoreStatisticsResetToConsistentState):
3203             Added clearing of the new state between test runs.
3204         * UIProcess/Network/NetworkProcessProxy.cpp:
3205         (WebKit::NetworkProcessProxy::resetCrossSiteLoadsWithLinkDecorationForTesting):
3206             Test infrastructure.
3207         * UIProcess/Network/NetworkProcessProxy.h:
3208         * UIProcess/WebPageProxy.cpp:
3209         (WebKit::isNonUniqueNavigationWithLinkDecoration):
3210             Convenience function.
3211         (WebKit::WebPageProxy::didCommitLoadForFrame):
3212             This function now reports to the network process when a link decorated
3213             cross-site navigation happens.
3214         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3215         (WebKit::WebsiteDataStore::resetCrossSiteLoadsWithLinkDecorationForTesting):
3216             Test infrastructure.
3217         * UIProcess/WebsiteData/WebsiteDataStore.h:
3218         * WebProcess/WebPage/WebPage.cpp:
3219         (WebKit::WebPage::close):
3220             Name change of function called.
3221
3222 2019-03-01  Tim Horton  <timothy_horton@apple.com>
3223
3224         Remove unused code in WebKitLegacy
3225         https://bugs.webkit.org/show_bug.cgi?id=189614
3226
3227         Reviewed by Simon Fraser.
3228
3229         * mac/MigrateHeadersFromWebKitLegacy.make:
3230
3231 2019-03-01  Tim Horton  <timothy_horton@apple.com>
3232
3233         Modernize WebKit::AttributedString a little bit
3234         https://bugs.webkit.org/show_bug.cgi?id=195200
3235
3236         Reviewed by Wenson Hsieh.
3237
3238         * Shared/mac/AttributedString.h:
3239         (WebKit::AttributedString::AttributedString):
3240         (WebKit::AttributedString::operator NSAttributedString * const):
3241         * Shared/mac/AttributedString.mm:
3242         (IPC::ArgumentCoder<WebKit::AttributedString>::encode):
3243         (IPC::ArgumentCoder<WebKit::AttributedString>::decode):
3244         (WebKit::AttributedString::encode const): Deleted.
3245         (WebKit::AttributedString::decode): Deleted.
3246         * UIProcess/Cocoa/WebViewImpl.mm:
3247         (WebKit::WebViewImpl::attributedSubstringForProposedRange):
3248         * WebProcess/WebPage/mac/WebPageMac.mm:
3249         (WebKit::WebPage::attributedSubstringForCharacterRangeAsync):
3250         Modern coders, and a constructor and cast operator to/from NSAttributedString.
3251         Also adopt those in a few places just for fun.
3252
3253 2019-03-01  Youenn Fablet  <youenn@apple.com>
3254
3255         Serialize IndexedDB::ObjectStoreOverwriteMode as an enum
3256         https://bugs.webkit.org/show_bug.cgi?id=195213
3257
3258         Reviewed by Alex Christensen.
3259
3260         Make use of enum trait to automatically check for correct enum value when receiving a putOrAdd message.
3261
3262         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
3263         (WebKit::WebIDBConnectionToClient::putOrAdd):
3264         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
3265         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.messages.in:
3266         * Scripts/webkit/messages.py:
3267         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
3268         (WebKit::WebIDBConnectionToServer::putOrAdd):
3269
3270 2019-03-01  Don Olmstead  <don.olmstead@sony.com>
3271
3272         [WinCairo] Enable service worker
3273         https://bugs.webkit.org/show_bug.cgi?id=188318
3274
3275         Reviewed by Youenn Fablet.
3276
3277         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3278         (WebKit::WebSWContextManagerConnection::terminateProcess):
3279         * WebProcess/Storage/WebSWContextManagerConnection.h:
3280         * config.h:
3281
3282 2019-03-01  Chris Dumez  <cdumez@apple.com>
3283
3284         Flaky API Test TestWebKitAPI.ProcessSwap.LoadUnload
3285         https://bugs.webkit.org/show_bug.cgi?id=195110
3286
3287         Reviewed by Ryosuke Niwa.
3288
3289         The test was attempting to disable PageCache via view preferences instead of using the
3290         process pool configuration flag. This would fail to disable PageCache because the
3291         usesPageCache preference would not prevent the creation of SuspendedPageProxy objects.
3292         As a result, the firing on the unload event would get delayed until the SuspendedPageProxy
3293         objects would get destroyed, which would lead to flakiness.
3294
3295         This patch updates WebPageProxy::suspendCurrentPageIfPossible() to not create suspended
3296         pages proxies when the usesPageCache preference is set to false.
3297
3298         * UIProcess/WebPageProxy.cpp:
3299         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
3300
3301 2019-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
3302
3303         [ThreadedCompositor] Simply the compositing run loop worker thread
3304         https://bugs.webkit.org/show_bug.cgi?id=195208
3305
3306         Reviewed by Don Olmstead.
3307
3308         We can remove the WorkQueuePool, since we never really supported more than one thread, and now that single
3309         process model non longer exists it doesn't even make sense. We can simply use a RunLoop instead of a WorkQueue
3310         so that the implementation is not specific to the generic WorkQueue implementation.
3311
3312         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
3313         (WebKit::createRunLoop): Helper function to create the RunLoop in a worker thread before m_updateTimer is initialized.
3314         (WebKit::CompositingRunLoop::CompositingRunLoop): Use createRunLoop().
3315         (WebKit::CompositingRunLoop::~CompositingRunLoop): Stop the worker thread run loop in the next main run loop iteration.
3316         (WebKit::CompositingRunLoop::performTask): Use m_runLoop.
3317         (WebKit::CompositingRunLoop::performTaskSync): Ditto.
3318         (WebKit::WorkQueuePool::singleton): Deleted.
3319         (WebKit::WorkQueuePool::dispatch): Deleted.
3320         (WebKit::WorkQueuePool::runLoop): Deleted.
3321         (WebKit::WorkQueuePool::invalidate): Deleted.
3322         (WebKit::WorkQueuePool::WorkQueuePool): Deleted.
3323         (WebKit::WorkQueuePool::getOrCreateWorkQueueForContext): Deleted.
3324         (): Deleted.
3325         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
3326
3327 2019-03-01  Justin Fan  <justin_fan@apple.com>
3328
3329         [Web GPU] 32-bit builds broken by attempt to disable WebGPU on 32-bit
3330         https://bugs.webkit.org/show_bug.cgi?id=195191
3331
3332         Rubber-stamped by Dean Jackson.
3333
3334         Dropping support for 32-bit entirely, so I'm intentionally leaving 32-bit broken.
3335
3336         * Configurations/FeatureDefines.xcconfig:
3337
3338 2019-02-28  Chris Dumez  <cdumez@apple.com>
3339
3340         HTTPSUpgradeList.db database should be opened in readonly mode
3341         https://bugs.webkit.org/show_bug.cgi?id=195194
3342         <rdar://problem/47103889>
3343
3344         Reviewed by Youenn Fablet.
3345
3346         HTTPSUpgradeList.db database should be opened in readonly mode since it is not meant to be
3347         modified by WebKit. Opening it in ReadWrite mode causes sandbox violations.
3348
3349         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
3350         (WebKit::NetworkHTTPSUpgradeChecker::NetworkHTTPSUpgradeChecker):
3351
3352 2019-02-28  David Quesada  <david_quesada@apple.com>
3353
3354         Expose APINavigationAction.shouldPerformDownload() on WKNavigationAction
3355         https://bugs.webkit.org/show_bug.cgi?id=195121
3356         rdar://problem/48450302
3357
3358         Reviewed by Alex Christensen.
3359
3360         * UIProcess/API/Cocoa/WKNavigationAction.mm:
3361         (-[WKNavigationAction _shouldPerformDownload]):
3362         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
3363
3364 2019-02-28  Antoine Quint  <graouts@apple.com>
3365
3366         Disable Web Animations in Safari Technology Preview
3367         https://bugs.webkit.org/show_bug.cgi?id=194748
3368         <rdar://problem/48139481>
3369
3370         Reviewed by Dean Jackson.
3371
3372         The test runners already opt into that feature explicitly, so all that is needed is to turn
3373         the default setting value to false.
3374
3375         * Shared/WebPreferences.yaml:
3376
3377 2019-02-28  Antoine Quint  <graouts@apple.com>
3378
3379         Enable the Pointer Events runtime flag by default
3380         https://bugs.webkit.org/show_bug.cgi?id=195156
3381
3382         Reviewed by Dean Jackson.
3383
3384         * Shared/WebPreferences.yaml:
3385
3386 2019-02-28  Sihui Liu  <sihui_liu@apple.com>
3387
3388         Revert r232263: it caused processes to crash because process was suspended with locked file
3389         https://bugs.webkit.org/show_bug.cgi?id=195122
3390         <rdar://problem/48444599>
3391
3392         Reviewed by Geoffrey Garen.
3393
3394         * NetworkProcess/NetworkProcess.cpp:
3395         (WebKit::NetworkProcess::NetworkProcess):
3396         * NetworkProcess/NetworkProcess.h:
3397         * Shared/WebSQLiteDatabaseTracker.cpp:
3398         (WebKit::WebSQLiteDatabaseTracker::WebSQLiteDatabaseTracker):
3399         (WebKit::WebSQLiteDatabaseTracker::hysteresisUpdated):
3400         * Shared/WebSQLiteDatabaseTracker.h:
3401         * WebProcess/WebProcess.cpp:
3402         (WebKit::m_webSQLiteDatabaseTracker):
3403         (WebKit::m_nonVisibleProcessCleanupTimer): Deleted.
3404         * WebProcess/WebProcess.h:
3405
3406 2019-02-28  Per Arne Vollan  <pvollan@apple.com>
3407
3408         [iOS] Move calls to [UIKeyboard isInHardwareKeyboardMode] to the UI process.
3409         https://bugs.webkit.org/show_bug.cgi?id=193683
3410         <rdar://problem/47634345>
3411
3412         Reviewed by Brent Fulgham.
3413
3414         When a keyboard is attached/deattached or the application becomes foreground, send a message from
3415         the UI process to the WebContent process, notifying whether a keyboard is attached or not. Also,
3416         cache the value of [UIKeyboard isInHardwareKeyboardMode] in the UI process, since this call seems
3417         to be expensive.
3418
3419         * UIProcess/API/Cocoa/WKWebView.mm:
3420         (hardwareKeyboardAvailabilityChangedCallback):
3421         * UIProcess/WebPageProxy.h:
3422         * UIProcess/WebProcessProxy.h:
3423         (WebKit::WebProcessProxy::setKeyboardIsAttached):
3424         (WebKit::WebProcessProxy::keyboardIsAttached const):
3425         * UIProcess/ios/WKContentViewInteraction.mm:
3426         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3427         * UIProcess/ios/WebPageProxyIOS.mm:
3428         (WebKit::WebPageProxy::applicationWillEnterForeground):
3429         (WebKit::WebPageProxy::hardwareKeyboardAvailabilityChanged):
3430         * WebProcess/WebPage/WebPage.h:
3431         * WebProcess/WebPage/WebPage.messages.in:
3432         * WebProcess/WebPage/ios/WebPageIOS.mm:
3433         (WebKit::WebPage::platformEditorState const):
3434         (WebKit::WebPage::hardwareKeyboardAvailabilityChanged):
3435
3436 2019-02-28  Carlos Garcia Campos  <cgarcia@igalia.com>
3437
3438         [CoordinatedGraphics] Remove COORDINATED_GRAPHICS_THREADED option
3439         https://bugs.webkit.org/show_bug.cgi?id=195159
3440
3441         Reviewed by Don Olmstead.
3442
3443         Use COORDINATED_GRAPHICS instead.
3444
3445         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3446         (WebKit::CoordinatedGraphicsScene::onNewBufferAvailable):
3447         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
3448         * Shared/CoordinatedGraphics/SimpleViewportController.cpp:
3449         * Shared/CoordinatedGraphics/SimpleViewportController.h:
3450         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
3451         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
3452         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3453         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
3454         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
3455         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h:
3456         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
3457         (WebKit::AcceleratedDrawingArea::mainFrameContentSizeChanged):
3458         (WebKit::AcceleratedDrawingArea::enterAcceleratedCompositingMode):
3459         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
3460         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:
3461         * WebProcess/WebPage/DrawingAreaImpl.cpp:
3462         (WebKit::DrawingAreaImpl::updatePreferences):
3463         * WebProcess/WebPage/WebPage.cpp:
3464         (WebKit::WebPage::sendViewportAttributesChanged):
3465         (WebKit::WebPage::viewportPropertiesDidChange):
3466         * WebProcess/gtk/WebProcessMainGtk.cpp:
3467
3468 2019-02-28  Sihui Liu  <sihui_liu@apple.com>
3469
3470         Stop using legacy IDB path by default when creating WebProcessPool from websiteDataStore
3471         https://bugs.webkit.org/show_bug.cgi?id=194958
3472
3473         Reviewed by Geoffrey Garen.
3474
3475         ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration should not use fixed IDB path.
3476
3477         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3478         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
3479         * UIProcess/API/APIWebsiteDataStore.cpp:
3480         (API::WebsiteDataStore::createLegacy):
3481         (API::indexedDBDatabaseDirectory):
3482         * UIProcess/API/APIWebsiteDataStore.h:
3483         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3484         (-[WKWebsiteDataStore _indexedDBDatabaseDirectory]):
3485         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3486         * UIProcess/WebProcessPool.cpp:
3487         (WebKit::legacyWebsiteDataStoreConfiguration):
3488
3489 2019-02-28  Carlos Garcia Campos  <cgarcia@igalia.com>
3490
3491         [CoordinatedGraphics] Unify all LayerTreeHost classes
3492         https://bugs.webkit.org/show_bug.cgi?id=195094
3493
3494         Reviewed by Žan Doberšek.
3495
3496         There's no reason to have 3 classes, since currently LayerTreeHost is only used by coordinated graphics based
3497         ports.
3498
3499         * PlatformWin.cmake:
3500         * SourcesGTK.txt:
3501         * SourcesWPE.txt:
3502         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
3503         (WebKit::AcceleratedDrawingArea::enterAcceleratedCompositingMode):
3504         (WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModeNow):
3505         * WebProcess/WebPage/AcceleratedDrawingArea.h:
3506         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp: Removed.
3507         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h: Removed.
3508         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp.
3509         (WebKit::LayerTreeHost::LayerTreeHost):
3510         (WebKit::LayerTreeHost::~LayerTreeHost):
3511         (WebKit::LayerTreeHost::setLayerFlushSchedulingEnabled):
3512         (WebKit::LayerTreeHost::scheduleLayerFlush):
3513         (WebKit::LayerTreeHost::cancelPendingLayerFlush):
3514         (WebKit::LayerTreeHost::layerFlushTimerFired):
3515         (WebKit::LayerTreeHost::setRootCompositingLayer):
3516         (WebKit::LayerTreeHost::setViewOverlayRootLayer):
3517         (WebKit::LayerTreeHost::invalidate):
3518         (WebKit::LayerTreeHost::scrollNonCompositedContents):
3519         (WebKit::LayerTreeHost::forceRepaint):
3520         (WebKit::LayerTreeHost::forceRepaintAsync):
3521         (WebKit::LayerTreeHost::sizeDidChange):
3522         (WebKit::LayerTreeHost::pauseRendering):
3523         (WebKit::LayerTreeHost::resumeRendering):
3524         (WebKit::LayerTreeHost::graphicsLayerFactory):
3525         (WebKit::LayerTreeHost::contentsSizeChanged):
3526         (WebKit::LayerTreeHost::didChangeViewportAttributes):
3527         (WebKit::LayerTreeHost::didChangeViewport):
3528         (WebKit::LayerTreeHost::setIsDiscardable):
3529         (WebKit::LayerTreeHost::setNativeSurfaceHandleForCompositing):
3530         (WebKit::LayerTreeHost::deviceOrPageScaleFactorChanged):
3531         (WebKit::LayerTreeHost::createDisplayRefreshMonitor):
3532         (WebKit::LayerTreeHost::didFlushRootLayer):
3533         (WebKit::LayerTreeHost::commitSceneState):
3534         (WebKit::LayerTreeHost::frameComplete):
3535         (WebKit::LayerTreeHost::nativeSurfaceHandleForCompositing):
3536         (WebKit::LayerTreeHost::didDestroyGLContext):
3537         (WebKit::LayerTreeHost::willRenderFrame):
3538         (WebKit::LayerTreeHost::didRenderFrame):
3539         (WebKit::LayerTreeHost::requestDisplayRefreshMonitorUpdate):
3540         (WebKit::LayerTreeHost::handleDisplayRefreshMonitorUpdate):
3541         (WebKit::LayerTreeHost::renderNextFrame):
3542         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h.
3543         * WebProcess/WebPage/DrawingAreaImpl.cpp:
3544         (WebKit::DrawingAreaImpl::setNeedsDisplay):
3545         (WebKit::DrawingAreaImpl::setNeedsDisplayInRect):
3546         * WebProcess/WebPage/LayerTreeHost.cpp: Removed.
3547         * WebProcess/WebPage/LayerTreeHost.h: Removed.
3548         * WebPage/win/LayerTreeHost.h: Added.
3549
3550 2019-02-28  Justin Fan  <justin_fan@apple.com>
3551
3552         [Web GPU] Enable Web GPU only on 64-bit
3553         https://bugs.webkit.org/show_bug.cgi?id=195139
3554
3555         Because Metal is only supported on 64 bit apps.
3556
3557         Unreviewed build fix.
3558
3559         * Configurations/FeatureDefines.xcconfig:
3560
3561 2019-02-27  Simon Fraser  <simon.fraser@apple.com>
3562
3563         Roll out r242014; it caused crashes in compositing logging (webkit.org/b/195141)
3564
3565         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
3566         (WebKit::LocalAuthenticator::getAssertion):
3567
3568 2019-02-27  Michael Catanzaro  <mcatanzaro@igalia.com>
3569
3570         Unreviewed, fix -Wformat warning
3571
3572         * WebProcess/WebPage/WebPage.cpp:
3573         (WebKit::WebPage::didCompletePageTransition):
3574
3575 2019-02-27  Brent Fulgham  <bfulgham@apple.com>
3576
3577         REGRESSION: Crash beneath ResourceLoadObserver::logSubresourceLoading
3578         https://bugs.webkit.org/show_bug.cgi?id=195072
3579
3580         Reviewed by Ryosuke Niwa.
3581
3582         ResourceLoadObserver and WebProcess should exist as long as the web page (process) is running. However,
3583         the NetworkProcess connection can close for a variety of reasons. If the ResourceLoadObserver observes
3584         a load or user gesture in the WebProcess, we should attempt to reconnect to the NetworkProcess (if it
3585         was disconnected), just like we do for other message send cases.
3586
3587         This patch switches from using the m_networkProcessConnection member (which might be null) to use the
3588         'ensureNetworkProcessConnection' accessor which ensures we have a valid connection for message sends.
3589
3590         * WebProcess/WebProcess.cpp:
3591         (WebKit::WebProcess::initializeWebProcess):
3592
3593 2019-02-27  Chris Dumez  <cdumez@apple.com>
3594
3595         Flaky API Test: TestWebKitAPI.ProcessSwap.SessionStorage
3596         https://bugs.webkit.org/show_bug.cgi?id=194480
3597
3598         Reviewed by Brady Eidson.
3599
3600         The StorageManager would only start listening for IPC on a given connection when
3601         StorageManager::processWillOpenConnection() is called. This gets called from
3602         WebsiteDataStore::webProcessWillOpenConnection() which gets called from
3603         WebProcessLifetimeTracker::webPageEnteringWebProcess().
3604
3605         webPageEnteringWebProcess() was called in WebPageProxy::finishAttachingToWebProcess()
3606         after process-swapping. This means that IPC comming from the *provisional* process
3607         would not get processed and we would only start processing IPC on the provisional
3608         process's connection when it would get committed.
3609
3610         To address the issue, this patch teaches WebProcessLifetimeTracker that a page can
3611         now have several processes. We also make sure that webPageEnteringWebProcess() gets
3612         called for the provisional process as soon as we create the provisional page, instead
3613         of waiting for it to get committed.
3614
3615         * UIProcess/ProvisionalPageProxy.cpp:
3616         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
3617         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
3618         (WebKit::ProvisionalPageProxy::connectionWillOpen):
3619         * UIProcess/ProvisionalPageProxy.h:
3620         * UIProcess/WebPageProxy.cpp:
3621         (WebKit::WebPageProxy::finishAttachingToWebProcess):
3622         (WebKit::WebPageProxy::connectionWillOpen):
3623         (WebKit::WebPageProxy::webProcessWillShutDown):
3624         (WebKit::WebPageProxy::processDidTerminate):
3625         * UIProcess/WebPageProxy.h:
3626         (WebKit::WebPageProxy::webProcessLifetimeTracker):
3627         * UIProcess/WebProcessLifetimeObserver.cpp:
3628         (WebKit::WebProcessLifetimeObserver::addWebPage):
3629         (WebKit::WebProcessLifetimeObserver::removeWebPage):
3630         * UIProcess/WebProcessLifetimeObserver.h:
3631         * UIProcess/WebProcessLifetimeTracker.cpp:
3632         (WebKit::WebProcessLifetimeTracker::addObserver):
3633         (WebKit::WebProcessLifetimeTracker::webPageEnteringWebProcess):
3634         (WebKit::WebProcessLifetimeTracker::webPageLeavingWebProcess):
3635         (WebKit::WebProcessLifetimeTracker::pageWasInvalidated):
3636         (WebKit::WebProcessLifetimeTracker::processIsRunning):
3637         * UIProcess/WebProcessLifetimeTracker.h:
3638         * UIProcess/WebProcessProxy.cpp:
3639         (WebKit::WebProcessProxy::connectionWillOpen):
3640         * UIProcess/WebStorage/StorageManager.cpp:
3641         (WebKit::StorageManager::SessionStorageNamespace::allowedConnections const):
3642         (WebKit::StorageManager::SessionStorageNamespace::addAllowedConnection):
3643         (WebKit::StorageManager::SessionStorageNamespace::removeAllowedConnection):
3644         (WebKit::StorageManager::addAllowedSessionStorageNamespaceConnection):
3645         (WebKit::StorageManager::removeAllowedSessionStorageNamespaceConnection):
3646         (WebKit::StorageManager::processWillOpenConnection):
3647         (WebKit::StorageManager::processDidCloseConnection):
3648         (WebKit::StorageManager::createSessionStorageMap):
3649         (WebKit::StorageManager::SessionStorageNamespace::allowedConnection const): Deleted.
3650         (WebKit::StorageManager::SessionStorageNamespace::setAllowedConnection): Deleted.
3651         (WebKit::StorageManager::setAllowedSessionStorageNamespaceConnection): Deleted.
3652         * UIProcess/WebStorage/StorageManager.h:
3653         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3654         (WebKit::WebsiteDataStore::webPageWillOpenConnection):
3655         (WebKit::WebsiteDataStore::webPageDidCloseConnection):
3656
3657 2019-02-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3658
3659         [iOS] Web pages shouldn't be able to present a keyboard after the web view resigns first responder
3660         https://bugs.webkit.org/show_bug.cgi?id=195118
3661         <rdar://problem/43411940>
3662
3663         Reviewed by Tim Horton.
3664
3665         It's currently possible for websites to redirect focus into an editable element on the page by programmatically
3666         requesting focus within the "blur" event handler. This is because our current heuristics:
3667
3668         (1) Allow programmatic focus to show the keyboard when an element is already focused; this is meant to handle
3669             the case where the page moves focus between different elements on the page.
3670         (2) And also allow programmatic focus to show the keyboard when changing activity state; this is meant to handle
3671             the case where a focused element should show the keyboard when first responder is restored on a web view
3672             (e.g. in the case where a modal view controller is dismissed, and the web view regains first responder once
3673             again).
3674
3675         In both of these scenarios, we actually only want the keyboard to appear if the web view itself is either
3676         becoming the first responder, or is already the first responder. Importantly, when blurring the focused element
3677         by calling -[WKWebViewe resignFirstResponder] (as is the case when dismissing the keyboard by tapping 'Done' or
3678         focusing other platform UI), we don't want to allow the page to show the keyboard due to element focus.
3679
3680         To fix this issue, we enforce that we're either becoming the first responder or already are the first responder
3681         before showing the keyboard due to activity state change or focused element change.
3682
3683         Test: fast/events/ios/do-not-show-keyboard-when-focusing-after-blur.html
3684
3685         * UIProcess/ios/WKContentViewInteraction.h:
3686         * UIProcess/ios/WKContentViewInteraction.mm:
3687         (-[WKContentView setupInteraction]):
3688         (-[WKContentView textInputTraits]):
3689
3690         Quick drive-by tweak: rename _isBlurringFocusedNode to _isBlurringFocusedElement, to match the rest of the
3691         terminology used in WebKit.
3692
3693         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3694
3695         Make our heuristics for determining whether to show the keyboard a tiny bit easier to follow, by moving the
3696         logic into a lambda function and using early returns. See above for more details.
3697
3698         (-[WKContentView _elementDidBlur]):
3699         (-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
3700
3701 2019-02-27  John Wilander  <wilander@apple.com>
3702
3703         Adopt WebCore::RegistrableDomain in WebCore::ResourceLoadStatistics and WebKit::NetworkProcessProxy
3704         https://bugs.webkit.org/show_bug.cgi?id=195071
3705         <rdar://problem/48417690>
3706
3707         Reviewed by Alex Christensen and Brent Fulgham.
3708
3709         This patch adopts WebCore::RegistrableDomain in WebKit::NetworkProcessProxy
3710         and makes the necessary infrastructure changes to support that.
3711
3712         The previous HashCountedSets in WebCore::ResourceLoadStatistics are now just
3713         HashSets since we never used the counts for anything. This change simplified
3714         the IPC::ArgumentCoder<ResourceLoadStatistics> encode and decode functions.
3715
3716         The patch also makes WebCore::RegistrableDomain's String constructor private.
3717         A new create function WebCore::RegistrableDomain::uncheckedCreateFromString()
3718         is introduced to better signal to users that creating a registrable domain
3719         object with a string may create an object that doesn't match a registrable
3720         domain in a valid HTTP-family URL.
3721
3722         Finally, this patch harmonizes parameter and variable naming, going from
3723         "origin" to "domain" and "mainFrame" to "topFrame."
3724
3725         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3726         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
3727         (WebKit::ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain const):
3728         (WebKit::ResourceLoadStatisticsMemoryStore::markAsPrevalentIfHasRedirectedToPrevalent):
3729         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccess):
3730         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal):
3731         (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
3732         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceLoading):
3733         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceRedirect):
3734         (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsSubresourceUnder const):
3735         (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsSubFrameUnder const):
3736         (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsRedirectingTo const):
3737         (WebKit::ResourceLoadStatisticsMemoryStore::setSubframeUnderTopFrameDomain):
3738         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUnderTopFrameDomain):
3739         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectTo):
3740         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectFrom):
3741         (WebKit::ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectTo):
3742         (WebKit::ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectFrom):
3743         (WebKit::ResourceLoadStatisticsMemoryStore::createEncoderFromData const):
3744         (WebKit::ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt):
3745         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUnexpiredRecentUserInteraction const):
3746         (WebKit::ResourceLoadStatisticsMemoryStore::setSubframeUnderTopFrameOrigin): Deleted.
3747         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUnderTopFrameOrigin): Deleted.
3748         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
3749         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3750         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted):
3751         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameDomain):
3752         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameDomain):
3753         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
3754         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin): Deleted.
3755         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin): Deleted.
3756         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3757         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp:
3758         (WebKit::sortedPrevalentResourceTelemetry):
3759         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3760         * NetworkProcess/NetworkProcess.cpp:
3761         (WebKit::NetworkProcess::setSubframeUnderTopFrameDomain):
3762         (WebKit::NetworkProcess::setSubresourceUnderTopFrameDomain):
3763         (WebKit::filterForRegistrableDomains):
3764         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
3765         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
3766         (WebKit::NetworkProcess::setSubframeUnderTopFrameOrigin): Deleted.
3767         (WebKit::NetworkProcess::setSubresourceUnderTopFrameOrigin): Deleted.
3768         * NetworkProcess/NetworkProcess.h:
3769         * NetworkProcess/NetworkProcess.messages.in:
3770         * NetworkProcess/NetworkSession.cpp:
3771         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
3772         * NetworkProcess/NetworkSession.h:
3773         * Platform/classifier/ResourceLoadStatisticsClassifier.cpp:
3774         (WebKit::ResourceLoadStatisticsClassifier::calculateResourcePrevalence):
3775         * Shared/WebCoreArgumentCoders.cpp:
3776         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
3777         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
3778         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3779         (WKWebsiteDataStoreSetStatisticsSubframeUnderTopFrameOrigin):
3780         (WKWebsiteDataStoreSetStatisticsSubresourceUnderTopFrameOrigin):
3781         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
3782         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
3783         * UIProcess/Network/NetworkProcessProxy.cpp:
3784         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
3785         (WebKit::NetworkProcessProxy::isPrevalentResource):
3786         (WebKit::NetworkProcessProxy::isVeryPrevalentResource):
3787         (WebKit::NetworkProcessProxy::setPrevalentResource):
3788         (WebKit::NetworkProcessProxy::setPrevalentResourceForDebugMode):
3789         (WebKit::NetworkProcessProxy::setVeryPrevalentResource):
3790         (WebKit::NetworkProcessProxy::setLastSeen):
3791         (WebKit::NetworkProcessProxy::clearPrevalentResource):
3792         (WebKit::NetworkProcessProxy::logUserInteraction):
3793         (WebKit::NetworkProcessProxy::hasHadUserInteraction):
3794         (WebKit::NetworkProcessProxy::clearUserInteraction):
3795         (WebKit::NetworkProcessProxy::setSubframeUnderTopFrameDomain):
3796         (WebKit::NetworkProcessProxy::isRegisteredAsRedirectingTo):
3797         (WebKit::NetworkProcessProxy::isRegisteredAsSubFrameUnder):
3798         (WebKit::NetworkProcessProxy::setSubresourceUnderTopFrameDomain):
3799         (WebKit::NetworkProcessProxy::isRegisteredAsSubresourceUnder):
3800         (WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectTo):
3801         (WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectFrom):
3802         (WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectTo):
3803         (WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectFrom):
3804         (WebKit::NetworkProcessProxy::isGrandfathered):
3805         (WebKit::NetworkProcessProxy::setGrandfathered):
3806         (WebKit::NetworkProcessProxy::hasStorageAccessForFrame):
3807         (WebKit::NetworkProcessProxy::hasStorageAccess):
3808         (WebKit::NetworkProcessProxy::requestStorageAccess):
3809         (WebKit::NetworkProcessProxy::requestStorageAccessConfirm):
3810         (WebKit::NetworkProcessProxy::grantStorageAccess):
3811         (WebKit::NetworkProcessProxy::setSubframeUnderTopFrameOrigin): Deleted.
3812         (WebKit::NetworkProcessProxy::setSubresourceUnderTopFrameOrigin): Deleted.
3813         * UIProcess/Network/NetworkProcessProxy.h:
3814         * UIProcess/Network/NetworkProcessProxy.messages.in:
3815         * UIProcess/WebPageProxy.cpp:
3816         (WebKit::WebPageProxy::requestStorageAccessConfirm):
3817         * UIProcess/WebPageProxy.h:
3818         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3819         (WebKit::WebsiteDataStore::isPrevalentResource):
3820         (WebKit::WebsiteDataStore::setPrevalentResource):
3821         (WebKit::WebsiteDataStore::setPrevalentResourceForDebugMode):
3822         (WebKit::WebsiteDataStore::isVeryPrevalentResource):
3823         (WebKit::WebsiteDataStore::setVeryPrevalentResource):
3824         (WebKit::WebsiteDataStore::setSubframeUnderTopFrameDomain):
3825         (WebKit::WebsiteDataStore::isRegisteredAsSubFrameUnder):
3826         (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameDomain):
3827         (WebKit::WebsiteDataStore::isRegisteredAsSubresourceUnder):
3828         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectTo):
3829         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectFrom):
3830         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectTo):
3831         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectFrom):
3832         (WebKit::WebsiteDataStore::isRegisteredAsRedirectingTo):
3833         (WebKit::WebsiteDataStore::clearPrevalentResource):
3834         (WebKit::WebsiteDataStore::setLastSeen):
3835         (WebKit::WebsiteDataStore::hasStorageAccess):
3836         (WebKit::WebsiteDataStore::requestStorageAccess):
3837         (WebKit::WebsiteDataStore::grantStorageAccess):
3838         (WebKit::WebsiteDataStore::logUserInteraction):
3839         (WebKit::WebsiteDataStore::hasHadUserInteraction):
3840         (WebKit::WebsiteDataStore::clearUserInteraction):
3841         (WebKit::WebsiteDataStore::setGrandfathered):
3842         (WebKit::WebsiteDataStore::setSubframeUnderTopFrameOrigin): Deleted.
3843         (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameOrigin): Deleted.
3844         * UIProcess/WebsiteData/WebsiteDataStore.h:
3845         * WebProcess/WebPage/WebPage.cpp:
3846         (WebKit::WebPage::hasStorageAccess):
3847         (WebKit::WebPage::requestStorageAccess):
3848
3849 2019-02-27  Keith Rollin  <krollin@apple.com>
3850
3851         Fix Xcode project UUIDs for TextCheckerCompletion.cpp and TextCheckerCompletion.h
3852         https://bugs.webkit.org/show_bug.cgi?id=195109
3853         <rdar://problem/48442272>
3854
3855         Reviewed by Alexey Proskuryakov.
3856
3857         In r144436, TextCheckerCompletion.cpp and TextCheckerCompletion.h were
3858         added to WebKit2.xcodeproj with invalid UUIDs (they included Q's and
3859         Z's in hexadecimal strings). While these UUIDs haven't caused any
3860         problems in practice over the last six years, they are indeed invalid,
3861         and were discovered via an Xcode-project processing tool that did not
3862         anticipate their format. Fix this by removing the files from the
3863         project and re-adding them.
3864
3865         * WebKit.xcodeproj/project.pbxproj:
3866
3867 2019-02-27  Youenn Fablet  <youenn@apple.com>
3868
3869         Remove UserMediaProcessManager processState map
3870         https://bugs.webkit.org/show_bug.cgi?id=195056
3871
3872         Reviewed by Eric Carlson.
3873
3874         Before the patch, the WebProcessProxy->ProcessState map was storing the list of manager proxies and process state.
3875         To improve on this model, this patch does the following:
3876         - Move the process state to WebProcessProxy.
3877         - Remove the map and replace it by a set of all manager proxies.
3878
3879         This simplifies the handling.
3880         On WebProcess side, instead of storing the sandbox extensions in each WebPage, we handle them in WebProcess directly.
3881         This mirrors what is being done in UIProcess and reduces the risk of inconsistencies between the two, the risk being that capture would fail.
3882
3883         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3884         (WebKit::UserMediaPermissionRequestManagerProxy::forEach):
3885         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy):
3886         (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
3887         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged):
3888         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
3889         * UIProcess/UserMediaProcessManager.cpp:
3890         (WebKit::UserMediaProcessManager::muteCaptureMediaStreamsExceptIn):
3891         (WebKit::UserMediaProcessManager::willCreateMediaStream):
3892         (WebKit::UserMediaProcessManager::endedCaptureSession):
3893         (WebKit::UserMediaProcessManager::setCaptureEnabled):
3894         (WebKit::UserMediaProcessManager::captureDevicesChanged):
3895         (WebKit::ProcessState::ProcessState): Deleted.
3896         (WebKit::ProcessState::hasVideoExtension const): Deleted.
3897         (WebKit::ProcessState::grantVideoExtension): Deleted.
3898         (WebKit::ProcessState::revokeVideoExtension): Deleted.
3899         (WebKit::ProcessState::hasAudioExtension const): Deleted.
3900         (WebKit::ProcessState::grantAudioExtension): Deleted.
3901         (WebKit::ProcessState::revokeAudioExtension): Deleted.