iOS Safari will not load USDZ in QLPreview when opening as BLOB
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-02-18  Dean Jackson  <dino@apple.com>
2
3         iOS Safari will not load USDZ in QLPreview when opening as BLOB
4         https://bugs.webkit.org/show_bug.cgi?id=194766
5         <rdar://problem/42769186>
6
7         Reviewed by Wenson Hsieh.
8
9         A download from a Blob URL can happen effectively instantly, which means
10         that the loadHandler on the registerItemForTypeIdentifier method might not have
11         been called yet, and we haven't been told what the completionHandler is.
12         In this case, keep a record of the URL we finished with, and call the completionHandler
13         right away.
14
15         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Add a new private member variable: _downloadedURL.
16         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]): Call the completionHandler
17         right away if we've finished.
18         (-[_WKPreviewControllerDataSource finish:]): Remember that we've finished by recording the URL.
19
20 2019-02-18  Alex Christensen  <achristensen@webkit.org>
21
22         Disable safe browsing in WKWebView and remove its WKPreferences API
23         https://bugs.webkit.org/show_bug.cgi?id=194723
24         <rdar://problem/48122993>
25
26         Reviewed by Geoffrey Garen.
27
28         * Shared/WebPreferences.yaml:
29         * UIProcess/API/Cocoa/WKPreferences.h:
30         * UIProcess/API/Cocoa/WKPreferences.mm:
31         (-[WKPreferences setSafeBrowsingEnabled:]): Deleted.
32         (-[WKPreferences isSafeBrowsingEnabled]): Deleted.
33
34 2019-02-18  Chris Fleizach  <cfleizach@apple.com>
35
36         AX: PSON: Going back from apple.com to search results, cannot interact with HTML content. Disabling Swap Processes on Cross-Site Navigation resolves the issue.
37         https://bugs.webkit.org/show_bug.cgi?id=194742
38
39         Reviewed by Chris Dumez.
40
41         Re-initialize the accessibility web process tokens when swapping processes.
42         Send page load notifications from the UIProcess instead of the WebProcess to improve reliability.
43
44         * UIProcess/mac/PageClientImplMac.mm:
45         (WebKit::PageClientImpl::didFinishLoadForMainFrame):
46         (WebKit::PageClientImpl::didFailLoadForMainFrame):
47         * WebProcess/WebPage/WebPage.cpp:
48         (WebKit::WebPage::reinitializeWebPage):
49         * WebProcess/WebPage/WebPage.h:
50         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
51         (WebKit::WebPage::platformReinitialize):
52         (WebKit::WebPage::platformDetach): Deleted.
53         (WebKit::WebPage::platformEditorState const): Deleted.
54         (WebKit::WebPage::updateAccessibilityTree): Deleted.
55         (WebKit::WebPage::performDefaultBehaviorForKeyEvent): Deleted.
56         (WebKit::WebPage::platformCanHandleRequest): Deleted.
57         (WebKit::WebPage::platformUserAgent const): Deleted.
58         (WebKit::WebPage::getCenterForZoomGesture): Deleted.
59         (WebKit::WebPage::setInputMethodState): Deleted.
60         (WebKit::WebPage::collapseSelectionInFrame): Deleted.
61         * WebProcess/WebPage/ios/WebPageIOS.mm:
62         (WebKit::WebPage::platformReinitialize):
63         * WebProcess/WebPage/mac/WebPageMac.mm:
64         (WebKit::WebPage::platformReinitialize):
65         * WebProcess/WebPage/win/WebPageWin.cpp:
66         (WebKit::WebPage::platformReinitialize):
67         * WebProcess/WebPage/wpe/WebPageWPE.cpp:
68         (WebKit::WebPage::platformReinitialize):
69
70 2019-02-18  Carlos Garcia Campos  <cgarcia@igalia.com>
71
72         [GTK] Crash while filling selection data during drag and drop
73         https://bugs.webkit.org/show_bug.cgi?id=194698
74
75         Reviewed by Michael Catanzaro.
76
77         I can't reproduce this, but it seems that m_draggingSelectionData is nullptr in fillDragData(). That can happen
78         when startDrag cancels a previous DND operation, because the new m_draggingSelectionData is set before the
79         current DND operation is cancelled, which sets it to nullptr.
80
81         * UIProcess/gtk/DragAndDropHandler.cpp:
82         (WebKit::DragAndDropHandler::startDrag): Finish the previous operation before setting m_draggingSelectionData.
83
84 2019-02-17  Youenn Fablet  <youenn@apple.com>
85
86         https://device.login.microsoftonline.com is hanging on STP75
87         https://bugs.webkit.org/show_bug.cgi?id=194734
88         <rdar://problem/47573830>
89
90         Reviewed by Jiewen Tan.
91
92         Make sure to only go the XPC route if SecKeyProxyStore has credentials.
93         Tested manually by going to the above website with and without the patch.
94         Load hangs without the patch and completes with the patch.
95
96         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
97         (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
98         * UIProcess/Authentication/cocoa/SecKeyProxyStore.h:
99         * UIProcess/Authentication/cocoa/SecKeyProxyStore.mm:
100         (WebKit::SecKeyProxyStore::initialize):
101
102 2019-02-17  David Kilzer  <ddkilzer@apple.com>
103
104         Unreviewed, rolling out r241620.
105
106         "Causes use-after-free crashes running layout tests with ASan and GuardMalloc."
107         (Requested by ddkilzer on #webkit.)
108
109         Reverted changeset:
110
111         "[WTF] Add environment variable helpers"
112         https://bugs.webkit.org/show_bug.cgi?id=192405
113         https://trac.webkit.org/changeset/241620
114
115 2019-02-15  Youenn Fablet  <youenn@apple.com>
116
117         NetworkDataTask should check its client before calling shouldCaptureExtraNetworkLoadMetrics
118         https://bugs.webkit.org/show_bug.cgi?id=194732
119
120         Reviewed by Geoffrey Garen.
121
122         NetworkDataTask may be kept alive if refing it after its NetworkLoad is gone.
123         This might happen for instance in DownloadManager or when checking for TLS certificates.
124         In that case, if the NetworkLoad gets destroyed, it clears the client of the NetworkDataTask.
125         To ensure that NetworkDataTask does not try to use its client, add a null check.
126
127         * NetworkProcess/NetworkDataTask.cpp:
128         (WebKit::NetworkDataTask::shouldCaptureExtraNetworkLoadMetrics const):
129
130 2019-02-15  Chris Dumez  <cdumez@apple.com>
131
132         [PSON] Allow tweaking WebProcess cache parameters via user defaults
133         https://bugs.webkit.org/show_bug.cgi?id=194731
134         <rdar://problem/48125377>
135
136         Reviewed by Geoffrey Garen.
137
138         Allow tweaking WebProcess cache parameters via user defaults like so:
139         $ defaults write com.apple.Safari WebProcessCacheCachedProcessLifetimeInSeconds 120
140         -> Cached processes will be evicted after 2 minutes (instead of 30)
141
142         $ defaults write com.apple.Safari WebProcessCacheClearingDelayAfterApplicationResignsActiveInSeconds 60
143         -> Web process cache will be cleared if Safari is no longer active for 1 minutes (instead of 5).
144
145         * SourcesCocoa.txt:
146         * UIProcess/Cocoa/WebProcessCacheCocoa.mm: Copied from Source/WebKit/UIProcess/WebProcessCache.h.
147         (WebKit::WebProcessCache::platformInitialize):
148         * UIProcess/WebProcessCache.cpp:
149         (WebKit::WebProcessCache::WebProcessCache):
150         (WebKit::WebProcessCache::platformInitialize):
151         * UIProcess/WebProcessCache.h:
152         * WebKit.xcodeproj/project.pbxproj:
153
154 2019-02-15  Chris Dumez  <cdumez@apple.com>
155
156         [PSON] Disable WebContent process cache on devices with less than 3GB of RAM
157         https://bugs.webkit.org/show_bug.cgi?id=194726
158         <rdar://problem/48126255>
159
160         Reviewed by Geoffrey Garen.
161
162         * UIProcess/WebProcessCache.cpp:
163         (WebKit::WebProcessCache::updateCapacity):
164
165 2019-02-15  Andy Estes  <aestes@apple.com>
166
167         [iOS] Stop setting a background color on the PDF host view
168         https://bugs.webkit.org/show_bug.cgi?id=194722
169         <rdar://48124152>
170
171         Reviewed by Wenson Hsieh.
172
173         PDFKit already sets a background color on this view, so there’s no need (and some harm) in
174         us doing it too.
175
176         * UIProcess/ios/WKPDFView.mm:
177         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
178
179 2019-02-15  Alex Christensen  <achristensen@webkit.org>
180
181         Update IPC code generator unit test expectations after r241611
182         https://bugs.webkit.org/show_bug.cgi?id=194678
183
184         * Scripts/webkit/LegacyMessages-expected.h:
185         * Scripts/webkit/Messages-expected.h:
186         * Scripts/webkit/MessagesSuperclass-expected.h:
187
188 2019-02-15  Ross Kirsling  <ross.kirsling@sony.com>
189
190         [WTF] Add environment variable helpers
191         https://bugs.webkit.org/show_bug.cgi?id=192405
192
193         Reviewed by Michael Catanzaro.
194
195         * NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
196         (main):
197         * Platform/unix/LoggingUnix.cpp:
198         (WebKit::logLevelString):
199         * Platform/win/LoggingWin.cpp:
200         (WebKit::logLevelString):
201         * PluginProcess/mac/PluginProcessMac.mm:
202         (WebKit::shouldCallRealDebugger):
203         * Shared/Plugins/unix/PluginSearchPath.cpp:
204         (WebKit::pluginsDirectories):
205         * Shared/glib/ProcessExecutablePathGLib.cpp:
206         (WebKit::findWebKitProcess):
207         * UIProcess/API/glib/WebKitSettings.cpp:
208         (webKitSettingsConstructed):
209         (webKitSettingsSetProperty):
210         * UIProcess/API/glib/WebKitWebContext.cpp:
211         (injectedBundleDirectory):
212         (webkitWebContextConstructed):
213         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
214         (webkitWebViewMaximizeWindow):
215         (webkitWebViewRestoreWindow):
216         * UIProcess/API/wpe/WPEView.cpp:
217         (WKWPE::m_backend):
218         * UIProcess/AuxiliaryProcessProxy.cpp:
219         (WebKit::AuxiliaryProcessProxy::getLaunchOptions):
220         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
221         (WebKit::XDGDBusProxyLauncher::launch):
222         (WebKit::bindDBusSession):
223         (WebKit::bindX11):
224         (WebKit::bindWayland):
225         (WebKit::bindPulse):
226         (WebKit::bindPathVar):
227         (WebKit::bindGStreamerData):
228         (WebKit::bubblewrapSpawn):
229         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
230         (WebKit::ProcessLauncher::launchProcess):
231         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
232         (WebKit::systemDirectoryPath):
233         (WebKit::ProcessLauncher::launchProcess):
234         * UIProcess/glib/WebProcessPoolGLib.cpp:
235         (WebKit::memoryPressureMonitorDisabled):
236         (WebKit::WebProcessPool::platformInitialize):
237         (WebKit::WebProcessPool::platformInitializeWebProcess):
238         * UIProcess/gtk/HardwareAccelerationManager.cpp:
239         (WebKit::HardwareAccelerationManager::HardwareAccelerationManager):
240         * WebProcess/EntryPoint/unix/WebProcessMain.cpp:
241         (main):
242         * WebProcess/gtk/WebProcessMainGtk.cpp:
243         * WebProcess/wpe/WebProcessMainWPE.cpp:
244         Utilize WTF::Environment where possible.
245
246 2019-02-15  Alex Christensen  <achristensen@webkit.org>
247
248         Add SPI version of WKPreferences.safeBrowsingEnabled
249         https://bugs.webkit.org/show_bug.cgi?id=194718
250         <rdar://problem/48122993>
251
252         Rubber-stamped by Brady Eidson.
253
254         * UIProcess/API/Cocoa/WKPreferences.mm:
255         (-[WKPreferences _isSafeBrowsingEnabled]):
256         (-[WKPreferences _setSafeBrowsingEnabled:]):
257         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
258
259 2019-02-15  Wenson Hsieh  <wenson_hsieh@apple.com>
260
261         [iOS] WKWebView callout bar is missing Change Writing Direction item
262         https://bugs.webkit.org/show_bug.cgi?id=190015
263         <rdar://problem/44810366>
264
265         Reviewed by Tim Horton.
266
267         Support -makeTextWritingDirectionLeftToRight: and -makeTextWritingDirectionRightToLeft: in WKWebView on iOS.
268         To match behavior in native UITextViews on iOS, we implement these methods by changing the *base* writing
269         direction, rather than the text writing direction (this is in contrast to macOS, which has different
270         NSResponder methods for changing the base writing direction as opposed to the text writing direction).
271
272         Additionally fixes the implementation of -makeTextWritingDirectionNatural:, which currently attempts to change
273         the text writing direction instead of the base writing direction.
274
275         * Platform/spi/ios/UIKitSPI.h:
276
277         Add a forward declaration for keyboards SPI to determine whether the user has an active RTL keyboard.
278
279         * Shared/EditorState.cpp:
280         (WebKit::EditorState::PostLayoutData::encode const):
281         (WebKit::EditorState::PostLayoutData::decode):
282         (WebKit::operator<<):
283         * Shared/EditorState.h:
284
285         Plumb the base writing direction to the UI process through EditorState.
286
287         * UIProcess/ios/WKContentViewInteraction.h:
288         * UIProcess/ios/WKContentViewInteraction.mm:
289         (-[WKContentView makeTextWritingDirectionNaturalForWebView:]):
290         (-[WKContentView makeTextWritingDirectionLeftToRightForWebView:]):
291         (-[WKContentView makeTextWritingDirectionRightToLeftForWebView:]):
292
293         Implement the new SPI (see above for more details).
294
295         (-[WKContentView canPerformActionForWebView:withSender:]):
296
297         Implement -canPerformAction: for LTR and RTL actions. To match existing UIWebView behavior, we only enable
298         these actions if either the base writing direction is RTL, or the user has an active RTL keyboard. This means,
299         for instance, that in the case where a user with only an English keyboard is editing LTR content, we would never
300         show an option to convert to RTL.
301
302         * WebProcess/WebPage/WebPage.cpp:
303         (WebKit::WebPage::editorState const):
304
305 2019-02-15  Alex Christensen  <achristensen@webkit.org>
306
307         Make WebPaymentCoordinatorProxy more robust and modern
308         https://bugs.webkit.org/show_bug.cgi?id=194678
309
310         Reviewed by Andy Estes.
311
312         Use WeakPtr instead of storing raw pointers in lambdas or the global activePaymentCoordinatorProxy to avoid UAF problems.
313         Call CompletionHandlers in all code paths to avoid hangs.
314         Use Delayed instead of LegacySync for synchronous messaging to progress towards removing LegacySync messages.
315
316         * Scripts/webkit/messages.py:
317         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
318         (WebKit::activePaymentCoordinatorProxy):
319         (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy):
320         (WebKit::WebPaymentCoordinatorProxy::availablePaymentNetworks):
321         (WebKit::WebPaymentCoordinatorProxy::canMakePayments):
322         (WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
323         (WebKit::WebPaymentCoordinatorProxy::didReachFinalState):
324         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
325         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
326         * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
327         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
328         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
329         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
330
331 2019-02-15  Youenn Fablet  <youenn@apple.com>
332
333         Make ServiceWorkerClientFetch closer to WebResourceLoader
334         https://bugs.webkit.org/show_bug.cgi?id=194651
335
336         Unreviewed, build fix for WPE.
337
338         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
339
340 2019-02-15  Chris Dumez  <cdumez@apple.com>
341
342         Regression(PSON) Navigating quickly back and forth can lead to getting 'about:blank' in the backforward list
343         https://bugs.webkit.org/show_bug.cgi?id=194717
344         <rdar://problem/47884404>
345
346         Reviewed by Brady Eidson.
347
348         When the client does a history navigation, the UIProcess sends a WebPage::GoToBackForwardItem IPC to the
349         WebProcess and the WebProcess sends a WebPageProxy::BackForwardGoToItem IPC back to the UIProcess to
350         update the current item in the BackForwardList. This means that there is a slight delay between the
351         point a client requests a history navigation and the point where the BackForwardList's current item gets
352         update. This delay is pre-existing behavior and not new to PSON.
353
354         However, with PSON enabled, if we decide to process-swap for the history navigation, we'll tell the
355         previous (committed) process to ignore the load and we ask a new (provisional) process to do the history
356         navigation. When the previous process receives the request to ignore the history navigation, it restores
357         the History's current item to the one previous the navigation, which sends a WebPageProxy::GoToBackForwardItem
358         IPC to the UIProcess to update the BackForwardList as well. In parallel, the new process starts the
359         history navigation and also sends a WebPageProxy::GoToBackForwardItem to update the BackForwardList's
360         current item as well. We end up with a race between the 2 GoToBackForwardItem IPC messages coming from
361         the old and new process. If the old process's message loses the race, we end up with the wrong current
362         history item getting set in the UIProcess. Later, when we commit the provisional load and try to suspend
363         the previous page, we would save the SuspendedPage on the *wrong* BackForwardList item. If one tries to
364         load this BackForwardList item later, we'll use its SuspendedPage and try to unsuspend it. However,
365         because the PageCache entry is saved on another HistoryItem than the one getting loaded in the WebProcess
366         side, we attempt to do a regular load instead of a PageCache restore. We end up failing the load because
367         pages cannot trigger new loads while in page cache. Because the load fails, we end up loading the
368         initial empty document and this is how we end up with 'about:blank' in the back forward list.
369
370         To address the issue, update WebPageProxy::backForwardGoToItem() to ignore messages from the old/committed
371         WebProcess when there is a pending provisional load. If the committed processes starts a legit new
372         load, it would clear any existing pending provisional load before attempting the call backForwardGoToItem().
373         As a result, ignoring such messages from the old processes when there is a pending provisional load is
374         safe.
375
376         In the future, we should probably move more of the history / backForwardList management to the UIProcess
377         to avoid this sort of issues. This would be a much larger refactoring though so I am going with this
378         simpler fix that is easily cherry-pickable for now.
379
380         * UIProcess/WebPageProxy.cpp:
381         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
382         (WebKit::WebPageProxy::continueNavigationInNewProcess):
383         (WebKit::WebPageProxy::backForwardGoToItem):
384
385 2019-02-15  Alex Christensen  <achristensen@webkit.org>
386
387         Update IPC code generator unit test expectations after r241595
388         https://bugs.webkit.org/show_bug.cgi?id=194679
389
390         * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
391         (WebKit::WebPage::didReceiveSyncWebPageMessage):
392         * Scripts/webkit/MessageReceiver-expected.cpp:
393         (WebKit::WebPage::didReceiveSyncMessage):
394
395 2019-02-15  Youenn Fablet  <youenn@apple.com>
396
397         Make ServiceWorkerClientFetch closer to WebResourceLoader
398         https://bugs.webkit.org/show_bug.cgi?id=194651
399
400         Reviewed by Alex Christensen.
401
402         The goal of this refactoring is to, at some point use the regular network process load path for service worker loads.
403         This should simplify things and allow less IPC exchanges, for instance in the case of fetch not handled by service worker.
404
405         Introduce two IPC messages for supporting redirect responses and allow the didReceiveResponse/continueDidReceiveResponse
406         handshake for navigation loads.
407
408         This makes ServiceWorker having to buffer load information for this particular case.
409
410         * NetworkProcess/NetworkProcess.cpp:
411         (WebKit::NetworkProcess::didReceiveFetchRedirectResponse):
412         (WebKit::NetworkProcess::didReceiveFetchResponse):
413         * NetworkProcess/NetworkProcess.h:
414         * NetworkProcess/NetworkProcess.messages.in:
415         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
416         (WebKit::WebSWServerConnection::continueDidReceiveFetchResponse):
417         (WebKit::WebSWServerConnection::didReceiveFetchRedirectResponse):
418         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
419         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
420         * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
421         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
422         (WebKit::ServiceWorkerClientFetch::start):
423         (WebKit::ServiceWorkerClientFetch::didReceiveRedirectResponse):
424         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
425         (WebKit::ServiceWorkerClientFetch::didReceiveData):
426         (WebKit::ServiceWorkerClientFetch::didFinish):
427         (WebKit::ServiceWorkerClientFetch::didFail):
428         (WebKit::ServiceWorkerClientFetch::didNotHandle):
429         (WebKit::ServiceWorkerClientFetch::cancel):
430         * WebProcess/Storage/ServiceWorkerClientFetch.h:
431         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in:
432         * WebProcess/Storage/WebSWClientConnection.cpp:
433         (WebKit::WebSWClientConnection::startFetch):
434         (WebKit::WebSWClientConnection::cancelFetch):
435         (WebKit::WebSWClientConnection::continueDidReceiveFetchResponse):
436         * WebProcess/Storage/WebSWClientConnection.h:
437         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
438         (WebKit::WebSWContextManagerConnection::continueDidReceiveFetchResponse):
439         (WebKit::WebSWContextManagerConnection::startFetch):
440         * WebProcess/Storage/WebSWContextManagerConnection.h:
441         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
442         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
443         (WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
444         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveRedirection):
445         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveResponse):
446         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
447         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish):
448         (WebKit::WebServiceWorkerFetchTaskClient::didFail):
449         (WebKit::WebServiceWorkerFetchTaskClient::didFinish):
450         (WebKit::WebServiceWorkerFetchTaskClient::continueDidReceiveResponse):
451         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
452
453 2019-02-15  Brian Burg  <bburg@apple.com>
454
455         [Mac] WebInspectorUI.framework does not need to be soft-linked anymore
456         https://bugs.webkit.org/show_bug.cgi?id=194411
457         <rdar://problem/47787614>
458
459         Reviewed by Joseph Pecoraro.
460
461         * Configurations/WebKit.xcconfig:
462         Conditionalize weak linking to WebInspectorUI.framework for Mac only.
463
464         * UIProcess/mac/WebInspectorProxyMac.mm:
465         (WebKit::WebInspectorProxy::inspectorPageURL):
466         (WebKit::WebInspectorProxy::inspectorTestPageURL):
467         (WebKit::WebInspectorProxy::inspectorBaseURL):
468         * WebProcess/WebPage/mac/WebInspectorUIMac.mm:
469         (WebKit::webInspectorUILocalizedStringsURL):
470         Rewrite uses of the bundle to exit early if bundle couldn't be loaded.
471
472 2019-02-15  Alex Christensen  <achristensen@webkit.org>
473
474         IPC code should support messages with both Delayed and WantsConnection attributes
475         https://bugs.webkit.org/show_bug.cgi?id=194679
476
477         Reviewed by Geoffrey Garen.
478
479         * Platform/IPC/HandleMessage.h:
480         (IPC::callMemberFunctionImpl):
481         (IPC::callMemberFunction):
482         (IPC::handleMessageDelayedWantsConnection):
483         * Scripts/webkit/messages.py:
484         * UIProcess/WebStorage/StorageManager.cpp:
485         (WebKit::StorageManager::getValues):
486         * UIProcess/WebStorage/StorageManager.h:
487         * UIProcess/WebStorage/StorageManager.messages.in:
488
489 2019-02-15  Commit Queue  <commit-queue@webkit.org>
490
491         Unreviewed, rolling out r241559 and r241566.
492         https://bugs.webkit.org/show_bug.cgi?id=194710
493
494         Causes layout test crashes under GuardMalloc (Requested by
495         ryanhaddad on #webkit).
496
497         Reverted changesets:
498
499         "[WTF] Add environment variable helpers"
500         https://bugs.webkit.org/show_bug.cgi?id=192405
501         https://trac.webkit.org/changeset/241559
502
503         "Unreviewed build fix for WinCairo Debug after r241559."
504         https://trac.webkit.org/changeset/241566
505
506 2019-02-15  Michael Catanzaro  <mcatanzaro@igalia.com>
507
508         [WPE][GTK] Defer sandboxing APIs to 2.26
509         https://bugs.webkit.org/show_bug.cgi?id=194274
510
511         Reviewed by Carlos Garcia Campos.
512
513         The web process sandbox has not been widely-tested yet, so we should defer the new APIs to
514         2.26.
515
516         * UIProcess/API/glib/WebKitWebContext.cpp:
517
518 2019-02-10  Darin Adler  <darin@apple.com>
519
520         Replace more uses of String::format with StringConcatenate (mostly non-Apple platform-specific cases)
521         https://bugs.webkit.org/show_bug.cgi?id=194487
522
523         Reviewed by Daniel Bates.
524
525         * NetworkProcess/NetworkProcess.cpp:
526         (WebKit::NetworkProcess::switchToNewTestingSession): Use makeString instead of String::format.
527         * NetworkProcess/soup/NetworkProcessSoup.cpp:
528         (WebKit::buildAcceptLanguages): Ditto.
529         * UIProcess/API/glib/IconDatabase.cpp:
530         (WebKit::IconDatabase::performURLImport): Ditto.
531         * UIProcess/gtk/InputMethodFilter.cpp:
532         (WebKit::InputMethodFilter::logConfirmCompositionForTesting): Ditto.
533         (WebKit::InputMethodFilter::logSetPreeditForTesting): Ditto.
534
535 2019-02-15  Truitt Savell  <tsavell@apple.com>
536
537         Unreviewed, rolling out r241564.
538
539         Caused 50+ Timeouts on Mac WK2, mostly in the http/ directory
540
541         Reverted changeset:
542
543         "[Mac] WebInspectorUI.framework does not need to be soft-
544         linked anymore"
545         https://bugs.webkit.org/show_bug.cgi?id=194411
546         https://trac.webkit.org/changeset/241564
547
548 2019-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
549
550         Unreviewed. Fix GTK+ build after r241556
551
552         I guess this is due to unified builds after a new file being added in r241556.
553
554         * UIProcess/API/C/WKAuthenticationDecisionListener.cpp:
555         * UIProcess/API/C/WKPage.cpp:
556
557 2019-02-14  Brent Fulgham  <bfulgham@apple.com>
558
559         REGRESSION (r240446): Storage Access API does not handle domains consistently
560         https://bugs.webkit.org/show_bug.cgi?id=194664
561
562         Reviewed by Alex Christensen.
563         
564         During my refactoring of the ResourceLoadStatistics code, I introduced two bugs:
565         (1) I neglected to be consistent in my use of 'primaryDomain', causing some Storage
566         Access API code paths to store approves under one domain (e.g., 'www.example.com'),
567         while checking status under the eTLD+1 (e.g., 'example.com'). The exact string matching
568         requirement caused these to get missed.
569
570         (2) I used a move operator before a final set of copies of domain names, leading to
571         some empty strings being passed to Storage Access API calls.
572
573         Both issues are corrected in this patch.
574
575         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
576         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode): Always make the
577         domain comply with our 'primaryDomain' logic.
578         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess): Ditto.
579         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted): Ditto.
580         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation): Ditto.
581         (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading): Ditto.
582         (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading): Ditto.
583         (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect): Ditto.
584         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction): Ditto.
585         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction): Ditto.
586         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction): Ditto.
587         (WebKit::WebResourceLoadStatisticsStore::setLastSeen): Ditto.
588         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource): Ditto.
589         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource): Ditto.
590         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource): Ditto.
591         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource): Ditto.
592         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder): Ditto.
593         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder): Ditto.
594         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo): Ditto.
595         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource): Ditto.
596         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered): Ditto.
597         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered): Ditto.
598         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin): Ditto.
599         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin): Ditto.
600         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo): Ditto.
601         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom): Ditto.
602         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo): Ditto.
603         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom): Ditto.
604         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
605         (WebKit::WebsiteDataStore::hasStorageAccess): Always make the
606         domain comply with our 'primaryDomain' logic.
607         (WebKit::WebsiteDataStore::requestStorageAccess): Ditto. Also make copy of domain
608         names before moving them to the completion handler.
609         (WebKit::WebsiteDataStore::grantStorageAccess): Ditto.
610         * WebProcess/WebPage/WebPage.cpp:
611         (WebKit::WebPage::hasStorageAccess):  Always make the domain comply with our
612         'primaryDomain' logic.
613         (WebKit::WebPage::requestStorageAccess): Ditto.
614
615 2019-02-14  Tim Horton  <timothy_horton@apple.com>
616
617         Fix the build.
618
619         * UIProcess/ios/WKDrawingView.mm:
620         (-[WKDrawingView renderedDrawing]):
621
622 2019-02-14  Youenn Fablet  <youenn@apple.com>
623
624         ASSERTION FAILED: m_caches.isEmpty() || !m_pendingInitializationCallbacks.isEmpty() in WebKit::CacheStorage::Caches::clearMemoryRepresentation()
625         https://bugs.webkit.org/show_bug.cgi?id=188393
626         <rdar://problem/43025665>
627
628         Reviewed by Alex Christensen.
629
630         In case Caches::dispose is called, clearMemoryRepresentation might be called if there is no active cache.
631         We also ensure to not clear the memory representation if there is any remaining removed cache.
632         Update the clearMemoryRepresentation assertion to take that into account.
633
634         In case a Caches is cleared twice, the clearMemoryRepresentation assertion will assert while it should not.
635         In that case m_storage is null the second time. Update the assertion accordingly.
636
637         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
638         (WebKit::CacheStorage::Caches::hasActiveCache const):
639         (WebKit::CacheStorage::Caches::dispose):
640         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
641         * NetworkProcess/cache/CacheStorageEngineCaches.h:
642
643 2019-02-14  Brian Burg  <bburg@apple.com>
644
645         [Mac] WebInspectorUI.framework does not need to be soft-linked anymore
646         https://bugs.webkit.org/show_bug.cgi?id=194411
647         <rdar://problem/47787614>
648
649         Reviewed by Joseph Pecoraro.
650
651         * Configurations/WebKit.xcconfig:
652         Conditionalize weak linking to WebInspectorUI.framework for Mac only.
653
654         * UIProcess/mac/WebInspectorProxyMac.mm:
655         (WebKit::WebInspectorProxy::inspectorPageURL):
656         (WebKit::WebInspectorProxy::inspectorTestPageURL):
657         (WebKit::WebInspectorProxy::inspectorBaseURL):
658         * WebProcess/WebPage/mac/WebInspectorUIMac.mm:
659         (WebKit::webInspectorUILocalizedStringsURL):
660         Rewrite uses of the bundle to exit early if bundle couldn't be loaded.
661
662 2019-02-14  Michael Catanzaro  <mcatanzaro@igalia.com>
663
664         [GTK] WebKitGTK+ -> WebKitGTK
665         https://bugs.webkit.org/show_bug.cgi?id=194658
666
667         Reviewed by Alex Christensen.
668
669         This renames WebKitGTK+ to WebKitGTK in a few user-visible places: the API documentation,
670         the pkg-config, and an error message.
671
672         In a couple places where it's exposed in WPE documentation, WPE is now mentioned, or the
673         reference to "WebKitGTK+" is changed to just "WebKit."
674
675         * UIProcess/API/glib/WebKitSettings.cpp:
676         (webkit_settings_class_init):
677         * UIProcess/API/glib/WebKitWebView.cpp:
678         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
679         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivateGtk.h:
680         * gtk/webkit2gtk-web-extension.pc.in:
681         * gtk/webkit2gtk.pc.in:
682
683 2019-02-14  Ross Kirsling  <ross.kirsling@sony.com>
684
685         [WTF] Add environment variable helpers
686         https://bugs.webkit.org/show_bug.cgi?id=192405
687
688         Reviewed by Michael Catanzaro.
689
690         * NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
691         (main):
692         * Platform/unix/EnvironmentUtilities.cpp:
693         (WebKit::EnvironmentUtilities::stripValuesEndingWithString):
694         * Platform/unix/LoggingUnix.cpp:
695         (WebKit::logLevelString):
696         * Platform/win/LoggingWin.cpp:
697         (WebKit::logLevelString):
698         * PluginProcess/mac/PluginProcessMac.mm:
699         (WebKit::shouldCallRealDebugger):
700         * Shared/Plugins/unix/PluginSearchPath.cpp:
701         (WebKit::pluginsDirectories):
702         * Shared/glib/ProcessExecutablePathGLib.cpp:
703         (WebKit::findWebKitProcess):
704         * UIProcess/API/glib/WebKitSettings.cpp:
705         (webKitSettingsConstructed):
706         (webKitSettingsSetProperty):
707         * UIProcess/API/glib/WebKitWebContext.cpp:
708         (injectedBundleDirectory):
709         (webkitWebContextConstructed):
710         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
711         (webkitWebViewMaximizeWindow):
712         (webkitWebViewRestoreWindow):
713         * UIProcess/API/wpe/WPEView.cpp:
714         (WKWPE::m_backend):
715         * UIProcess/AuxiliaryProcessProxy.cpp:
716         (WebKit::AuxiliaryProcessProxy::getLaunchOptions):
717         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
718         (WebKit::XDGDBusProxyLauncher::launch):
719         (WebKit::bindDBusSession):
720         (WebKit::bindX11):
721         (WebKit::bindWayland):
722         (WebKit::bindPulse):
723         (WebKit::bindPathVar):
724         (WebKit::bindGStreamerData):
725         (WebKit::bubblewrapSpawn):
726         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
727         (WebKit::ProcessLauncher::launchProcess):
728         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
729         (WebKit::systemDirectoryPath):
730         (WebKit::ProcessLauncher::launchProcess):
731         * UIProcess/glib/WebProcessPoolGLib.cpp:
732         (WebKit::memoryPressureMonitorDisabled):
733         (WebKit::WebProcessPool::platformInitialize):
734         (WebKit::WebProcessPool::platformInitializeWebProcess):
735         * UIProcess/gtk/HardwareAccelerationManager.cpp:
736         (WebKit::HardwareAccelerationManager::HardwareAccelerationManager):
737         * WebProcess/EntryPoint/unix/WebProcessMain.cpp:
738         (main):
739         * WebProcess/gtk/WebProcessMainGtk.cpp:
740         * WebProcess/wpe/WebProcessMainWPE.cpp:
741         Utilize WTF::Environment where possible.
742
743 2019-02-14  Jiewen Tan  <jiewen_tan@apple.com>
744
745         Handle _WKNavigationActionPolicyAllowWithoutTryingAppLink for LoadOptimizer
746         https://bugs.webkit.org/show_bug.cgi?id=194640
747         <rdar://problem/48064140>
748
749         Reviewed by Brent Fulgham.
750
751         * UIProcess/Cocoa/NavigationState.mm:
752         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
753
754 2019-02-14  Chris Dumez  <cdumez@apple.com>
755
756         [PSON] Introduce a WebContent Process cache
757         https://bugs.webkit.org/show_bug.cgi?id=194594
758         <rdar://problem/46793397>
759
760         Reviewed by Geoff Garen.
761
762         Introduce a WebContent Process cache to reduce the number of process launches when
763         process swap on navigation is enabled, and to reduce the power cost of the feature.
764
765         If a WebProcess loaded pages from a single registrable domain then it is eligible
766         for the cache. When process-swapping on navigation to a new registrable domain, we
767         now attempt to retrieve a process from the cache for the domain in question instead
768         of always launching a new one.
769
770         The WebProcess cache currently has the following attributes:
771         - It may contains 4 processes per GB of RAM the machine has, up to 30 processes.
772         - WebProcesses automatically get evicted from the cache after 30 minutes.
773         - If the application is no longer the active app, then the cache will get cleared
774           after 5 minutes.
775         - WebProcesses that are in the cache are reported as "(Cached)" in Activity Monitor.
776
777         The WebProcess cache is currently disabled by default and can by enabled by the
778         client via SPI.
779
780         * Shared/WebBackForwardListItem.cpp:
781         (WebKit::WebBackForwardListItem::WebBackForwardListItem):
782         * Shared/WebBackForwardListItem.h:
783         (WebKit::WebBackForwardListItem::lastProcessIdentifier const):
784         (WebKit::WebBackForwardListItem::setLastProcessIdentifier):
785         Add new lastProcessIdentifier data member that reflects which process this item
786         was last loaded in. It is normally identical to the identifier of the process
787         that created the item but it gets overriden in case of cross-site client-side
788         redirect, since a new process takes over the item in this case.
789
790         * Sources.txt:
791         Add new source file.
792
793         * UIProcess/API/APIProcessPoolConfiguration.cpp:
794         (API::ProcessPoolConfiguration::copy):
795         * UIProcess/API/APIProcessPoolConfiguration.h:
796         * UIProcess/API/C/WKContextConfigurationRef.cpp:
797         (WKContextConfigurationUsesWebProcessCache):
798         (WKContextConfigurationSetUsesWebProcessCache):
799         * UIProcess/API/C/WKContextConfigurationRef.h:
800         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
801         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
802         (-[_WKProcessPoolConfiguration setUsesWebProcessCache:]):
803         (-[_WKProcessPoolConfiguration usesWebProcessCache]):
804         Add new SPI to enable the WebProcess cache.
805
806         * UIProcess/API/Cocoa/WKProcessPool.mm:
807         (-[WKProcessPool _webProcessCountIgnoringPrewarmedAndCached]):
808         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
809         Add new SPI for testing which returns the number of WebProcesses ignoring
810         both prewarmed and cached ones.
811
812         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
813         (WebKit::WebProcessPool::registerNotificationObservers):
814         (WebKit::WebProcessPool::unregisterNotificationObservers):
815         Add application active state observers as the WebProcess cache gets cleared
816         when the application resigns active state for more than 5 minutes.
817
818         * UIProcess/ProvisionalPageProxy.cpp:
819         (WebKit::ProvisionalPageProxy::loadRequest):
820         When doing a load in a new process with the BackForwardList locked (i.e. client-side
821         redirect), make sure we update the last process identifier for the BackForwardListItem.
822         This is important because the logic in WebProcessPool::processForNavigation() relies on
823         this identifier to select which process to do the history navigation into, and we want
824         to do the load in the post-redirect process, not the pre-redirect one.
825
826         * UIProcess/WebPageProxy.cpp:
827         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
828         Tell the WebProcess whenever a main frame provisional load is started, providing the URL.
829
830         * UIProcess/WebProcessCache.cpp: Added.
831         (WebKit::WebProcessCache::WebProcessCache):
832         (WebKit::WebProcessCache::addProcess):
833         (WebKit::WebProcessCache::takeProcess):
834         (WebKit::WebProcessCache::updateMaximumSize):
835         (WebKit::WebProcessCache::clear):
836         (WebKit::WebProcessCache::setApplicationIsActive):
837         (WebKit::WebProcessCache::evictProcess):
838         (WebKit::WebProcessCache::CachedProcess::CachedProcess):
839         (WebKit::WebProcessCache::CachedProcess::~CachedProcess):
840         (WebKit::WebProcessCache::CachedProcess::takeProcess):
841         (WebKit::WebProcessCache::CachedProcess::evictionTimerFired):
842         * UIProcess/WebProcessCache.h: Added.
843         (WebKit::WebProcessCache::maximumSize):
844         (WebKit::WebProcessCache::size const):
845         (WebKit::WebProcessCache::CachedProcess::process):
846         Add process cache implementation.
847
848         * UIProcess/WebProcessPool.cpp:
849         (WebKit::m_webProcessCache):
850         WebProcessCache is stored on the WebProcessPool via m_webProcessCache data member.
851
852         (WebKit::WebProcessPool::~WebProcessPool):
853         Clear the WebProcess cache in the destructor.
854
855         (WebKit::WebProcessPool::setApplicationIsActive):
856         Notify the WebProcessCache whenever the application's active state changes.
857
858         (WebKit::WebProcessPool::createWebPage):
859         If the state of PSON changes via the experimental features menu, dynamically
860         update the WebProcessCache's size. This is needed because the cache is disabled
861         when PSON is disabled.
862
863         (WebKit::WebProcessPool::handleMemoryPressureWarning):
864         Clear the WebProcess cache on memory pressure.
865
866         (WebKit::WebProcessPool::processForNavigationInternal):
867         Query the WebProcessCache before attempting to create a new WebProcess for a cross-site
868         navigation.
869
870         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
871         This logic was split out of processForNavigationInternal() to reduce the size
872         of the method.
873
874         * UIProcess/WebProcessPool.h:
875         * UIProcess/WebProcessProxy.cpp:
876         (WebKit::WebProcessProxy::setIsInProcessCache):
877         Update the isInProcessCache flag on the WebProcessProxy and send an IPC to the WebContent
878         process so that it can update its name in Activity Monitor.
879         We also need to stop holding a strong reference to the WebProcessPool whenever the process
880         is in the cache, similarly to what we do for pre-warmed processes, given that such processes
881         should not keep the process pool alive.
882
883         (WebKit::WebProcessProxy::addExistingWebPage):
884         Assert that we never try to add a page to a cached process, it should be taken out of the
885         cache before use.
886
887         (WebKit::WebProcessProxy::hasProvisionalPageWithID const):
888         (WebKit::WebProcessProxy::isAllowedToUpdateBackForwardItem const):
889         (WebKit::WebProcessProxy::updateBackForwardItem):
890         In case of client-side redirects, the previous process would sometimes send an IPC causing
891         the UIProcess' backforward list item to get updated with the pre-redirect URL after we've
892         already redirected. This previously would be unlikely to occur because we do not suspend
893         client-redirect pages and their process would normally exit before getting a chance to send
894         the IPC. However, with the process cache, the bug became obvious as the process would stay
895         alive and send up the "bad" IPC. To address the issue, we now only let the IPC update the
896         item if the item's page is (still) associated with the process. In the future, we may want
897         to update the IPC so that it gets sent to the WebPageProxy instead of the WebProcessProxy.
898
899         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
900         If a cached WebProcess crashes, remove it from the cache so that we do not attempt to use
901         it for a load later.
902
903         (WebKit::WebProcessProxy::canBeAddedToWebProcessCache const):
904         Only cache WebProcesses that have loaded a single registrable domain. Also prevent caching
905         for service worker and inspector processes.
906
907         (WebKit::WebProcessProxy::maybeShutDown):
908         If the process is cacheable, add it to the cache instead of shutting it down right away.
909
910         (WebKit::WebProcessProxy::canTerminateAuxiliaryProcess):
911         Make sure we do not attempt to terminate a processes that is in the cache.
912
913         (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
914         Whenever a main frame provisional load starts, make sure we update the process's associated
915         registrable domain. nullopt indicates that there is no associated domain yet. Null string
916         indicates that the process is associated with several registrable domain and is therefore
917         not eligible for caching.
918
919         * UIProcess/WebProcessProxy.h:
920         (WebKit::WebProcessProxy::registrableDomain const):
921         (WebKit::WebProcessProxy::isInProcessCache const):
922         (WebKit::WebProcessProxy::provisionalPageCount const):
923         Add convenience getters.
924
925         * WebKit.xcodeproj/project.pbxproj:
926         Add new files to project.
927
928         * WebProcess/WebProcess.cpp:
929         (WebKit::WebProcess::setIsInProcessCache):
930         * WebProcess/WebProcess.h:
931         * WebProcess/WebProcess.messages.in:
932         * WebProcess/cocoa/WebProcessCocoa.mm:
933         (WebKit::WebProcess::updateProcessName):
934         Update the WebProcess' name in Activity Monitor whenever it goes into or out of the WebProcess
935         cache.
936
937 2019-02-14  Per Arne Vollan  <pvollan@apple.com>
938
939         [iOS] Open sandbox for certain calls.
940         https://bugs.webkit.org/show_bug.cgi?id=194626
941
942         Reviewed by Brent Fulgham.
943
944         Reporting shows that certain calls needs to be allowed in the sandbox.
945
946         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
947
948 2019-02-14  Chris Fleizach  <cfleizach@apple.com>
949
950         AX: ARIA Reflection was disabled in error
951         https://bugs.webkit.org/show_bug.cgi?id=194647
952         <rdar://problem/48068336>
953
954         Reviewed by Ryosuke Niwa.
955
956         * Shared/WebPreferences.yaml:
957
958 2019-02-14  Commit Queue  <commit-queue@webkit.org>
959
960         Unreviewed, rolling out r241486.
961         https://bugs.webkit.org/show_bug.cgi?id=194655
962
963         causing API failures in builds (Requested by ShawnRoberts on
964         #webkit).
965
966         Reverted changeset:
967
968         "[Cocoa] Media elements will restart network buffering just
969         before suspending"
970         https://bugs.webkit.org/show_bug.cgi?id=193691
971         https://trac.webkit.org/changeset/241486
972
973 2019-02-14  Youenn Fablet  <youenn@apple.com>
974
975         Do not add a caches to its engine if the salt cannot be initialized
976         https://bugs.webkit.org/show_bug.cgi?id=194604
977
978         Reviewed by Antti Koivisto.
979
980         This is a follow-up to https://bugs.webkit.org/show_bug.cgi?id=194588.
981         We should return early if initialize fails.
982
983         * NetworkProcess/cache/CacheStorageEngine.cpp:
984         (WebKit::CacheStorage::Engine::readCachesFromDisk):
985
986 2019-02-13  Carlos Garcia Campos  <cgarcia@igalia.com>
987
988         [GTK] Use a scrolled window for script alerts text
989         https://bugs.webkit.org/show_bug.cgi?id=184875
990
991         Reviewed by Michael Catanzaro.
992
993         To ensure long text doesn't make the dialog bigger.
994
995         * UIProcess/API/gtk/WebKitScriptDialogImpl.cpp:
996         (webkitScriptDialogImplConstructed): Use PANGO_ELLIPSIZE_END for the title and add a scrolled window for the body.
997         (webkitScriptDialogImplSetText): Helper function to set the dialog body, ensuring the scrolled window fills the
998         dialog available size.
999         (webkitScriptDialogImplNew): It now receives the maximum size and uses webkitScriptDialogImplSetText().
1000         * UIProcess/API/gtk/WebKitScriptDialogImpl.h:
1001         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
1002         (webkitWebViewScriptDialog): Pass the 80% of the web view size as the maximum size of script dialogs.
1003
1004 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
1005
1006         Crash in WKBundleFrameGetParentFrame when called inside didRemoveFrameFromHierarchy
1007         https://bugs.webkit.org/show_bug.cgi?id=194641
1008
1009         Reviewed by Geoffrey Garen.
1010
1011         Fixed the bug by adding a null check to WebFrame::parentFrame.
1012
1013         * WebProcess/WebPage/WebFrame.cpp:
1014         (WebKit::WebFrame::parentFrame const):
1015
1016 2019-02-13  Timothy Hatcher  <timothy@apple.com>
1017
1018         Allow some deprecations in WKDrawingView.
1019         https://bugs.webkit.org/show_bug.cgi?id=194636
1020
1021         Reviewed by Wenson Hsieh.
1022
1023         * UIProcess/ios/WKDrawingView.mm:
1024         (-[WKDrawingView PNGRepresentation]):
1025         (-[WKDrawingView loadDrawingFromPNGRepresentation:]):
1026         (-[WKDrawingView _canvasViewWillBeginDrawing:]):
1027         (-[WKDrawingView didChangeInk:]):
1028
1029 2019-02-13  Jer Noble  <jer.noble@apple.com>
1030
1031         [Cocoa] Media elements will restart network buffering just before suspending
1032         https://bugs.webkit.org/show_bug.cgi?id=193691
1033
1034         Reviewed by Eric Carlson.
1035
1036         When the WebProcess receives a notification that the process is about to become
1037         suspended, it tells the MemoryPressureHandler to release all critical memory. This
1038         has the side effect of causing AVFoundation-backed media elements to dump their
1039         in-memory caches and start downloading media data again. Instead, media elements
1040         should all stop buffering media data during suspension. Add new testing SPI to
1041         simulate suspension and resume messages.
1042
1043         * UIProcess/API/Cocoa/WKWebView.mm:
1044         (-[WKWebView _processWillSuspendImminentlyForTesting]):
1045         (-[WKWebView _processDidResumeForTesting]):
1046         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1047         * UIProcess/WebProcessProxy.h:
1048         * UIProcess/ios/WKInkPickerView.mm:
1049         * WebProcess/WebPage/WebPage.cpp:
1050         (WebKit::WebPage::suspendAllMediaBuffering):
1051         (WebKit::WebPage::resumeAllMediaBuffering):
1052         * WebProcess/WebPage/WebPage.h:
1053         * WebProcess/WebProcess.cpp:
1054         (WebKit::WebProcess::actualPrepareToSuspend):
1055         (WebKit::WebProcess::cancelPrepareToSuspend):
1056         (WebKit::WebProcess::processDidResume):
1057         (WebKit::WebProcess::suspendAllMediaBuffering):
1058         (WebKit::WebProcess::resumeAllMediaBuffering):
1059         * WebProcess/WebProcess.h:
1060
1061 2019-02-13  Per Arne Vollan  <pvollan@apple.com>
1062
1063         [iOS] Fix sandbox violation during media playback
1064         https://bugs.webkit.org/show_bug.cgi?id=194616
1065         <rdar://problem/48049264>
1066
1067         Reviewed by Brent Fulgham.
1068
1069         Mach lookup to "com.apple.coremedia.figcontentkeysession.xpc" should be allowed.
1070
1071         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1072
1073 2019-02-13  Tim Horton  <timothy_horton@apple.com>
1074
1075         Encrypted PDFs inside <embed> or <object> crash the Web Content process
1076         https://bugs.webkit.org/show_bug.cgi?id=194605
1077         <rdar://problem/19894818>
1078
1079         Reviewed by Andy Estes.
1080
1081         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1082         (WebKit::PDFPlugin::createPasswordEntryForm):
1083         Don't try to create a password form field if we can't make form fields.
1084
1085         This means you will be left with a useless embedded PDF, but at least
1086         the Web Content process won't crash.
1087
1088         We'll need to find an alternative implementation of PDF embedded form
1089         fields that is compatible with <embed> and <object> if we want to support
1090         this. Currently we piggy-back off the fact that we can just insert
1091         <input>s into the PluginDocument's DOM, but we can't do that if there
1092         is no PluginDocument, just a main document, like in the <embed> case.
1093
1094 2019-02-12  Jiewen Tan  <jiewen_tan@apple.com>
1095
1096         Further restricting webarchive loads
1097         https://bugs.webkit.org/show_bug.cgi?id=194567
1098         <rdar://problem/47610130>
1099
1100         Reviewed by Youenn Fablet.
1101
1102         * WebProcess/WebPage/WebPage.cpp:
1103         (WebKit::WebPage::loadRequest):
1104         Set a flag to indicate a load is started from clients.
1105
1106 2019-02-13  Michael Catanzaro  <mcatanzaro@igalia.com>
1107
1108         [WPE][GTK] Merge WebProcessPoolWPE.cpp and WebProcessPoolGtk.cpp
1109         https://bugs.webkit.org/show_bug.cgi?id=194551
1110
1111         Reviewed by Carlos Garcia Campos.
1112
1113         * SourcesGTK.txt:
1114         * SourcesWPE.txt:
1115         * UIProcess/glib/WebProcessPoolGLib.cpp: Renamed from Source/WebKit/UIProcess/gtk/WebProcessPoolGtk.cpp.
1116         (WebKit::initializeRemoteInspectorServer):
1117         (WebKit::memoryPressureMonitorDisabled):
1118         (WebKit::WebProcessPool::platformInitialize):
1119         (WebKit::WebProcessPool::platformInitializeWebProcess):
1120         (WebKit::WebProcessPool::platformInvalidateContext):
1121         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
1122         * UIProcess/wpe/WebProcessPoolWPE.cpp: Removed.
1123
1124 2019-02-13  Michael Catanzaro  <mcatanzaro@igalia.com>
1125
1126         Fix -Wformat warning from r241401
1127         https://bugs.webkit.org/show_bug.cgi?id=194584
1128         <rdar://problem/47761293>
1129
1130         * WebProcess/WebPage/WebPage.cpp:
1131         (WebKit::WebPage::setActivityState):
1132
1133 2019-02-13  Youenn Fablet  <youenn@apple.com>
1134
1135         Make WebRTCUnifiedPlanEnabled true by default
1136         https://bugs.webkit.org/show_bug.cgi?id=194595
1137
1138         Reviewed by Eric Carlson.
1139
1140         * Shared/WebPreferences.yaml:
1141
1142 2019-02-13  John Wilander  <wilander@apple.com>
1143
1144         Store Ad Click Attribution requests in the network process
1145         https://bugs.webkit.org/show_bug.cgi?id=194510
1146         <rdar://problem/47650118>
1147
1148         Reviewed by Alex Christensen and Daniel Bates.
1149
1150         With this patch, WebPageProxy::didCommitLoadForFrame() now looks for
1151         an AdClickAttribution object in its navigation state. If there is an
1152         attribution, it sends it to the network process where the 
1153         WebKit::NetworkSession stores it in an object of a new class,
1154         WebKit::NetworkAdClickAttribution.
1155
1156         This patch also covers test infrastructure to support two new
1157         TestRunner functions:
1158         - dumpAdClickAttribution()
1159         - clearAdClickAttribution()
1160
1161         * NetworkProcess/Cookies/WebCookieManager.cpp:
1162             Added missing header include.
1163         * NetworkProcess/Downloads/DownloadManager.cpp:
1164             Added missing header include.
1165         * NetworkProcess/NetworkAdClickAttribution.cpp: Added.
1166         (WebKit::NetworkAdClickAttribution::ensureDestinationMapForSource):
1167         (WebKit::NetworkAdClickAttribution::store):
1168         (WebKit::NetworkAdClickAttribution::clear):
1169         (WebKit::NetworkAdClickAttribution::toString const):
1170         * NetworkProcess/NetworkAdClickAttribution.h: Added.
1171             Stores WebCore::AdClickAttribution objects in a map structure.
1172         * NetworkProcess/NetworkLoad.cpp:
1173             Added missing header includes.
1174         * NetworkProcess/NetworkProcess.cpp:
1175         (WebKit::NetworkProcess::storeAdClickAttribution):
1176         (WebKit::NetworkProcess::dumpAdClickAttribution):
1177         (WebKit::NetworkProcess::clearAdClickAttribution):
1178         * NetworkProcess/NetworkProcess.h:
1179         * NetworkProcess/NetworkProcess.messages.in:
1180         * NetworkProcess/NetworkSession.cpp:
1181         (WebKit::NetworkSession::NetworkSession):
1182         (WebKit::NetworkSession::storeAdClickAttribution):
1183         (WebKit::NetworkSession::dumpAdClickAttribution):
1184         (WebKit::NetworkSession::clearAdClickAttribution):
1185         * NetworkProcess/NetworkSession.h:
1186         * NetworkProcess/soup/RemoteNetworkingContextSoup.cpp:
1187             Added missing header include.
1188         * Sources.txt:
1189             Added NetworkProcess/NetworkAdClickAttribution.cpp.
1190         * UIProcess/API/APINavigation.h:
1191         (API::Navigation::adClickAttribution const):
1192         * UIProcess/API/C/WKPage.cpp:
1193         (WKPageDumpAdClickAttribution):
1194         (WKPageClearAdClickAttribution):
1195             Test infrastructure.
1196         * UIProcess/API/C/WKPagePrivate.h:
1197         * UIProcess/Network/NetworkProcessProxy.cpp:
1198         (WebKit::NetworkProcessProxy::dumpAdClickAttribution):
1199         (WebKit::NetworkProcessProxy::clearAdClickAttribution):
1200             Test infrastructure.
1201         * UIProcess/Network/NetworkProcessProxy.h:
1202         * UIProcess/WebPageProxy.cpp:
1203         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
1204             This is where pending Ad Click Attributions are forwarded to the
1205             network process.
1206         (WebKit::WebPageProxy::dumpAdClickAttribution):
1207         (WebKit::WebPageProxy::clearAdClickAttribution):
1208             Test infrastructure.
1209         * UIProcess/WebPageProxy.h:
1210         * UIProcess/WebProcessPool.cpp:
1211         (WebKit::WebProcessPool::dumpAdClickAttribution):
1212         (WebKit::WebProcessPool::clearAdClickAttribution):
1213             Test infrastructure.
1214         * UIProcess/WebProcessPool.h:
1215         * WebKit.xcodeproj/project.pbxproj:
1216         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1217         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1218             Added missing data copying from navigationAction to navigationActionData.
1219
1220 2019-02-13  Antti Koivisto  <antti@apple.com>
1221
1222         Crash in WebKit::CacheStorage::Engine::cachesRootPath
1223         https://bugs.webkit.org/show_bug.cgi?id=194588
1224         <rdar://problem/46363997>
1225
1226         Reviewed by Youenn Fablet.
1227
1228         * NetworkProcess/cache/CacheStorageEngine.cpp:
1229         (WebKit::CacheStorage::Engine::cachesRootPath):
1230
1231         Salt may have not been initialized yet when the Engine is destroyed.
1232
1233 2019-02-13  Alex Christensen  <achristensen@webkit.org>
1234
1235         Remove legacy sync messaging in some IPC code
1236         https://bugs.webkit.org/show_bug.cgi?id=194561
1237
1238         Reviewed by Geoffrey Garen.
1239
1240         Changing some LegacySync messages to Delayed messages.  We should probably rename Delayed to Sync.
1241         There are too many ways to send messages.  Let's work to get rid of the old one.
1242
1243         * NetworkProcess/NetworkProcess.cpp:
1244         (WebKit::NetworkProcess::setAllowsAnySSLCertificateForWebSocket):
1245         (WebKit::NetworkProcess::processWillSuspendImminently):
1246         * NetworkProcess/NetworkProcess.h:
1247         * NetworkProcess/NetworkProcess.messages.in:
1248         * PluginProcess/PluginControllerProxy.cpp:
1249         (WebKit::PluginControllerProxy::handleWheelEvent):
1250         (WebKit::PluginControllerProxy::handleMouseEnterEvent):
1251         (WebKit::PluginControllerProxy::handleMouseLeaveEvent):
1252         (WebKit::PluginControllerProxy::handleKeyboardEvent):
1253         (WebKit::PluginControllerProxy::handleEditingCommand):
1254         (WebKit::PluginControllerProxy::isEditingCommandEnabled):
1255         (WebKit::PluginControllerProxy::handlesPageScaleFactor):
1256         (WebKit::PluginControllerProxy::requiresUnifiedScaleFactor):
1257         (WebKit::PluginControllerProxy::paintEntirePlugin):
1258         (WebKit::PluginControllerProxy::supportsSnapshotting):
1259         (WebKit::PluginControllerProxy::snapshot):
1260         (WebKit::PluginControllerProxy::getPluginScriptableNPObject):
1261         (WebKit::PluginControllerProxy::getFormValue):
1262         * PluginProcess/PluginControllerProxy.h:
1263         * PluginProcess/PluginControllerProxy.messages.in:
1264         * Shared/Plugins/NPObjectMessageReceiver.cpp:
1265         (WebKit::NPObjectMessageReceiver::deallocate):
1266         (WebKit::NPObjectMessageReceiver::hasMethod):
1267         (WebKit::NPObjectMessageReceiver::invoke):
1268         (WebKit::NPObjectMessageReceiver::invokeDefault):
1269         (WebKit::NPObjectMessageReceiver::hasProperty):
1270         (WebKit::NPObjectMessageReceiver::getProperty):
1271         (WebKit::NPObjectMessageReceiver::setProperty):
1272         (WebKit::NPObjectMessageReceiver::removeProperty):
1273         (WebKit::NPObjectMessageReceiver::enumerate):
1274         (WebKit::NPObjectMessageReceiver::construct):
1275         * Shared/Plugins/NPObjectMessageReceiver.h:
1276         * Shared/Plugins/NPObjectMessageReceiver.messages.in:
1277         * UIProcess/mac/SecItemShimProxy.cpp:
1278         (WebKit::SecItemShimProxy::secItemRequest):
1279         * UIProcess/mac/SecItemShimProxy.h:
1280         * UIProcess/mac/SecItemShimProxy.messages.in:
1281
1282 2019-02-13  Truitt Savell  <tsavell@apple.com>
1283
1284         Unreviewed, rolling out r241433.
1285
1286         Broke internal builds.
1287
1288         Reverted changeset:
1289
1290         "Move
1291         UIWebTouchEventsGestureRecognizer.activeTouchesByIdentifier to
1292         SPI"
1293         https://bugs.webkit.org/show_bug.cgi?id=194531
1294         https://trac.webkit.org/changeset/241433
1295
1296 2019-02-12  Antoine Quint  <graouts@apple.com>
1297
1298         Move UIWebTouchEventsGestureRecognizer.activeTouchesByIdentifier to SPI
1299         https://bugs.webkit.org/show_bug.cgi?id=194531
1300         <rdar://problem/47714562>
1301
1302         Reviewed by Dean Jackson.
1303
1304         * Platform/spi/ios/UIKitSPI.h:
1305         * UIProcess/ios/WKContentViewInteraction.mm:
1306         (-[WKContentView cancelPointersForGestureRecognizer:]): We update the referenced Radar since we need to keep the call
1307         to respondsToSelector until the SPI has shipped for OpenSource builds to work.
1308
1309 2019-02-13  Antoine Quint  <graouts@apple.com>
1310
1311         Support simulated mouse events on iOS based on a PlatformTouchEvent
1312         https://bugs.webkit.org/show_bug.cgi?id=194501
1313         <rdar://problem/46910790>
1314
1315         Reviewed by Dean Jackson.
1316
1317         Add two new internal runtime flags to control whether simulated mouse events should be dipatched along with touch events and whether
1318         simulated mousemove events dispatched should automatically trigger the behavior preventDefault() would also trigger. We also ensure
1319         that we correctly create touch tracking regions for mouse events.
1320
1321         * Shared/WebPreferences.yaml:
1322         * UIProcess/WebPageProxy.cpp:
1323         (WebKit::WebPageProxy::updateTouchEventTracking):
1324
1325 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
1326
1327         Crash in Page::setActivityState because m_page is null
1328         https://bugs.webkit.org/show_bug.cgi?id=194584
1329
1330         Reviewed by Antti Koivisto.
1331
1332         Add a null check to avoid the crash. Also add a debug assertion to help diagnose this in the future.
1333
1334         * WebProcess/WebPage/WebPage.cpp:
1335         (WebKit::WebPage::setActivityState):
1336
1337 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
1338
1339         Release assert in PolicyCheckIdentifier::isValidFor via WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction
1340         https://bugs.webkit.org/show_bug.cgi?id=194582
1341
1342         Reviewed by Antti Koivisto.
1343
1344         The bug was caused by WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction invoking the callback
1345         with responseIdentifier even when we had failed to send the policy check IPC. Clearly, responseIdentifier
1346         is invalid in that case, and we should be using requestIdentifier instead.
1347
1348         Unfortunately no new tests since I'm not aware of a way to make sendSync fail in this case.
1349
1350         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1351         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1352
1353 2019-02-13  Benjamin Poulain  <benjamin@webkit.org>
1354
1355         Responsiveness timers are too expensive for frequent events
1356         https://bugs.webkit.org/show_bug.cgi?id=194003
1357
1358         Reviewed by Geoffrey Garen.
1359
1360         With each event, we set a responsivness timer to check if the WebProcess
1361         is responsive, and reset the timer when the WebProcess sends an answer.
1362
1363         For frequent events (e.g. wheel events, mouse force events, etc),
1364         we are spamming the kernel with hundreds of timers per second.
1365         That is a bit inefficient.
1366
1367         Another source of inefficiency comes from the timer implementation
1368         itself. Stopping a RunLoop::Timer removes the timer from every mode
1369         and invalidate the timer. It becomes costly since we do it a lot.
1370
1371         With this patch, I tweak ResponsivenessTimer and its use to minimize
1372         how often we schedule system timers.
1373
1374         The first change is to not stop the timer when we get the stop()
1375         calls if we expect more events to come in. Instead, we keep track
1376         if we care about the timeout or not in the attribute "m_waitingForTimer".
1377         When the next event starts, we can reschedule the timer without ever
1378         having told the kernel about the stop.
1379         If there are no next events, the timeout fires but m_waitingForTimer
1380         is false. To avoid idle wake up, the lazy stop is only used when having
1381         following events is common.
1382
1383         The second improvements comes from not even rescheduling the timer
1384         when restarted. Instead of changing the timer, we let the original timer
1385         fire and re-shedule a new one with the missing time.
1386
1387         For more context, also see patches r240759 and r240944.
1388
1389         * UIProcess/ResponsivenessTimer.cpp:
1390         (WebKit::ResponsivenessTimer::ResponsivenessTimer):
1391         (WebKit::ResponsivenessTimer::invalidate):
1392         (WebKit::ResponsivenessTimer::timerFired):
1393         (WebKit::ResponsivenessTimer::start):
1394         (WebKit::ResponsivenessTimer::startWithLazyStop):
1395         (WebKit::ResponsivenessTimer::stop):
1396         (WebKit::ResponsivenessTimer::processTerminated):
1397         (WebKit::ResponsivenessTimer::~ResponsivenessTimer): Deleted.
1398         * UIProcess/ResponsivenessTimer.h:
1399         (WebKit::ResponsivenessTimer::hasActiveTimer const):
1400         * UIProcess/WebPageProxy.cpp:
1401         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
1402         (WebKit::WebPageProxy::sendWheelEvent):
1403         (WebKit::WebPageProxy::handleKeyboardEvent):
1404         (WebKit::WebPageProxy::handleGestureEvent):
1405         * UIProcess/WebProcessProxy.cpp:
1406         (WebKit::WebProcessProxy::isResponsiveWithLazyStop):
1407         * UIProcess/WebProcessProxy.h:
1408
1409 2019-02-12  Tim Horton  <timothy_horton@apple.com>
1410
1411         Null deref in userInterfaceLayoutDirection under ViewGestureController::handleSwipeGesture
1412         https://bugs.webkit.org/show_bug.cgi?id=194569
1413         <rdar://problem/46711049>
1414
1415         Reviewed by Wenson Hsieh.
1416
1417         * UIProcess/mac/ViewGestureControllerMac.mm:
1418         (WebKit::ViewGestureController::handleSwipeGesture):
1419         It is conceivable that we could get here if the client closes the page
1420         e.g. in the callback from willEndSwipeGesture. We already guarded against
1421         this ... one line too late! Rearrange the lines so we don't call into
1422         WebPageProxy at all if we don't have a drawing area (which is a strict subset
1423         of the time that isValid would return true). This is a speculative fix,
1424         since I can no longer reproduce the crash on demand.
1425
1426 2019-02-12  Youenn Fablet  <youenn@apple.com>
1427
1428         WebServiceWorkerProvider::handleFetch no longer needs a CachedResource parameter
1429         https://bugs.webkit.org/show_bug.cgi?id=194548
1430
1431         Reviewed by Alex Christensen.
1432
1433         * WebProcess/Network/WebLoaderStrategy.cpp:
1434         (WebKit::WebLoaderStrategy::scheduleLoad):
1435         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
1436         (WebKit::WebServiceWorkerProvider::handleFetch):
1437         * WebProcess/Storage/WebServiceWorkerProvider.h:
1438
1439 2019-02-12  Tim Horton  <timothy_horton@apple.com>
1440
1441         Remove WKLegacyPDFView
1442         https://bugs.webkit.org/show_bug.cgi?id=194559
1443
1444         Reviewed by Andy Estes.
1445
1446         * Platform/spi/ios/CorePDFSPI.h: Removed.
1447         * SourcesCocoa.txt:
1448         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
1449         (-[WKWebViewContentProviderRegistry initWithConfiguration:]):
1450         * UIProcess/ios/WKLegacyPDFView.h: Removed.
1451         * UIProcess/ios/WKLegacyPDFView.mm: Removed.
1452         * WebKit.xcodeproj/project.pbxproj:
1453
1454 2019-02-12  Chris Dumez  <cdumez@apple.com>
1455
1456         Regression(PSON) MESSAGE_CHECK() hit under WebPageProxy::didFailProvisionalLoadForFrameShared()
1457         https://bugs.webkit.org/show_bug.cgi?id=194568
1458         <rdar://problem/47944490>
1459
1460         Reviewed by Ryosuke Niwa.
1461
1462         When the provisional process crashes, it is unsafe to call ProvisionalPageProxy::cancel() because
1463         the WebProcessProxy clears its frame map as soon as the process crashes. Calling cancel() after
1464         that would call WebPageProxy::didFailProvisionalLoadForFrameShared(), which would try to look up
1465         the frame by ID and MESSAGE_CHECK() that the frame is not null. We would fail this check since
1466         the frame has been removed from the WebProcessProxy at this point.
1467
1468         * UIProcess/API/Cocoa/WKWebView.mm:
1469         (-[WKWebView _provisionalWebProcessIdentifier]):
1470         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1471         * UIProcess/WebPageProxy.cpp:
1472         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
1473         (WebKit::WebPageProxy::provisionalProcessDidTerminate):
1474
1475 2019-02-12  Per Arne Vollan  <pvollan@apple.com>
1476
1477         [iOS] Youtube fails to play.
1478         https://bugs.webkit.org/show_bug.cgi?id=194565
1479         <rdar://problem/47974770>
1480
1481         Reviewed by Geoffrey Garen.
1482
1483         This is caused by sandbox violations and was introduced in r240500.
1484
1485         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1486
1487 2019-02-12  Alex Christensen  <achristensen@webkit.org>
1488
1489         Remove firing assertion after r241317
1490         https://bugs.webkit.org/show_bug.cgi?id=194506
1491
1492         * WebProcess/Network/WebLoaderStrategy.cpp:
1493         (WebKit::WebLoaderStrategy::setDefersLoading):
1494         The creation of a PageGroupLoadDeferrer in Chrome.cpp tries to defer loading.
1495         See comments in Chrome::runJavaScriptAlert et al.
1496         This was necessary with WebKitLegacy, so keep it, but it doesn't need to do anything in modern WebKit.
1497
1498 2019-02-12  Tim Horton  <timothy_horton@apple.com>
1499
1500         Find on Page shouldn't zoom in on matches
1501         https://bugs.webkit.org/show_bug.cgi?id=194557
1502         <rdar://problem/42087017>
1503
1504         Reviewed by Wenson Hsieh.
1505
1506         * UIProcess/ios/SmartMagnificationController.h:
1507         * UIProcess/ios/SmartMagnificationController.messages.in:
1508         * UIProcess/ios/SmartMagnificationController.mm:
1509         (WebKit::SmartMagnificationController::scrollToRect):
1510         * WebProcess/WebPage/ios/FindControllerIOS.mm:
1511         (WebKit::FindController::updateFindIndicator):
1512         Only scroll to reveal the find result, do not zoom in.
1513
1514 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1515
1516         Allow pages to trigger programmatic paste from script on iOS
1517         https://bugs.webkit.org/show_bug.cgi?id=194271
1518         <rdar://problem/47808810>
1519
1520         Reviewed by Tim Horton.
1521
1522         Cancel the pending DOM paste access handler when the menu is about to hide, rather than when the hiding
1523         animation has completed. This ensures that if the page (on behalf of the user) requests DOM paste again during
1524         user interaction before the callout bar has finished fading after the previous DOM paste, we won't automatically
1525         cancel the incoming DOM paste access request because the callout bar animation finished.
1526
1527         This scenario is exercised in the layout test editing/pasteboard/ios/dom-paste-consecutive-confirmations.html.
1528
1529         * Platform/spi/ios/UIKitSPI.h:
1530         * UIProcess/ios/WKContentViewInteraction.mm:
1531         (-[WKContentView setupInteraction]):
1532         (-[WKContentView _willHideMenu:]):
1533         (-[WKContentView _didHideMenu:]):
1534
1535 2019-02-12  Chris Fleizach  <cfleizach@apple.com>
1536
1537         AX: IsolatedTree: Implement more attributes
1538         https://bugs.webkit.org/show_bug.cgi?id=193911
1539         <rdar://problem/47599217>
1540
1541         Reviewed by Daniel Bates.
1542
1543         * Platform/spi/mac/AccessibilityPrivSPI.h: Added.
1544         * WebKit.xcodeproj/project.pbxproj:
1545         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.h:
1546         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
1547         (-[WKAccessibilityWebPageObjectBase clientSupportsIsolatedTree]):
1548         (-[WKAccessibilityWebPageObjectBase isolatedTreeRootObject]):
1549         (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
1550         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
1551         (-[WKAccessibilityWebPageObject IGNORE_WARNINGS_END]):
1552         (-[WKAccessibilityWebPageObject convertScreenPointToRootView:]):
1553         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):
1554         (-[WKAccessibilityWebPageObject accessibilityAttributeSizeValue]):
1555         (-[WKAccessibilityWebPageObject accessibilityAttributePositionValue]):
1556         (-[WKAccessibilityWebPageObject accessibilityDataDetectorValue:point:]):
1557         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]):
1558         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
1559
1560 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1561
1562         Allow pages to trigger programmatic paste from script on iOS
1563         https://bugs.webkit.org/show_bug.cgi?id=194271
1564         <rdar://problem/47808810>
1565
1566         Reviewed by Ryosuke Niwa.
1567
1568         * Shared/WebPreferences.yaml:
1569         * Shared/WebPreferencesDefaultValues.h:
1570
1571         Add an internal setting to enable or disable DOM paste access requests. This is on by default in iOS only
1572         (excluding watchOS and Apple TV), and is additionally disabled on macOS.
1573
1574         * UIProcess/API/gtk/PageClientImpl.cpp:
1575         (WebKit::PageClientImpl::requestDOMPasteAccess):
1576         * UIProcess/API/gtk/PageClientImpl.h:
1577         * UIProcess/API/wpe/PageClientImpl.cpp:
1578         (WebKit::PageClientImpl::requestDOMPasteAccess):
1579
1580         Plumb DOM paste access requests from the web process (WebEditorClient) to the view (WKContentView). As per the
1581         usual, this involves WebEditorClient, WebPage, WebPageProxy, PageClient and finally WKContentView.
1582
1583         * UIProcess/API/wpe/PageClientImpl.h:
1584         * UIProcess/PageClient.h:
1585         * UIProcess/WebPageProxy.cpp:
1586         (WebKit::WebPageProxy::requestDOMPasteAccess):
1587         * UIProcess/WebPageProxy.h:
1588         * UIProcess/WebPageProxy.messages.in:
1589         * UIProcess/ios/PageClientImplIOS.h:
1590         * UIProcess/ios/PageClientImplIOS.mm:
1591         (WebKit::PageClientImpl::requestDOMPasteAccess):
1592         * UIProcess/ios/WKContentViewInteraction.h:
1593         * UIProcess/ios/WKContentViewInteraction.mm:
1594         (-[WKContentView setupInteraction]):
1595         (-[WKContentView cleanupInteraction]):
1596         (-[WKContentView resignFirstResponderForWebView]):
1597         (-[WKContentView _webTouchEventsRecognized:]):
1598
1599         Bail from any pending DOM paste access handler the moment we start handling touches on the web view, or if the
1600         web view resigns first responder, or if the web process crashes.
1601
1602         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1603
1604         Reject text selection gestures while waiting for DOM paste access.
1605
1606         (-[WKContentView canPerformAction:withSender:]):
1607         (-[WKContentView canPerformActionForWebView:withSender:]):
1608
1609         If we're handling a DOM paste, always return YES to allow the callout bar to show the "Paste" option.
1610
1611         (-[WKContentView _didHideMenu:]):
1612
1613         If the menu is programmatically hidden by the app while handling a DOM paste request, immediately reject the DOM
1614         paste request.
1615
1616         (-[WKContentView pasteForWebView:]):
1617
1618         Adjust -pasteForWebView: on WKContentView to first check whether there's an outstanding DOM paste completion
1619         handler to invoke, instead of telling the page to execute a paste command.
1620
1621         (-[WKContentView _handleDOMPasteRequestWithResult:]):
1622
1623         Add a helper to take and invoke the current DOM paste completion handler (if it exists) with the given result,
1624         and then dismiss the shared callout bar. Returns whether or not the paste completion handler exists. Invoked
1625         from various sources of user interaction or significant state changes (e.g. following a web process crash in
1626         -cleanupInteraction).
1627
1628         (-[WKContentView _willPerformAction:sender:]):
1629         (-[WKContentView _didPerformAction:sender:]):
1630
1631         Add hooks to detect when WKContentView is executing an editing action. This is to ensure that the page doesn't
1632         get stuck in a bad state in the case where WKWebView has been subclassed, overrides `-paste:`, and does not
1633         invoke the superclass method (which calls back into `-[WKContentView pasteForWebView:]`). There are a few
1634         possibilities here:
1635         1. WKWebView's `-paste:` action is not overridden. In this case, we will call back into `-pasteForWebView:`,
1636            which will notice that we have a pending paste completion handler and invoke it.
1637         2. WKWebView's `-paste:` action is overridden and does not call back into the content view. In this case, we
1638            will invoke the paste completion handler in `-_didPerformAction:sender:`.
1639         3. WKWebView's `-canPerformAction:withSender:` is overridden to include additional actions. In this case, we may
1640            get a call to invoke a different action selector while waiting for a potential paste action. If this happens,
1641            prevent the DOM paste in `-_willPerformAction:sender:` prior to handling the other action.
1642
1643         (-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
1644
1645         Dismiss DOM paste UI upon handling any key event.
1646
1647         (-[WKContentView showGlobalMenuControllerInRect:]):
1648         (-[WKContentView hideGlobalMenuController]):
1649
1650         Helper methods to present and dismiss the global UIMenuController, that accounts for available platform APIs for
1651         presenting or dismissing the menu controller on iOS.
1652
1653         (-[WKContentView _requestDOMPasteAccessWithElementRect:completionHandler:]):
1654
1655         Attempt to find a good target presentation rect when showing the callout menu. First, we will try to use the
1656         rect of the element the user has interacted with when triggering the paste. If such an element is too large or
1657         does not exist, we fall back to presenting the callout menu near the user's last touch location (with a small
1658         amount of margin, such that the action doesn't overlap with the user's finger, stylus, etc.).
1659
1660         (-[WKContentView _resetShowingTextStyle:]): Deleted.
1661
1662         Rename this to `-_didHideMenu:`.
1663
1664         * UIProcess/mac/PageClientImplMac.h:
1665         * UIProcess/win/PageClientImpl.cpp:
1666         (WebKit::PageClientImpl::requestDOMPasteAccess):
1667         * UIProcess/win/PageClientImpl.h:
1668         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1669         (WebKit::WebEditorClient::requestDOMPasteAccess):
1670         * WebProcess/WebCoreSupport/WebEditorClient.h:
1671         * WebProcess/WebPage/WebPage.cpp:
1672         (WebKit::WebPage::requestDOMPasteAccess):
1673
1674         Add more plumbing and method stubs.
1675
1676         (WebKit::WebPage::updateCurrentModifierState):
1677         (WebKit::WebPage::rectForElementAtInteractionLocation const):
1678         * WebProcess/WebPage/WebPage.h:
1679         * WebProcess/WebPage/ios/WebPageIOS.mm:
1680         (WebKit::WebPage::rectForElementAtInteractionLocation const):
1681         (WebKit::WebPage::rectForElementAtInteractionLocation): Deleted.
1682
1683         Mark this method as const, add a platform-agnostic stub, and adopt it for the purposes of determining where to
1684         position the callout bar when pasting.
1685
1686 2019-02-12  Alex Christensen  <achristensen@webkit.org>
1687
1688         Remove setDefersLoading infrastructure from WebKit2
1689         https://bugs.webkit.org/show_bug.cgi?id=194506
1690
1691         Reviewed by Brady Eidson.
1692
1693         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1694         (WebKit::NetworkConnectionToWebProcess::setDefersLoading): Deleted.
1695         * NetworkProcess/NetworkConnectionToWebProcess.h:
1696         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1697         * NetworkProcess/NetworkDataTask.h:
1698         * NetworkProcess/NetworkDataTaskBlob.cpp:
1699         (WebKit::NetworkDataTaskBlob::suspend): Deleted.
1700         * NetworkProcess/NetworkDataTaskBlob.h:
1701         * NetworkProcess/NetworkLoad.cpp:
1702         (WebKit::NetworkLoad::initialize):
1703         (WebKit::NetworkLoad::setDefersLoading): Deleted.
1704         * NetworkProcess/NetworkLoad.h:
1705         * NetworkProcess/NetworkLoadParameters.h:
1706         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1707         (WebKit::NetworkResourceLoadParameters::encode const):
1708         (WebKit::NetworkResourceLoadParameters::decode):
1709         * NetworkProcess/NetworkResourceLoader.cpp:
1710         (WebKit::NetworkResourceLoader::start):
1711         (WebKit::NetworkResourceLoader::startNetworkLoad):
1712         (WebKit::NetworkResourceLoader::setDefersLoading): Deleted.
1713         * NetworkProcess/NetworkResourceLoader.h:
1714         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1715         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1716         (WebKit::NetworkDataTaskCocoa::suspend): Deleted.
1717         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
1718         (WebKit::NetworkDataTaskCurl::suspend): Deleted.
1719         * NetworkProcess/curl/NetworkDataTaskCurl.h:
1720         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1721         (WebKit::NetworkDataTaskSoup::suspend): Deleted.
1722         * NetworkProcess/soup/NetworkDataTaskSoup.h:
1723         * WebProcess/Network/WebLoaderStrategy.cpp:
1724         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1725         (WebKit::WebLoaderStrategy::setDefersLoading):
1726
1727 2019-02-12  Michael Catanzaro  <mcatanzaro@igalia.com>
1728
1729         Unreviewed, fix build warnings after content extensions enablement
1730         https://bugs.webkit.org/show_bug.cgi?id=193622
1731         <rdar://problem/47982850>
1732
1733         * UIProcess/API/C/WKUserContentExtensionStoreRef.cpp:
1734         (toResult):
1735
1736 2019-02-12  Tim Horton  <timothy_horton@apple.com>
1737
1738         Switching focus from a UITextField to an editable WKWebView causes the keyboard to dance
1739         https://bugs.webkit.org/show_bug.cgi?id=194524
1740         <rdar://problem/35481797>
1741
1742         Reviewed by Wenson Hsieh.
1743
1744         * Platform/spi/ios/UIKitSPI.h:
1745         * UIProcess/ios/InputViewUpdateDeferrer.h:
1746         * UIProcess/ios/InputViewUpdateDeferrer.mm:
1747         (WebKit::InputViewUpdateDeferrer::InputViewUpdateDeferrer):
1748         (WebKit::InputViewUpdateDeferrer::~InputViewUpdateDeferrer):
1749         Make use of the per-responder and much safer input view pinning mechanism.
1750
1751         * UIProcess/ios/WKContentViewInteraction.mm:
1752         (-[WKContentView becomeFirstResponderForWebView]):
1753         (-[WKContentView _singleTapCommited:]):
1754         (-[WKContentView _attemptClickAtLocation:modifierFlags:]):
1755         Always temporarily pin input views when becoming first responder; there are
1756         many paths (such as through the text interaction assistant) that can
1757         focus us on tap, trying to cover them all is a fool's errand. We'll
1758         just get out the big hammer and call it in becomeFirstResponder.
1759         This also means we can remove it from _singleTapCommitted and _attemptClick...
1760
1761         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1762         Don't release the input view pinning until we return from _elementDidFocus;
1763         it does the rebuilding synchronously, so we need to have actually updated
1764         all of the prerequisites of -inputView before depinning.
1765
1766 2019-02-12  Youenn Fablet  <youenn@apple.com>
1767
1768         Make use of is<SubresourceLoader>
1769         https://bugs.webkit.org/show_bug.cgi?id=194541
1770
1771         Reviewed by Alex Christensen.
1772
1773         * WebProcess/Network/WebLoaderStrategy.cpp:
1774         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1775
1776 2019-02-12  Alex Christensen  <achristensen@webkit.org>
1777
1778         WebPage::close needs to remove all message receivers associated with that WebPage, not WebPage::~WebPage
1779         https://bugs.webkit.org/show_bug.cgi?id=194522
1780         <rdar://problem/47789393>
1781
1782         Reviewed by Chris Dumez.
1783
1784         The InjectedBundle SPI can retain the WebPage or wrapping objects (WKWebProcessPlugInBrowserContextController/WKBundlePageRef).
1785         This can make it so WebPage::close is called before WebPage::~WebPage, and if the SuspendedPageProxy is reused for a subsequent
1786         navigation to the same domain, the WebProcess is reused with a different WebPage instance with the same PageID, which causes problems
1787         when another WebPage registers message handlers and then the previous WebPage is destroyed, which removes both message handlers.
1788
1789         * WebProcess/WebPage/WebPage.cpp:
1790         (WebKit::WebPage::~WebPage):
1791         (WebKit::WebPage::close):
1792         (WebKit::WebPage::mainFrameDidLayout):
1793         * WebProcess/WebPage/WebPage.h:
1794         * WebProcess/WebProcess.h:
1795         (WebKit::WebProcess::eventDispatcher):
1796
1797 2019-02-12  Michael Catanzaro  <mcatanzaro@igalia.com>
1798
1799         [WPE][GTK] Unsafe g_unsetenv() use in WebProcessPool::platformInitialize
1800         https://bugs.webkit.org/show_bug.cgi?id=194370
1801
1802         Reviewed by Darin Adler.
1803
1804         It is incorrect to use g_unsetenv() here because it is MT-Unsafe. We know that it is
1805         impossible and unreasonable to expect the application has not started other threads at this
1806         point, and threads will be calling getenv(). WebKit itself has probably already started
1807         threads of its own.
1808
1809         Fortunately, the remote inspector in the web process is already prepared to deal with
1810         failure to connect to the inspector server, so we don't need to do anything except stop
1811         messing with the environment.
1812
1813         Note these files are copies of each other. I'll merge them together in a follow-up patch.
1814
1815         * UIProcess/gtk/WebProcessPoolGtk.cpp:
1816         (WebKit::initializeRemoteInspectorServer):
1817         (WebKit::WebProcessPool::platformInitialize):
1818         * UIProcess/wpe/WebProcessPoolWPE.cpp:
1819         (WebKit::initializeRemoteInspectorServer):
1820         (WebKit::WebProcessPool::platformInitialize):
1821
1822 2019-02-08  Beth Dakin  <bdakin@apple.com>
1823
1824         Ensure old binaries have old snapshotting behaviors
1825         https://bugs.webkit.org/show_bug.cgi?id=194449
1826         -and corresponding-
1827         rdar://problem/47931954
1828
1829         Reviewed by Darin Adler.
1830
1831         Make sure that a nil configuration behaves the same way that it used to on apps 
1832         that were linked before FirstWithSnapshotAfterScreenUpdates
1833
1834         * UIProcess/API/Cocoa/WKWebView.mm:
1835         (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
1836         * UIProcess/Cocoa/VersionChecks.h:
1837
1838 2019-02-12  Andy Estes  <aestes@apple.com>
1839
1840         [iOSMac] Enable Parental Controls Content Filtering
1841         https://bugs.webkit.org/show_bug.cgi?id=194521
1842         <rdar://39732376>
1843
1844         Reviewed by Tim Horton.
1845
1846         * Configurations/FeatureDefines.xcconfig:
1847
1848 2019-02-11  Alex Christensen  <achristensen@webkit.org>
1849
1850         Remove noisy and unnecessary logs added in r241223
1851         https://bugs.webkit.org/show_bug.cgi?id=194427
1852
1853         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1854         (WebKit::ProcessLauncher::launchProcess):
1855         Errors occur all the time in the XPC connection's event handler, like when a process terminates.
1856         We don't need to print an "error" every time any process terminates.
1857
1858 2019-02-11  Brian Burg  <bburg@apple.com>
1859
1860         [Cocoa] Web Automation: client callbacks are not called if delegate does not override
1861         https://bugs.webkit.org/show_bug.cgi?id=194519
1862         <rdar://problem/47981961>
1863
1864         Reviewed by Joseph Pecoraro.
1865
1866         Call the completion handler directly if the delegate does not implement the relevant method.
1867
1868         * UIProcess/Cocoa/AutomationSessionClient.mm:
1869         (WebKit::AutomationSessionClient::requestNewPageWithOptions):
1870         (WebKit::AutomationSessionClient::requestSwitchToPage):
1871         (WebKit::AutomationSessionClient::requestHideWindowOfPage):
1872         (WebKit::AutomationSessionClient::requestRestoreWindowOfPage):
1873         (WebKit::AutomationSessionClient::requestMaximizeWindowOfPage):
1874
1875 2019-02-11  Daniel Bates  <dabates@apple.com>
1876
1877         [iOS] Adopt SPI to support Emacs bindings: transpose and delete to end of paragraph
1878         https://bugs.webkit.org/show_bug.cgi?id=194505
1879         <rdar://problem/47743533>
1880
1881         Reviewed by Tim Horton.
1882
1883         * UIProcess/ios/WKContentViewInteraction.mm:
1884         (-[WKContentView _deleteToEndOfParagraph]): Added.
1885         (-[WKContentView _transpose]): Added.
1886
1887 2019-02-11  Adrian Perez de Castro  <aperez@igalia.com>
1888
1889         [GTK][WPE] Add content extensions support in WKTR and unskip layout tests
1890         https://bugs.webkit.org/show_bug.cgi?id=193622
1891
1892         Reviewed by Michael Catanzaro.
1893
1894         * NetworkProcess/cache/NetworkCacheData.h: Define an adoptAndMapFile() implementation
1895         for GFileIOStream objects.
1896         * NetworkProcess/cache/NetworkCacheDataSoup.cpp:
1897         (WebKit::NetworkCache::adoptAndMapFile): Added implementation, which extracts the file
1898         descriptor from a GFileIOStream, as it inherits from GFileDescriptorBased, and then
1899         reuses the version of adoptAndMapFile() which takes a file descritor for the actual work.
1900         * NetworkProcess/NetworkLoadChecker.cpp:
1901         (Webkit::NetworkLoadChecker::checkRequest): Use "this" when referring to
1902         processContentExtensionRulesForLoad() in order to avoid ambiguity.
1903         * Sources.txt: Add WKUserContentExtensionStoreRef.cpp, all ports use it now.
1904         * SourcesCocoa.txt: Remove WKUserContentExtensionStoreRef.cpp, because it is not
1905         Cocoa-specific anymore.
1906         * SourcesGTK.txt: Add APIContentRuleListStoreGLib.cpp.
1907         * SourcesWPE.txt: Ditto.
1908         * UIProcess/API/C/WKUserContentExtensionStoreRef.cpp:
1909         (WKUserContentExtensionStoreCreate): Added.
1910         (toResult): Added.
1911         (WKUserContentExtensionStoreCompile): Added.
1912         (WKUserContentExtensionStoreLookup): Added.
1913         (WKUserContentExtensionStoreRemove): Added.
1914         * UIProcess/API/C/WKUserContentExtensionStoreRef.h: Add declarations for the new C API
1915         functions and for the WKUserContentExtensionStoreResult status enum.
1916         * UIProcess/API/glib/APIContentRuleListStoreGLib.cpp: Added.
1917         (API::ContentRuleListStore::defaultStorePath): Add a dummy implementation. The public API
1918         for the GLib based ports (GTK+ and WPE) will not allow using the default store and will
1919         always indicating a path.
1920
1921 2019-02-11  Daniel Bates  <dabates@apple.com>
1922
1923         [iOS] Mouse/Touch/Pointer events are missing modifier keys
1924         https://bugs.webkit.org/show_bug.cgi?id=191446
1925         <rdar://problem/45929460>
1926
1927         Reviewed by Tim Horton.
1928
1929         Make use of UIKit SPI to retreive the modifier flags when dispatching mouse and touch events.
1930         Add new WebKit SPI for iOS, -[WKNavigationAction modifierFlags], to retrieve the the modifier
1931         flags held when a navigation action was initiated.
1932
1933         * Platform/spi/ios/UIKitSPI.h: Expose SPI.
1934         * Shared/NativeWebTouchEvent.h: Re-arrange macro guards so that we can expose the helper function
1935         WebKit::webEventModifierFlags(). This is a bit more involved that usual since this header is included
1936         from both C++ and Objective-C source files. It only makes sense to expose this function when
1937         compiling as part of an Objective-C source file.
1938         * Shared/ios/NativeWebTouchEventIOS.mm:
1939         (WebKit::NativeWebTouchEvent::NativeWebTouchEvent): Modified to take the modifier flags held down
1940         when the platform touch event was received and pass them through to the base constructor.
1941         (WebKit::webEventModifierFlags): Added. Converts from the platform-speciifc UIKeyModifierFlags to
1942         OptionSet<WebKit::WebEvent::Modifier>.
1943         * Shared/ios/WebIOSEventFactory.h:
1944         * Shared/ios/WebIOSEventFactory.mm:
1945         (WebIOSEventFactory::toUIKeyModifierFlags): Added. Converts from OptionSet<WebKit::WebEvent::Modifier>
1946         to the platform-specific UIKeyModifierFlags.
1947         * UIProcess/API/Cocoa/WKNavigationAction.mm:
1948         (-[WKNavigationAction modifierFlags]): Added.
1949         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
1950         * UIProcess/WebPageProxy.h:
1951         * UIProcess/ios/WKContentViewInteraction.h:
1952         * UIProcess/ios/WKContentViewInteraction.mm:
1953         (gestureRecognizerModifierFlags): Added.
1954
1955         (-[WKContentView _webTouchEventsRecognized:]):
1956         (-[WKContentView _highlightLongPressRecognized:]):
1957         (-[WKContentView _twoFingerSingleTapGestureRecognized:]):
1958         (-[WKContentView _singleTapCommited:]):
1959         Pass modifier flags through.
1960
1961         (-[WKContentView _attemptClickAtLocation:modifierFlags:]): Added.
1962         (-[WKContentView actionSheetAssistant:openElementAtLocation:]): This is invoked when a person opens a link
1963         via the action sheet. We don't have access to the modifier flags to pass. It also seems like an implementation
1964         detail that this action is implemented via mouse click and we should re-evaluate this decision in light of
1965         the fact tht the action sheet is browser UI and we tend to be very reserved on what UI actions are visible
1966         to the page. On Mac, opening a link via the context menu is not visible to the page, at least from a mouse
1967         event perspective.
1968         (webEventFlagsForUIKeyModifierFlags): Added.
1969         (-[WKContentView _hoverGestureRecognizerChanged:]): Pass modifier flags through.
1970         (-[WKContentView _attemptClickAtLocation:]): Deleted.
1971         * UIProcess/ios/WebPageProxyIOS.mm:
1972         (WebKit::WebPageProxy::handleTwoFingerTapAtPoint):
1973         (WebKit::WebPageProxy::commitPotentialTap):
1974         (WebKit::WebPageProxy::handleTap):
1975         * WebProcess/WebPage/WebPage.h:
1976         * WebProcess/WebPage/WebPage.messages.in:
1977         * WebProcess/WebPage/ios/WebPageIOS.mm:
1978         (WebKit::WebPage::handleSyntheticClick):
1979         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
1980         (WebKit::WebPage::completeSyntheticClick):
1981         (WebKit::WebPage::handleTap):
1982         (WebKit::WebPage::handleTwoFingerTapAtPoint):
1983         (WebKit::WebPage::commitPotentialTap):
1984         Pass modifier flags through.
1985
1986 2019-02-11  Jer Noble  <jer.noble@apple.com>
1987
1988         [Cocoa] Notify AVSystemController of our presenting PID before registering as a Now Playing app.
1989         https://bugs.webkit.org/show_bug.cgi?id=194504
1990
1991         Reviewed by Eric Carlson.
1992
1993         * WebKit.xcodeproj/project.pbxproj:
1994         * WebProcess/WebCoreSupport/WebUserMediaClient.cpp:
1995         (WebKit::WebUserMediaClient::requestUserMediaAccess):
1996         * WebProcess/WebPage/WebPage.cpp:
1997         (WebKit::WebPage::prepareToSendUserMediaPermissionRequest): Deleted.
1998         * WebProcess/WebPage/WebPage.h:
1999         (WebKit::WebPage::userMediaPermissionRequestManager):
2000         * WebProcess/WebPage/ios/WebPageIOS.mm:
2001         (WebKit::WebPage::prepareToSendUserMediaPermissionRequest): Deleted.
2002
2003 2019-02-11  Commit Queue  <commit-queue@webkit.org>
2004
2005         Unreviewed, rolling out r241272 and r241276.
2006         https://bugs.webkit.org/show_bug.cgi?id=194514
2007
2008         Broke the Apple Internal build and the fix requires human
2009         intervention :( (Requested by dydz on #webkit).
2010
2011         Reverted changesets:
2012
2013         "[iOS] Mouse/Touch/Pointer events are missing modifier keys"
2014         https://bugs.webkit.org/show_bug.cgi?id=191446
2015         https://trac.webkit.org/changeset/241272
2016
2017         "Fix internal iOS build after r241272"
2018         https://bugs.webkit.org/show_bug.cgi?id=191446
2019         https://trac.webkit.org/changeset/241276
2020
2021 2019-02-11  Alex Christensen  <achristensen@webkit.org>
2022
2023         Fix internal iOS build after r241272
2024         https://bugs.webkit.org/show_bug.cgi?id=191446
2025
2026         * Platform/spi/ios/UIKitSPI.h:
2027         Declare the _modifierFlags when using the internal SDK also.
2028
2029 2019-02-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2030
2031         fast/forms/ios/force-gregorian-calendar-for-credit-card-expiry.html does not work on iPad
2032         https://bugs.webkit.org/show_bug.cgi?id=194313
2033
2034         Reviewed by Tim Horton.
2035
2036         Make `-dateTimePickerCalendarType` work on iPad by handling the case where the date picker control is a
2037         WKDateTimePopover. This fixes UIScriptController::calendarType() returning null on iPad.
2038
2039         * UIProcess/ios/forms/WKFormInputControl.mm:
2040         (-[WKFormInputControl dateTimePickerCalendarType]):
2041         (-[WKDateTimePopover calendarType]):
2042
2043 2019-02-11  Daniel Bates  <dabates@apple.com>
2044
2045         [iOS] Mouse/Touch/Pointer events are missing modifier keys
2046         https://bugs.webkit.org/show_bug.cgi?id=191446
2047         <rdar://problem/45929460>
2048
2049         Reviewed by Tim Horton.
2050
2051         Make use of UIKit SPI to retreive the modifier flags when dispatching mouse and touch events.
2052         Add new WebKit SPI for iOS, -[WKNavigationAction modifierFlags], to retrieve the the modifier
2053         flags held when a navigation action was initiated.
2054
2055         * Platform/spi/ios/UIKitSPI.h: Expose SPI.
2056         * Shared/NativeWebTouchEvent.h: Re-arrange macro guards so that we can expose the helper function
2057         WebKit::webEventModifierFlags(). This is a bit more involved that usual since this header is included
2058         from both C++ and Objective-C source files. It only makes sense to expose this function when
2059         compiling as part of an Objective-C source file.
2060         * Shared/ios/NativeWebTouchEventIOS.mm:
2061         (WebKit::NativeWebTouchEvent::NativeWebTouchEvent): Modified to take the modifier flags held down
2062         when the platform touch event was received and pass them through to the base constructor.
2063         (WebKit::webEventModifierFlags): Added. Converts from the platform-speciifc UIKeyModifierFlags to
2064         OptionSet<WebKit::WebEvent::Modifier>.
2065         * Shared/ios/WebIOSEventFactory.h:
2066         * Shared/ios/WebIOSEventFactory.mm:
2067         (WebIOSEventFactory::toUIKeyModifierFlags): Added. Converts from OptionSet<WebKit::WebEvent::Modifier>
2068         to the platform-specific UIKeyModifierFlags.
2069         * UIProcess/API/Cocoa/WKNavigationAction.mm:
2070         (-[WKNavigationAction modifierFlags]): Added.
2071         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
2072         * UIProcess/WebPageProxy.h:
2073         * UIProcess/ios/WKContentViewInteraction.h:
2074         * UIProcess/ios/WKContentViewInteraction.mm:
2075         (gestureRecognizerModifierFlags): Added.
2076
2077         (-[WKContentView _webTouchEventsRecognized:]):
2078         (-[WKContentView _highlightLongPressRecognized:]):
2079         (-[WKContentView _twoFingerSingleTapGestureRecognized:]):
2080         (-[WKContentView _singleTapCommited:]):
2081         Pass modifier flags through.
2082
2083         (-[WKContentView _attemptClickAtLocation:modifierFlags:]): Added.
2084         (-[WKContentView actionSheetAssistant:openElementAtLocation:]): This is invoked when a person opens a link
2085         via the action sheet. We don't have access to the modifier flags to pass. It also seems like an implementation
2086         detail that this action is implemented via mouse click and we should re-evaluate this decision in light of
2087         the fact tht the action sheet is browser UI and we tend to be very reserved on what UI actions are visible
2088         to the page. On Mac, opening a link via the context menu is not visible to the page, at least from a mouse
2089         event perspective.
2090         (webEventFlagsForUIKeyModifierFlags): Added.
2091         (-[WKContentView _hoverGestureRecognizerChanged:]): Pass modifier flags through.
2092         (-[WKContentView _attemptClickAtLocation:]): Deleted.
2093         * UIProcess/ios/WebPageProxyIOS.mm:
2094         (WebKit::WebPageProxy::handleTwoFingerTapAtPoint):
2095         (WebKit::WebPageProxy::commitPotentialTap):
2096         (WebKit::WebPageProxy::handleTap):
2097         * WebProcess/WebPage/WebPage.h:
2098         * WebProcess/WebPage/WebPage.messages.in:
2099         * WebProcess/WebPage/ios/WebPageIOS.mm:
2100         (WebKit::WebPage::handleSyntheticClick):
2101         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
2102         (WebKit::WebPage::completeSyntheticClick):
2103         (WebKit::WebPage::handleTap):
2104         (WebKit::WebPage::handleTwoFingerTapAtPoint):
2105         (WebKit::WebPage::commitPotentialTap):
2106         Pass modifier flags through.
2107
2108 2019-02-11  Youenn Fablet  <youenn@apple.com>
2109
2110         Filter out Overconstrainederror.constraint when getUserMedia is not granted
2111         https://bugs.webkit.org/show_bug.cgi?id=194240
2112
2113         Reviewed by Eric Carlson.
2114
2115         Make sure in UIProcess to filter out constraint if either the page was not granted gum access or it has no persistent access.
2116
2117         Refactor UserMediaPermissionRequestManagerProxy to make the implementation easier to understand.
2118
2119         Covered by added test.
2120
2121         * UIProcess/UserMediaPermissionCheckProxy.cpp:
2122         (WebKit::UserMediaPermissionCheckProxy::setUserMediaAccessInfo):
2123         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2124         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
2125         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
2126         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess):
2127         (WebKit::UserMediaPermissionRequestManagerProxy::getRequestAction):
2128         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2129         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest):
2130         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionInvalidRequest):
2131         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest):
2132         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo):
2133         (WebKit::UserMediaPermissionRequestManagerProxy::wasGrantedVideoOrAudioAccess):
2134         (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList):
2135         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
2136         (WebKit::UserMediaPermissionRequestManagerProxy::createPermissionRequest): Deleted.
2137         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2138         * UIProcess/UserMediaPermissionRequestProxy.h:
2139         (WebKit::UserMediaPermissionRequestProxy::isPending const):
2140         (WebKit::UserMediaPermissionRequestProxy::setEligibleVideoDeviceUIDs):
2141         (WebKit::UserMediaPermissionRequestProxy::setEligibleAudioDeviceUIDs):
2142         (WebKit::UserMediaPermissionRequestProxy::hasAudioDevice const):
2143         (WebKit::UserMediaPermissionRequestProxy::hasVideoDevice const):
2144         (WebKit::UserMediaPermissionRequestProxy::hasPersistentAccess const):
2145         (WebKit::UserMediaPermissionRequestProxy::setHasPersistentAccess):
2146         (WebKit::UserMediaPermissionRequestProxy::userMediaID const):
2147         (WebKit::UserMediaPermissionRequestProxy::topLevelDocumentSecurityOrigin const):
2148         (WebKit::UserMediaPermissionRequestProxy::userMediaDocumentSecurityOrigin const):
2149         (WebKit::UserMediaPermissionRequestProxy::userRequest const):
2150         (WebKit::UserMediaPermissionRequestProxy::setDeviceIdentifierHashSalt):
2151         (WebKit::UserMediaPermissionRequestProxy::deviceIdentifierHashSalt const):
2152         (WebKit::UserMediaPermissionRequestProxy::audioDevice const):
2153         (WebKit::UserMediaPermissionRequestProxy::videoDevice const):
2154         * UIProcess/WebPageProxy.cpp:
2155         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
2156         * UIProcess/WebPageProxy.h:
2157
2158 2019-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
2159
2160         [WPE] Do not try to create empty egl windows
2161         https://bugs.webkit.org/show_bug.cgi?id=194497
2162
2163         Reviewed by Žan Doberšek.
2164
2165         In AcceleratedSurfaceWPE we ensure the size we pass to wpe is at least 0x0, but wl_egl_window_create() returns
2166         nullptr if 0 is passed as width or height. We should use at least 1x1 instead.
2167
2168         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
2169         (WebKit::AcceleratedSurfaceWPE::initialize):
2170         (WebKit::AcceleratedSurfaceWPE::clientResize):
2171
2172 2019-02-10  Carlos Garcia Campos  <cgarcia@igalia.com>
2173
2174         [WPE] Do not use a sync IPC message to send the host FD to the web process
2175         https://bugs.webkit.org/show_bug.cgi?id=194216
2176
2177         Reviewed by Darin Adler.
2178
2179         It can be sent as a web page creation parameter instead.
2180
2181         * PlatformWPE.cmake:
2182         * Shared/WebPageCreationParameters.cpp:
2183         (WebKit::WebPageCreationParameters::encode const):
2184         (WebKit::WebPageCreationParameters::decode):
2185         * Shared/WebPageCreationParameters.h:
2186         * SourcesWPE.txt:
2187         * UIProcess/API/wpe/CompositingManagerProxy.cpp: Removed.
2188         * UIProcess/API/wpe/CompositingManagerProxy.h: Removed.
2189         * UIProcess/API/wpe/CompositingManagerProxy.messages.in: Removed.
2190         * UIProcess/API/wpe/PageClientImpl.cpp:
2191         (WebKit::PageClientImpl::hostFileDescriptor):
2192         * UIProcess/API/wpe/PageClientImpl.h:
2193         * UIProcess/API/wpe/WPEView.cpp:
2194         (WKWPE::m_backend):
2195         * UIProcess/API/wpe/WPEView.h:
2196         (WKWPE::View::create):
2197         * UIProcess/PageClient.h:
2198         * UIProcess/WebPageProxy.cpp:
2199         (WebKit::WebPageProxy::creationParameters):
2200         * WebProcess/WebPage/WebPage.cpp:
2201         (WebKit::m_hostFileDescriptor):
2202         * WebProcess/WebPage/WebPage.h:
2203         (WebKit::WebPage::releaseHostFileDescriptor):
2204         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
2205         (WebKit::AcceleratedSurfaceWPE::AcceleratedSurfaceWPE):
2206         (WebKit::AcceleratedSurfaceWPE::initialize):
2207         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.h:
2208         * WebProcess/WebPage/wpe/CompositingManager.cpp: Removed.
2209         * WebProcess/WebPage/wpe/CompositingManager.h: Removed.
2210
2211 2019-02-04  Carlos Garcia Campos  <cgarcia@igalia.com>
2212
2213         [GTK][WPE] Add enable-javascript-markup setting
2214         https://bugs.webkit.org/show_bug.cgi?id=193439
2215
2216         Reviewed by Michael Catanzaro.
2217
2218         Expose JavaScriptMarkupEnabled setting in the GLib API.
2219
2220         * UIProcess/API/glib/WebKitSettings.cpp:
2221         (webKitSettingsSetProperty):
2222         (webKitSettingsGetProperty):
2223         (webkit_settings_class_init):
2224         (webkit_settings_get_enable_javascript_markup):
2225         (webkit_settings_set_enable_javascript_markup):
2226         * UIProcess/API/gtk/WebKitSettings.h:
2227         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
2228         * UIProcess/API/wpe/WebKitSettings.h:
2229         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
2230
2231 2019-02-10  Darin Adler  <darin@apple.com>
2232
2233         Switch uses of StringBuilder with String::format for hex numbers to use HexNumber.h instead
2234         https://bugs.webkit.org/show_bug.cgi?id=194485
2235
2236         Reviewed by Daniel Bates.
2237
2238         * UIProcess/DeviceIdHashSaltStorage.cpp:
2239         (WebKit::DeviceIdHashSaltStorage::completeDeviceIdHashSaltForOriginCall): Use
2240         appendUnsignedAsHex instead of appendUnsigned64AsHex.
2241
2242         * UIProcess/WebBackForwardList.cpp:
2243         (WebKit::WebBackForwardList::loggingString): Use appendUnsignedAsHex and
2244         reinterpret_cast<uintptr_t> instead of String::format and "%p".
2245
2246 2019-02-10  Commit Queue  <commit-queue@webkit.org>
2247
2248         Unreviewed, rolling out r241167.
2249         https://bugs.webkit.org/show_bug.cgi?id=194482
2250
2251         Broke the GTK mediastream tests (Requested by philn on
2252         #webkit).
2253
2254         Reverted changeset:
2255
2256         "Filter out Overconstrainederror.constraint when getUserMedia
2257         is not granted"
2258         https://bugs.webkit.org/show_bug.cgi?id=194240
2259         https://trac.webkit.org/changeset/241167
2260
2261 2019-02-09  Darin Adler  <darin@apple.com>
2262
2263         Eliminate unnecessary String temporaries by using StringConcatenateNumbers
2264         https://bugs.webkit.org/show_bug.cgi?id=194021
2265
2266         Reviewed by Geoffrey Garen.
2267
2268         * NetworkProcess/NetworkResourceLoader.cpp:
2269         (WebKit::escapeIDForJSON): Use an ASCIILiteral to create a String.
2270
2271         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2272         (WebKit::NetworkCache::makeVersionedDirectoryPath): Remove String::number and let
2273         makeString do the conversion without allocating/destroying a String.
2274
2275         * NetworkProcess/mac/RemoteNetworkingContext.mm: Removed "using namespace WebCore".
2276         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession): Remove String::number
2277         and let makeString do the conversion without allocating/destroying a String.
2278
2279         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp: Removed "using namespace WebCore".
2280         (WebKit::registerMDNSNameCallback): Added explicit WebCore prefix as needed.
2281         (WebKit::NetworkMDNSRegister::registerMDNSName): Ditto. Also remove String::number
2282         and let makeString do the conversion without allocating/destroying a String.
2283
2284         * UIProcess/WebPageGroup.cpp:
2285         (WebKit::pageGroupData): Remove String::number and let makeString do the conversion
2286         without allocating/destroying a String.
2287         * UIProcess/WebPageProxy.cpp:
2288         (WebKit::WebPageProxy::createInspectorTargets): Ditto.
2289         * UIProcess/ios/WKLegacyPDFView.mm:
2290         (-[WKLegacyPDFView _URLForLinkAnnotation:]): Ditto.
2291         * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
2292         (WebKit::uniqueWorldName): Ditto.
2293         * WebProcess/WebPage/WebPageInspectorTarget.cpp:
2294         (WebKit::WebPageInspectorTarget::identifier const): Ditto.
2295
2296 2019-02-09  Alexander Mikhaylenko  <exalm7659@gmail.com>
2297
2298         [GTK] Fix typo in the newly added API
2299         https://bugs.webkit.org/show_bug.cgi?id=194472
2300
2301         Reviewed by Michael Catanzaro.
2302
2303         Fix a typo: enableed -> enabled.
2304
2305         * UIProcess/API/glib/WebKitSettings.cpp:
2306         (webkit_settings_set_enable_back_forward_navigation_gestures):
2307         * UIProcess/API/gtk/WebKitSettings.h:
2308
2309 2019-02-08  Alex Christensen  <achristensen@webkit.org>
2310
2311         Speculative fix for Mojave API test after r241223
2312         https://bugs.webkit.org/show_bug.cgi?id=194427
2313
2314         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
2315         (WebKit::XPCInitializationHandler):
2316         (WebKit::XPCServiceMain):
2317         Set the __APPLEEVENTSSERVICENAME environment variable before handling any xpc messages like we used to.
2318         I'll worry about making things right in the daemon later.
2319
2320 2019-02-08  Chris Dumez  <cdumez@apple.com>
2321
2322         [WK2][macOS] Avoid creating new CVDisplayLink objects for each WebProcess
2323         https://bugs.webkit.org/show_bug.cgi?id=194463
2324
2325         Reviewed by Tim Horton.
2326
2327         Avoid creating new CVDisplayLink objects for each WebProcess. We really only need one per
2328         display, creating such object is expensive and it is even worse in a PSON world where we
2329         swap process on navigation.
2330
2331         This patch moves the DisplayLink storing from WebProcessProxy to WebProcessPool. Also,
2332         a DisplayLink can now be associated to several IPC connections instead of having a 1:1
2333         mapping. When a DisplayLink no longer has any observers, we now merely stop it instead
2334         of destroying it.
2335
2336         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2337         (WebKit::WebProcessPool::startDisplayLink):
2338         (WebKit::WebProcessPool::stopDisplayLink):
2339         (WebKit::WebProcessPool::stopDisplayLinks):
2340         * UIProcess/WebProcessPool.h:
2341         * UIProcess/WebProcessProxy.cpp:
2342         (WebKit::WebProcessProxy::~WebProcessProxy):
2343         (WebKit::WebProcessProxy::processWillShutDown):
2344         (WebKit::WebProcessProxy::shutDown):
2345         * UIProcess/WebProcessProxy.h:
2346         * UIProcess/mac/DisplayLink.cpp:
2347         (WebKit::DisplayLink::DisplayLink):
2348         (WebKit::DisplayLink::addObserver):
2349         (WebKit::DisplayLink::removeObserver):
2350         (WebKit::DisplayLink::removeObservers):
2351         (WebKit::DisplayLink::hasObservers const):
2352         (WebKit::DisplayLink::displayLinkCallback):
2353         * UIProcess/mac/DisplayLink.h:
2354         * UIProcess/mac/WebProcessProxyMac.mm:
2355         (WebKit::WebProcessProxy::startDisplayLink):
2356         (WebKit::WebProcessProxy::stopDisplayLink):
2357
2358 2019-02-08  Alexander Mikhaylenko  <exalm7659@gmail.com>
2359
2360         [GTK] Implement back/forward touchpad gesture
2361         https://bugs.webkit.org/show_bug.cgi?id=193919
2362
2363         Reviewed by Michael Catanzaro.
2364
2365         Move ViewSnapshotStore and ViewGestureController from Cocoa/Mac directory
2366         to UIProcess/, also move some parts of mac/ViewGestreControllerMac.mm to
2367         ViewGestureController.cpp, split up Mac- and iOS-specific parts of
2368         ViewSnapshotStore.cpp into mac/ViewSnapshotMac.mm, then implement 2-finger
2369         touchpad swipe back-forward gesture for GTK based on that.
2370
2371         To avoid name conflict, rename existing ViewGestureController class inside
2372         UIProcess/API/gtk/WebKitWebViewBase.cpp into TouchGestureController.
2373
2374         Since GTK gestures can only work with 3 or 4 fingers, treat horizontal
2375         scrolling events as a swipe as long as there's nowhere to scroll in that
2376         direction and web page doesn't handle the scrolling.
2377
2378         This is only allowed for touchpads, even though it can theoretically work
2379         with touch mice and trackpoints.
2380
2381         The gesture requires every item in back-forward list to have a snapshot.
2382         There's already an existing infrastructure for that, so the patch changes
2383         a bunch of #if PLATFORM(COCOA) statements to also check for GTK platform.
2384         The snapshots have to be taken in sync, so the implementation draws webview
2385         widget into a Cairo image surface.
2386
2387         The gesture is disabled by default, and can be enabled by setting the newly
2388         added 'enable-back-forward-navigation-gestures' property in WebKitSettings to
2389         true.
2390
2391         Gesture drawing is implemented via Cairo. When the gesture is active, the
2392         actual page is drawn into a Cairo group, which is then drawn together with
2393         a given snapshot, as well as dimming and a drop shadow over the "lower" layer.
2394
2395         Also add a memory pressure handler that clears snapshot store when low on memory.
2396
2397         * DerivedSources-input.xcfilelist:
2398         * PlatformGTK.cmake:
2399         * PlatformMac.cmake:
2400         * Shared/SessionState.h: Add snapshot to back-forward items for GTK.
2401         * Shared/WebBackForwardListItem.h: Add snapshot to back-forward items for GTK.
2402         * SourcesCocoa.txt:
2403         * SourcesGTK.txt:
2404         * UIProcess/API/glib/WebKitSettings.cpp:
2405         Added 'enable-back-forward-navigation-gestures' property for enabling the gesture.
2406         (webKitSettingsSetProperty):
2407         (webKitSettingsGetProperty):
2408         (webkit_settings_class_init):
2409         (webkit_settings_get_enable_back_forward_navigation_gestures): Added, GTK only.
2410         (webkit_settings_set_enable_back_forward_navigation_gestures): Added, GTK only.
2411         * UIProcess/API/glib/WebKitWebView.cpp:
2412         (enableBackForwardNavigationGesturesChanged): Added, GTK only.
2413         (webkitWebViewUpdateSettings):
2414         (webkitWebViewDisconnectSettingsSignalHandlers):
2415         * UIProcess/API/gtk/PageClientImpl.cpp:
2416         (WebKit::PageClientImpl::setViewNeedsDisplay): Redraw the whole screen instead of a region during the gesture.
2417         (WebKit::PageClientImpl::takeViewSnapshot): Added.
2418         (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore): Pass unhandled events to the gesture controller.
2419         (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot): Redraw the widget immediately after removing snapshot.
2420         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame): Added, send a notification to the gesture controller.
2421         (WebKit::PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame):  Send a notification to the gesture controller.
2422         (WebKit::PageClientImpl::didFinishLoadForMainFrame):  Send a notification to the gesture controller.
2423         (WebKit::PageClientImpl::didFailLoadForMainFrame):  Added, send a notification to the gesture controller.
2424         (WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame):  Send a notification to the gesture controller.
2425         (WebKit::PageClientImpl::didRestoreScrollPosition):  Added, send a notification to the gesture controller.
2426         * UIProcess/API/gtk/PageClientImpl.h:
2427         * UIProcess/API/gtk/WebKitSettings.h:
2428         Add webkit_settings_get_enable_back_forward_navigation_gestures() and webkit_settings_get_enable_back_forward_navigation_gestures()
2429         to public API.
2430         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2431         (webkitWebViewBaseDraw): Pass drawing to ViewGestureController during the gesture.
2432         (webkitWebViewBaseScrollEvent): Pass scroll events to ViewGestureController during the gesture.
2433         (webkitWebViewBaseGestureController): Renamed ViewGestureController to TouchGestureController.
2434         (webkitWebViewBaseViewGestureController): Added.
2435         (webkitWebViewBaseCreateWebPage): Create an instance of ViewGestureController.
2436         (webkitWebViewBaseTakeViewSnapshot): Added.
2437         (webkitWebViewBaseDidStartProvisionalLoadForMainFrame): Added.
2438         (webkitWebViewBaseDidFirstVisuallyNonEmptyLayoutForMainFrame): Added.
2439         (webkitWebViewBaseDidFinishLoadForMainFrame): Added.
2440         (webkitWebViewBaseDidFailLoadForMainFrame): Added.
2441         (webkitWebViewBaseDidSameDocumentNavigationForMainFrame): Added.
2442         (webkitWebViewBaseDidRestoreScrollPosition): Added.
2443         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
2444         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Mentioned the added functions in docs.
2445         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2446         (WebKit::WebProcessPool::platformInitialize): Move the check from WebMemoryPressureHandlerCocoa.mm here.
2447         * UIProcess/PageClient.h: Add takeViewSnapshot() for GTK.
2448         * UIProcess/ViewGestureController.cpp: Renamed from Source/WebKit/UIProcess/Cocoa/ViewGestureController.cpp.
2449         (WebKit::ViewGestureController::ViewGestureController):
2450         (WebKit::ViewGestureController::~ViewGestureController):
2451         (WebKit::ViewGestureController::disconnectFromProcess):
2452         (WebKit::ViewGestureController::connectToProcess):
2453         (WebKit::ViewGestureController::controllerForGesture):
2454         (WebKit::ViewGestureController::takeNextGestureID):
2455         (WebKit::ViewGestureController::willBeginGesture):
2456         (WebKit::ViewGestureController::didEndGesture):
2457         (WebKit::ViewGestureController::setAlternateBackForwardListSourcePage):
2458         (WebKit::ViewGestureController::canSwipeInDirection const):
2459         (WebKit::ViewGestureController::didStartProvisionalOrSameDocumentLoadForMainFrame):
2460         (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
2461         (WebKit::ViewGestureController::didFirstVisuallyNonEmptyLayoutForMainFrame):
2462         (WebKit::ViewGestureController::didRepaintAfterNavigation):
2463         (WebKit::ViewGestureController::didHitRenderTreeSizeThreshold):
2464         (WebKit::ViewGestureController::didRestoreScrollPosition):
2465         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
2466         (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
2467         (WebKit::ViewGestureController::checkForActiveLoads):
2468         (WebKit::ViewGestureController::SnapshotRemovalTracker::SnapshotRemovalTracker):
2469         (WebKit::ViewGestureController::SnapshotRemovalTracker::eventsDescription):
2470         (WebKit::ViewGestureController::SnapshotRemovalTracker::log const):
2471         (WebKit::ViewGestureController::SnapshotRemovalTracker::resume):
2472         (WebKit::ViewGestureController::SnapshotRemovalTracker::start):
2473         (WebKit::ViewGestureController::SnapshotRemovalTracker::reset):
2474         (WebKit::ViewGestureController::SnapshotRemovalTracker::stopWaitingForEvent):
2475         (WebKit::ViewGestureController::SnapshotRemovalTracker::eventOccurred):
2476         (WebKit::ViewGestureController::SnapshotRemovalTracker::cancelOutstandingEvent):
2477         (WebKit::ViewGestureController::SnapshotRemovalTracker::hasOutstandingEvent):
2478         (WebKit::ViewGestureController::SnapshotRemovalTracker::fireRemovalCallbackIfPossible):
2479         (WebKit::ViewGestureController::SnapshotRemovalTracker::fireRemovalCallbackImmediately):
2480         (WebKit::ViewGestureController::SnapshotRemovalTracker::watchdogTimerFired):
2481         (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog):
2482         (WebKit::deltaShouldCancelSwipe):
2483         (WebKit::ViewGestureController::PendingSwipeTracker::PendingSwipeTracker):
2484         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanBecomeSwipe):
2485         (WebKit::ViewGestureController::PendingSwipeTracker::handleEvent):
2486         (WebKit::ViewGestureController::PendingSwipeTracker::eventWasNotHandledByWebCore):
2487         (WebKit::ViewGestureController::PendingSwipeTracker::tryToStartSwipe):
2488         (WebKit::ViewGestureController::PendingSwipeTracker::reset):
2489         (WebKit::ViewGestureController::startSwipeGesture):
2490         (WebKit::ViewGestureController::isPhysicallySwipingLeft const):
2491         (WebKit::ViewGestureController::shouldUseSnapshotForSize):
2492         (WebKit::ViewGestureController::forceRepaintIfNeeded):
2493         (WebKit::ViewGestureController::willEndSwipeGesture):
2494         (WebKit::ViewGestureController::endSwipeGesture):
2495         (WebKit::ViewGestureController::requestRenderTreeSizeNotificationIfNeeded):
2496         * UIProcess/ViewGestureController.h: Renamed from Source/WebKit/UIProcess/Cocoa/ViewGestureController.h.
2497         (WebKit::ViewGestureController::wheelEventWasNotHandledByWebCore):
2498         (WebKit::ViewGestureController::shouldIgnorePinnedState):
2499         (WebKit::ViewGestureController::setShouldIgnorePinnedState):
2500         (WebKit::ViewGestureController::hasActiveMagnificationGesture const):
2501         (WebKit::ViewGestureController::setCustomSwipeViews):
2502         (WebKit::ViewGestureController::setCustomSwipeViewsTopContentInset):
2503         (WebKit::ViewGestureController::setDidMoveSwipeSnapshotCallback):
2504         (WebKit::ViewGestureController::backgroundColorForCurrentSnapshot const):
2505         (WebKit::ViewGestureController::didFinishLoadForMainFrame):
2506         (WebKit::ViewGestureController::didFailLoadForMainFrame):
2507         (WebKit::ViewGestureController::setSwipeGestureEnabled):
2508         (WebKit::ViewGestureController::isSwipeGestureEnabled):
2509         (WebKit::ViewGestureController::SnapshotRemovalTracker::pause):
2510         (WebKit::ViewGestureController::SnapshotRemovalTracker::isPaused const):
2511         (WebKit::ViewGestureController::SnapshotRemovalTracker::hasRemovalCallback const):
2512         (WebKit::ViewGestureController::SnapshotRemovalTracker::renderTreeSizeThreshold const):
2513         (WebKit::ViewGestureController::SnapshotRemovalTracker::setRenderTreeSizeThreshold):
2514         (WebKit::ViewGestureController::PendingSwipeTracker::shouldIgnorePinnedState):
2515         (WebKit::ViewGestureController::PendingSwipeTracker::setShouldIgnorePinnedState):
2516         (WebKit::ViewGestureController::SwipeProgressTracker::progress const):
2517         (WebKit::ViewGestureController::SwipeProgressTracker::direction const):
2518         * UIProcess/ViewGestureController.messages.in: Renamed from Source/WebKit/UIProcess/Cocoa/ViewGestureController.messages.in.
2519         * UIProcess/ViewSnapshotStore.cpp: Copied from Source/WebKit/UIProcess/mac/ViewSnapshotStore.mm.
2520         (WebKit::ViewSnapshotStore::ViewSnapshotStore):
2521         (WebKit::ViewSnapshotStore::~ViewSnapshotStore):
2522         (WebKit::ViewSnapshotStore::singleton):
2523         (WebKit::ViewSnapshotStore::didAddImageToSnapshot):
2524         (WebKit::ViewSnapshotStore::willRemoveImageFromSnapshot):
2525         (WebKit::ViewSnapshotStore::pruneSnapshots):
2526         (WebKit::ViewSnapshotStore::recordSnapshot):
2527         (WebKit::ViewSnapshotStore::discardSnapshotImages):
2528         (WebKit::ViewSnapshot::~ViewSnapshot):
2529         * UIProcess/ViewSnapshotStore.h: Renamed from Source/WebKit/UIProcess/mac/ViewSnapshotStore.h.
2530         (WebKit::ViewSnapshot::setRenderTreeSize):
2531         (WebKit::ViewSnapshot::renderTreeSize const):
2532         (WebKit::ViewSnapshot::setBackgroundColor):
2533         (WebKit::ViewSnapshot::backgroundColor const):
2534         (WebKit::ViewSnapshot::setViewScrollPosition):
2535         (WebKit::ViewSnapshot::viewScrollPosition const):
2536         (WebKit::ViewSnapshot::setDeviceScaleFactor):
2537         (WebKit::ViewSnapshot::deviceScaleFactor const):
2538         (WebKit::ViewSnapshot::surface const):
2539         (WebKit::ViewSnapshot::imageSizeInBytes const):
2540         (WebKit::ViewSnapshot::size const):
2541         (WebKit::ViewSnapshotStore::setDisableSnapshotVolatilityForTesting):
2542         (WebKit::ViewSnapshotStore::disableSnapshotVolatilityForTesting const):
2543         * UIProcess/WebBackForwardList.cpp:
2544         (WebKit::WebBackForwardList::didRemoveItem): Unset snapshot for GTK.
2545         * UIProcess/WebMemoryPressureHandler.cpp: Copied from Source/WebKit/UIProcess/Cocoa/WebMemoryPressureHandlerCocoa.mm.
2546         (WebKit::installMemoryPressureHandler):
2547         * UIProcess/WebMemoryPressureHandler.h: Renamed from Source/WebKit/UIProcess/Cocoa/WebMemoryPressureHandlerCocoa.h.
2548         * UIProcess/WebPageProxy.cpp:
2549         (WebKit::WebPageProxy::recordNavigationSnapshot): Take snapshots for GTK.
2550         * UIProcess/WebPageProxy.h:
2551         * UIProcess/gtk/ViewGestureControllerGtk.cpp: Added. This is a port of
2552         UIProcess/mac/ViewGestureControllerMac.mm. SwipeProgressTracker class is a
2553         re-implementation of trackSwipeEventWithOptions.
2554         (WebKit::isEventStop):
2555         (WebKit::ViewGestureController::platformTeardown):
2556         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanStartSwipe):
2557         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanEndSwipe):
2558         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanInfluenceSwipe):
2559         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventGetScrollingDeltas):
2560         (WebKit::ViewGestureController::handleScrollWheelEvent):
2561         (WebKit::ViewGestureController::trackSwipeGesture):
2562         (WebKit::ViewGestureController::SwipeProgressTracker::SwipeProgressTracker):
2563         (WebKit::ViewGestureController::SwipeProgressTracker::startTracking):
2564         (WebKit::ViewGestureController::SwipeProgressTracker::reset):
2565         (WebKit::ViewGestureController::SwipeProgressTracker::handleEvent):
2566         (WebKit::ViewGestureController::SwipeProgressTracker::startAnimation):
2567         (WebKit::easeOutCubic):
2568         (WebKit::ViewGestureController::SwipeProgressTracker::onAnimationTick):
2569         (WebKit::ViewGestureController::SwipeProgressTracker::endAnimation):
2570         (WebKit::ViewGestureController::beginSwipeGesture):
2571         (WebKit::ViewGestureController::handleSwipeGesture):
2572         (WebKit::ViewGestureController::draw):
2573         (WebKit::ViewGestureController::removeSwipeSnapshot):
2574         (WebKit::ViewGestureController::beginSimulatedSwipeInDirectionForTesting):
2575         (WebKit::ViewGestureController::completeSimulatedSwipeInDirectionForTesting):
2576         * UIProcess/gtk/ViewSnapshotStoreGtk.cpp: Renamed from Source/WebKit/UIProcess/Cocoa/WebMemoryPressureHandlerCocoa.mm.
2577         (WebKit::ViewSnapshot::create):
2578         (WebKit::ViewSnapshot::ViewSnapshot):
2579         (WebKit::ViewSnapshot::hasImage const):
2580         (WebKit::ViewSnapshot::clearImage):
2581         (WebKit::ViewSnapshot::imageSizeInBytes const):
2582         (WebKit::ViewSnapshot::size const):
2583         * UIProcess/gtk/WebProcessPoolGtk.cpp:
2584         (WebKit::memoryPressureMonitorDisabled): Added.
2585         (WebKit::WebProcessPool::platformInitialize): Install memory pressure handler.
2586         (WebKit::WebProcessPool::platformInitializeWebProcess): Use memoryPressureMonitorDisabled().
2587         * UIProcess/mac/ViewGestureControllerMac.mm:
2588         Moved many functions into UIProcess/ViewGestureController.cpp
2589         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanStartSwipe):
2590         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanEndSwipe):
2591         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanInfluenceSwipe):
2592         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventGetScrollingDeltas):
2593         (WebKit::ViewGestureController::trackSwipeGesture):
2594         (WebKit::scrollEventCanInfluenceSwipe): Deleted.
2595         (WebKit::deltaShouldCancelSwipe): Deleted.
2596         (WebKit::ViewGestureController::PendingSwipeTracker::PendingSwipeTracker): Deleted.
2597         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanBecomeSwipe): Deleted.
2598         (WebKit::ViewGestureController::PendingSwipeTracker::handleEvent): Deleted.
2599         (WebKit::ViewGestureController::PendingSwipeTracker::eventWasNotHandledByWebCore): Deleted.
2600         (WebKit::ViewGestureController::PendingSwipeTracker::tryToStartSwipe): Deleted.
2601         (WebKit::ViewGestureController::PendingSwipeTracker::reset): Deleted.
2602         (WebKit::ViewGestureController::willEndSwipeGesture): Deleted.
2603         (WebKit::ViewGestureController::shouldUseSnapshotForSize): Deleted.
2604         (WebKit::ViewGestureController::isPhysicallySwipingLeft const): Deleted.
2605         (WebKit::ViewGestureController::endSwipeGesture): Deleted.
2606         (WebKit::ViewGestureController::forceRepaintIfNeeded): Deleted.
2607         (WebKit::ViewGestureController::requestRenderTreeSizeNotificationIfNeeded): Deleted.
2608         * UIProcess/mac/ViewSnapshotStoreMac.mm: Renamed from Source/WebKit/UIProcess/mac/ViewSnapshotStore.mm.
2609         (WebKit::ViewSnapshotStore::snapshottingContext):
2610         (WebKit::ViewSnapshot::create):
2611         (WebKit::ViewSnapshot::ViewSnapshot):
2612         (WebKit::ViewSnapshot::setSurface):
2613         (WebKit::ViewSnapshot::hasImage const):
2614         (WebKit::ViewSnapshot::clearImage):
2615         (WebKit::ViewSnapshot::setVolatile):
2616         (WebKit::ViewSnapshot::asLayerContents):
2617         (WebKit::ViewSnapshot::asImageForTesting):
2618         * WebKit.xcodeproj/project.pbxproj:
2619         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
2620         Make SetRenderTreeSizeNotificationThreshold() cross-platform.
2621         (WebKit::ViewGestureGeometryCollector::ViewGestureGeometryCollector):
2622         (WebKit::ViewGestureGeometryCollector::computeMinimumAndMaximumViewportScales const):
2623         (WebKit::ViewGestureGeometryCollector::mainFrameDidLayout):
2624         * WebProcess/WebPage/ViewGestureGeometryCollector.h:
2625         * WebProcess/WebPage/ViewGestureGeometryCollector.messages.in:
2626         * WebProcess/WebPage/WebPage.cpp:
2627         Start using ViewGestureGeometryCollector for GTK.
2628         (WebKit::WebPage::mainFrameDidLayout):
2629         * WebProcess/WebPage/WebPage.h:
2630
2631 2019-02-08  Alex Christensen  <achristensen@webkit.org>
2632
2633         Add SPI to use networking daemon instead of XPC service
2634         https://bugs.webkit.org/show_bug.cgi?id=194427
2635
2636         Reviewed by Geoffrey Garen.
2637
2638         There is still work to be done, but with the proper plist it starts and loads webpages!
2639
2640         * NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.mm:
2641         (WebKit::DaemonMain):
2642         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
2643         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
2644         (WebKit::XPCEventHandler):
2645         (WebKit::XPCInitializationHandler):
2646         (WebKit::XPCServiceMain):
2647         (WebKit::XPCServiceEventHandler): Deleted.
2648         * UIProcess/API/APIProcessPoolConfiguration.h:
2649         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2650         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2651         (-[_WKProcessPoolConfiguration usesNetworkingDaemon]):
2652         (-[_WKProcessPoolConfiguration setUsesNetworkingDaemon:]):
2653         * UIProcess/AuxiliaryProcessProxy.cpp:
2654         (WebKit::AuxiliaryProcessProxy::getLaunchOptions):
2655         * UIProcess/Launcher/ProcessLauncher.h:
2656         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2657         (WebKit::serviceName):
2658         (WebKit::ProcessLauncher::launchProcess):
2659         * UIProcess/Network/NetworkProcessProxy.cpp:
2660         (WebKit::NetworkProcessProxy::getLaunchOptions):
2661         * UIProcess/WebProcessPool.cpp:
2662         (WebKit::WebProcessPool::usesNetworkingDaemon const):
2663         * UIProcess/WebProcessPool.h:
2664
2665 2019-02-08  Truitt Savell  <tsavell@apple.com>
2666
2667         Unreviewed, rolling out r241197.
2668
2669         Broke iOS Simulator Debug build and casued 1 API failure on
2670         High Sierra
2671
2672         Reverted changeset:
2673
2674         "Add SPI to use networking daemon instead of XPC service"
2675         https://bugs.webkit.org/show_bug.cgi?id=194427
2676         https://trac.webkit.org/changeset/241197
2677
2678 2019-02-08  Beth Dakin  <bdakin@apple.com>
2679
2680         Abstract and discussion comments needed for afterScreenUpdates
2681         https://bugs.webkit.org/show_bug.cgi?id=194442
2682
2683         Reviewed by Wenson Hsieh.
2684
2685         Forgot to add these comments with https://bugs.webkit.org/show_bug.cgi?id=194362
2686         * UIProcess/API/Cocoa/WKSnapshotConfiguration.h:
2687
2688 2019-02-08  Beth Dakin  <bdakin@apple.com>
2689
2690         Add afterScreenUpdates to WKSnapshotConfiguration
2691         https://bugs.webkit.org/show_bug.cgi?id=194362
2692         -and corresponding-
2693         <rdar://problem/40655528> Please add an "after screen updates" property to 
2694         WKSnapshotConfiguration (to solve blank snapshots)
2695
2696         Reviewed by Tim Horton.
2697
2698         This is the WebKit equivalent of - (UIView *)snapshotViewAfterScreenUpdates:(BOOL)afterUpdates;
2699         This makes our snapshotting API more predictable and reliable on iOS devices, 
2700         which is why the new configuration property defaults to YES.
2701
2702         New property that defaults to YES.
2703         * UIProcess/API/Cocoa/WKSnapshotConfiguration.h:
2704         * UIProcess/API/Cocoa/WKSnapshotConfiguration.mm:
2705         (-[WKSnapshotConfiguration init]):
2706         (-[WKSnapshotConfiguration copyWithZone:]):
2707
2708         When afterScreenUpdates is set, invoke the snapshot via 
2709         callAfterNextPresentationUpdate.
2710         * UIProcess/API/Cocoa/WKWebView.mm:
2711         (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
2712         (-[WKWebView _callCompletionHandler:withSnapshotImage:atDeviceScale:]):
2713
2714 2019-02-08  Alex Christensen  <achristensen@webkit.org>
2715
2716         Add SPI to use networking daemon instead of XPC service
2717         https://bugs.webkit.org/show_bug.cgi?id=194427
2718
2719         Reviewed by Geoffrey Garen.
2720
2721         There is still work to be done, but with the proper plist it starts and loads webpages!
2722
2723         * NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.mm:
2724         (WebKit::DaemonMain):
2725         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
2726         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
2727         (WebKit::XPCEventHandler):
2728         (WebKit::XPCInitializationHandler):
2729         (WebKit::XPCServiceMain):
2730         (WebKit::XPCServiceEventHandler): Deleted.
2731         * UIProcess/API/APIProcessPoolConfiguration.h:
2732         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2733         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2734         (-[_WKProcessPoolConfiguration usesNetworkingDaemon]):
2735         (-[_WKProcessPoolConfiguration setUsesNetworkingDaemon:]):
2736         * UIProcess/AuxiliaryProcessProxy.cpp:
2737         (WebKit::AuxiliaryProcessProxy::getLaunchOptions):
2738         * UIProcess/Launcher/ProcessLauncher.h:
2739         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2740         (WebKit::serviceName):
2741         (WebKit::ProcessLauncher::launchProcess):
2742         * UIProcess/Network/NetworkProcessProxy.cpp:
2743         (WebKit::NetworkProcessProxy::getLaunchOptions):
2744         * UIProcess/WebProcessPool.cpp:
2745         (WebKit::WebProcessPool::usesNetworkingDaemon const):
2746         * UIProcess/WebProcessPool.h:
2747
2748 2019-02-08  Keith Rollin  <krollin@apple.com>
2749
2750         Unreviewed build fix.
2751
2752         r241135 modified how entitlements were built up for the macOS. Those
2753         changes broke the iOSMac builds. Bring back some deletions in order to
2754         fix iOSMac.
2755
2756         * Configurations/PluginService.64.xcconfig:
2757         * Configurations/PluginService.entitlements: Added.
2758         * WebKit.xcodeproj/project.pbxproj:
2759
2760 2019-02-07  Chris Dumez  <cdumez@apple.com>
2761
2762         Mark more heap-allocated classes as fast allocated
2763         https://bugs.webkit.org/show_bug.cgi?id=194422
2764
2765         Reviewed by Ryosuke Niwa.
2766
2767         * NetworkProcess/NetworkLoad.cpp:
2768         * NetworkProcess/NetworkLoadChecker.h:
2769         * NetworkProcess/NetworkResourceLoader.cpp:
2770         * Platform/IPC/Connection.h:
2771         * Platform/IPC/mac/ImportanceAssertion.h:
2772         * PluginProcess/PluginCreationParameters.h:
2773         * Shared/API/Cocoa/RemoteObjectRegistry.h:
2774         * Shared/WebEvent.h:
2775         * UIProcess/API/APIHTTPCookieStore.cpp:
2776         * UIProcess/API/APINotificationProvider.h:
2777         * UIProcess/API/Cocoa/PageLoadStateObserver.h:
2778         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
2779         * UIProcess/API/Cocoa/WKWebView.mm:
2780         (-[WKWebView _setInputDelegate:]):
2781         * UIProcess/API/gtk/PageClientImpl.h:
2782         * UIProcess/BackingStore.h:
2783         * UIProcess/Cocoa/AutomationClient.h:
2784         * UIProcess/Cocoa/DiagnosticLoggingClient.h:
2785         * UIProcess/Cocoa/DownloadClient.h:
2786         * UIProcess/Cocoa/FindClient.h:
2787         * UIProcess/Cocoa/NavigationState.h:
2788         * UIProcess/Cocoa/UIDelegate.h:
2789         * UIProcess/Cocoa/ViewGestureController.h:
2790         * UIProcess/DeviceIdHashSaltStorage.h:
2791         * UIProcess/Downloads/DownloadProxyMap.h:
2792         * UIProcess/Gamepad/UIGamepad.h:
2793         * UIProcess/Notifications/WebNotificationProvider.h:
2794         * UIProcess/ProcessAssertion.h:
2795         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
2796         * UIProcess/WebContextInjectedBundleClient.h:
2797         * UIProcess/WebFormClient.h:
2798         * UIProcess/WebGeolocationProvider.h:
2799         * UIProcess/WebPageProxy.h:
2800         * WebProcess/Automation/WebAutomationSessionProxy.h:
2801         * WebProcess/InjectedBundle/API/APIInjectedBundleBundleClient.h:
2802         * WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h:
2803         * WebProcess/InjectedBundle/API/APIInjectedBundlePageContextMenuClient.h:
2804         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
2805         * WebProcess/InjectedBundle/API/APIInjectedBundlePageResourceLoadClient.h:
2806         * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
2807         * WebProcess/InjectedBundle/APIInjectedBundleFormClient.h:
2808         * WebProcess/Network/webrtc/LibWebRTCNetwork.h:
2809         * WebProcess/Network/webrtc/LibWebRTCSocket.h:
2810         * WebProcess/Network/webrtc/WebRTCResolver.h:
2811         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
2812         * WebProcess/WebPage/DrawingArea.h:
2813
2814 2019-02-07  Wenson Hsieh  <wenson_hsieh@apple.com>
2815
2816         [iOS] [WK2] Modernize code for applying autocorrection
2817         https://bugs.webkit.org/show_bug.cgi?id=194397
2818
2819         Reviewed by Tim Horton.
2820
2821         * UIProcess/ios/WKContentViewInteraction.h:
2822         * UIProcess/ios/WKContentViewInteraction.mm:
2823         (-[WKContentView requestAutocorrectionRectsForString:withCompletionHandler:]):
2824         (-[WKContentView applyAutocorrection:toString:withCompletionHandler:]):
2825
2826         Use BlockPtr instead of temporarily storing the completion handler.
2827
2828         * WebProcess/WebPage/WebPage.h:
2829         * WebProcess/WebPage/WebPage.messages.in:
2830
2831         Change a LegacySync to Delayed.
2832
2833         * WebProcess/WebPage/ios/WebPageIOS.mm:
2834         (WebKit::WebPage::applyAutocorrection):
2835         (WebKit::WebPage::syncApplyAutocorrection):
2836         (WebKit::WebPage::applyAutocorrectionInternal):
2837
2838 2019-02-07  Wenson Hsieh  <wenson_hsieh@apple.com>
2839
2840         [iOS] Clicking links in Safari using Apple Pencil is much more difficult after r238475
2841         https://bugs.webkit.org/show_bug.cgi?id=194415
2842         <rdar://problem/47550281>
2843
2844         Reviewed by Tim Horton.
2845
2846         Fix the bug by not firing the Apple-pencil-exclusive tap gesture recognizer in the case where editable images
2847         are disabled. This gesture recognizer is only used for inserting editable images, and currently conflicts with
2848         the synthetic click gesture recognizer used to recognize clicks from generic digitizer inputs.
2849
2850         * UIProcess/ios/WKContentViewInteraction.mm:
2851         (-[WKContentView gestureRecognizerShouldBegin:]):
2852         (-[WKContentView _stylusSingleTapRecognized:]):
2853
2854 2019-02-07  Per Arne Vollan  <pvollan@apple.com>
2855
2856         [macOS] Block coreservicesd in sandbox.
2857         https://bugs.webkit.org/show_bug.cgi?id=192670
2858
2859         Reviewed by Alexey Proskuryakov.
2860
2861         We should block CoreServices in newer versions of macOS. In order to achieve this we need to avoid calling
2862         _RegisterApplication before entering the sandbox, since this call will open up a connection to CoreServices.
2863         The call to _RegisterApplication is moved to ChildProcess::updateProcessName, since it is needed to
2864         successfully update the process name. The call to ChildProcess::updateProcessName is made after entering
2865         the sandbox.
2866
2867         * Shared/AuxiliaryProcess.cpp:
2868         (WebKit::AuxiliaryProcess::initialize):
2869         * WebProcess/cocoa/WebProcessCocoa.mm:
2870         (WebKit::WebProcess::initializeProcessName):
2871         (WebKit::WebProcess::platformInitializeProcess):
2872         * WebProcess/com.apple.WebProcess.sb.in:
2873
2874 2019-02-07  Youenn Fablet  <youenn@apple.com>
2875
2876         Filter out Overconstrainederror.constraint when getUserMedia is not granted
2877         https://bugs.webkit.org/show_bug.cgi?id=194240
2878
2879         Reviewed by Eric Carlson.
2880
2881         Make sure in UIProcess to filter out constraint if either the page was not granted gum access or it has no persistent access.
2882
2883         Refactor UserMediaPermissionRequestManagerProxy to make the implementation easier to understand.
2884
2885         Covered by added test.
2886
2887         * UIProcess/UserMediaPermissionCheckProxy.cpp:
2888         (WebKit::UserMediaPermissionCheckProxy::setUserMediaAccessInfo):
2889         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2890         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
2891         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
2892         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess):
2893         (WebKit::UserMediaPermissionRequestManagerProxy::getRequestAction):
2894         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2895         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest):
2896         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionInvalidRequest):
2897         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest):
2898         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo):
2899         (WebKit::UserMediaPermissionRequestManagerProxy::wasGrantedVideoOrAudioAccess):
2900         (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList):
2901         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
2902         (WebKit::UserMediaPermissionRequestManagerProxy::createPermissionRequest): Deleted.
2903         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2904         * UIProcess/UserMediaPermissionRequestProxy.h:
2905         (WebKit::UserMediaPermissionRequestProxy::isPending const):
2906         (WebKit::UserMediaPermissionRequestProxy::setEligibleVideoDeviceUIDs):
2907         (WebKit::UserMediaPermissionRequestProxy::setEligibleAudioDeviceUIDs):
2908         (WebKit::UserMediaPermissionRequestProxy::hasAudioDevice const):
2909         (WebKit::UserMediaPermissionRequestProxy::hasVideoDevice const):
2910         (WebKit::UserMediaPermissionRequestProxy::hasPersistentAccess const):
2911         (WebKit::UserMediaPermissionRequestProxy::setHasPersistentAccess):
2912         (WebKit::UserMediaPermissionRequestProxy::userMediaID const):
2913         (WebKit::UserMediaPermissionRequestProxy::topLevelDocumentSecurityOrigin const):
2914         (WebKit::UserMediaPermissionRequestProxy::userMediaDocumentSecurityOrigin const):
2915         (WebKit::UserMediaPermissionRequestProxy::userRequest const):
2916         (WebKit::UserMediaPermissionRequestProxy::setDeviceIdentifierHashSalt):
2917         (WebKit::UserMediaPermissionRequestProxy::deviceIdentifierHashSalt const):
2918         (WebKit::UserMediaPermissionRequestProxy::audioDevice const):
2919         (WebKit::UserMediaPermissionRequestProxy::videoDevice const):
2920         * UIProcess/WebPageProxy.cpp:
2921         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
2922         * UIProcess/WebPageProxy.h:
2923
2924 2019-02-07  Wenson Hsieh  <wenson_hsieh@apple.com>
2925
2926         [iOS] [WK2] Modernize autocorrection context code
2927         https://bugs.webkit.org/show_bug.cgi?id=194373
2928
2929         Reviewed by Tim Horton.
2930
2931         * Shared/ios/WebAutocorrectionContext.h: Added.
2932         (WebKit::WebAutocorrectionContext::encode const):
2933         (WebKit::WebAutocorrectionContext::decode):
2934
2935         Introduce a WebAutocorrectionContext struct that encapsulates the individual pieces of autocorrection context.
2936         Change to use this instead of a long list of arguments when propagating autocorrection context information over
2937         IPC.
2938
2939         * UIProcess/AutoCorrectionCallback.h:
2940         * UIProcess/WebPageProxy.h:
2941         * UIProcess/WebPageProxy.messages.in:
2942         * UIProcess/ios/WKContentViewInteraction.h:
2943         * UIProcess/ios/WKContentViewInteraction.mm:
2944         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
2945         (+[WKAutocorrectionContext autocorrectionContextWithContext:]):
2946         (+[WKAutocorrectionContext autocorrectionContextWithData:markedText:selectedText:afterText:selectedRangeInMarkedText:]): Deleted.
2947
2948         Change this constructor to take an entire WebAutocorrectionContext.
2949
2950         * UIProcess/ios/WebPageProxyIOS.mm:
2951         (WebKit::WebPageProxy::autocorrectionContextCallback):
2952         (WebKit::WebPageProxy::requestAutocorrectionContext):
2953         (WebKit::WebPageProxy::autocorrectionContextSync):
2954         (WebKit::WebPageProxy::getAutocorrectionContext): Deleted.
2955         * WebKit.xcodeproj/project.pbxproj:
2956         * WebProcess/WebPage/WebPage.h:
2957         * WebProcess/WebPage/WebPage.messages.in:
2958
2959         Use Delayed instead of LegacySync.
2960
2961         * WebProcess/WebPage/ios/WebPageIOS.mm:
2962         (WebKit::WebPage::autocorrectionContext):
2963
2964         Renamed from computeAutocorrectionContext. This is now a private method on WebPage that uses the focused or main
2965         frame to compute and return a WebAutocorrectionContext.
2966
2967         (WebKit::WebPage::requestAutocorrectionContext):
2968         (WebKit::WebPage::autocorrectionContextSync):
2969
2970         Renamed getAutocorrectionContext to autocorrectionContextSync.
2971
2972         (WebKit::computeAutocorrectionContext): Deleted.
2973         (WebKit::WebPage::getAutocorrectionContext): Deleted.
2974
2975 2019-02-07  Youenn Fablet  <youenn@apple.com>
2976
2977         Simplify applyConstraints callbacks
2978         https://bugs.webkit.org/show_bug.cgi?id=194297
2979
2980         Reviewed by Eric Carlson.
2981
2982         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2983         (WebKit::UserMediaCaptureManagerProxy::applyConstraints):
2984         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2985         (WebKit::UserMediaCaptureManager::Source::applyConstraintsSucceeded):
2986         (WebKit::UserMediaCaptureManager::Source::applyConstraintsFailed):
2987         (WebKit::UserMediaCaptureManager::applyConstraintsFailed):
2988         * WebProcess/cocoa/UserMediaCaptureManager.h:
2989
2990 2019-02-07  Brent Fulgham  <bfulgham@apple.com>
2991
2992         Permit additional IOKit Properties needed by Media PlugIns on older Mac Hardware
2993         https://bugs.webkit.org/show_bug.cgi?id=194412
2994         <rdar://problem/47820615>
2995
2996         Reviewed by Per Arne Vollan.
2997
2998         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
2999
3000 2019-02-07  Brent Fulgham  <bfulgham@apple.com>
3001
3002         Permit additional IOKit Properties needed by older Mac Hardware
3003         https://bugs.webkit.org/show_bug.cgi?id=194410
3004         <rdar://problem/47820620>
3005
3006         Reviewed by Per Arne Vollan.
3007
3008         * WebProcess/com.apple.WebProcess.sb.in:
3009
3010 2019-02-07  Brady Eidson  <beidson@apple.com>
3011
3012         Rename the TAKE_DOWNLOAD_ASSERTION macro.
3013
3014         Rubberstamped by Andy Estes.
3015
3016         * NetworkProcess/Downloads/DownloadMap.cpp:
3017         * NetworkProcess/Downloads/DownloadMap.h:
3018
3019 2019-02-07  Keith Rollin  <krollin@apple.com>
3020
3021         Fix XCBuild issue related to codesigning WebContent process
3022         https://bugs.webkit.org/show_bug.cgi?id=193799
3023         <rdar://problem/47533890>
3024
3025         Reviewed by Brent Fulgham.
3026
3027         Building with XCBuild enabled results in the error message "cannot
3028         read entitlement data" when trying to codesign the macOS XPC
3029         processes. The reason for this error message is that there is a build
3030         step that deletes any previous "stale" generated .xcent file before
3031         building up a new one. With XCBuild enabled, the build steps got
3032         re-ordered, such that the step that deletes this file could get
3033         executed after the steps that build up the file. The built-up set of
3034         entitlements is now gone, and the build process fails when `codesign`
3035         tries to access it.
3036
3037         The apparent quick-fix to this problem -- of tweaking dependencies so
3038         that the build steps execute in the desired order -- wouldn't work
3039         with XCBuild. Establishing these dependencies would require both
3040         having multiple build phases produce the same .xcent file as output,
3041         as well as a build phase that has this file as an input and an output.
3042         XCBuild either forbids or frowns upon these configurations.
3043
3044         Ultimately, the solution that worked was to take over complete control
3045         of the codesigning process. This means (a) not specifying a base
3046         .entitlements file that XCode uses to start with (and which was
3047         subsequently altered via custom build scripts), (b) not letting XCode
3048         automatically and silently inject a 'get-task-all' entitlement used to
3049         facilitate debugging (we now add that entitlement by hand), and (c)
3050         building up all of our entitlements by hand via a single custom
3051         script. Because of the addition of this custom script, many other
3052         scripts and entitlements files could now be removed.
3053
3054         * Configurations/BaseXPCService.xcconfig:
3055         * Configurations/Databases-iOS.entitlements: Removed.
3056         * Configurations/Network-OSX-restricted.entitlements: Removed.
3057         * Configurations/Network-OSX-sandbox.entitlements: Removed.
3058         * Configurations/Network-OSX.entitlements: Removed.
3059         * Configurations/NetworkService.xcconfig:
3060         * Configurations/PluginService.64.xcconfig:
3061         * Configurations/PluginService.entitlements: Removed.
3062         * Configurations/WebContent-OSX-sandbox.entitlements: Removed.
3063         * Configurations/WebContent-OSX.entitlements: Removed.
3064         * Configurations/WebContent-or-Plugin-OSX-restricted.entitlements: Removed.
3065         * Configurations/WebContentService.xcconfig:
3066         * Scripts/copy-webcontent-resources-to-private-headers.sh:
3067         * Scripts/process-entitlements.sh: Added.
3068         * Scripts/process-network-sandbox-entitlements.sh: Removed.
3069         * Scripts/process-webcontent-or-plugin-entitlements.sh: Removed.
3070         * Scripts/process-webcontent-sandbox-entitlements.sh: Removed.
3071         * WebKit.xcodeproj/project.pbxproj:
3072
3073 2019-02-07  Alex Christensen  <achristensen@webkit.org>
3074
3075         Fix internal build after r241127
3076         https://bugs.webkit.org/show_bug.cgi?id=191394
3077
3078         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
3079         Add some (un)availability macros.
3080
3081 2019-02-07  Youenn Fablet  <youenn@apple.com>
3082
3083         Make to clear sources from UserMediaCaptureManagerProxy and UserMediaCaptureManager when no longer needed
3084         https://bugs.webkit.org/show_bug.cgi?id=194312
3085
3086         Reviewed by Eric Carlson.
3087
3088         Sources in UserMediaCaptureManager and Proxy are never removed once added to their HashMap.
3089         Use the 'ended' mechanism to do the clean-up on WebProcess side.
3090         As part of this clean-up, send IPC to UIProcess to do clean-up on proxy side.
3091         On WebProcess crash case, clean-up the proxy as well.
3092
3093         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
3094         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
3095         (WebKit::UserMediaCaptureManagerProxy::end):
3096         (WebKit::UserMediaCaptureManagerProxy::clear):
3097         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
3098         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
3099         * UIProcess/WebProcessProxy.cpp:
3100         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
3101         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
3102         (WebKit::UserMediaCaptureManager::sourceEnded):
3103         * WebProcess/cocoa/UserMediaCaptureManager.h:
3104
3105 2019-02-07  Alex Christensen  <achristensen@webkit.org>
3106
3107         Print backgrounds preference should be honored instead of WKWebViewConfiguration value
3108         https://bugs.webkit.org/show_bug.cgi?id=194364
3109         <rdar://problem/47627599>
3110
3111         Reviewed by Tim Horton.
3112
3113         Without this patch, changing the preference for printing the background has no effect.
3114         This patch fixes that, and I verified it manually by checking "Print backgrounds" in Safari's print menu.
3115         Unfortunately, the only way to test this is actually printing because only values from WebPageProxy::preferences
3116         or WebPageProxy::configuration's preferences are exposed to the API, but values from WebPageProxy::preferencesStore
3117         are used when printing.  Actually printing verifies this change fixes the bug.
3118
3119         * UIProcess/API/Cocoa/WKWebView.mm:
3120         (-[WKWebView _initializeWithConfiguration:]):
3121
3122 2019-02-07  Chris Dumez  <cdumez@apple.com>
3123
3124         Mark DisplayLink as fast allocated
3125         https://bugs.webkit.org/show_bug.cgi?id=194400
3126
3127         Reviewed by Geoffrey Garen.
3128
3129         * UIProcess/mac/DisplayLink.h:
3130
3131 2019-02-07  Per Arne Vollan  <pvollan@apple.com>
3132
3133         [macOS] API test times out after r241026
3134         https://bugs.webkit.org/show_bug.cgi?id=194372
3135
3136         Reviewed by Alex Christensen.
3137
3138         The API test TestWebKitAPI.RenderingProgress.FirstMeaningfulPaint times out after r241026.
3139         A new function pointer, layoutMilestones, is added to WKBundlePageLoaderClient, in order
3140         for clients to decide which milestones they would like to listen for.
3141
3142         * WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h:
3143         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
3144         (layoutMilestones):
3145         (setUpPageLoaderClient):
3146         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
3147         (WebKit::InjectedBundlePageLoaderClient::layoutMilestones const):
3148         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
3149
3150 2019-02-07  Alex Christensen  <achristensen@webkit.org>
3151
3152         Deprecate WKBundlePageSetDefersLoading
3153         https://bugs.webkit.org/show_bug.cgi?id=191394
3154
3155         Reviewed by Dean Jackson.
3156
3157         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3158         (WKBundlePageSetDefersLoading):
3159         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
3160         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
3161         (-[WKWebProcessPlugInBrowserContextController _defersLoading]):
3162         (-[WKWebProcessPlugInBrowserContextController _setDefersLoading:]):
3163         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
3164
3165 2019-02-07  Alex Christensen  <achristensen@webkit.org>
3166
3167         Digital crown should scroll safe browsing warning on watchOS
3168         https://bugs.webkit.org/show_bug.cgi?id=194363
3169         <rdar://problem/47348124>
3170
3171         Reviewed by Wenson Hsieh.
3172
3173         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
3174         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
3175         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]):
3176         (-[WKSafeBrowsingWarning addContent]):
3177
3178 2019-02-07  Alex Christensen  <achristensen@webkit.org>
3179
3180         Shrink and hyphenate safe browsing warning text on watchOS
3181         https://bugs.webkit.org/show_bug.cgi?id=194361
3182         <rdar://problem/47466549>
3183
3184         Reviewed by Geoffrey Garen.
3185
3186         Some internationalizations use long words that didn't fit on small watches.
3187
3188         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
3189         (fontOfSize):
3190         (-[WKSafeBrowsingWarning addContent]):
3191         (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
3192
3193 2019-02-07  Miguel Gomez  <magomez@igalia.com>
3194
3195         [WPE] Implement GStreamer based holepunch
3196         https://bugs.webkit.org/show_bug.cgi?id=193715
3197
3198         Reviewed by Xabier Rodriguez-Calvar.
3199
3200         Add a new parameter to the calls of TextureMapper::drawSolidColor().
3201
3202         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3203         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
3204
3205 2019-02-06  Benjamin Poulain  <benjamin@webkit.org>
3206
3207         Unreviewed, rolling out r240759 and r240944.
3208
3209         Some timer uses are done off the main thread, WebCore::Timer
3210         cannot be used
3211
3212         Reverted changesets:
3213
3214         "<rdar://problem/47570443> Responsiveness timers are too
3215         expensive for frequent events"
3216         https://bugs.webkit.org/show_bug.cgi?id=194003
3217         https://trac.webkit.org/changeset/240759
3218
3219         "Use deferrable timer to restart the Responsiveness Timer on
3220         each wheel event"
3221         https://bugs.webkit.org/show_bug.cgi?id=194135
3222         https://trac.webkit.org/changeset/240944
3223
3224 2019-02-06  chris fleizach  <cfleizach@apple.com>
3225
3226         AX:  com.apple.WebKit.WebContent at WebKit: -[WKAccessibilityWebPageObjectBase axObjectCache]
3227         https://bugs.webkit.org/show_bug.cgi?id=194306
3228         <rdar://problem/47764549>
3229
3230         Reviewed by Zalan Bujtas.
3231
3232         Check the page reference is still valid.
3233         Modernize code in this area.
3234
3235         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
3236
3237 2019-02-06  Daniel Bates  <dabates@apple.com>
3238
3239         Move toNSEventModifierFlags() and toNSButtonNumber() to WebEventFactory.mm
3240         https://bugs.webkit.org/show_bug.cgi?id=194321
3241
3242         Reviewed by Jer Noble.
3243
3244         Move some code to WebEventFactory so that it can be shared by both WKNavigationAction.mm
3245         and UIDelegate.mm among other benefits.
3246
3247         * Shared/mac/WebEventFactory.h:
3248         * Shared/mac/WebEventFactory.mm:
3249         (WebKit::WebEventFactory::toNSEventModifierFlags):
3250         (WebKit::WebEventFactory::toNSButtonNumber):
3251         * UIProcess/API/Cocoa/WKNavigationAction.mm:
3252         (-[WKNavigationAction modifierFlags]):
3253         (-[WKNavigationAction buttonNumber]):
3254         (toNSEventModifierFlags): Deleted.
3255         (toNSButtonNumber): Deleted.
3256         * UIProcess/Cocoa/UIDelegate.mm:
3257         (WebKit::UIDelegate::UIClient::mouseDidMoveOverElement):
3258         (WebKit::toNSEventModifierFlags): Deleted.
3259
3260 2019-02-06  Andy Estes  <aestes@apple.com>
3261
3262         [Payment Request] It should be possible to require a phonetic name for shipping contacts
3263         https://bugs.webkit.org/show_bug.cgi?id=194311
3264         <rdar://46733045>
3265
3266         Reviewed by Alex Christensen.
3267
3268         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
3269         (WebKit::WebPaymentCoordinator::supportsVersion): Deleted.
3270         * WebProcess/ApplePay/WebPaymentCoordinator.h:
3271
3272 2019-02-06  Keith Rollin  <krollin@apple.com>
3273
3274         Really enable the automatic checking and regenerations of .xcfilelists during builds
3275         https://bugs.webkit.org/show_bug.cgi?id=194357
3276         <rdar://problem/47861231>
3277
3278         Reviewed by Chris Dumez.
3279
3280         Bug 194124 was supposed to enable the automatic checking and
3281         regenerating of .xcfilelist files during the build. While related
3282         changes were included in that patch, the change to actually enable the
3283         operation somehow was omitted. This patch actually enables the
3284         operation. The check-xcfilelist.sh scripts now check
3285         WK_DISABLE_CHECK_XCFILELISTS, and if it's "1", opts-out the developer
3286         from the checking.
3287
3288         * Scripts/check-xcfilelists.sh:
3289
3290 2019-02-06  John Wilander  <wilander@apple.com>
3291
3292         Forward Ad Click Attribution data from HTMLAnchorElement::handleClick() to WebKit::NavigationActionData
3293         https://bugs.webkit.org/show_bug.cgi?id=194325
3294         <rdar://problem/47840283>
3295
3296         Reviewed by Chris Dumez.
3297
3298         * Shared/NavigationActionData.cpp:
3299         (WebKit::NavigationActionData::encode const):
3300         (WebKit::NavigationActionData::decode):
3301         * Shared/NavigationActionData.h:
3302             Now holds an optional WebCore::AdClickAttribution object.
3303
3304 2019-02-06  Daniel Bates  <dabates@apple.com>
3305
3306         Fix the Apple Internal build. See <rdar://problem/47860943> for more details.
3307
3308         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
3309         (-[WKFullscreenStackView init]):
3310
3311 2019-02-06  Daniel Bates  <dabates@apple.com>
3312
3313         Standardize on ControlKey instead of CtrlKey
3314         https://bugs.webkit.org/show_bug.cgi?id=194317
3315
3316         Reviewed by Tim Horton.
3317
3318         * Shared/WebEventConversion.cpp:
3319         (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
3320         (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
3321         (WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
3322         (WebKit::WebKit2PlatformTouchEvent::WebKit2PlatformTouchEvent):
3323         (WebKit::WebKit2PlatformGestureEvent::WebKit2PlatformGestureEvent):
3324         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
3325         (WebKit::WebEditorClient::handleKeyboardEvent):
3326         * WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp:
3327         (WebKit::handleKeyPress):
3328
3329 2019-02-06  Per Arne Vollan  <pvollan@apple.com>
3330
3331         Roll out parts of r238819 since it is a PLT performance regression.
3332         https://bugs.webkit.org/show_bug.cgi?id=194346
3333
3334         Unreviewed performance fix.
3335
3336         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
3337         (didStartProvisionalLoadForFrame):
3338         (didReceiveServerRedirectForProvisionalLoadForFrame):
3339         (didFinishLoadForFrame):
3340         (globalObjectIsAvailableForFrame):
3341         (didRemoveFrameFromHierarchy):
3342         (didCommitLoadForFrame):
3343         (didFinishDocumentLoadForFrame):
3344         (didFailProvisionalLoadWithErrorForFrame):
3345         (didFailLoadWithErrorForFrame):
3346         (didSameDocumentNavigationForFrame):
3347         (didLayoutForFrame):
3348         (didReachLayoutMilestone):
3349         (didFirstVisuallyNonEmptyLayoutForFrame):
3350         (didHandleOnloadEventsForFrame):
3351         (userAgentForURL):
3352         (setUpPageLoaderClient):
3353         (willSendRequestForFrame):
3354         (didInitiateLoadForResource):
3355         (didFinishLoadForResource):
3356         (didFailLoadForResource):
3357         (setUpResourceLoadClient):
3358         (-[WKWebProcessPlugInBrowserContextController setLoadDelegate:]):
3359         (ResourceLoadClient::ResourceLoadClient): Deleted.
3360         (ResourceLoadClient::loadDelegate const): Deleted.
3361         (ResourceLoadClient::pluginContextController const): Deleted.
3362         (PageLoaderClient::PageLoaderClient): Deleted.
3363         (PageLoaderClient::loadDelegate const): Deleted.
3364         (PageLoaderClient::pluginContextController const): Deleted.
3365         (PageLoaderClient::didStartProvisionalLoadForFrame): Deleted.
3366         (PageLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame): Deleted.
3367         (PageLoaderClient::didFinishLoadForFrame): Deleted.
3368         (PageLoaderClient::globalObjectIsAvailableForFrame): Deleted.
3369         (PageLoaderClient::didRemoveFrameFromHierarchy): Deleted.
3370         (PageLoaderClient::didCommitLoadForFrame): Deleted.
3371         (PageLoaderClient::didFinishDocumentLoadForFrame): Deleted.
3372         (PageLoaderClient::didFailProvisionalLoadWithErrorForFrame): Deleted.
3373         (PageLoaderClient::didFailLoadWithErrorForFrame): Deleted.
3374         (PageLoaderClient::didSameDocumentNavigationForFrame): Deleted.
3375         (PageLoaderClient::didLayoutForFrame): Deleted.
3376         (PageLoaderClient::didReachLayoutMilestone): Deleted.
3377         (PageLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame): Deleted.
3378         (PageLoaderClient::layoutMilestones const): Deleted.
3379         (PageLoaderClient::didHandleOnloadEventsForFrame): Deleted.
3380         (PageLoaderClient::userAgentForURL const): Deleted.
3381         (ResourceLoadClient::willSendRequestForFrame): Deleted.
3382         (ResourceLoadClient::didInitiateLoadForResource): Deleted.
3383         (ResourceLoadClient::didFinishLoadForResource): Deleted.
3384         (ResourceLoadClient::didFailLoadForResource): Deleted.
3385
3386 2019-02-06  Michael Catanzaro  <mcatanzaro@igalia.com>
3387
3388         REGRESSION(r240785): [SOUP] Broke cookie persistent storage
3389         https://bugs.webkit.org/show_bug.cgi?id=194209
3390
3391         Reviewed by Carlos Garcia Campos.
3392
3393         I missed a spot when moving the persistent storage parameters from NetworkProcess to
3394         NetworkSession. They have to be initialized separately for the default session.
3395
3396         * UIProcess/soup/WebProcessPoolSoup.cpp:
3397         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3398
3399 2019-02-05  Alex Christensen  <achristensen@webkit.org>
3400
3401         Stop using blobRegistry in NetworkProcess
3402         https://bugs.webkit.org/show_bug.cgi?id=194027
3403
3404         Reviewed by Youenn Fablet.
3405
3406         * NetworkProcess/Downloads/DownloadManager.cpp:
3407         (WebKit::DownloadManager::startDownload):
3408      &n