[iOS] Consider the annotation bounds when positioning action sheets near long-pressed...
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-05-09  Andy Estes  <aestes@apple.com>
2
3         [iOS] Consider the annotation bounds when positioning action sheets near long-pressed PDF links
4         https://bugs.webkit.org/show_bug.cgi?id=185472
5         <rdar://problem/39967092>
6
7         Reviewed by Daniel Bates.
8
9         Adopted new PDFHostViewControllerDelegate methods that include annotation rects
10         when URLs and page indices are long-pressed. This allows us to avoid obscuring
11         annotations when positioning action sheet popovers.
12
13         We also no longer need to convert the press location into host view coordinate
14         space, as PDFKit now does that for us.
15
16         * UIProcess/ios/WKPDFView.mm:
17         (-[WKPDFView _showActionSheetForURL:atLocation:withAnnotationRect:]):
18         (-[WKPDFView pdfHostViewController:didLongPressURL:atLocation:withAnnotationRect:]):
19         (-[WKPDFView pdfHostViewController:didLongPressPageIndex:atLocation:withAnnotationRect:]):
20         (-[WKPDFView _showActionSheetForURL:atLocation:]): Deleted.
21         (-[WKPDFView pdfHostViewController:didLongPressURL:atLocation:]): Deleted.
22         (-[WKPDFView pdfHostViewController:didLongPressPageIndex:atLocation:]): Deleted.
23
24 2018-05-09  Andy Estes  <aestes@apple.com>
25
26         [iOS] Tell PDFHostViewController when animated resizes begin and end
27         https://bugs.webkit.org/show_bug.cgi?id=185477
28         <rdar://problem/39875372>
29
30         Reviewed by Anders Carlsson.
31
32         * UIProcess/API/Cocoa/WKWebView.mm:
33         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
34         (-[WKWebView _endAnimatedResize]):
35         * UIProcess/Cocoa/WKWebViewContentProvider.h:
36         * UIProcess/ios/WKPDFView.mm:
37         (-[WKPDFView web_beginAnimatedResize]):
38         (-[WKPDFView web_endAnimatedResize]):
39
40 2018-05-09  Michael Catanzaro  <mcatanzaro@igalia.com>
41
42         Unreviewed. Update OptionsWPE.cmake and NEWS for 2.21.1 release.
43
44         * wpe/NEWS: Added. Add release notes for 2.21.1.
45
46 2018-05-09  Michael Catanzaro  <mcatanzaro@igalia.com>
47
48         [WPE] Build cleanly with GCC 8 and ICU 60
49         https://bugs.webkit.org/show_bug.cgi?id=185462
50
51         Reviewed by Carlos Alberto Lopez Perez.
52
53         * Platform/IPC/glib/GSocketMonitor.cpp:
54         (IPC::GSocketMonitor::start): Silence -Wcast-function-type warning.
55         * Shared/API/glib/WebKitContextMenu.cpp:
56         (webkit_context_menu_new_with_items): Ditto.
57
58 2018-05-08  Sihui Liu  <sihui_liu@apple.com>
59
60         Adopt new async _savecookies SPI for keeping networking process active during flushing cookies
61         https://bugs.webkit.org/show_bug.cgi?id=185261
62         <rdar://problem/37214391>
63
64         Reviewed by Chris Dumez.
65
66         By adopting new async SPI _savecookies, we can keep networking process active(not suspended)
67         until cookies are fully synced to disk with process assertion.
68
69         * NetworkProcess/NetworkProcess.cpp:
70         (WebKit::NetworkProcess::didSyncAllCookies):
71         * NetworkProcess/NetworkProcess.h:
72         * NetworkProcess/NetworkProcess.messages.in:
73         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
74         (WebKit::NetworkProcess::syncAllCookies):
75         * UIProcess/Network/NetworkProcessProxy.cpp:
76         (WebKit::NetworkProcessProxy::didClose):
77         (WebKit::NetworkProcessProxy::syncAllCookies):
78         (WebKit::NetworkProcessProxy::didSyncAllCookies):
79         * UIProcess/Network/NetworkProcessProxy.h:
80         * UIProcess/Network/NetworkProcessProxy.messages.in:
81         * UIProcess/WebProcessPool.cpp:
82         (WebKit::WebProcessPool::syncNetworkProcessCookies):
83
84 2018-05-08  Per Arne Vollan  <pvollan@apple.com>
85
86         Set colorspace in the PDF plugin.
87         https://bugs.webkit.org/show_bug.cgi?id=185445
88         <rdar://problem/40030981>
89
90         Reviewed by Simon Fraser.
91
92         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h:
93         * WebProcess/Plugins/PDF/PDFPlugin.mm:
94         (WebKit::PDFPlugin::PDFPlugin):
95
96 2018-05-08  Megan Gardner  <megan_gardner@apple.com>
97
98         Don't clear selection until we are actually interacting with a Node.
99         https://bugs.webkit.org/show_bug.cgi?id=185455
100
101         Reviewed by Wenson Hsieh.
102         
103         The presence of TextInteractionAssistant should not be used as a proxy for it we are actually editing content.
104         We need to check to see if we have an active node, and then we should clear the selection.
105
106         * UIProcess/ios/WKContentViewInteraction.mm:
107         (-[WKContentView setSelectedTextRange:]):
108
109 2018-05-08  Ryan Haddad  <ryanhaddad@apple.com>
110
111         Unreviewed, rolling out r231486.
112
113         Caused service worker LayoutTest failures on macOS Debug WK2.
114
115         Reverted changeset:
116
117         "Allow WebResourceLoader to cancel a load served from a
118         service worker"
119         https://bugs.webkit.org/show_bug.cgi?id=185274
120         https://trac.webkit.org/changeset/231486
121
122 2018-05-08  Andy Estes  <aestes@apple.com>
123
124         [iOS] _WKWebViewPrintFormatter should return a page count of 0 for PDF documents that do not allow printing
125         https://bugs.webkit.org/show_bug.cgi?id=185133
126
127         Reviewed by Andreas Kling.
128
129         * UIProcess/ios/WKPDFView.mm:
130         (-[WKPDFView _ensureDocumentForPrinting]):
131         (-[WKPDFView _wk_pageCountForPrintFormatter:]):
132         (-[WKPDFView _wk_printedDocument]):
133
134 2018-05-08  Andy Estes  <aestes@apple.com>
135
136         [iOS] WKPDFView remains in the view hierarchy after navigating away
137         https://bugs.webkit.org/show_bug.cgi?id=185449
138         <rdar://problem/39693469>
139
140         Reviewed by Tim Horton.
141
142         WKPDFView removes the PDF host view from the view hierarchy in its -dealloc
143         method, and relies on WKWebView releasing its last reference in
144         -_setHasCustomContentView:loadedMIMEType: when the user navigates.
145
146         However, WKWPDFView was capturing a strong reference to self in the block passed
147         to +[PDFHostViewController createHostView:forExtensionIdentifier:], and PDFKit
148         (actually UIKit) is retaining this block beyond its being called. This results in
149         the PDF host view remaining as a child of the WKScrollView even after the user
150         navigates to another page.
151
152         Changed the aforementioned block to a lambda that captures a weak reference to
153         self to prevent WKPDFView from outliving the current navigation.
154
155         * UIProcess/ios/WKPDFView.mm:
156         (-[WKPDFView retain]):
157         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
158
159 2018-05-08  John Wilander  <wilander@apple.com>
160
161         Storage Access API: Make user opt-in sticky
162         https://bugs.webkit.org/show_bug.cgi?id=185454
163         <rdar://problem/40003946>
164
165         Reviewed by Alex Christensen.
166
167         This patch persists the user's choice to opt-in to access under specific domains.
168         Such storage access should age out with the accessing domain's cookies and website
169         data. The opt-in prompt is still an experimental feature.
170
171         * UIProcess/WebResourceLoadStatisticsStore.cpp:
172         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
173         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
174         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
175         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
176         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessInternal):
177         (WebKit::WebResourceLoadStatisticsStore::hasUserGrantedStorageAccessThroughPrompt const):
178         (WebKit::WebResourceLoadStatisticsStore::hasHadUnexpiredRecentUserInteraction const):
179         * UIProcess/WebResourceLoadStatisticsStore.h:
180
181 2018-05-08  Daniel Bates  <dabates@apple.com>
182
183         Do not apply X-Frame-Options and CSP frame-ancestors to Quick Look-applicable responses in NetworkProcess
184         https://bugs.webkit.org/show_bug.cgi?id=185442
185         <rdar://problem/40067209>
186
187         Reviewed by Andy Estes.
188
189         Just as we exempt responses in WebContent process that will be handled by Quick Look from the Content
190         Security Policy frame-ancestors directive and X-Frame-Options checking we need to do the same when
191         such checks are performed in NetworkProcess following r231479.
192
193         HTTP responses that will be previewed using Quick Look are not considered web pages and are subject
194         to the security model for Quick Look documents. That is, they are exempt from Content Security Policy
195         and X-Frame-Options processing.
196
197         * NetworkProcess/NetworkResourceLoader.cpp:
198         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
199
200 2018-05-08  Brian Burg  <bburg@apple.com>
201
202         REGRESSION(r230743): Mousemove events are not coalesced properly, mousemove/drag is very laggy
203         https://bugs.webkit.org/show_bug.cgi?id=185425
204         <rdar://problem/39323336>
205
206         Reviewed by Simon Fraser.
207
208         When mousemove events come in faster than they can be processed, we should coalesce
209         pending mousemoves that have not yet been sent to WebProcess. This has the effect of
210         processing the most recent mousemove location, which is the old behavior that regressed.
211
212         * UIProcess/WebPageProxy.cpp:
213         (WebKit::WebPageProxy::handleMouseEvent):
214         If there is >1 event in the mouse queue, then the first one is being processed by WebProcess
215         and the second one is eligible for coalescing. Replace it if the last event and new event
216         are both mousemoves.
217
218 2018-05-08  Per Arne Vollan  <pvollan@apple.com>
219
220         The PDF context menu should not be created in the WebContent process.
221         https://bugs.webkit.org/show_bug.cgi?id=185401
222
223         Reviewed by Tim Horton.
224
225         Send a sync IPC message from the WebContent process to the UI process with the necessary context
226         menu information when the menu is requested. The NSMenu will then be created and shown in the
227         UI process. The reply will contain the selected menu item index.
228
229         * Shared/mac/PDFContextMenu.h: Added.
230         (WebKit::PDFContextMenuItem::encode const):
231         (WebKit::PDFContextMenuItem::decode):
232         (WebKit::PDFContextMenu::encode const):
233         (WebKit::PDFContextMenu::decode):
234         * UIProcess/WebPageProxy.h:
235         * UIProcess/WebPageProxy.messages.in:
236         * UIProcess/mac/WebPageProxyMac.mm:
237         (-[WKPDFMenuTarget menuItem]):
238         (-[WKPDFMenuTarget contextMenuAction:]):
239         (WebKit::WebPageProxy::showPDFContextMenu):
240         * WebKit.xcodeproj/project.pbxproj:
241         * WebProcess/Plugins/PDF/PDFPlugin.mm:
242         (WebKit::PDFPlugin::handleContextMenuEvent):
243
244 2018-05-08  Dean Jackson  <dino@apple.com>
245
246         System Preview links should trigger a download
247         https://bugs.webkit.org/show_bug.cgi?id=185439
248         <rdar://problem/40065545>
249
250         Reviewed by Jon Lee.
251
252         Encode the new field identifying a system preview. And
253         if you encounter such a resource request, trigger
254         a download.
255
256         * Shared/WebCoreArgumentCoders.cpp:
257         (IPC::ArgumentCoder<ResourceRequest>::encode):
258         (IPC::ArgumentCoder<ResourceRequest>::decode):
259         * UIProcess/WebPageProxy.cpp:
260         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
261
262 2018-05-08  John Wilander  <wilander@apple.com>
263
264         Storage Access API: Add a request roundtrip to check whether prompting is needed
265         https://bugs.webkit.org/show_bug.cgi?id=185368
266         <rdar://problem/40011556>
267
268         Reviewed by Alex Christensen and Youenn Fablet.
269
270         This patch adds an enum WebKit::StorageAccessStatus to handle our three access
271         states:
272         - WebKit::StorageAccessStatus::CannotRequestAccess.
273             This means the domain is blocked from cookie access.
274         - WebKit::StorageAccessStatus::RequiresUserPrompt.
275             This means that access has not been granted yet and a prompt is required.
276         - WebKit::StorageAccessStatus::HasAccess.
277             This either means that this domain does not need to ask for access,
278             access was already granted, or access was granted now.
279
280         If the call to WebResourceLoadStatisticsStore::requestStorageAccess() comes
281         back as WebKit::StorageAccessStatus::RequiresUserPrompt, the WebPageProxy
282         prompts the user and if the user said yes, calls a direct
283         WebResourceLoadStatisticsStore::grantStorageAccess().
284
285         Existing test cases pass because requestStorageAccessConfirm in WKPage.cpp
286         does not have m_client.requestStorageAccessConfirm and thus returns true.
287
288         * UIProcess/Network/NetworkProcessProxy.messages.in:
289             Added a missing #endif.
290         * UIProcess/WebPageProxy.cpp:
291         (WebKit::WebPageProxy::requestStorageAccess):
292             Here we now handle the various cases encoded in WebKit::StorageAccessStatus.
293         * UIProcess/WebResourceLoadStatisticsStore.cpp:
294         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
295             Now covers the optional prompt case.
296         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
297         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
298         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessInternal):
299             Granting access is broken out to allow WebKit::WebPageProxy to call it
300             directly.
301         * UIProcess/WebResourceLoadStatisticsStore.h:
302         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
303         (WebKit::WebsiteDataStore::requestStorageAccess):
304         (WebKit::WebsiteDataStore::grantStorageAccess):
305             Piping through calls from from WebKit::WebResourceLoadStatisticsStore
306             to WebKit::WebPageProxy.
307         * UIProcess/WebsiteData/WebsiteDataStore.h:
308
309 2018-05-08  Chris Dumez  <cdumez@apple.com>
310
311         Unreviewed, rolling out r231376 and r231458.
312
313         Caused some API tests failures on iOS
314
315         Reverted changesets:
316
317         "[iOS] Apps that are not visible may not get suspended if they
318         trigger page loads while in the background"
319         https://bugs.webkit.org/show_bug.cgi?id=185318
320         https://trac.webkit.org/changeset/231376
321
322         "[iOS] Release page load process assertion if the screen is
323         locked"
324         https://bugs.webkit.org/show_bug.cgi?id=185333
325         https://trac.webkit.org/changeset/231458
326
327 2018-05-08  Dean Jackson  <dino@apple.com>
328
329         Use thumbnails in System Previews
330         https://bugs.webkit.org/show_bug.cgi?id=185397
331         <rdar://problem/40039376>
332
333         Reviewed by Jon Lee.
334
335         A system preview that goes through the WKWebViewContentProvider will
336         show a static thumbnail/snapshot of the item, rather than jumping
337         directly to QuickLook.
338
339         This means we have to link to the AssetViewer framework. That provides
340         a ASVThumbnailView that will trigger QuickLook for us.
341
342         * Configurations/WebKit.xcconfig: Link to AssetViewer.
343
344         * UIProcess/ios/WKSystemPreviewView.h: Better macro use. Remove some unneeded protocols.
345         * UIProcess/ios/WKSystemPreviewView.mm:
346         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]): Update this
347         to use an ASVThumbnailView, when on the internal SDK (because it is private).
348         (-[WKSystemPreviewView _layoutThumbnailView]): Use the content insets to put
349         the thumbnail in the right place.
350         (-[WKSystemPreviewView thumbnailView:wantsToPresentPreviewController:forItem:]):
351         Delegate method.
352         (-[WKSystemPreviewView web_contentView]):
353         (-[WKSystemPreviewView web_computedContentInsetDidChange]):
354         (-[WKSystemPreviewView numberOfPreviewItemsInPreviewController:]): Deleted.
355         (-[WKSystemPreviewView previewController:previewItemAtIndex:]): Deleted.
356         (-[WKSystemPreviewView previewControllerWillDismiss:]): Deleted.
357
358 2018-05-08  Youenn Fablet  <youenn@apple.com>
359
360         Allow WebResourceLoader to cancel a load served from a service worker
361         https://bugs.webkit.org/show_bug.cgi?id=185274
362
363         Reviewed by Chris Dumez.
364
365         Use FetchIdentifier instead of uint64_t.
366         Add IPC support for cancelling a fetch from WebProcess to service worker process.
367         Ask service worker process to cancel the fetch when its corresponding WebResourceLoader is cancelled.
368         No change of behavior as once a WebResourceLoader is cancelled, any related IPC is not processed.
369         A follow-up patch should try to cancel the FetchResponse load, meaning to either cancel the network load
370         or to abort reading the readable stream.
371
372         * Scripts/webkit/messages.py:
373         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
374         (WebKit::WebSWServerConnection::cancelFetch):
375         (WebKit::WebSWServerConnection::startFetch):
376         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
377         (WebKit::WebSWServerConnection::didReceiveFetchData):
378         (WebKit::WebSWServerConnection::didReceiveFetchFormData):
379         (WebKit::WebSWServerConnection::didFinishFetch):
380         (WebKit::WebSWServerConnection::didFailFetch):
381         (WebKit::WebSWServerConnection::didNotHandleFetch):
382         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
383         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
384         * StorageProcess/StorageProcess.cpp:
385         (WebKit::StorageProcess::didFailFetch):
386         (WebKit::StorageProcess::didNotHandleFetch):
387         (WebKit::StorageProcess::didReceiveFetchResponse):
388         (WebKit::StorageProcess::didReceiveFetchData):
389         (WebKit::StorageProcess::didReceiveFetchFormData):
390         (WebKit::StorageProcess::didFinishFetch):
391         * StorageProcess/StorageProcess.h:
392         * StorageProcess/StorageProcess.messages.in:
393         * WebProcess/Network/WebLoaderStrategy.cpp:
394         (WebKit::WebLoaderStrategy::remove):
395         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
396         (WebKit::ServiceWorkerClientFetch::create):
397         (WebKit::ServiceWorkerClientFetch::ServiceWorkerClientFetch):
398         (WebKit::ServiceWorkerClientFetch::start):
399         (WebKit::ServiceWorkerClientFetch::cancel):
400         * WebProcess/Storage/ServiceWorkerClientFetch.h:
401         * WebProcess/Storage/WebSWClientConnection.cpp:
402         (WebKit::WebSWClientConnection::startFetch):
403         (WebKit::WebSWClientConnection::cancelFetch):
404         * WebProcess/Storage/WebSWClientConnection.h:
405         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
406         (WebKit::WebSWContextManagerConnection::cancelFetch):
407         (WebKit::WebSWContextManagerConnection::startFetch):
408         * WebProcess/Storage/WebSWContextManagerConnection.h:
409         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
410         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
411         (WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
412         (WebKit::WebServiceWorkerFetchTaskClient::cancel):
413         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
414         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
415         (WebKit::WebServiceWorkerProvider::handleFetch):
416         (WebKit::WebServiceWorkerProvider::cancelFetch):
417         (WebKit::WebServiceWorkerProvider::fetchFinished):
418         * WebProcess/Storage/WebServiceWorkerProvider.h:
419
420 2018-05-08  Antti Koivisto  <antti@apple.com>
421
422         Don't use mapped cache files in case of Class A/B protected app
423         https://bugs.webkit.org/show_bug.cgi?id=185422
424         <rdar://problem/34001688>
425
426         Reviewed by Chris Dumez.
427
428         Currently we don't use shared memory maps in these cases. This still leaves us open for crashes
429         in the network process when the device is locked.
430
431         This patch disables use of blob storage (mapped cache files) in apps that use class A/B protection.
432         Normally we use blobs for resources > 16KB. Since use of shared memory is already disabled,
433         the only optimization lost for these apps is body data deduplication.
434
435         Any existing cache entries with blobs are ignored and deleted. New entries are created with
436         body data inlined with the metadata.
437
438         * NetworkProcess/cache/NetworkCache.cpp:
439         (WebKit::NetworkCache::Cache::store):
440         * NetworkProcess/cache/NetworkCache.h:
441         (WebKit::NetworkCache::Cache::canUseSharedMemoryForBodyData const): Deleted.
442         * NetworkProcess/cache/NetworkCacheEntry.cpp:
443         (WebKit::NetworkCache::Entry::initializeShareableResourceHandleFromStorageRecord const):
444
445             Remove the code the prevented use of shared memory in these cases. Non-mapped Data objects
446             are never shareable.
447
448         (WebKit::NetworkCache::Entry::setNeedsValidation):
449         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
450         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
451         (WebKit::NetworkCache::canUseSharedMemoryForPath): Deleted.
452         * NetworkProcess/cache/NetworkCacheFileSystem.h:
453         * NetworkProcess/cache/NetworkCacheStorage.cpp:
454         (WebKit::NetworkCache::Storage::Storage):
455         (WebKit::NetworkCache::Storage::mayContainBlob const):
456         (WebKit::NetworkCache::Storage::shouldStoreBodyAsBlob):
457         (WebKit::NetworkCache::shouldStoreBodyAsBlob): Deleted.
458         * NetworkProcess/cache/NetworkCacheStorage.h:
459         (WebKit::NetworkCache::Storage::canUseSharedMemoryForBodyData const): Deleted.
460
461 2018-05-07  Carlos Garcia Campos  <cgarcia@igalia.com>
462
463         Unreviewed. Add missing exit not included in r231298.
464
465         * WebProcess/WebProcess.cpp:
466         (WebKit::WebProcess::ensureWebToStorageProcessConnection):
467
468 2018-05-07  Daniel Bates  <dabates@apple.com>
469
470         Check X-Frame-Options and CSP frame-ancestors in network process
471         https://bugs.webkit.org/show_bug.cgi?id=185410
472         <rdar://problem/37733934>
473
474         Reviewed by Ryosuke Niwa.
475
476         * NetworkProcess/NetworkResourceLoadParameters.cpp:
477         (WebKit::NetworkResourceLoadParameters::encode const): Always encode the frame ancestor origins.
478         (WebKit::NetworkResourceLoadParameters::decode): Always decode the frame ancestor origins.
479         * NetworkProcess/NetworkResourceLoader.cpp:
480         (WebKit::NetworkResourceLoader::shouldInterruptLoadForXFrameOptions): Added.
481         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions): Added.
482         (WebKit::NetworkResourceLoader::didReceiveResponse): Check if the load needs to be interrupted due
483         to a violation of the CSP frame-ancestors directive or X-Frame-Options. If there is a violation
484         then stop the load.
485         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry): Ditto.
486         (NetworkResourceLoader::addConsoleMessage): Added.
487         (NetworkResourceLoader::sendCSPViolationReport): Added.
488         * NetworkProcess/NetworkResourceLoader.h:
489         * Scripts/webkit/messages.py: Teach the generator about data types MessageLevel and MessageSource
490         as they are both defined in file JavaScriptCore/ConsoleTypes.h as opposed to independent headers.
491         Also tell the generator that these types should not be forward declared so that we can use these
492         types without their JSC:: prefix in WebPage.messages.in.
493         * WebProcess/Network/NetworkProcessConnection.cpp:
494         (WebKit::NetworkProcessConnection::didReceiveMessage): Route WebPage messages to the appropriate
495         web page.
496         * WebProcess/Network/WebLoaderStrategy.cpp:
497         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): Added message StopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied.
498         * WebProcess/Network/WebResourceLoader.cpp:
499         (WebKit::WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied): Added.
500         * WebProcess/Network/WebResourceLoader.h:
501         * WebProcess/Network/WebResourceLoader.messages.in:
502         * WebProcess/WebPage/WebFrame.cpp:
503         (WebKit::WebFrame::addConsoleMessage):
504         * WebProcess/WebPage/WebFrame.h:
505         * WebProcess/WebPage/WebPage.cpp:
506         (WebKit::WebPage::addConsoleMessage): Added.
507         (WebKit::WebPage::sendCSPViolationReport): Added.
508         * WebProcess/WebPage/WebPage.h:
509         * WebProcess/WebPage/WebPage.messages.in: Add messages AddConsoleMessage and SendCSPViolationReport
510         for adding a console message to Web Inspector and sending a CSP report, respectively.
511
512 2018-05-07  Daniel Bates  <dabates@apple.com>
513
514         Abstract logic to log console messages and send CSP violation reports into a client
515         https://bugs.webkit.org/show_bug.cgi?id=185393
516         <rdar://problem/40036053>
517
518         Reviewed by Brent Fulgham.
519
520         For now, build a URL from the source origin associated with the NetworkResourceLoader
521         and pass this to the ContentSecurityPolicy constructor.
522
523         Additionally, make NetworkLoadChecker::contentSecurityPolicy() non-const since it returns
524         a non-const pointer to a ContentSecurityPolicy object; => callers can mutate this object
525         right from under NetworkLoadChecker. Making this non-const makes this clear to a reader.
526         Also remove the mutable keyword from the definition of NetworkLoadChecker::m_contentSecurityPolicy.
527
528         * NetworkProcess/NetworkLoadChecker.cpp:
529         (WebKit::NetworkLoadChecker::contentSecurityPolicy):
530         (WebKit::NetworkLoadChecker::contentSecurityPolicy const): Deleted.
531         * NetworkProcess/NetworkLoadChecker.h:
532
533 2018-05-07  Alex Christensen  <achristensen@webkit.org>
534
535         WebResourceLoadStatisticsStore::requestStorageAccess should call its completion handler on the main thread
536         https://bugs.webkit.org/show_bug.cgi?id=185403
537
538         Reviewed by Brent Fulgham.
539
540         * UIProcess/WebResourceLoadStatisticsStore.cpp:
541         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
542
543 2018-05-07  Chris Dumez  <cdumez@apple.com>
544
545         [iOS] Release page load process assertion if the screen is locked
546         https://bugs.webkit.org/show_bug.cgi?id=185333
547
548         Reviewed by Geoffrey Garen.
549
550         We normally take a background process assertion during page loads to allow them to complete
551         even if the tab / app is backgrounded. We should however avoid doing so when the backgrounding
552         is caused by the screen locking. Keeping the process assertion in this case would prevent the
553         whole device from sleeping longer than it should, thus negatively impacting power.
554
555         * UIProcess/Cocoa/NavigationState.h:
556         * UIProcess/Cocoa/NavigationState.mm:
557         (WebKit::NavigationState::NavigationState):
558         (WebKit::NavigationState::releaseNetworkActivityToken):
559         (WebKit::NavigationState::didChangeIsLoading):
560         * UIProcess/ios/WebPageProxyIOS.mm:
561         (WebKit::WebPageProxy::applicationDidEnterBackground):
562
563 2018-05-07  Brent Fulgham  <bfulgham@apple.com>
564
565         Add experimental feature to prompt for Storage Access API use
566         https://bugs.webkit.org/show_bug.cgi?id=185335
567         <rdar://problem/39994649>
568
569         Reviewed by Alex Christensen and Youenn Fablet.
570
571         Create a new experimental feature that gates the ability of WebKit clients to prompt the user when
572         Storage Access API is invoked.
573
574         Currently this feature doesn't have any user-visible impact.
575
576         * Shared/API/APIObject.h:
577         * Shared/API/c/WKBase.h:
578         * Shared/WebPreferences.yaml:
579         * UIProcess/API/APIUIClient.h:
580         (API::UIClient::requestStorageAccessConfirm):
581         * UIProcess/API/C/WKPage.cpp:
582         (WebKit::RequestStorageAccessConfirmResultListener::create):
583         (WebKit::RequestStorageAccessConfirmResultListener::~RequestStorageAccessConfirmResultListener):
584         (WebKit::RequestStorageAccessConfirmResultListener::call):
585         (WebKit::RequestStorageAccessConfirmResultListener::RequestStorageAccessConfirmResultListener):
586         (WKPageRequestStorageAccessConfirmResultListenerGetTypeID):
587         (WKPageRequestStorageAccessConfirmResultListenerCall):
588         (WKPageSetPageUIClient):
589         * UIProcess/API/C/WKPageUIClient.h:
590         * UIProcess/API/Cocoa/WKPreferences.mm:
591         (-[WKPreferences _storageAccessPromptsEnabled]):
592         (-[WKPreferences _setStorageAccessPromptsEnabled:]):
593         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
594         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
595         * UIProcess/Cocoa/UIDelegate.h:
596         * UIProcess/Cocoa/UIDelegate.mm:
597         (WebKit::UIDelegate::setDelegate):
598         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
599         * UIProcess/WebPageProxy.cpp:
600         (WebKit::WebPageProxy::requestStorageAccessConfirm):
601         * UIProcess/WebPageProxy.h:
602         * UIProcess/WebPageProxy.messages.in:
603         * UIProcess/WebPreferences.cpp:
604         (WebKit::WebPreferences::update):
605         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
606         (WebKit::WebChromeClient::requestStorageAccess):
607
608 2018-05-07  Dean Jackson  <dino@apple.com>
609
610         Use a dark gray for system preview bbackground
611         https://bugs.webkit.org/show_bug.cgi?id=185391
612         <rdar://problem/40035120>
613
614         Reviewed by Eric Carlson.
615
616         Throw some darker shade at this view.
617
618         * UIProcess/ios/WKSystemPreviewView.mm:
619         (-[WKSystemPreviewView web_initWithFrame:webView:]):
620
621 2018-05-07  Don Olmstead  <don.olmstead@sony.com>
622
623         [Win] Add missing methods to WebChromeClient
624         https://bugs.webkit.org/show_bug.cgi?id=185325
625
626         Reviewed by Brent Fulgham.
627
628         * WebProcess/WebCoreSupport/WebChromeClient.h:
629
630 2018-05-07  Megan Gardner  <megan_gardner@apple.com>
631
632         Allow Web Touch events to timeout
633         https://bugs.webkit.org/show_bug.cgi?id=185282
634
635         Reviewed by Tim Horton.
636         
637         This is backwards, fixing.
638
639         * UIProcess/WebPageProxy.cpp:
640         (WebKit::WebPageProxy::handleTouchEventSynchronously):
641
642 2018-05-07  Don Olmstead  <don.olmstead@sony.com>
643
644         [Win] LoggingWin is missing includes
645         https://bugs.webkit.org/show_bug.cgi?id=185326
646
647         Reviewed by Per Arne Vollan.
648
649         * Platform/win/LoggingWin.cpp:
650
651 2018-05-07  Daniel Bates  <dabates@apple.com>
652
653         CSP should be passed the referrer
654         https://bugs.webkit.org/show_bug.cgi?id=185367
655
656         Reviewed by Per Arne Vollan.
657
658         Pass the referrer through NetworkLoadChecker so that it can pass it to the ContentSecurityPolicy
659         object it instantiates.
660
661         * NetworkProcess/NetworkLoadChecker.cpp:
662         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
663         (WebKit::NetworkLoadChecker::contentSecurityPolicy const):
664         * NetworkProcess/NetworkLoadChecker.h:
665         (WebKit::NetworkLoadChecker::create):
666         * NetworkProcess/NetworkResourceLoader.cpp:
667         * NetworkProcess/PingLoad.cpp:
668         (WebKit::PingLoad::PingLoad):
669
670 2018-05-07  Daniel Bates  <dabates@apple.com>
671
672         Substitute CrossOriginPreflightResultCache::clear() for CrossOriginPreflightResultCache::empty()
673         https://bugs.webkit.org/show_bug.cgi?id=185170
674
675         Reviewed by Per Arne Vollan.
676
677         * WebProcess/WebProcess.cpp:
678         (WebKit::WebProcess::clearResourceCaches):
679         (WebKit::WebProcess::deleteWebsiteData):
680
681 2018-05-07  Brian Burg  <bburg@apple.com>
682
683         Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected
684         https://bugs.webkit.org/show_bug.cgi?id=184861
685         <rdar://problem/39153768>
686
687         Reviewed by Timothy Hatcher.
688
689         We need to track how many frontends are attached to the web page (both local and remote).
690         InspectorController propagates this out to WebKit via InspectorClient. This is then
691         kept in UIProcess as a member of WebPageProxy. When making a decision whether to use a
692         new process for a navigation, return early with "no" if any frontends are open for the
693         page being navigated.
694
695         * UIProcess/WebPageProxy.h:
696         (WebKit::WebPageProxy::didChangeInspectorFrontendCount):
697         (WebKit::WebPageProxy::inspectorFrontendCount const):
698         * UIProcess/WebPageProxy.messages.in:
699         * UIProcess/WebProcessPool.cpp:
700         (WebKit::WebProcessPool::processForNavigation):
701         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
702         (WebKit::WebInspectorClient::frontendCountChanged):
703         * WebProcess/WebCoreSupport/WebInspectorClient.h:
704         * WebProcess/WebPage/WebPage.cpp:
705         (WebKit::WebPage::inspectorFrontendCountChanged):
706         * WebProcess/WebPage/WebPage.h:
707
708 2018-05-04  Tim Horton  <timothy_horton@apple.com>
709
710         Shift to a lower-level framework for simplifying URLs
711         https://bugs.webkit.org/show_bug.cgi?id=185334
712
713         Reviewed by Dan Bernstein.
714
715         * Configurations/WebKit.xcconfig:
716         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
717         (-[WKFullScreenWindowController _updateLocationInfo]):
718
719 2018-05-04  Per Arne Vollan  <pvollan@apple.com>
720
721         Shutdown WindowServer connections after checking in with launch services
722         https://bugs.webkit.org/show_bug.cgi?id=185082
723         <rdar://problem/39613173>
724
725         Reviewed by Brent Fulgham.
726
727         When WindowServer access is blocked in the WebContent process, we should shutdown all connections
728         after checking in with launch services.
729
730         * WebProcess/cocoa/WebProcessCocoa.mm:
731         (WebKit::WebProcess::platformInitializeProcess):
732
733 2018-05-04  Don Olmstead  <don.olmstead@sony.com>
734
735         [Win][WebKit] Fix forwarding headers for Windows build
736         https://bugs.webkit.org/show_bug.cgi?id=184412
737
738         Reviewed by Alex Christensen.
739
740         * PlatformWin.cmake:
741         * UIProcess/API/APIAttachment.h:
742         * UIProcess/API/APIContextMenuClient.h:
743         * UIProcess/API/C/WKProcessTerminationReason.h:
744         * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
745
746 2018-05-04  Chris Dumez  <cdumez@apple.com>
747
748         [iOS] Apps that are not visible may not get suspended if they trigger page loads while in the background
749         https://bugs.webkit.org/show_bug.cgi?id=185318
750
751         Reviewed by Geoffrey Garen.
752
753         Whenever there is a page load going on, we take a background process assertion to delay process
754         suspension until this load completes. However, there is also a 3 seconds grace period after
755         a load is complete to allow the app to trigger a new load shortly after. This grace period was
756         introduced to support use cases where a visible app does loads in an offscreen view. However,
757         it can be abused by apps running in the background as they could trigger new page loads while
758         in the background to delay process suspension. This patch tightens the policy so that only
759         apps that are currently visible get to use this grace period. Apps that are in the background
760         get to finish their current load and will then get suspended.
761
762         * UIProcess/Cocoa/NavigationState.mm:
763         (WebKit::NavigationState::didChangeIsLoading):
764
765 2018-05-04  Per Arne Vollan  <pvollan@apple.com>
766
767         Adjust sandbox profile for simulator.
768         https://bugs.webkit.org/show_bug.cgi?id=185319
769
770         Reviewed by Brent Fulgham.
771
772         Disable Kerberos rules, as well as rules related to NSApplication initialization.
773
774         * WebProcess/com.apple.WebProcess.sb.in:
775
776 2018-05-04  Tim Horton  <timothy_horton@apple.com>
777
778         Wasted time dlopening Lookup when tearing down a WKWebView
779         https://bugs.webkit.org/show_bug.cgi?id=185310
780         <rdar://problem/39934085>
781
782         Reviewed by Wenson Hsieh.
783
784         * UIProcess/Cocoa/WebViewImpl.h:
785         * UIProcess/Cocoa/WebViewImpl.mm:
786         (-[WKWindowVisibilityObserver dealloc]):
787         (-[WKWindowVisibilityObserver startObservingLookupDismissalIfNeeded]):
788         (WebKit::WebViewImpl::prepareForDictionaryLookup):
789         (-[WKWindowVisibilityObserver startObservingLookupDismissal]): Deleted.
790         Avoid un-registering as a Lookup dismissal observer if we never
791         registered in the first place, because that involves dlopening Lookup.
792
793 2018-05-04  Megan Gardner  <megan_gardner@apple.com>
794
795         Allow Web Touch events to timeout
796         https://bugs.webkit.org/show_bug.cgi?id=185282
797         <rdar://problem/38728319>
798
799         Reviewed by Tim Horton.
800         
801         Web Touch events currently never time out, which blocks the user from interacting with the UI Process at all.
802         We should allow these events to time out so that the user can interact with the rest of the UI.
803
804         * UIProcess/WebPageProxy.cpp:
805         (WebKit::WebPageProxy::handleTouchEventSynchronously):
806
807 2018-05-04  Wenson Hsieh  <whsieh@berkeley.edu>
808
809         REGRESSION: [ios-simulator] 3 WKWebViewAutofillTests API test failures seen with 11.3 SDK
810         https://bugs.webkit.org/show_bug.cgi?id=184196
811         <rdar://problem/39054481>
812
813         Reviewed by Tim Horton.
814
815         Remove an unnecessary call to NSClassFromString, now that trunk WebKit only supports iOS 11.3+.
816
817         * UIProcess/ios/WKContentViewInteraction.mm:
818         (-[WKContentView insertTextSuggestion:]):
819
820 2018-05-04  Youenn Fablet  <youenn@apple.com>
821
822         NetworkProcessProxy::didReceiveAuthenticationChallenge should take an AuthenticationChallenge r-value
823         https://bugs.webkit.org/show_bug.cgi?id=185302
824
825         Reviewed by Geoffrey Garen.
826
827         Pass AuthenticationChallenge as an r-value since it comes from IPC.
828         No change of behavior.
829
830         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
831         (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
832         * UIProcess/Authentication/AuthenticationChallengeProxy.h:
833         (WebKit::AuthenticationChallengeProxy::create):
834         * UIProcess/Downloads/DownloadProxy.cpp:
835         (WebKit::DownloadProxy::didReceiveAuthenticationChallenge):
836         * UIProcess/Downloads/DownloadProxy.h:
837         * UIProcess/Network/NetworkProcessProxy.cpp:
838         (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
839         * UIProcess/Network/NetworkProcessProxy.h:
840
841 2018-05-04  Sihui Liu  <sihui_liu@apple.com>
842
843         Assertion failure in NetworkStorageSession::setCookie: privilege of UI process is not set
844         https://bugs.webkit.org/show_bug.cgi?id=185262
845
846         Reviewed by Chris Dumez.
847
848         Fix an assertion failure by setting UI process privileges in constructor of WebsiteDataStore
849         because UI process may use the cookie API before creating a WebView.
850
851         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
852         (WebKit::WebsiteDataStore::WebsiteDataStore):
853
854 2018-05-04  Per Arne Vollan  <pvollan@apple.com>
855
856         Adjust sandbox rules for simulator.
857         https://bugs.webkit.org/show_bug.cgi?id=185275
858
859         Reviewed by Brent Fulgham.
860
861         Enable rules related to CoreMedia for minimal simulator.
862
863         * WebProcess/com.apple.WebProcess.sb.in:
864
865 2018-05-04  Carlos Garcia Campos  <cgarcia@igalia.com>
866
867         [GTK] Epiphany (GNOME Web) says "Error downloading: Service Unavailable." when trying to download an image from discogs.com
868         https://bugs.webkit.org/show_bug.cgi?id=174730
869
870         Reviewed by Michael Catanzaro.
871
872         The problem is that we don't send any User-Agent HTTP header for downloads started by WebProcessPool::download().
873
874         * UIProcess/API/glib/WebKitDownload.cpp:
875         (webkitDownloadUpdateRequest): Helper to update the cached request.
876         (webkitDownloadStarted): Updated the cached request if we have one.
877         (webkit_download_get_request): Use webkitDownloadUpdateRequest().
878         * UIProcess/API/glib/WebKitDownloadClient.cpp:
879         * UIProcess/API/glib/WebKitDownloadPrivate.h:
880         * UIProcess/WebProcessPool.cpp:
881         (WebKit::WebProcessPool::download): Set the User-Agent HTTP header if there isn't any.
882
883 2018-05-04  Carlos Garcia Campos  <cgarcia@igalia.com>
884
885         [GTK] Some event tests failing after r230817
886         https://bugs.webkit.org/show_bug.cgi?id=185072
887
888         Reviewed by Michael Catanzaro.
889
890         Do not send mouse move events to the WebProcess for crossing events during testing. WTR never generates crossing
891         events and they can confuse tests.
892
893         Fixes: editing/pasteboard/drag-link-with-data-transfer-adds-trusted-link-to-pasteboard.html
894                fast/css/user-drag-none.html
895                fast/events/context-activated-by-key-event.html
896                fast/events/drag-selects-image.html
897                fast/events/dropzone-005.html
898                fast/events/mouse-click-events.html
899                fast/events/mouse-cursor-change.html
900
901         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
902         (webkitWebViewBaseCrossingNotifyEvent):
903
904 2018-05-03  Chris Dumez  <cdumez@apple.com>
905
906         More aggressively terminate child processes when the connection to their parent process is severed
907         https://bugs.webkit.org/show_bug.cgi?id=177972
908         <rdar://problem/33317607>
909
910         Reviewed by Geoff Garen.
911
912         More aggressively terminate child processes when the connection to their parent process is severed.
913         Previously, we would dispatch to the main thread and then exit the process. This would sometimes
914         cause the process to say alive for 10 seconds until our watchdog would forcefully terminate the
915         process. This could happen in particular when the main thread is blocked on a synchronous IPC.
916
917         * NetworkProcess/NetworkProcess.cpp:
918         (WebKit::NetworkProcess::didClose): Deleted.
919         * NetworkProcess/NetworkProcess.h:
920         * PluginProcess/PluginProcess.cpp:
921         (WebKit::PluginProcess::didClose): Deleted.
922         * PluginProcess/PluginProcess.h:
923         * Shared/ChildProcess.cpp:
924         (WebKit::ChildProcess::didClose):
925         (WebKit::didCloseOnConnectionWorkQueue):
926         (WebKit::ChildProcess::terminationTimerFired):
927         * Shared/ChildProcess.h:
928         * StorageProcess/StorageProcess.cpp:
929         (WebKit::StorageProcess::didClose): Deleted.
930         * StorageProcess/StorageProcess.h:
931         * WebProcess/WebProcess.cpp:
932         (WebKit::WebProcess::didClose): Deleted.
933         * WebProcess/WebProcess.h:
934
935 2018-05-03  Yusuke Suzuki  <utatane.tea@gmail.com>
936
937         Use default std::optional if it is provided
938         https://bugs.webkit.org/show_bug.cgi?id=185159
939
940         Reviewed by Michael Catanzaro.
941
942         * Shared/SandboxExtension.h:
943         (WebKit::SandboxExtension::Handle::decode):
944         * Shared/TouchBarMenuItemData.cpp:
945         (WebKit::TouchBarMenuItemData::decode):
946
947 2018-05-03  Justin Fan  <justin_fan@apple.com>
948
949         [WebGL] Add runtime flag for enabling ASTC support in WebGL
950         https://bugs.webkit.org/show_bug.cgi?id=184840
951
952         Reviewed by Myles C. Maxfield.
953
954         Added runtime flag for ASTC support in WebGL, to turn on/off when extension is implemented.
955
956         * Shared/WebPreferences.yaml:
957
958 2018-05-03  Keith Rollin  <krollin@apple.com>
959
960         Unreviewed build fix after <https://trac.webkit.org/changeset/231282>.
961
962         * NetworkProcess/NetworkActivityTracker.h:
963
964 2018-05-03  Wenson Hsieh  <wenson_hsieh@apple.com>
965
966         Ads in NYTimes app are shifted downwards by the scroll view's top content inset
967         https://bugs.webkit.org/show_bug.cgi?id=185251
968         <rdar://problem/39062357>
969
970         Reviewed by Tim Horton.
971
972         The NYTimes app embeds advertisements in each article's WKWebView by adding views in the WKScrollView's view
973         hierarchy. These views are positioned using the bounding client rects of elements in the DOM (via Element
974         ::getBoundingClientRect). Prior to r229641, WebKit would report bounding client rects inset by the content
975         insets of WKScrollView, which means that if a top content inset X is specified on the scroll view, an element
976         that is flush against the top of the viewport will have a bounding client rect top of -X (when it should really
977         be 0).
978
979         To account for this, NYTimes adds the scroll view content insets back to the bounding client rect when
980         determining the position of each advertisement which, after r229641, causes these views to be shifted downwards
981         by an amount equal to the scroll view content inset top.
982
983         This new behavior does not affect Safari, since Safari uses SPI to explicitly set obscured insets. As such, we
984         address this by gating the scroll view content inset fix with a linked-on-or-after check.
985
986         * UIProcess/API/Cocoa/WKWebView.mm:
987         (-[WKWebView _computedObscuredInset]):
988         * UIProcess/Cocoa/VersionChecks.h:
989
990 2018-05-03  Chris Dumez  <cdumez@apple.com>
991
992         Load hangs if the WebProcess fails to launch
993         https://bugs.webkit.org/show_bug.cgi?id=185225
994         <rdar://problem/38249058>
995
996         Reviewed by Geoff Garen.
997
998         When a process fails to launch, ChildProcessProxy::didFinishLaunching() gets called with an
999         invalid connection identifier. While NetworkProcessProxy::didFinishLaunching() properly deals with
1000         this situation, WebProcessProxy::didFinishLaunching() does not. As a result, we do not attempt to
1001         relaunch the process, we do not notify the client and WebPageProxy::m_isValid stays true.
1002
1003         This patch thus updates WebProcessProxy::didFinishLaunching() to check if the connection identifier
1004         is valid and treats it as a crash. As a result, the WebPageProxies properly reset their state and
1005         the client gets notified of the crash so that it can attempt to reload.
1006
1007         * UIProcess/API/Cocoa/WKProcessPool.mm:
1008         (-[WKProcessPool _makeNextWebProcessLaunchFailForTesting]):
1009         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1010         * UIProcess/Launcher/ProcessLauncher.h:
1011         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1012         (WebKit::ProcessLauncher::launchProcess):
1013         Add SPI to make the next WebProcess launch fail, for the purpose of API testing.
1014
1015         * UIProcess/WebProcessPool.h:
1016         * UIProcess/WebProcessProxy.cpp:
1017         (WebKit::WebProcessProxy::getLaunchOptions):
1018         (WebKit::WebProcessProxy::didClose):
1019         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
1020         (WebKit::WebProcessProxy::didFinishLaunching):
1021         * UIProcess/WebProcessProxy.h:
1022
1023 2018-05-03  Commit Queue  <commit-queue@webkit.org>
1024
1025         Unreviewed, rolling out r231223 and r231288.
1026         https://bugs.webkit.org/show_bug.cgi?id=185256
1027
1028         The change in r231223 breaks internal builds, and r231288 is a
1029         dependent change. (Requested by ryanhaddad on #webkit).
1030
1031         Reverted changesets:
1032
1033         "Use default std::optional if it is provided"
1034         https://bugs.webkit.org/show_bug.cgi?id=185159
1035         https://trac.webkit.org/changeset/231223
1036
1037         "Use pointer instead of
1038         std::optional<std::reference_wrapper<>>"
1039         https://bugs.webkit.org/show_bug.cgi?id=185186
1040         https://trac.webkit.org/changeset/231288
1041
1042 2018-05-03  Per Arne Vollan  <pvollan@apple.com>
1043
1044         An error message is written to stderr when the WebContent process is blocking WindowServer access.
1045         https://bugs.webkit.org/show_bug.cgi?id=184701
1046
1047         Reviewed by Brent Fulgham.
1048
1049         Calling 'setApplicationIsDaemon(true)' instead of 'CGSSetDenyWindowServerConnections(true)' to disable
1050         access to the WindowServer in the WebContent process, will remove this error message. After this change,
1051         the url of the WebContent process is still showing up in Activity Monitor, which previously was a
1052         problem when calling 'setApplicationIsDaemon(true)'.
1053
1054         * WebProcess/WebProcess.cpp:
1055         (WebKit::WebProcess::initializeProcess):
1056         * WebProcess/cocoa/WebProcessCocoa.mm:
1057         (WebKit::WebProcess::platformInitializeProcess):
1058
1059 2018-05-03  Ryan Haddad  <ryanhaddad@apple.com>
1060
1061         Unreviewed, rolling out r231253.
1062
1063         The API test added with this change is crashing on the bots.
1064
1065         Reverted changeset:
1066
1067         "Web Inspector: opt out of process swap on navigation if a Web
1068         Inspector frontend is connected"
1069         https://bugs.webkit.org/show_bug.cgi?id=184861
1070         https://trac.webkit.org/changeset/231253
1071
1072 2018-05-03  Brent Fulgham  <bfulgham@apple.com>
1073
1074         Re-eneable Network Extension support in the WebContent process
1075         https://bugs.webkit.org/show_bug.cgi?id=185236
1076         <rdar://problem/39883004>
1077
1078         Reviewed by Eric Carlson.
1079
1080         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1081         * WebProcess/com.apple.WebProcess.sb.in:
1082
1083 2018-05-03  Tim Horton  <timothy_horton@apple.com>
1084
1085         REGRESSION (r231014): Entitlements are not applied to XPC services on macOS
1086         https://bugs.webkit.org/show_bug.cgi?id=185241
1087
1088         Reviewed by Dan Bernstein.
1089
1090         * Configurations/BaseXPCService.xcconfig:
1091         * Configurations/WebContentService.Development.xcconfig:
1092         * Configurations/WebContentService.xcconfig:
1093
1094 2018-05-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1095
1096         REGRESSION(r222772): [GTK][WPE] WebProcess from WebKitGtk+ 2.19.9x SIGSEVs in WebKit::WebProcess::ensureNetworkProcessConnection() at Source/WebKit/WebProcess/WebProcess.cpp:1127
1097         https://bugs.webkit.org/show_bug.cgi?id=183348
1098
1099         Reviewed by Michael Catanzaro.
1100
1101         When connection doesn't exit in case of sync message failure, always exit in case of failing to send
1102         GetNetworkProcessConnection or GetStorageProcessConnection messages. This can happen when the WebView is created
1103         and destroyed quickly.
1104
1105         * WebProcess/WebProcess.cpp:
1106         (WebKit::WebProcess::ensureNetworkProcessConnection):
1107         (WebKit::WebProcess::ensureWebToStorageProcessConnection):
1108
1109 2018-05-02  Nan Wang  <n_wang@apple.com>
1110
1111         AX: Missing kAXSWebAccessibilityEventsEnabledNotification causes a crash
1112         https://bugs.webkit.org/show_bug.cgi?id=185237
1113
1114         Reviewed by Dan Bernstein.
1115
1116         When libAccessibility.dylib is missing, the compiler would optimize out the global
1117         notification and lead to a crash. Fixed it by using the isNullFunction check instead,
1118         since we are sure the global notification would be there when the corresponding function 
1119         is available.
1120
1121         * UIProcess/API/Cocoa/WKWebView.mm:
1122         (-[WKWebView _initializeWithConfiguration:]):
1123
1124 2018-05-02  Keith Rollin  <krollin@apple.com>
1125
1126         Add facility for tracking times and results of page and resource loading
1127         https://bugs.webkit.org/show_bug.cgi?id=184838
1128         <rdar://problem/36548974>
1129
1130         Reviewed by Brent Fulgham.
1131
1132         Add NetworkActivityTracker. The idea behind this facility is to create
1133         and destroy them around networking activity that we want to track for
1134         the purpose of measuring overall network health. They can be created
1135         around the loading of pages or individual resources, and can be
1136         arranged in a parent/child hierarchy to indicate what pages the
1137         resources are part of. The NetworkActivity tracker tracks load times
1138         and results. On Cocoa, it can be integrated with CFNetwork in order to
1139         associate WebKit activity with low-level networking activity.
1140
1141         * CMakeLists.txt:
1142         * Configurations/WebKit.xcconfig:
1143         * NetworkProcess/NetworkActivityTracker.cpp: Copied from Source/WebKit/NetworkProcess/NetworkLoadParameters.h.
1144         (WebKit::NetworkActivityTracker::NetworkActivityTracker):
1145         (WebKit::NetworkActivityTracker::~NetworkActivityTracker):
1146         (WebKit::NetworkActivityTracker::setParent):
1147         (WebKit::NetworkActivityTracker::start):
1148         (WebKit::NetworkActivityTracker::complete):
1149         * NetworkProcess/NetworkActivityTracker.h: Added.
1150         (WebKit::NetworkActivityTracker::getPlatformObject):
1151         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1152         (WebKit::NetworkConnectionToWebProcess::didClose):
1153         (WebKit::NetworkConnectionToWebProcess::pageLoadCompleted):
1154         (WebKit::networkActivityTrackingEnabled):
1155         (WebKit::NetworkConnectionToWebProcess::startTrackingResourceLoad):
1156         (WebKit::NetworkConnectionToWebProcess::stopTrackingResourceLoad):
1157         (WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTracking):
1158         (WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTrackingForPage):
1159         (WebKit::NetworkConnectionToWebProcess::findRootNetworkActivity):
1160         (WebKit::NetworkConnectionToWebProcess::findNetworkActivityTracker):
1161         * NetworkProcess/NetworkConnectionToWebProcess.h:
1162         (WebKit::NetworkConnectionToWebProcess::ResourceNetworkActivityTracker::ResourceNetworkActivityTracker):
1163         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1164         * NetworkProcess/NetworkDataTask.cpp:
1165         (WebKit::NetworkDataTask::create):
1166         * NetworkProcess/NetworkLoadParameters.h:
1167         * NetworkProcess/NetworkProcess.cpp:
1168         (WebKit::NetworkProcess::initializeNetworkProcess):
1169         * NetworkProcess/NetworkProcess.h:
1170         (WebKit::NetworkProcess::trackNetworkActivity const):
1171         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1172         (WebKit::NetworkProcessCreationParameters::encode const):
1173         (WebKit::NetworkProcessCreationParameters::decode):
1174         * NetworkProcess/NetworkProcessCreationParameters.h:
1175         * NetworkProcess/NetworkResourceLoader.cpp:
1176         (WebKit::NetworkResourceLoader::start):
1177         (WebKit::NetworkResourceLoader::cleanup):
1178         (WebKit::NetworkResourceLoader::abort):
1179         (WebKit::NetworkResourceLoader::didFinishLoading):
1180         (WebKit::NetworkResourceLoader::didFailLoading):
1181         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
1182         (WebKit::NetworkResourceLoader::continueProcessingCachedEntryAfterDidReceiveResponse):
1183         * NetworkProcess/NetworkResourceLoader.h:
1184         * NetworkProcess/cocoa/NetworkActivityTrackerCocoa.mm: Added.
1185         (WebKit::NetworkActivityTracker::NetworkActivityTracker):
1186         (WebKit::NetworkActivityTracker::~NetworkActivityTracker):
1187         (WebKit::NetworkActivityTracker::setParent):
1188         (WebKit::NetworkActivityTracker::start):
1189         (WebKit::NetworkActivityTracker::complete):
1190         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1191         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1192         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1193         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1194         (API::ProcessPoolConfiguration::copy):
1195         * UIProcess/API/APIProcessPoolConfiguration.h:
1196         * UIProcess/API/C/WKContextConfigurationRef.cpp:
1197         (WKContextConfigurationTrackNetworkActivity):
1198         (WKContextConfigurationSetTrackNetworkActivity):
1199         * UIProcess/API/C/WKContextConfigurationRef.h:
1200         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1201         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1202         (-[_WKProcessPoolConfiguration trackNetworkActivity]):
1203         (-[_WKProcessPoolConfiguration setTrackNetworkActivity:]):
1204         * UIProcess/WebProcessPool.cpp:
1205         (WebKit::WebProcessPool::ensureNetworkProcess):
1206         * WebKit.xcodeproj/project.pbxproj:
1207         * WebProcess/Network/WebLoaderStrategy.cpp:
1208         (WebKit::WebLoaderStrategy::pageLoadCompleted):
1209         * WebProcess/Network/WebLoaderStrategy.h:
1210
1211 2018-05-02  Jer Noble  <jer.noble@apple.com>
1212
1213         Open audio/video sandbox services for minimal simulator
1214         https://bugs.webkit.org/show_bug.cgi?id=185217
1215         <rdar://problem/39918909>
1216
1217         Reviewed by Per Arne Vollan.
1218
1219         * WebKit.xcodeproj/project.pbxproj:
1220         * WebProcess/com.apple.WebProcess.sb.in:
1221
1222 2018-05-02  Daniel Bates  <dabates@apple.com>
1223
1224         Cleanup NetworkResourceLoader::didReceiveResponse()
1225         https://bugs.webkit.org/show_bug.cgi?id=185209
1226
1227         Reviewed by Chris Dumez.
1228
1229         Use early returns to make the control flow easier to read and reason about. Disregarding a
1230         From-Origin violation, NetworkResourceLoader::didReceiveResponse() only returns NetworkLoadClient::ShouldContinueDidReceiveResponse::No
1231         when the load is for a main resource and hence it must wait for the embedding client to allow
1232         the load before continuing with it. With regards to a From-Origin violation, the network
1233         process schedules to fail the load in a subsequent turn of the event loop before returning
1234         NetworkLoadClient::ShouldContinueDidReceiveResponse::No. It return NetworkLoadClient::ShouldContinueDidReceiveResponse::No
1235         solely to tell the NetworkLoadClient to defer assuming the load is allowed (because we will
1236         fail it on the next turn of the event loop).
1237
1238         Additionally, remove all logging about the return value as we no longer have a need for
1239         such logging.
1240
1241         * NetworkProcess/NetworkResourceLoader.cpp:
1242         (WebKit::NetworkResourceLoader::didReceiveResponse):
1243
1244 2018-05-02  Alex Christensen  <achristensen@webkit.org>
1245
1246         Add WKWebsiteDataStorePrivate._proxyConfiguration SPI
1247         https://bugs.webkit.org/show_bug.cgi?id=185179
1248
1249         Reviewed by Andy Estes.
1250
1251         * NetworkProcess/NetworkSessionCreationParameters.h:
1252         (WebKit::NetworkSessionCreationParameters::encode const):
1253         (WebKit::NetworkSessionCreationParameters::decode):
1254         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1255         (WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded):
1256         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1257         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1258         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1259         * Shared/WebsiteDataStoreParameters.cpp:
1260         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
1261         * Shared/cf/ArgumentCodersCF.cpp:
1262         (IPC::encode):
1263         (IPC::decode):
1264         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1265         (-[WKWebsiteDataStore _setProxyConfiguration:]):
1266         (-[WKWebsiteDataStore _proxyConfiguration]):
1267         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1268         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1269         (WebKit::WebsiteDataStore::parameters):
1270         * UIProcess/WebsiteData/WebsiteDataStore.h:
1271         (WebKit::WebsiteDataStore::setProxyConfiguration):
1272         (WebKit::WebsiteDataStore::proxyConfiguration):
1273
1274 2018-05-02  Youenn Fablet  <youenn@apple.com>
1275
1276         Use NetworkLoadChecker for navigation loads
1277         https://bugs.webkit.org/show_bug.cgi?id=184892
1278         <rdar://problem/39652686>
1279
1280         Reviewed by Chris Dumez.
1281
1282         Compute whether a response is same origin in no-cors case.
1283         This allows providing more precise filtering.
1284         In case of navigate loads, set the tainting to basic which will make filtering to the minimum.
1285
1286         Pass the sourceOrigin for navigation loads as well.
1287         Enable to restrict HTTP response access for navigation load.
1288
1289         Content Blockers are disabled for now in NetworkLoadChecker for navigation loads.
1290         They should be reenabled as a follow-up.
1291
1292         Add a specific case to allow any redirection to about:// URLs.
1293         While this does not conform with the spec, this keeps the existing WebKit behavior.
1294
1295         * NetworkProcess/NetworkLoadChecker.cpp:
1296         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
1297         (WebKit::NetworkLoadChecker::validateResponse):
1298         (WebKit::NetworkLoadChecker::continueCheckingRequest):
1299         (WebKit::NetworkLoadChecker::doesNotNeedCORSCheck const):
1300         * NetworkProcess/NetworkResourceLoader.cpp:
1301         (WebKit::NetworkResourceLoader::sanitizeResponseIfPossible):
1302         * WebProcess/Network/WebLoaderStrategy.cpp:
1303         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1304         (WebKit::WebLoaderStrategy::isDoingLoadingSecurityChecks const):
1305         We only do security checks if this runtime flag is on.
1306         * WebProcess/Network/WebLoaderStrategy.h:
1307
1308 2018-05-02  Jer Noble  <jer.noble@apple.com>
1309
1310         Make EncryptedMediaAPIEnabled an experimental feature
1311         https://bugs.webkit.org/show_bug.cgi?id=185212
1312
1313         Reviewed by Eric Carlson.
1314
1315         * Shared/WebPreferences.yaml:
1316
1317 2018-05-02  Per Arne Vollan  <pvollan@apple.com>
1318
1319         Adjust sandbox profile in simulator mode.
1320         https://bugs.webkit.org/show_bug.cgi?id=185172
1321         <rdar://problem/39876860>
1322
1323         Reviewed by Brent Fulgham.
1324
1325         Fix some sandbox violations.
1326
1327         * WebProcess/com.apple.WebProcess.sb.in:
1328
1329 2018-05-02  Brian Burg  <bburg@apple.com>
1330
1331         Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected
1332         https://bugs.webkit.org/show_bug.cgi?id=184861
1333         <rdar://problem/39153768>
1334
1335         Reviewed by Ryosuke Niwa.
1336
1337         We need to track how many frontends are attached to the web page (both local and remote).
1338         InspectorController propagates this out to WebKit via InspectorClient. This is then
1339         kept in UIProcess as a member of WebPageProxy. When making a decision whether to use a
1340         new process for a navigation, return early with "no" if any frontends are open for the
1341         page being navigated.
1342
1343         * UIProcess/WebPageProxy.h:
1344         (WebKit::WebPageProxy::didChangeInspectorFrontendCount):
1345         (WebKit::WebPageProxy::inspectorFrontendCount const):
1346         * UIProcess/WebPageProxy.messages.in:
1347         * UIProcess/WebProcessPool.cpp:
1348         (WebKit::WebProcessPool::processForNavigation):
1349         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
1350         (WebKit::WebInspectorClient::frontendCountChanged):
1351         * WebProcess/WebCoreSupport/WebInspectorClient.h:
1352         * WebProcess/WebPage/WebPage.cpp:
1353         (WebKit::WebPage::inspectorFrontendCountChanged):
1354         * WebProcess/WebPage/WebPage.h:
1355
1356 2018-05-02  Jer Noble  <jer.noble@apple.com>
1357
1358         Adopt -destinationWindowToExitFullScreenForWindow:
1359         https://bugs.webkit.org/show_bug.cgi?id=185204
1360         <rdar://problem/22486621>
1361
1362         Reviewed by Eric Carlson.
1363
1364         * UIProcess/mac/WKFullScreenWindowController.mm:
1365         (-[WKFullScreenWindowController destinationWindowToExitFullScreenForWindow:]):
1366
1367 2018-05-02  Per Arne Vollan  <pvollan@apple.com>
1368
1369         Disable Media capture rules in sandbox for simulator.
1370         https://bugs.webkit.org/show_bug.cgi?id=185206
1371         <rdar://problem/39910015>
1372
1373         Reviewed by Eric Carlson.
1374
1375         These rules are not relevant in this case.
1376
1377         * WebProcess/com.apple.WebProcess.sb.in:
1378
1379 2018-05-02  Eric Carlson  <eric.carlson@apple.com>
1380
1381         [iOS] Provide audio route information when invoking AirPlay picker
1382         https://bugs.webkit.org/show_bug.cgi?id=185199
1383         <rdar://problem/39853103>
1384
1385         Reviewed by Jer Noble.
1386
1387         * Scripts/webkit/messages.py:
1388         * UIProcess/PageClient.h:
1389         * UIProcess/WebPageProxy.h:
1390         * UIProcess/WebPageProxy.messages.in:
1391         * UIProcess/ios/PageClientImplIOS.h:
1392         * UIProcess/ios/PageClientImplIOS.mm:
1393         (WebKit::PageClientImpl::showPlaybackTargetPicker):  Pass route sharing policy and routing context UID.
1394
1395         * UIProcess/ios/WKContentViewInteraction.h:
1396         * UIProcess/ios/WKContentViewInteraction.mm:
1397         (-[WKContentView _showPlaybackTargetPicker:fromRect:routeSharingPolicy:routingContextUID:]): Take same.
1398         (-[WKContentView _showPlaybackTargetPicker:fromRect:]): Deleted.
1399
1400         * UIProcess/ios/WebPageProxyIOS.mm:
1401         (WebKit::WebPageProxy::showPlaybackTargetPicker): Pass route sharing policy and routing context UID.
1402
1403         * UIProcess/ios/forms/WKAirPlayRoutePicker.h:
1404         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
1405         (-[WKAirPlayRoutePicker showFromView:routeSharingPolicy:routingContextUID:]): Take same.
1406         (-[WKAirPlayRoutePicker showFromView:]): Deleted.
1407
1408         * WebProcess/WebCoreSupport/WebChromeClient.h:
1409         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
1410         (WebKit::WebChromeClient::showPlaybackTargetPicker):
1411
1412 2018-05-02  Jer Noble  <jer.noble@apple.com>
1413
1414         Get the WebKit.framework bundle by asking for WKWebView
1415         https://bugs.webkit.org/show_bug.cgi?id=185175
1416
1417         Reviewed by Tim Horton.
1418
1419         * NetworkProcess/mac/NetworkProcessMac.mm:
1420         (WebKit::NetworkProcess::initializeSandbox):
1421         * Shared/mac/ChildProcessMac.mm:
1422         (WebKit::ChildProcess::initializeSandbox):
1423         * StorageProcess/mac/StorageProcessMac.mm:
1424         (WebKit::StorageProcess::initializeSandbox):
1425
1426 2018-05-02  Youenn Fablet  <youenn@apple.com>
1427
1428         Cannot gather srflx or relay ICE candidates on IPv6 network (ICE agent hangs?)
1429         https://bugs.webkit.org/show_bug.cgi?id=181009
1430         <rdar://problem/36144555>
1431
1432         Reviewed by Eric Carlson.
1433
1434         On iOS/IPv6 networks, STUN servers name resolution returns a zero IPv6 IP address.
1435         No error is raised which leads to sending STUN requests with that IP address.
1436         Once the request times out, the ICE candidate gathering finishes with host candidates only.
1437
1438         This patch makes WebRTC DNS resolver to send only IPv4 resolved addresses.
1439         STUN is used for NAT traversal which is for IPv4 addresses.
1440         Not sending IPv6 addresses allows terminating ICE candidate gathering sooner.
1441
1442         Manually tested on iOS with IPv4/IPv6 and IPv6 networks.
1443
1444         * NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp:
1445         (WebKit::resolvedName):
1446
1447 2018-05-02  Youenn Fablet  <youenn@apple.com>
1448
1449         CacheStorage::Engine should keep a list of initialization callback
1450         https://bugs.webkit.org/show_bug.cgi?id=185184
1451         <rdar://problem/38875651>
1452
1453         Reviewed by Antti Koivisto.
1454
1455         Keep each initialize callback in a Vector so as to compute the salt only once.
1456         Call all callbacks then in a loop.
1457
1458         * NetworkProcess/cache/CacheStorageEngine.cpp:
1459         (WebKit::CacheStorage::Engine::~Engine):
1460         (WebKit::CacheStorage::Engine::initialize):
1461         * NetworkProcess/cache/CacheStorageEngine.h:
1462
1463 2018-05-02  Jer Noble  <jer.noble@apple.com>
1464
1465         Pipe volume through PlaybackSessionManager/Proxy.
1466         https://bugs.webkit.org/show_bug.cgi?id=185182
1467
1468         Reviewed by Eric Carlson.
1469
1470         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
1471         * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
1472         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
1473         (WebKit::PlaybackSessionModelContext::setVolume):
1474         (WebKit::PlaybackSessionModelContext::volumeChanged):
1475         (WebKit::PlaybackSessionManagerProxy::volumeChanged):
1476         (WebKit::PlaybackSessionManagerProxy::setVolume):
1477         * WebProcess/cocoa/PlaybackSessionManager.h:
1478         * WebProcess/cocoa/PlaybackSessionManager.messages.in:
1479         * WebProcess/cocoa/PlaybackSessionManager.mm:
1480         (WebKit::PlaybackSessionInterfaceContext::volumeChanged):
1481         (WebKit::PlaybackSessionManager::volumeChanged):
1482         (WebKit::PlaybackSessionManager::setVolume):
1483
1484 2018-05-01  Yusuke Suzuki  <utatane.tea@gmail.com>
1485
1486         Use default std::optional if it is provided
1487         https://bugs.webkit.org/show_bug.cgi?id=185159
1488
1489         Reviewed by JF Bastien.
1490
1491         * Shared/SandboxExtension.h:
1492         (WebKit::SandboxExtension::Handle::decode):
1493         * Shared/TouchBarMenuItemData.cpp:
1494         (WebKit::TouchBarMenuItemData::decode):
1495
1496 2018-05-01  Jer Noble  <jer.noble@apple.com>
1497
1498         Production build error in Migrate Header phase when WK_ALTERNATE_FRAMEWORKS_DIR is set to non-empty value
1499         https://bugs.webkit.org/show_bug.cgi?id=185171
1500
1501         Reviewed by Timothy Hatcher.
1502
1503         * Configurations/BaseTarget.xcconfig:
1504
1505 2018-05-01  Per Arne Vollan  <pvollan@apple.com>
1506
1507         Use correct runloop type in the WebContent process.
1508         https://bugs.webkit.org/show_bug.cgi?id=185140
1509
1510         Reviewed by Brent Fulgham.
1511
1512         Use WK_MACOS_* machinery to determine runloop type for the WebContent process.
1513
1514         * Configurations/WebContentService.xcconfig:
1515
1516 2018-05-01  Oleksandr Skachkov  <gskachkov@gmail.com>
1517
1518         WebAssembly: add support for stream APIs - JavaScript API
1519         https://bugs.webkit.org/show_bug.cgi?id=183442
1520
1521         Reviewed by Yusuke Suzuki and JF Bastien.
1522
1523         Add WEBASSEMBLY_STREAMING_API feature flag
1524
1525         * Configurations/FeatureDefines.xcconfig:
1526
1527 2018-04-30  Per Arne Vollan  <pvollan@apple.com>
1528
1529         Use correct runloop type in the WebContent process.
1530         https://bugs.webkit.org/show_bug.cgi?id=185140
1531         <rdar://problem/39585037>
1532
1533         Reviewed by Brent Fulgham.
1534
1535         The macOS target version should be used to determine the runloop type.
1536
1537         * Configurations/WebContentService.xcconfig:
1538
1539 2018-04-30  Michael Saboff  <msaboff@apple.com>
1540
1541         Eliminate WebProcessShim.dylib
1542         https://bugs.webkit.org/show_bug.cgi?id=185147
1543
1544         Reviewed by Ryosuke Niwa.
1545
1546         * Configurations/WebContentService.xcconfig:
1547         * Configurations/WebProcessShim.xcconfig: Removed.
1548         * WebKit.xcodeproj/project.pbxproj:
1549
1550 2018-04-30  Michael Saboff  <msaboff@apple.com>
1551
1552         Remove unused mac/CookieStorageShimLibrary
1553         https://bugs.webkit.org/show_bug.cgi?id=185146
1554
1555         Reviewed by Alex Christensen.
1556
1557         * Shared/mac/CookieStorageShimLibrary.cpp: Removed.
1558         * Shared/mac/CookieStorageShimLibrary.h: Removed.
1559         * WebKit.xcodeproj/project.pbxproj:
1560
1561 2018-04-30  Alex Christensen  <achristensen@webkit.org>
1562
1563         Add WKUIDelegatePrivate equivalent of WKPageContextMenuClient getContextMenuFromProposedMenuAsync
1564         https://bugs.webkit.org/show_bug.cgi?id=180955
1565
1566         Reviewed by Andy Estes.
1567
1568         * UIProcess/API/APIContextMenuClient.h:
1569         (API::ContextMenuClient::menuFromProposedMenu):
1570         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1571         * UIProcess/Cocoa/UIDelegate.h:
1572         * UIProcess/Cocoa/UIDelegate.mm:
1573         (WebKit::UIDelegate::setDelegate):
1574         (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu):
1575         * UIProcess/mac/WebContextMenuProxyMac.mm:
1576         (WebKit::WebContextMenuProxyMac::showContextMenuWithItems):
1577
1578 2018-04-30  JF Bastien  <jfbastien@apple.com>
1579
1580         Use some C++17 features
1581         https://bugs.webkit.org/show_bug.cgi?id=185135
1582
1583         Reviewed by Alex Christensen.
1584
1585         As discussed here [0] let's move WebKit to a subset of C++17. We
1586         now require GCC 6 [1] which means that, according to [2] we can
1587         use the following C++17 language features (I removed some
1588         uninteresting ones):
1589
1590          - New auto rules for direct-list-initialization
1591          - static_assert with no message
1592          - typename in a template template parameter
1593          - Nested namespace definition
1594          - Attributes for namespaces and enumerators
1595          - u8 character literals
1596          - Allow constant evaluation for all non-type template arguments
1597          - Fold Expressions
1598          - Unary fold expressions and empty parameter packs
1599          - __has_include in preprocessor conditional
1600          - Differing begin and end types in range-based for
1601          - Improving std::pair and std::tuple
1602
1603         Consult the Tony Tables [3] to see before / after examples.
1604
1605         Of course we can use any library feature if we're willing to
1606         import them to WTF (and they don't require language support).
1607
1608
1609           [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html
1610           [1]: https://trac.webkit.org/changeset/231152/webkit
1611           [2]: https://en.cppreference.com/w/cpp/compiler_support
1612           [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md
1613
1614         * Configurations/Base.xcconfig:
1615         * DerivedSources.make:
1616         * PlatformMac.cmake:
1617
1618 2018-04-30  Wenson Hsieh  <wenson_hsieh@apple.com>
1619
1620         [Extra zoom mode] Respect the existing shrink-to-fit attribute instead of using min-device-width
1621         https://bugs.webkit.org/show_bug.cgi?id=185132
1622         <rdar://problem/39834562>
1623
1624         Reviewed by Tim Horton.
1625
1626         Remove the experimental feature for `min-device-width`.
1627
1628         * Shared/WebPreferences.yaml:
1629
1630 2018-04-30  Keith Rollin  <krollin@apple.com>
1631
1632         Include breadcrumb for tracking resource loading into CFNetwork
1633         https://bugs.webkit.org/show_bug.cgi?id=184837
1634         rdar://problem/39575411
1635
1636         Reviewed by Brent Fulgham.
1637
1638         When starting the network-based loading of a resource, log the
1639         description provided by NetworkDataTask. On Cocoa, this is implemented
1640         to return the description property in NSURLSessionTask. This
1641         information better allows us to track a resource load through the
1642         WebContent process, the Networking process, and the Cocoa networking
1643         layers.
1644
1645         * NetworkProcess/NetworkDataTask.cpp:
1646         (WebKit::NetworkDataTask::description const):
1647         * NetworkProcess/NetworkDataTask.h:
1648         * NetworkProcess/NetworkLoad.cpp:
1649         (WebKit::NetworkLoad::description const):
1650         * NetworkProcess/NetworkLoad.h:
1651         * NetworkProcess/NetworkResourceLoader.cpp:
1652         (WebKit::NetworkResourceLoader::startNetworkLoad):
1653         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1654         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1655         (WebKit::NetworkDataTaskCocoa::description const):
1656
1657 2018-04-30  Andy Estes  <aestes@apple.com>
1658
1659         [iOS] Try to unlock PDF documents before printing them
1660         https://bugs.webkit.org/show_bug.cgi?id=185084
1661         <rdar://problem/39356622>
1662
1663         Reviewed by Dan Bernstein.
1664
1665         * UIProcess/ios/WKPDFView.mm:
1666         (-[WKPDFView pdfHostViewController:documentDidUnlockWithPassword:]):
1667
1668         Stored the password that successfully unlocked the current PDF document.
1669
1670         (-[WKPDFView _wk_printedDocument]):
1671
1672         Used the stored password to unlock the CGPDFDocument we create for printing.
1673
1674 2018-04-28  Andy Estes  <aestes@apple.com>
1675
1676         [iOS] Present an action sheet when long-pressing on PDF links
1677         https://bugs.webkit.org/show_bug.cgi?id=185093
1678         <rdar://problem/39356651>
1679
1680         Reviewed by Dan Bernstein.
1681
1682         * UIProcess/ios/WKPDFView.mm:
1683         (-[WKPDFView dealloc]):
1684
1685         Called -[WKActionSheetAssistant cleanupSheet].
1686
1687         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
1688
1689         Created a WKActionSheetAssistant with the host view as the assistant view and
1690         ourselves as the delegate.
1691
1692         (-[WKPDFView _URLWithPageIndex:]):
1693
1694         Added. Creates a URL to the current page with a page number fragment appended.
1695
1696         (-[WKPDFView _goToURL:atLocation:]):
1697
1698         Added. Navigates to a URL with a synthetic mouse click at a location in host view
1699         coordinates.
1700
1701         (-[WKPDFView pdfHostViewController:goToURL:]):
1702         (-[WKPDFView pdfHostViewController:goToPageIndex:withViewFrustum:]):
1703
1704         Called -_goToURL:atLocation:. Used -_URLWithPageIndex: to construct an NSURL from
1705         a page index.
1706
1707         (-[WKPDFView _showActionSheetForURL:atLocation:]):
1708
1709         Added. Populates _positionInformation with a URL and location and calls
1710         -[WKActionSheetAssistant showLinkSheet].
1711
1712         (-[WKPDFView pdfHostViewController:didLongPressURL:atLocation:]):
1713         (-[WKPDFView pdfHostViewController:didLongPressPageIndex:atLocation:]):
1714
1715         Called -_showActionSheetForURL:atLocation:. Used -_URLWithPageIndex: to construct
1716         an NSURL from a page index.
1717
1718         (-[WKPDFView positionInformationForActionSheetAssistant:]):
1719
1720         Returned _positionInformation.
1721
1722         (-[WKPDFView actionSheetAssistant:performAction:]):
1723
1724         Populated the pasteboard with plain text and URL representations of
1725         _positionInformation.url.
1726
1727         (-[WKPDFView actionSheetAssistant:openElementAtLocation:]):
1728
1729         Called -_goToURL:atLocation.
1730
1731         (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]):
1732
1733         Created a UIWKSelectionAssistant and called -showShareSheetFor:fromRect:.
1734
1735         (-[WKPDFView actionSheetAssistant:shouldIncludeAppLinkActionsForElement:]):
1736
1737         Returned API::UIClient::shouldIncludeAppLinkActionsForElement().
1738
1739         (-[WKPDFView actionSheetAssistant:decideActionsForElement:defaultActions:]):
1740
1741         Returned API::UIClient::actionsForElement()l
1742
1743 2018-04-28  Andy Estes  <aestes@apple.com>
1744
1745         [iOS] Allow com.apple.WebKit.Networking to look up com.apple.wifi.manager
1746         https://bugs.webkit.org/show_bug.cgi?id=185114
1747         <rdar://problem/39808763>
1748
1749         Reviewed by Wenson Hsieh.
1750
1751         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
1752
1753 2018-04-28  Brent Fulgham  <bfulgham@apple.com>
1754
1755         Revise sandboxes to allow additional IOKit property access
1756         https://bugs.webkit.org/show_bug.cgi?id=185095
1757         <rdar://problem/39809455>
1758
1759         Reviewed by Eric Carlson.
1760
1761         Update the WebContent and Plugin processes to allow additional IOKit property access.
1762
1763         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
1764         * WebProcess/com.apple.WebProcess.sb.in:
1765
1766 2018-04-28  Carlos Garcia Campos  <cgarcia@igalia.com>
1767
1768         [GTK] WebProcess from WebKitGtk+ 2.19.92 SIGSEVs in WebCore::TextureMapperGL::~TextureMapperGL
1769         https://bugs.webkit.org/show_bug.cgi?id=184040
1770
1771         Reviewed by Michael Catanzaro.
1772
1773         This can happen when using single shared process model or when the process limit is reached in multiple process
1774         model. In this case, all pages in the same web process with accelerated compositing enabled share the same
1775         compositing thread. Every page sets its GL context as current when rendering a frame, but not when invalidating
1776         the threaded compositor when the page is closed. So, if a hidden tab is closed, the threaded compositor is
1777         invalidated and the GL resources of the current context (the visible page) are destroyed. This is also causing
1778         the blank pages issue when closing a tab related to another one, the current one stops rendering anything because
1779         its GL context has been released. We should make the threaded compositor context current when invalidating it.
1780
1781         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1782         (WebKit::ThreadedCompositor::invalidate):
1783
1784 2018-04-27  Timothy Hatcher  <timothy@apple.com>
1785
1786         REGRESSION: Touch events fail to dispatch to the page in all cases.
1787
1788         https://bugs.webkit.org/show_bug.cgi?id=185097
1789         rdar://problem/39731995
1790
1791         Reviewed by Tim Horton.
1792
1793         * UIProcess/ios/WKContentViewInteraction.mm:
1794         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
1795         Consult internal gesture recognizers, otherwise NO might get returned.
1796
1797 2018-04-26  Ryosuke Niwa  <rniwa@webkit.org>
1798
1799         PSON: Triggering a navigation to an invalid URL creates a new WebContent process
1800         https://bugs.webkit.org/show_bug.cgi?id=185066
1801
1802         Reviewed by Youenn Fablet.
1803
1804         Don't create a new WebContent process when the target URL is invalid as well as when the source URL is invalid.
1805
1806         * UIProcess/WebProcessPool.cpp:
1807         (WebKit::WebProcessPool::processForNavigationInternal):
1808
1809 2018-04-27  Youenn Fablet  <youenn@apple.com>
1810
1811         Use NetworkLoadChecker for XHR/fetch loads
1812         https://bugs.webkit.org/show_bug.cgi?id=184741
1813
1814         Reviewed by Chris Dumez.
1815
1816         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
1817         (WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
1818         Pass the preflight error as completion error if any.
1819         * NetworkProcess/NetworkLoad.cpp:
1820         (WebKit::NetworkLoad::willPerformHTTPRedirection):
1821         Set response source to Network so that checks relying on that are correct.
1822         * NetworkProcess/NetworkLoadChecker.cpp:
1823         (WebKit::NetworkLoadChecker::validateResponse):
1824         Adding Oppaqueredirect tainting.
1825         (NetworkLoadChecker::doesNotNeedCORSCheck):
1826         Adding a check to only activate CORS checks for CORS enabled schemes.
1827         Non CORS enabled schemes loads should have failed in WebProcess already.
1828         (WebKit::NetworkLoadChecker::checkCORSRedirectedRequest):
1829         Remove Authorization header as done by SubresourceLoader.
1830         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
1831         If error is cancellation, we still want to call the completion handler.
1832         * NetworkProcess/NetworkResourceLoader.cpp:
1833         Activate network load checker for all types of loads.
1834         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1835         Handle manual redirection by directly calling didReceiveResponse.
1836
1837 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
1838
1839         Add an experimental feature flag for viewport "min-device-width"
1840         https://bugs.webkit.org/show_bug.cgi?id=185050
1841         <rdar://problem/39624038>
1842
1843         Reviewed by Tim Horton.
1844
1845         Add MinDeviceWidthEnabled as a new experimental feature, on by default in extra zoom mode and off elsewhere.
1846
1847         * Shared/WebPreferences.yaml:
1848         * Shared/WebPreferencesDefaultValues.h:
1849
1850 2018-04-27  Daniel Bates  <dabates@apple.com>
1851
1852         UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance() is applicable to both Mac and iOS
1853         https://bugs.webkit.org/show_bug.cgi?id=185079
1854         <rdar://problem/39794960>
1855
1856         I inadvertently forgot to move the UIDelegate field webViewDidResignInputElementStrongPasswordAppearanceWithUserInfo
1857         outside the PLATFORM(MAC)-guard.
1858
1859         * UIProcess/Cocoa/UIDelegate.h:
1860
1861 2018-04-27  Daniel Bates  <dabates@apple.com>
1862
1863         UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance() is applicable to both Mac and iOS
1864         https://bugs.webkit.org/show_bug.cgi?id=185079
1865         <rdar://problem/39794960>
1866
1867         Reviewed by Andy Estes.
1868
1869         * UIProcess/Cocoa/UIDelegate.h:
1870         * UIProcess/Cocoa/UIDelegate.mm:
1871         (WebKit::UIDelegate::setDelegate):
1872         (WebKit::UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance):
1873
1874 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
1875
1876         Rename minimumLayoutSize to viewLayoutSize
1877         https://bugs.webkit.org/show_bug.cgi?id=185050
1878         <rdar://problem/39624038>
1879
1880         Reviewed by Tim Horton.
1881
1882         Renames minimumLayoutSize to viewLayoutSize, since the minimum layout size in ViewportConfiguration is now
1883         different from the minimum layout size that is currently pushed down from the UI process (e.g. WKWebView SPI) in
1884         the case where `min-device-width` is used to override the minimum layout size.
1885
1886         * Shared/WebPageCreationParameters.cpp:
1887         (WebKit::WebPageCreationParameters::encode const):
1888         (WebKit::WebPageCreationParameters::decode):
1889         * Shared/WebPageCreationParameters.h:
1890         * UIProcess/API/Cocoa/WKWebView.mm:
1891         (-[WKWebView _processDidExit]):
1892         (-[WKWebView activeViewLayoutSize:]):
1893         (-[WKWebView _dispatchSetViewLayoutSize:]):
1894         (-[WKWebView _frameOrBoundsChanged]):
1895         (-[WKWebView _minimumLayoutSizeOverride]):
1896         (-[WKWebView _setViewLayoutSizeOverride:]):
1897         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
1898         (-[WKWebView _endAnimatedResize]):
1899         (-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:maximumUnobscuredSizeOverride:]):
1900         (-[WKWebView _clearOverrideLayoutParameters]):
1901         (-[WKWebView _minimumLayoutWidth]):
1902         (-[WKWebView _setMinimumLayoutWidth:]):
1903         (-[WKWebView activeMinimumLayoutSize:]): Deleted.
1904         (-[WKWebView _dispatchSetMinimumLayoutSize:]): Deleted.
1905         (-[WKWebView _setMinimumLayoutSizeOverride:]): Deleted.
1906         (-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:minimumLayoutSizeForMinimalUI:maximumUnobscuredSizeOverride:]): Deleted.
1907
1908         Remove unused SPI that has been deprecated since iOS 9, has a simple drop-in replacement, and no longer has any
1909         internal clients.
1910
1911         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1912         * UIProcess/Cocoa/WebViewImpl.mm:
1913         (WebKit::WebViewImpl::setMinimumSizeForAutoLayout):
1914         (WebKit::WebViewImpl::minimumSizeForAutoLayout const):
1915         (WebKit::WebViewImpl::setIntrinsicContentSize):
1916         * UIProcess/DrawingAreaProxy.h:
1917         (WebKit::DrawingAreaProxy::viewLayoutSizeDidChange):
1918         (WebKit::DrawingAreaProxy::minimumLayoutSizeDidChange): Deleted.
1919         * UIProcess/WebPageProxy.cpp:
1920         (WebKit::WebPageProxy::creationParameters):
1921         (WebKit::WebPageProxy::setViewLayoutSize):
1922         (WebKit::WebPageProxy::setMinimumLayoutSize): Deleted.
1923         * UIProcess/WebPageProxy.h:
1924         (WebKit::WebPageProxy::viewLayoutSize const):
1925         (WebKit::WebPageProxy::minimumLayoutSize const): Deleted.
1926         * UIProcess/ios/WebPageProxyIOS.mm:
1927         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
1928         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize):
1929         (WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize): Deleted.
1930         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
1931         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
1932         (WebKit::TiledCoreAnimationDrawingAreaProxy::viewLayoutSizeDidChange):
1933         (WebKit::TiledCoreAnimationDrawingAreaProxy::didUpdateGeometry):
1934         (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange):
1935         (WebKit::TiledCoreAnimationDrawingAreaProxy::willSendUpdateGeometry):
1936         (WebKit::TiledCoreAnimationDrawingAreaProxy::minimumLayoutSizeDidChange): Deleted.
1937         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1938         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
1939         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
1940         (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
1941         * WebProcess/WebPage/WebPage.cpp:
1942         (WebKit::m_credentialsMessenger):
1943         (WebKit::WebPage::setViewLayoutSize):
1944         (WebKit::WebPage::setMinimumLayoutSize): Deleted.
1945         * WebProcess/WebPage/WebPage.h:
1946         (WebKit::WebPage::viewLayoutSize const):
1947         (WebKit::WebPage::minimumLayoutSize const): Deleted.
1948         * WebProcess/WebPage/WebPage.messages.in:
1949         * WebProcess/WebPage/ios/WebPageIOS.mm:
1950         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
1951         (WebKit::WebPage::dynamicViewportSizeUpdate):
1952         (WebKit::WebPage::setViewportConfigurationMinimumLayoutSize): Deleted.
1953         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1954         (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded):
1955         (WebKit::TiledCoreAnimationDrawingArea::updateGeometry):
1956
1957 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
1958
1959         [Extra zoom mode] Add a mechanism to override default viewport behaviors in extra zoom mode
1960         https://bugs.webkit.org/show_bug.cgi?id=185050
1961         <rdar://problem/39624038>
1962
1963         Reviewed by Tim Horton.
1964
1965         Remove the forceHorizontalViewportShrinkToFit and minimumAllowedLayoutWidth SPI hooks from WebKit, and
1966         additionally remove all logic for plumbing viewSize to WebCore. See WebCore/ChangeLog for more information.
1967
1968         * Shared/VisibleContentRectUpdateInfo.cpp:
1969         (WebKit::VisibleContentRectUpdateInfo::encode const):
1970         (WebKit::VisibleContentRectUpdateInfo::decode):
1971         (WebKit::operator<<):
1972         * Shared/VisibleContentRectUpdateInfo.h:
1973         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
1974         (WebKit::VisibleContentRectUpdateInfo::allowShrinkToFit const):
1975         (WebKit::operator==):
1976         (WebKit::VisibleContentRectUpdateInfo::forceHorizontalShrinkToFit const): Deleted.
1977         * UIProcess/API/Cocoa/WKWebView.mm:
1978         (-[WKWebView _initializeWithConfiguration:]):
1979         (-[WKWebView activeMinimumLayoutSize:]):
1980         (-[WKWebView _dispatchSetMinimumLayoutSize:]):
1981         (-[WKWebView _frameOrBoundsChanged]):
1982         (-[WKWebView _setMinimumLayoutSizeOverride:]):
1983         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
1984         (-[WKWebView _endAnimatedResize]):
1985         (-[WKWebView _minimumAllowedLayoutWidth]): Deleted.
1986         (-[WKWebView _setMinimumAllowedLayoutWidth:]): Deleted.
1987         (-[WKWebView activeMinimumLayoutSizes:]): Deleted.
1988         (-[WKWebView _dispatchSetMinimumLayoutSize:viewSize:]): Deleted.
1989         (-[WKWebView _setForceHorizontalViewportShrinkToFit:]): Deleted.
1990         (-[WKWebView _forceHorizontalViewportShrinkToFit]): Deleted.
1991         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1992         * UIProcess/WebPageProxy.cpp:
1993         (WebKit::WebPageProxy::creationParameters):
1994         * UIProcess/WebPageProxy.h:
1995         * UIProcess/ios/WKContentView.mm:
1996         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
1997         * UIProcess/ios/WebPageProxyIOS.mm:
1998         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
1999         (WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize):
2000         * WebProcess/WebPage/WebPage.cpp:
2001         (WebKit::m_credentialsMessenger):
2002         * WebProcess/WebPage/WebPage.h:
2003         * WebProcess/WebPage/WebPage.messages.in:
2004         * WebProcess/WebPage/ios/WebPageIOS.mm:
2005         (WebKit::WebPage::setViewportConfigurationMinimumLayoutSize):
2006         (WebKit::WebPage::dynamicViewportSizeUpdate):
2007         (WebKit::WebPage::updateVisibleContentRects):
2008
2009 2018-04-27  Carlos Garcia Campos  <cgarcia@igalia.com>
2010
2011         REGRESSION(r230812): [WPE][GTK] WebKitWebViewSessionState.cpp throws away encoded BackForwardList identifier
2012         https://bugs.webkit.org/show_bug.cgi?id=184823
2013
2014         Reviewed by Michael Catanzaro.
2015
2016         Bump session sate format version to 2 and stop encoding the backfoward list item identifier, since it's always
2017         regenerated.
2018
2019         * UIProcess/API/glib/WebKitWebViewSessionState.cpp:
2020         (encodeBackForwardListItemState): Always encode version 2.
2021         (encodeBackForwardListState): Ditto.
2022         (encodeSessionState): Ditto.
2023         (decodeBackForwardListItemStateV1): Decode list item state for version 1.
2024         (decodeBackForwardListItemState): Receive the version and call decodeBackForwardListItemStateV1() if it's 1 or
2025         use the version 2 otherwise.
2026         (decodeSessionState): Load data for known formats and use the one that worked to decode it.
2027
2028 2018-04-26  Megan Gardner  <megan_gardner@apple.com>
2029
2030         Add timeout for ensurePositionInformationIsUpToDate
2031         https://bugs.webkit.org/show_bug.cgi?id=184567
2032
2033         Reviewed by Wenson Hsieh.
2034         
2035         We are having long hang times for WebKit, and this is one of the culprits.
2036         If we do not get an answer for positionInformation in a reasonable amount of time, we should timeout,
2037         so as to not hang the UI.
2038
2039         * UIProcess/ios/WKContentViewInteraction.mm:
2040         (-[WKContentView ensurePositionInformationIsUpToDate:]):
2041
2042 2018-04-26  Andy Estes  <aestes@apple.com>
2043
2044         Try again to fix the iOS build after r231063.
2045
2046         * Configurations/Base.xcconfig:
2047
2048 2018-04-26  Jer Noble  <jer.noble@apple.com>
2049
2050         WK_COCOA_TOUCH the WK_ACCESSIBILITY_LDFLAGS
2051         https://bugs.webkit.org/show_bug.cgi?id=185007
2052         <rdar://problem/39735943>
2053
2054         Reviewed by Timothy Hatcher.
2055
2056         * Configurations/WebKit.xcconfig:
2057
2058 2018-04-26  Jer Noble  <jer.noble@apple.com>
2059
2060         Unreviewed build fix; fix iOS TAPI build step after r231063.
2061
2062         * Configurations/WebKit.xcconfig:
2063
2064 2018-04-26  Jer Noble  <jer.noble@apple.com>
2065
2066         WK_COCOA_TOUCH all the things.
2067         https://bugs.webkit.org/show_bug.cgi?id=185006
2068
2069         Reviewed by Tim Horton.
2070
2071         * Configurations/BaseTarget.xcconfig:
2072         * Configurations/WebKit.xcconfig:
2073
2074 2018-04-26  Daniel Bates  <dabates@apple.com>
2075
2076         Remove WebCore::-qualifier in NetworkLoadChecker.cpp
2077         https://bugs.webkit.org/show_bug.cgi?id=185037
2078
2079         Reviewed by Youenn Fablet.
2080
2081         It is unncesssary to qualify WebCore types in NetworkLoadChecker.cpp as it has a
2082         "using namespace WebCore" directive.
2083
2084         * NetworkProcess/NetworkLoadChecker.cpp:
2085         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
2086         (WebKit::NetworkLoadChecker::checkRedirection):
2087         (WebKit::NetworkLoadChecker::validateResponse):
2088         (WebKit::NetworkLoadChecker::continueCheckingRequest): Removed extra space character and unnecessary
2089         parentheses from the right-hand side of the assignment to m_storedCredentialsPolicy.
2090         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
2091
2092 2018-04-26  Daniel Bates  <dabates@apple.com>
2093
2094         Rename NetworkLoadChecker::returnError() to NetworkLoadChecker::accessControlErrorForValidationHandler()
2095         https://bugs.webkit.org/show_bug.cgi?id=185035
2096
2097         Reviewed by Youenn Fablet.
2098
2099         Substitute NetworkLoadChecker::accessControlErrorForValidationHandler() for NetworkLoadChecker::returnError()
2100         to better describe that it is a convenience function that returns a wrapped ResourceError object,
2101         that represents an access control error, suitable to be passed directly to a validation handler.
2102
2103         * NetworkProcess/NetworkLoadChecker.cpp:
2104         (WebKit::NetworkLoadChecker::checkRedirection): Update as needed for renaming.
2105         (WebKit::NetworkLoadChecker::accessControlErrorForValidationHandler): Use auto -> syntax to avoid the need to
2106         class-qualify the return type. Also renamed parameter from error to message as it represents the message/description
2107         for the access control error.
2108         (WebKit::NetworkLoadChecker::checkRequest): Update as needed for renaming. Also substitute "message" for "error"
2109         to match the argument of accessControlErrorForValidationHandler() with the same name.
2110         (WebKit::NetworkLoadChecker::continueCheckingRequest): Update as needed for renaming.
2111         (WebKit::NetworkLoadChecker::returnError): Deleted; renamed to accessControlErrorForValidationHandler().
2112         * NetworkProcess/NetworkLoadChecker.h:
2113
2114 2018-04-26  Jiewen Tan  <jiewen_tan@apple.com>
2115
2116         Remove access to keychain from the WebContent process
2117         https://bugs.webkit.org/show_bug.cgi?id=184428
2118         <rdar://problem/13150903>
2119
2120         Part 3.
2121
2122         Tighten WebContent Process' sandbox profile to all Security.framework services.
2123
2124         Reviewed by Brent Fulgham.
2125
2126         * WebProcess/com.apple.WebProcess.sb.in:
2127
2128 2018-04-26  Youenn Fablet  <youenn@apple.com>
2129
2130         Make cross origin redirection error messages consistent between SubresourceLoader and NetworkLoadChecker
2131         https://bugs.webkit.org/show_bug.cgi?id=185023
2132
2133         Reviewed by Chris Dumez.
2134
2135         Align NetworkLoadChecker with what SubresourceLoader is doing so that we can keep WK1 and WK2 error messages as consistent as possible.
2136
2137         * NetworkProcess/NetworkLoadChecker.cpp:
2138         (WebKit::NetworkLoadChecker::checkRedirection):
2139         (WebKit::NetworkLoadChecker::validateResponse):
2140
2141 2018-04-25  Megan Gardner  <megan_gardner@apple.com>
2142
2143         Activate selection when interacting with editable content
2144         https://bugs.webkit.org/show_bug.cgi?id=185017
2145
2146         Reviewed by Tim Horton.
2147         
2148         Fixes a regression from r231016 where selection now does not work when interacting with
2149         editable content. When we go into editable content, we should turn on the assistant.
2150         This fulfills the requirement of user interaction as well, so any javascript selections
2151         after this point should be valid.
2152
2153         * UIProcess/ios/WKContentViewInteraction.mm:
2154         (-[WKContentView _startAssistingKeyboard]):
2155         (-[WKContentView _stopAssistingKeyboard]):
2156
2157 2018-04-26  Per Arne Vollan  <pvollan@apple.com>
2158
2159         Disable content filtering in minimal simulator mode
2160         https://bugs.webkit.org/show_bug.cgi?id=185027
2161         <rdar://problem/39736091>
2162
2163         Reviewed by Jer Noble.
2164
2165         * Configurations/FeatureDefines.xcconfig:
2166
2167 2018-04-26  Brady Eidson  <beidson@apple.com>
2168
2169         Add a setting for keeping around all processes and always reusing them per-origin.
2170         <rdar://problem/39695798> and https://bugs.webkit.org/show_bug.cgi?id=185020
2171
2172         Reviewed by Andy Estes.
2173
2174         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2175         (API::ProcessPoolConfiguration::copy):
2176         * UIProcess/API/APIProcessPoolConfiguration.h:
2177
2178         * UIProcess/API/C/WKContextConfigurationRef.cpp:
2179         (WKContextConfigurationAlwaysKeepAndReuseSwappedProcesses):
2180         (WKContextConfigurationSetAlwaysKeepAndReuseSwappedProcesses):
2181         * UIProcess/API/C/WKContextConfigurationRef.h:
2182
2183         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2184         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2185         (-[_WKProcessPoolConfiguration setAlwaysKeepAndReuseSwappedProcesses:]):
2186         (-[_WKProcessPoolConfiguration alwaysKeepAndReuseSwappedProcesses]):
2187
2188         * UIProcess/SuspendedPageProxy.cpp:
2189         (WebKit::SuspendedPageProxy::webProcessDidClose):
2190         (WebKit::SuspendedPageProxy::destroyWebPageInWebProcess):
2191         * UIProcess/SuspendedPageProxy.h:
2192
2193         * UIProcess/WebPageProxy.cpp:
2194         (WebKit::WebPageProxy::suspendedPageClosed):
2195         (WebKit::WebPageProxy::suspendedPageProcessClosed): Deleted.
2196         * UIProcess/WebPageProxy.h:
2197         (WebKit::WebPageProxy::suspendedPage const):
2198
2199         * UIProcess/WebProcessPool.cpp:
2200         (WebKit::WebProcessPool::shouldTerminate):
2201         (WebKit::WebProcessPool::disconnectProcess):
2202         (WebKit::WebProcessPool::addProcessToOriginCacheSet):
2203         (WebKit::WebProcessPool::removeProcessFromOriginCacheSet):
2204         (WebKit::WebProcessPool::processForNavigation): If a swap will occur, cache the old process.
2205         (WebKit::WebProcessPool::processForNavigationInternal): Consider re-using a previously cached process.
2206         * UIProcess/WebProcessPool.h:
2207
2208         * WebProcess/WebPage/WebPage.cpp:
2209         (WebKit::m_credentialsMessenger):
2210
2211 2018-04-26  Andy VanWagoner  <thetalecrafter@gmail.com>
2212
2213         [INTL] Implement Intl.PluralRules
2214         https://bugs.webkit.org/show_bug.cgi?id=184312
2215
2216         Reviewed by JF Bastien.
2217
2218         Added Intl.PluralRules feature flag.
2219
2220         * Configurations/FeatureDefines.xcconfig:
2221
2222 2018-04-26  Zan Dobersek  <zdobersek@igalia.com>
2223
2224         [GTK][WPE] Initial ASYNC_SCROLLING support
2225         https://bugs.webkit.org/show_bug.cgi?id=184961
2226
2227         Reviewed by Carlos Garcia Campos.
2228
2229         Guard RemoteScrollingCoordinator and RemoteScrollingCoordinatorProxy
2230         usage in WebChromeClient and WebPageProxy, respectively, with
2231         PLATFORM(COCOA) in addition to the ASYNC_SCROLLING guards.
2232
2233         Despite enabling the code at build-time, the feature (as intended) is
2234         not yet used because of the DrawingArea rejection in the WebPage
2235         constructor.
2236
2237         * UIProcess/WebPageProxy.cpp:
2238         (WebKit::WebPageProxy::initializeWebPage):
2239         (WebKit::WebPageProxy::handleWheelEvent):
2240         (WebKit::WebPageProxy::updateTouchEventTracking):
2241         * UIProcess/WebPageProxy.h:
2242         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2243         (WebKit::WebChromeClient::createScrollingCoordinator const):
2244
2245 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2246
2247         [WPE] Build and link against latest WPEBackend and WPEBackend-fdo
2248         https://bugs.webkit.org/show_bug.cgi?id=184643
2249
2250         Reviewed by Žan Doberšek.
2251
2252         Adapt to single-header WPE includes.
2253
2254         Null-initialize padding to silence -Wmissing-field-initializers. (Yuck.)
2255
2256         * Shared/NativeWebTouchEvent.h:
2257         * Shared/wpe/WebEventFactory.cpp:
2258         * UIProcess/API/glib/WebKitPrivate.cpp:
2259         * UIProcess/API/wpe/CompositingManagerProxy.cpp:
2260         * UIProcess/API/wpe/ScrollGestureController.h:
2261         * UIProcess/API/wpe/WPEView.cpp:
2262         (WKWPE::m_backend):
2263         * UIProcess/API/wpe/WebKitWebViewBackend.h:
2264         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
2265         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
2266         (WebKit::AcceleratedSurfaceWPE::initialize):
2267
2268 2018-04-25  Saam Barati  <sbarati@apple.com>
2269
2270         dlopen the bundle's executable before calling -[NSBundle load] since that will also do a bunch of other things we don't need
2271         https://bugs.webkit.org/show_bug.cgi?id=184904
2272
2273         Reviewed by Geoffrey Garen.
2274
2275         Loading an NSBundle does a lot of work to find the principal class inside
2276         the bundle. This means it walks all the objective C class names loaded
2277         by the bundle. Doing this is *really* expensive.
2278         
2279         Some users of the injected bundle define a WKBundleInitialize function.
2280         In such a case, we don't need the principal class, so we can skip loading
2281         the NSBundle. Now, before we load the bundle, we dlopen and dlsym looking
2282         for the WKBundleInitialize function. If we find it, we skip loading
2283         the bundle. If we don't find the WKBundleInitialize function, we fall
2284         back to loading the bundle and finding the principal class.
2285         
2286         This speeds up initializeWebProcess by ~70ms on my MBP.
2287
2288         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
2289         (WebKit::InjectedBundle::initialize):
2290
2291 2018-04-25  Youenn Fablet  <youenn@apple.com>
2292
2293         Use NetworkLoadChecker for all subresource loads except fetch/XHR
2294         https://bugs.webkit.org/show_bug.cgi?id=184870
2295         <rdar://problem/39370034>
2296
2297         Reviewed by Chris Dumez.
2298
2299         Relax rules to check for non HTTP(s) redirections to throw only when WebProcess says to load it after redirection.
2300         This allows WebProcess to load redirected non HTTP(s) URLs, such as data URLs.
2301         We keep these checks when WebProcess asks to continue the load and for all PingLoads.
2302
2303         Update error messages to be more consistent with WK1.
2304
2305         * NetworkProcess/NetworkLoadChecker.cpp:
2306         (WebKit::NetworkLoadChecker::checkRedirection):
2307         (WebKit::NetworkLoadChecker::continueCheckingRequest):
2308         (WebKit::NetworkLoadChecker::validateResourceResponse):
2309         (WebKit::NetworkLoadChecker::continueCheckingRequest):
2310         * NetworkProcess/NetworkLoadChecker.h:
2311         (WebKit::NetworkLoadChecker::validateResponse):
2312         * NetworkProcess/NetworkResourceLoader.cpp:
2313         (WebKit::shouldUseNetworkLoadChecker):
2314         (WebKit::NetworkResourceLoader::continueWillSendRequest):
2315
2316 2018-04-25  Ryosuke Niwa  <rniwa@webkit.org>
2317
2318         PSON: Don't create a new process when navigating to a blob URL, data URL, and about:blank
2319         https://bugs.webkit.org/show_bug.cgi?id=184962
2320
2321         Reviewed by Youenn Fablet.
2322         <rdar://problem/39715044>
2323
2324         Build fix. Revert the change in r231019 to remove the empty URL and about:blank check here.
2325         These checks are for the source / originating URL, not the target URL.
2326
2327         * UIProcess/WebProcessPool.cpp:
2328         (WebKit::WebProcessPool::processForNavigation):
2329
2330 2018-04-25  Youenn Fablet  <youenn@apple.com>
2331
2332         WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier should use DoNotProcessIncomingMessagesWhenWaitingForSyncReply
2333         https://bugs.webkit.org/show_bug.cgi?id=184978
2334         <rdar://problem/39667094>
2335
2336         Reviewed by Simon Fraser.
2337
2338         Use DoNotProcessIncomingMessagesWhenWaitingForSyncReply to keep a consistent state after the sync IPC call.
2339
2340         * WebProcess/Network/WebLoaderStrategy.cpp:
2341         (WebKit::WebLoaderStrategy::responseFromResourceLoadIdentifier):
2342         (WebKit::WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier):
2343
2344 2018-04-25  Jiewen Tan  <jiewen_tan@apple.com>
2345
2346         Remove access to keychain from the WebContent process
2347         https://bugs.webkit.org/show_bug.cgi?id=184428
2348         <rdar://problem/13150903>
2349
2350         Reviewed by Brent Fulgham.
2351
2352         This patch does the followings:
2353         1. Added necessary support to move HTMLKeygenElement's operation from WebContent Process to UI Process.
2354         2. Craft new SPI copySignedPublicKeyAndChallengeString to supply HTMLKeygenElement with dummy data such
2355         that WebKitTestRunner tests will not modify the underlying key store (e.g., the macOS Keychain).
2356
2357         * UIProcess/API/APINavigationClient.h:
2358         (API::NavigationClient::signedPublicKeyAndChallengeString):
2359         * UIProcess/API/C/WKPage.cpp:
2360         (WKPageSetPageNavigationClient):
2361         * UIProcess/API/C/WKPageNavigationClient.h:
2362         * UIProcess/Cocoa/NavigationState.h:
2363         * UIProcess/Cocoa/NavigationState.mm:
2364         (WebKit::NavigationState::NavigationClient::signedPublicKeyAndChallengeString):
2365         * UIProcess/WebPageProxy.cpp:
2366         (WebKit::WebPageProxy::signedPublicKeyAndChallengeString):
2367         * UIProcess/WebPageProxy.h:
2368         * UIProcess/WebPageProxy.messages.in:
2369         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2370         (WebKit::WebChromeClient::signedPublicKeyAndChallengeString const):
2371         * WebProcess/WebCoreSupport/WebChromeClient.h:
2372
2373 2018-04-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2374
2375         [Extra zoom mode] The search field on www.bing.com is missing label text
2376         https://bugs.webkit.org/show_bug.cgi?id=184975
2377         <rdar://problem/39723081>
2378
2379         Reviewed by Tim Horton.
2380
2381         Adds support for displaying the "aria-label" attribute as the input view's label text in extra zoom mode. Also
2382         adds support for grabbing the input label's text for testing.
2383
2384         Test: fast/forms/extrazoom/form-control-label-text.html
2385
2386         * Shared/AssistedNodeInformation.cpp:
2387         (WebKit::AssistedNodeInformation::encode const):
2388         (WebKit::AssistedNodeInformation::decode):
2389         * Shared/AssistedNodeInformation.h:
2390         * UIProcess/API/Cocoa/WKWebView.mm:
2391         (-[WKWebView formInputLabel]):
2392         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2393         * UIProcess/ios/WKContentViewInteraction.h:
2394         * UIProcess/ios/WKContentViewInteraction.mm:
2395         (-[WKContentView formInputLabel]):
2396         * WebProcess/WebPage/ios/WebPageIOS.mm:
2397         (WebKit::WebPage::getAssistedNodeInformation):
2398
2399 2018-04-25  Ryosuke Niwa  <rniwa@webkit.org>
2400
2401         PSON: Don't create a new process when navigating to a blob URL, data URL, and about:blank
2402         https://bugs.webkit.org/show_bug.cgi?id=184962
2403
2404         Reviewed by Youenn Fablet.
2405
2406         Don't create a new WebContent process when navigating to a blob object URL since doing so
2407         can result in a race condition in which the blog URL is removed from the blob registry of
2408         the network process by the time the navigation gets commited. This causes a failure in
2409         fast/dom/HTMLAnchorElement/anchor-download-unset.html and oher layout tests.
2410
2411         In the future, the network process should verify that a given WebContent process has access
2412         to a given blob URL. For now, we rely on WebContent process to tell us whether it can
2413         navigate to a given blob URL or not.
2414
2415         * Shared/NavigationActionData.cpp:
2416         (WebKit::NavigationActionData::encode const): Encode newly added treatAsSameOriginNavigation.
2417         (WebKit::NavigationActionData::decode): Ditto for decoding.
2418         * Shared/NavigationActionData.h:
2419         (WebKit::NavigationActionData::treatAsSameOriginNavigation): Added.
2420         * UIProcess/API/APINavigation.h:
2421         (API::Navigation::setTreatAsSameOriginNavigation): Added.
2422         (API::Navigation::treatAsSameOriginNavigation const): Added.
2423         * UIProcess/API/APIProcessPoolConfiguration.h:
2424         * UIProcess/WebPageProxy.cpp:
2425         (WebKit::WebPageProxy::decidePolicyForNavigationAction): Use the current process when
2426         treatAsSameOriginNavigation is set to true; i.e. when navigating to a blob URL the current
2427         document has access.
2428         * UIProcess/WebProcessPool.cpp:
2429         (WebKit::WebProcessPool::processForNavigation):
2430         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2431         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2432
2433 2018-04-25  Megan Gardner  <megan_gardner@apple.com>
2434
2435         Don't activate Selection Assistant unless it is actually needed.
2436         https://bugs.webkit.org/show_bug.cgi?id=184944
2437         <rdar://problem/39469671>
2438
2439         Reviewed by Tim Horton.
2440         
2441         Don't activate the selection unless we need to. Activating on init is overeager and allowing Javascript to 
2442         activate selections without user input.
2443
2444         * UIProcess/ios/WKContentViewInteraction.mm:
2445         (-[WKContentView useSelectionAssistantWithGranularity:]):
2446
2447 2018-04-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2448
2449         Fix entitlements and sandbox configurations in WebKit after r230778
2450         https://bugs.webkit.org/show_bug.cgi?id=184960
2451         <rdar://problem/39662827>
2452
2453         Reviewed by Tim Horton.
2454
2455         Build fixes for watchOS and tvOS after r230778.
2456
2457         * Configurations/BaseXPCService.xcconfig:
2458         * Configurations/NetworkService.xcconfig:
2459         * Configurations/WebContentService.xcconfig:
2460
2461 2018-04-25  Brent Fulgham  <bfulgham@apple.com>
2462
2463         Unreviewed build fix after r231008.
2464
2465         * NetworkProcess/NetworkDataTask.cpp:
2466         (WebKit::NetworkDataTask::create): Forgot to remove an unneeded constructor argument.
2467
2468 2018-04-25  Brent Fulgham  <bfulgham@apple.com>
2469
2470         Don't Block First Party Cookies on Redirects
2471         https://bugs.webkit.org/show_bug.cgi?id=184948
2472         <rdar://problem/39534099>
2473
2474         Reviewed by Youenn Fablet.
2475
2476         Top-level navigations should not be subject to cookie blocking behavior. When performing redirects for main frame
2477         navigation we are blocking cookies, leading to site breakage.
2478         
2479         We need to keep track of which NetworkDataTasks are due to a main frame navigation. When a redirect is performed
2480         on the main frame, we should treat the new origin as the 'first party for cookies' and avoid blocking cookies for
2481         that URL.
2482
2483         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2484         (WebKit::NetworkConnectionToWebProcess::preconnectTo): Use the correct parameter type. We actually serialize
2485         NetworkResourceLoadParameters over IPC, so we should get access to all the members of this child class.
2486         * NetworkProcess/NetworkConnectionToWebProcess.h:
2487         * NetworkProcess/NetworkDataTask.cpp:
2488         (WebKit::NetworkDataTask::create): Pass new 'loadIsForNavigation' flag to create methods. 
2489         (WebKit::NetworkDataTask::NetworkDataTask): Capture 'loadIsForNavigation' in constructor.
2490         * NetworkProcess/NetworkDataTask.h:
2491         (WebKit::NetworkDataTask::isTopLevelNavigation const): Added.
2492         * NetworkProcess/NetworkDataTaskBlob.cpp:
2493         (WebKit::NetworkDataTaskBlob::NetworkDataTaskBlob): Accept new constructor argument.
2494         * NetworkProcess/NetworkDataTaskBlob.h:
2495         * NetworkProcess/NetworkLoad.cpp:
2496         (WebKit::NetworkLoad::willPerformHTTPRedirection): Retain requester value from old request during redirect.
2497         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2498         (NetworkResourceLoadParameters::decode): Update to pass new flag.
2499         (NetworkResourceLoadParameters::encode): Ditto.
2500         * NetworkProcess/NetworkLoadParameters.h:
2501         * NetworkProcess/capture/NetworkDataTaskReplay.cpp:
2502         (WebKit::NetworkCapture::NetworkDataTaskReplay::NetworkDataTaskReplay): Accept new constructor argument.
2503         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2504         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2505         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Accept new constructor argument.
2506         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
2507         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2508         (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl): Accept new constructor argument.
2509         * NetworkProcess/curl/NetworkDataTaskCurl.h:
2510         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
2511         (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup): Accept new constructor argument.
2512         * NetworkProcess/soup/NetworkDataTaskSoup.h:
2513
2514 2018-04-25  Youenn Fablet  <youenn@apple.com>
2515
2516         Ensure DNT is set for redirections handled in NetworkProcess
2517         https://bugs.webkit.org/show_bug.cgi?id=184890
2518
2519         Reviewed by Ryosuke Niwa.
2520
2521         Compute whether DNT header should be set on requests based on:
2522         - request has a DNT header
2523         - session is ephemeral (aka private browsing mode)
2524         In both cases, we ensure a DNT header is added for any request triggered by a redirection.
2525
2526         Covered by http/wpt/fetch/dnt-header-after-redirection.html.
2527
2528         * NetworkProcess/NetworkLoadChecker.cpp:
2529         (WebKit::NetworkLoadChecker::check):
2530         (WebKit::NetworkLoadChecker::prepareRedirectedRequest):
2531         * NetworkProcess/NetworkLoadChecker.h:
2532         * NetworkProcess/NetworkResourceLoader.cpp:
2533         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
2534         (WebKit::NetworkResourceLoader::continueWillSendRequest):
2535         * NetworkProcess/PingLoad.cpp:
2536         (WebKit::PingLoad::willPerformHTTPRedirection):
2537         * WebProcess/Network/WebLoaderStrategy.cpp:
2538         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2539
2540 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2541
2542         [WPE] Remove deprecated functions and properties from the API
2543         https://bugs.webkit.org/show_bug.cgi?id=179295
2544
2545         Reviewed by Žan Doberšek.
2546
2547         * UIProcess/API/glib/WebKitCookieManager.cpp:
2548         * UIProcess/API/glib/WebKitFormSubmissionRequest.cpp:
2549         * UIProcess/API/glib/WebKitNavigationPolicyDecision.cpp:
2550         (webkitNavigationPolicyDecisionGetProperty):
2551         (webkit_navigation_policy_decision_class_init):
2552         * UIProcess/API/glib/WebKitSettings.cpp:
2553         (webKitSettingsSetProperty):
2554         (webKitSettingsGetProperty):
2555         (webkit_settings_class_init):
2556         * UIProcess/API/glib/WebKitWebContext.cpp:
2557         (webkitWebContextGetProperty):
2558         (webkitWebContextSetProperty):
2559         (webkit_web_context_class_init):
2560         * UIProcess/API/glib/WebKitWebView.cpp:
2561         (webkit_web_view_class_init):
2562         (webkitWebViewHandleAuthenticationChallenge):
2563         (webkitWebViewWebProcessTerminated):
2564         * UIProcess/API/wpe/WebKitCookieManager.h:
2565         * UIProcess/API/wpe/WebKitFormSubmissionRequest.h:
2566         * UIProcess/API/wpe/WebKitNavigationPolicyDecision.h:
2567         * UIProcess/API/wpe/WebKitSettings.h:
2568         * UIProcess/API/wpe/WebKitWebContext.h:
2569
2570 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2571
2572         Unreviewed, silence -Wreturn-type warning
2573         https://bugs.webkit.org/show_bug.cgi?id=184560
2574
2575         * NetworkProcess/NetworkResourceLoader.cpp:
2576         (WebKit::shouldCancelCrossOriginLoad):
2577
2578 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2579
2580         [GTK] Miscellaneous build cleanups
2581         https://bugs.webkit.org/show_bug.cgi?id=184399
2582
2583         Reviewed by Žan Doberšek.
2584
2585         * PlatformGTK.cmake:
2586
2587 2018-04-25  Dean Jackson  <dino@apple.com>
2588
2589         Make a better flag for system preview, and disable it where necessary
2590         https://bugs.webkit.org/show_bug.cgi?id=184968
2591         <rdar://problem/39686506>
2592
2593         Reviewed by Eric Carlson.
2594
2595         Use USE(SYSTEM_PREVIEW).
2596
2597         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
2598         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
2599         (-[WKWebViewContentProviderRegistry init]):
2600         * UIProcess/ios/WKSystemPreviewView.mm:
2601
2602 2018-04-25  Carlos Garcia Campos  <cgarcia@igalia.com>
2603
2604         [GTK] Implement MouseEvent.buttons
2605         https://bugs.webkit.org/show_bug.cgi?id=184913
2606
2607         Reviewed by Žan Doberšek.
2608
2609         It's currently returning always 0.
2610
2611         * Shared/gtk/WebEventFactory.cpp:
2612         (WebKit::pressedMouseButtons): Helper function to get the pressed mouse buttons.
2613         (WebKit::WebEventFactory::createWebMouseEvent): Pass presssed mouse buttons to constructor instead of 0.
2614         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
2615         (WebKit::WebAutomationSession::platformSimulateMouseInteraction): Include the mouse buttons state in automation
2616         synthesized events and update m_currentModifiers with the mouse buttons state.
2617         (WebKit::keyCodeForVirtualKey): Do not set the state here.
2618         (WebKit::modifiersForKeyCode): Helper to get the modifiers for a key code.
2619         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): Initialize the modifiers also when
2620         virtualKey is std::nullopt;
2621
2622 2018-04-24  Nan Wang  <n_wang@apple.com>
2623
2624         AX: soft link libAccessibility.dylb
2625         https://bugs.webkit.org/show_bug.cgi?id=184919
2626
2627         Reviewed by Dan Bernstein.
2628
2629         Weakly linked libAccessibility.dylib on macOS.
2630
2631         * Configurations/WebKit.xcconfig:
2632         * UIProcess/API/Cocoa/WKWebView.mm:
2633         (-[WKWebView _initializeWithConfiguration:]):
2634         (-[WKWebView _updateAccessibilityEventsEnabled]):
2635
2636 2018-04-24  Fujii Hironori  <Hironori.Fujii@sony.com>
2637
2638         [WinCairo] Add WKView and WKAPI
2639         https://bugs.webkit.org/show_bug.cgi?id=182869
2640
2641         Reviewed by Alex Christensen.
2642
2643         Resurrected source files for WebKit for Windows port which was
2644         removed in r139003.
2645
2646         * PlatformWin.cmake: Renamed the output name of WebKit to WebKit2
2647         not to conflict WebKitLegacy. Added source files and include paths.
2648         * UIProcess/API/C/WKAPICast.h:
2649         * UIProcess/API/C/win/WKAPICastWin.h: Added.
2650         * UIProcess/API/C/win/WKView.cpp: Added.
2651         (WKViewCreate):
2652         (WKViewGetWindow):
2653         (WKViewGetPage):
2654         (WKViewSetParentWindow):
2655         (WKViewWindowAncestryDidChange):
2656         (WKViewSetIsInWindow):
2657         (WKViewSetScrollOffsetOnNextResize):
2658         * UIProcess/API/C/win/WKView.h: Added.
2659         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp: Added.
2660         (API::WebsiteDataStore::defaultApplicationCacheDirectory):
2661         (API::WebsiteDataStore::defaultCacheStorageDirectory):
2662         (API::WebsiteDataStore::defaultNetworkCacheDirectory):
2663         (API::WebsiteDataStore::defaultIndexedDBDatabaseDirectory):
2664         (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
2665         (API::WebsiteDataStore::defaultLocalStorageDirectory):
2666         (API::WebsiteDataStore::defaultMediaKeysStorageDirectory):
2667         (API::WebsiteDataStore::defaultWebSQLDatabaseDirectory):
2668         (API::WebsiteDataStore::defaultResourceLoadStatisticsDirectory):
2669         (API::WebsiteDataStore::cacheDirectoryFileSystemRepresentation):
2670         (API::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation):
2671         (API::WebsiteDataStore::defaultDataStoreConfiguration):
2672         * UIProcess/Launcher/ProcessLauncher.h:
2673         * UIProcess/Launcher/win/ProcessLauncherWin.cpp: Added.
2674         (WebKit::processName):
2675         (WebKit::ProcessLauncher::launchProcess):
2676         (WebKit::ProcessLauncher::terminateProcess):
2677         (WebKit::ProcessLauncher::platformInvalidate):
2678         * UIProcess/Network/NetworkProcessProxy.cpp:
2679         (WebKit::NetworkProcessProxy::networkProcessFailedToLaunch):
2680         (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess):
2681         * UIProcess/WebsiteData/win/WebsiteDataStoreWin.cpp: Added.
2682         (WebKit::WebsiteDataStore::platformInitialize):
2683         (WebKit::WebsiteDataStore::platformDestroy):
2684         (WebKit::WebsiteDataStore::platformRemoveRecentSearches):
2685         * UIProcess/win/PageClientImpl.cpp: Added.
2686         (WebKit::PageClientImpl::PageClientImpl):
2687         (WebKit::PageClientImpl::createDrawingAreaProxy):
2688         (WebKit::PageClientImpl::setViewNeedsDisplay):
2689         (WebKit::PageClientImpl::requestScroll):
2690         (WebKit::PageClientImpl::viewScrollPosition):
2691         (WebKit::PageClientImpl::viewSize):
2692         (WebKit::PageClientImpl::isViewWindowActive):
2693         (WebKit::PageClientImpl::isViewFocused):
2694         (WebKit::PageClientImpl::isViewVisible):
2695         (WebKit::PageClientImpl::isViewInWindow):
2696         (WebKit::PageClientImpl::PageClientImpl::processDidExit):
2697         (WebKit::PageClientImpl::didRelaunchProcess):
2698         (WebKit::PageClientImpl::toolTipChanged):
2699         (WebKit::PageClientImpl::setCursor):
2700         (WebKit::PageClientImpl::setCursorHiddenUntilMouseMoves):
2701         (WebKit::PageClientImpl::didChangeViewportProperties):
2702         (WebKit::PageClientImpl::registerEditCommand):
2703         (WebKit::PageClientImpl::clearAllEditCommands):
2704         (WebKit::PageClientImpl::canUndoRedo):
2705         (WebKit::PageClientImpl::executeUndoRedo):
2706         (WebKit::PageClientImpl::convertToDeviceSpace):
2707         (WebKit::PageClientImpl::convertToUserSpace):
2708         (WebKit::PageClientImpl::screenToRootView):
2709         (WebKit::PageClientImpl::rootViewToScreen):
2710         (WebKit::PageClientImpl::doneWithKeyEvent):
2711         (WebKit::PageClientImpl::createPopupMenuProxy):
2712         (WebKit::PageClientImpl::createContextMenuProxy):
2713         (WebKit::createColorPicker):
2714         (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
2715         (WebKit::PageClientImpl::exitAcceleratedCompositingMode):
2716         (WebKit::PageClientImpl::updateAcceleratedCompositingMode):
2717         (WebKit::PageClientImpl::pageClosed):
2718         (WebKit::PageClientImpl::preferencesDidChange):
2719         (WebKit::PageClientImpl::didChangeContentSize):
2720         (WebKit::PageClientImpl::handleDownloadRequest):
2721         (WebKit::PageClientImpl::didCommitLoadForMainFrame):
2722         (WebKit::PageClientImpl::fullScreenManagerProxyClient):
2723         (WebKit::PageClientImpl::closeFullScreenManager):
2724         (WebKit::PageClientImpl::isFullScreen):
2725         (WebKit::PageClientImpl::enterFullScreen):
2726         (WebKit::PageClientImpl::exitFullScreen):
2727         (WebKit::PageClientImpl::beganEnterFullScreen):
2728         (WebKit::PageClientImpl::beganExitFullScreen):
2729         (WebKit::PageClientImpl::doneWithTouchEvent):
2730         (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore):
2731         (WebKit::PageClientImpl::didFinishLoadingDataForCustomContentProvider):
2732         (WebKit::PageClientImpl::navigationGestureDidBegin):
2733         (WebKit::PageClientImpl::navigationGestureWillEnd):
2734         (WebKit::PageClientImpl::navigationGestureDidEnd):
2735         (WebKit::PageClientImpl::willRecordNavigationSnapshot):
2736         (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
2737         (WebKit::PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame):
2738         (WebKit::PageClientImpl::didFinishLoadForMainFrame):
2739         (WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame):
2740         (WebKit::PageClientImpl::didChangeBackgroundColor):
2741         (WebKit::PageClientImpl::isPlayingAudioWillChange):
2742         (WebKit::PageClientImpl::isPlayingAudioDidChange):
2743         (WebKit::PageClientImpl::refView):
2744         (WebKit::PageClientImpl::derefView):
2745         * UIProcess/win/PageClientImpl.h: Added.
2746         * UIProcess/win/TextCheckerWin.cpp: Added.
2747         (WebKit::checkerState):
2748         (WebKit::TextChecker::state):
2749         (WebKit::TextChecker::setTestingMode):
2750         (WebKit::TextChecker::isTestingMode):
2751         (WebKit::TextChecker::isContinuousSpellCheckingAllowed):
2752         (WebKit::TextChecker::setContinuousSpellCheckingEnabled):
2753         (WebKit::TextChecker::setGrammarCheckingEnabled):
2754         (WebKit::TextChecker::continuousSpellCheckingEnabledStateChanged):
2755         (WebKit::TextChecker::grammarCheckingEnabledStateChanged):
2756         (WebKit::TextChecker::uniqueSpellDocumentTag):
2757         (WebKit::TextChecker::closeSpellDocumentWithTag):
2758         (WebKit::TextChecker::checkSpellingOfString):
2759         (WebKit::TextChecker::checkGrammarOfString):
2760         (WebKit::TextChecker::spellingUIIsShowing):
2761         (WebKit::TextChecker::toggleSpellingUIIsShowing):
2762         (WebKit::TextChecker::updateSpellingUIWithMisspelledWord):
2763         (WebKit::TextChecker::updateSpellingUIWithGrammarString):
2764         (WebKit::TextChecker::getGuessesForWord):
2765         (WebKit::TextChecker::learnWord):
2766         (WebKit::TextChecker::ignoreWord):
2767         (WebKit::TextChecker::requestCheckingOfString):
2768         (WebKit::TextChecker::checkTextOfParagraph):
2769         * UIProcess/win/WebContextMenuProxyWin.cpp: Added.
2770         (WebKit::WebContextMenuProxyWin::show):
2771         (WebKit::WebContextMenuProxyWin::showContextMenuWithItems):
2772         (WebKit::WebContextMenuProxyWin::WebContextMenuProxyWin):
2773         (WebKit::WebContextMenuProxyWin::~WebContextMenuProxyWin):
2774         * UIProcess/win/WebContextMenuProxyWin.h: Added.
2775         (WebKit::WebContextMenuProxyWin::create):
2776         * UIProcess/win/WebInspectorProxyWin.cpp: Added.
2777         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
2778         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
2779         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
2780         (WebKit::WebInspectorProxy::platformDidCloseForCrash):
2781         (WebKit::WebInspectorProxy::platformInvalidate):
2782         (WebKit::WebInspectorProxy::platformHide):
2783         (WebKit::WebInspectorProxy::platformBringToFront):
2784         (WebKit::WebInspectorProxy::platformBringInspectedPageToFront):
2785         (WebKit::WebInspectorProxy::platformIsFront):
2786         (WebKit::WebInspectorProxy::platformInspectedURLChanged):
2787         (WebKit::WebInspectorProxy::inspectorPageURL):
2788         (WebKit::WebInspectorProxy::inspectorTestPageURL):
2789         (WebKit::WebInspectorProxy::inspectorBaseURL):
2790         (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
2791         (WebKit::WebInspectorProxy::platformInspectedWindowWidth):
2792         (WebKit::WebInspectorProxy::platformAttach):
2793         (WebKit::WebInspectorProxy::platformDetach):
2794         (WebKit::WebInspectorProxy::platformSetAttachedWindowHeight):
2795         (WebKit::WebInspectorProxy::platformSetAttachedWindowWidth):
2796         (WebKit::WebInspectorProxy::platformStartWindowDrag):
2797         (WebKit::WebInspectorProxy::platformSave):
2798         (WebKit::WebInspectorProxy::platformAppend):
2799         (WebKit::WebInspectorProxy::platformAttachAvailabilityChanged):
2800         * UIProcess/win/WebPageProxyWin.cpp: Added.
2801         (WebKit::WebPageProxy::platformInitialize):
2802         (WebKit::WebPageProxy::standardUserAgent):
2803         (WebKit::WebPageProxy::saveRecentSearches):
2804         (WebKit::WebPageProxy::loadRecentSearches):
2805         (WebKit::WebPageProxy::editorStateChanged):
2806         * UIProcess/win/WebPreferencesWin.cpp: Added.
2807         (WebKit::WebPreferences::platformInitializeStore):
2808         (WebKit::WebPreferences::platformUpdateStringValueForKey):
2809         (WebKit::WebPreferences::platformUpdateBoolValueForKey):
2810         (WebKit::WebPreferences::platformUpdateUInt32ValueForKey):
2811         (WebKit::WebPreferences::platformUpdateDoubleValueForKey):
2812         (WebKit::WebPreferences::platformUpdateFloatValueForKey):
2813         (WebKit::WebPreferences::platformGetStringUserValueForKey):
2814         (WebKit::WebPreferences::platformGetBoolUserValueForKey):
2815         (WebKit::WebPreferences::platformGetUInt32UserValueForKey):
2816         (WebKit::WebPreferences::platformGetDoubleUserValueForKey):
2817         * UIProcess/win/WebProcessPoolWin.cpp: Added.
2818         (WebKit::WebProcessPool::platformInitialize):
2819         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2820         (WebKit::WebProcessPool::platformInitializeWebProcess):
2821         (WebKit::WebProcessPool::platformInvalidateContext):
2822         (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory):
2823         (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory):
2824         (WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory):
2825         (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory):
2826         (WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory):
2827         (WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory):
2828         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory):
2829         (WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory):
2830         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
2831         * UIProcess/win/WebView.cpp: Added.
2832         (WebKit::WebView::WebViewWndProc):
2833         (WebKit::WebView::wndProc):
2834         (WebKit::WebView::registerWebViewWindowClass):
2835         (WebKit::WebView::WebView):
2836         (WebKit::WebView::~WebView):
2837         (WebKit::WebView::initialize):
2838         (WebKit::WebView::setParentWindow):
2839         (WebKit::findTopLevelParentWindow):
2840         (WebKit::WebView::windowAncestryDidChange):
2841         (WebKit::WebView::onMouseEvent):
2842         (WebKit::WebView::onWheelEvent):
2843         (WebKit::WebView::onHorizontalScroll):
2844         (WebKit::WebView::onVerticalScroll):
2845         (WebKit::WebView::onKeyEvent):
2846         (WebKit::drawPageBackground):
2847         (WebKit::WebView::paint):
2848         (WebKit::WebView::onPaintEvent):
2849         (WebKit::WebView::onPrintClientEvent):
2850         (WebKit::WebView::onSizeEvent):
2851         (WebKit::WebView::onWindowPositionChangedEvent):
2852         (WebKit::WebView::onSetFocusEvent):
2853         (WebKit::WebView::onKillFocusEvent):
2854         (WebKit::WebView::onTimerEvent):
2855         (WebKit::WebView::onShowWindowEvent):
2856         (WebKit::WebView::onSetCursor):
2857         (WebKit::WebView::updateActiveState):
2858         (WebKit::WebView::updateActiveStateSoon):
2859         (WebKit::initCommonControls):
2860         (WebKit::WebView::initializeToolTipWindow):
2861         (WebKit::WebView::startTrackingMouseLeave):
2862         (WebKit::WebView::stopTrackingMouseLeave):
2863         (WebKit::WebView::shouldInitializeTrackPointHack):
2864         (WebKit::WebView::close):
2865         (WebKit::WebView::cursorToShow const):
2866         (WebKit::WebView::updateNativeCursor):
2867         (WebKit::WebView::setOverrideCursor):
2868         (WebKit::WebView::setIsInWindow):
2869         (WebKit::WebView::setIsVisible):
2870         (WebKit::WebView::isWindowActive):
2871         (WebKit::WebView::isFocused):
2872         (WebKit::WebView::isVisible):
2873         (WebKit::WebView::isInWindow):
2874         (WebKit::WebView::setScrollOffsetOnNextResize):
2875         (WebKit::WebView::setViewNeedsDisplay):
2876         (WebKit::WebView::createColorChooserProxy):
2877         (WebKit::WebView::didCommitLoadForMainFrame):
2878         (WebKit::WebView::customRepresentationZoomFactor):
2879         (WebKit::WebView::setCustomRepresentationZoomFactor):
2880         (WebKit::WebView::findStringInCustomRepresentation):
2881         (WebKit::WebView::countStringMatchesInCustomRepresentation):
2882         (WebKit::WebView::nativeWindow):
2883         (WebKit::WebView::windowReceivedMessage):
2884         * UIProcess/win/WebView.h: Added.
2885         (WebKit::WebView::create):
2886         (WebKit::WebView::window const):
2887         (WebKit::WebView::page const):
2888         (WebKit::WebView::drawingArea):
2889         (WebKit::WebView::setWasActivatedByMouseEvent):
2890
2891 2018-04-24  Fujii Hironori  <Hironori.Fujii@sony.com>
2892
2893         Implement Same-Site cookies
2894         https://bugs.webkit.org/show_bug.cgi?id=159464
2895         <rdar://problem/27196358>
2896
2897         Unreviewed build fix.
2898
2899         WinCairo WebKit2 can't compile since r230921.
2900
2901         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2902         (WebKit::NetworkDataTaskCurl::appendCookieHeader):
2903         CookieJarCurlDatabase::cookieRequestHeaderFieldValue needs
2904         SameSiteInfo.
2905
2906 2018-04-24  Simon Fraser  <simon.fraser@apple.com>
2907
2908         Add a new "color-filter" CSS property as an experimental feature
2909         https://bugs.webkit.org/show_bug.cgi?id=184940
2910
2911         Reviewed by Jon Lee.
2912         
2913         Add the color-filter property as an experimental feature.
2914
2915         * Shared/WebPreferences.yaml:
2916
2917 2018-04-24  Saam Barati  <sbarati@apple.com>
2918
2919         Keep around a pre-warmed process when doing process swap on navigation
2920         https://bugs.webkit.org/show_bug.cgi?id=184765
2921         <rdar://problem/39685099>
2922
2923         Reviewed by Ryosuke Niwa and Brady Eidson.
2924
2925         This patch makes it so that WebProcessPool prewarms a process when process
2926         swap on navigation is turned on. When we do a process swap on navigation,
2927         we first try to grab a prewarmed process before creating a new one.
2928         
2929         We try to be smart about when to create these processes. The initial heuristic
2930         that this patch chooses is when we reach the DidFirstVisuallyNonEmptyLayout
2931         layout milestone. We're going to try to improve on this heuristic in:
2932         https://bugs.webkit.org/show_bug.cgi?id=184899
2933         
2934         This is a 40% progression on PLT with process swap on navigation turned on.
2935
2936         * UIProcess/API/Cocoa/WKProcessPool.mm:
2937         (-[WKProcessPool _prewarmedWebProcessCount]):
2938         (-[WKProcessPool _webProcessCountIgnoringPrewarmed]):
2939         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2940         * UIProcess/ServiceWorkerProcessProxy.cpp:
2941         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
2942         * UIProcess/WebPageProxy.cpp:
2943         (WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
2944         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
2945         * UIProcess/WebPageProxy.h:
2946         * UIProcess/WebProcessPool.cpp:
2947         (WebKit::WebProcessPool::createNewWebProcess):
2948         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
2949         (WebKit::WebProcessPool::warmInitialProcess):
2950         (WebKit::WebProcessPool::disconnectProcess):
2951         (WebKit::WebProcessPool::createWebPage):
2952         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
2953         (WebKit::WebProcessPool::processForNavigation):
2954         * UIProcess/WebProcessPool.h:
2955         * UIProcess/WebProcessProxy.cpp:
2956         (WebKit::WebProcessProxy::create):
2957         (WebKit::WebProcessProxy::WebProcessProxy):
2958         (WebKit::m_isInPrewarmedPool):
2959         (WebKit::m_userMediaCaptureManagerProxy): Deleted.
2960         * UIProcess/WebProcessProxy.h:
2961         (WebKit::WebProcessProxy::isInPrewarmedPool const):
2962         (WebKit::WebProcessProxy::setIsInPrewarmedPool):
2963
2964 2018-04-24  Commit Queue  <commit-queue@webkit.org>
2965
2966         Unreviewed, rolling out r230971.
2967         https://bugs.webkit.org/show_bug.cgi?id=184939
2968
2969         This fix was not appropriate (Requested by n_wang on #webkit).
2970
2971         Reverted changeset:
2972
2973         "AX: soft link libAccessibility.dylb"
2974         https://bugs.webkit.org/show_bug.cgi?id=184919
2975         https://trac.webkit.org/changeset/230971
2976
2977 2018-04-24  Nan Wang  <n_wang@apple.com>
2978
2979         AX: soft link libAccessibility.dylb
2980         https://bugs.webkit.org/show_bug.cgi?id=184919
2981
2982         Reviewed by Chris Fleizach.
2983
2984         Make sure we soft link the library so that it won't crash
2985         if it's missing in the system.
2986
2987         * Configurations/WebKit.xcconfig:
2988         * UIProcess/API/Cocoa/WKWebView.mm:
2989         (-[WKWebView _initializeWithConfiguration:]):
2990         (-[WKWebView _updateAccessibilityEventsEnabled]):
2991
2992 2018-04-24  John Wilander  <wilander@apple.com>
2993
2994         From-Origin: Support for 'same' and 'same-site' response header, nested frame origin check
2995         https://bugs.webkit.org/show_bug.cgi?id=184560
2996         <rdar://problem/38901344>
2997
2998         Reviewed by Youenn Fablet and Daniel Bates.
2999
3000         This patch implements significant parts of https://github.com/whatwg/fetch/issues/687.
3001         We consume the From-Origin response header and only load the resource if:
3002         - The header is non-existent, empty, or invalid.
3003         - The header specifies 'same' and the resource's origin matches the originating
3004           document's origin and the origins up the frame tree.
3005         - The header specifies 'same-site' and the resource's eTLD+1 matches the originating
3006           document's eTLD+1 and the eTLD+1 of the documents up the frame tree.
3007
3008         This feature is experimental and off by default.
3009
3010         * NetworkProcess/NetworkResourceLoadParameters.cpp:
3011         (WebKit::NetworkResourceLoadParameters::encode const):
3012         (WebKit::NetworkResourceLoadParameters::decode):
3013             Support for the two new load parameters:
3014             - shouldEnableFromOriginResponseHeader
3015             - frameAncestorOrigins
3016         * NetworkProcess/NetworkResourceLoadParameters.h:
3017         * NetworkProcess/NetworkResourceLoader.cpp:
3018         (WebKit::areFrameAncestorsSameSite):
3019         (WebKit::areFrameAncestorsSameOrigin):
3020         (WebKit::shouldCancelCrossOriginLoad):
3021             The three functions above implement the new blocking logic.
3022         (WebKit::fromOriginResourceError):
3023             Convenience function that returns an error with the From-Origin error message.
3024         (WebKit::NetworkResourceLoader::didReceiveResponse):
3025             Now checks for a From-Origin response header.
3026         (WebKit::NetworkResourceLoader::didFailLoading):
3027             Now checks for a From-Origin response header.
3028         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
3029             Now checks for a From-Origin response header.
3030         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
3031             Now checks for a From-Origin response header.
3032         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
3033             Now checks for a From-Origin response header.
3034         * Shared/WebCoreArgumentCoders.cpp:
3035         (IPC::ArgumentCoder<Vector<RefPtr<SecurityOrigin>>>::encode):
3036         (IPC::ArgumentCoder<Vector<RefPtr<SecurityOrigin>>>::decode):
3037             Now encodes and decodes vectors of RefPtr<WebCore::SecurityOrigin>.
3038         * Shared/WebCoreArgumentCoders.h:
3039         * Shared/WebPreferences.yaml:
3040             Added From-Origin support as an experimental feature.
3041         * UIProcess/API/C/WKPreferences.cpp:
3042         (WKPreferencesSetFromOriginResponseHeaderEnabled):
3043         (WKPreferencesGetFromOriginResponseHeaderEnabled):
3044         * UIProcess/API/C/WKPreferencesRef.h:
3045         * WebProcess/Network/WebLoaderStrategy.cpp:
3046         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
3047             Sets the two new load parameters:
3048             - shouldEnableFromOriginResponseHeader
3049             - frameAncestorOrigins
3050
3051 2018-04-24  Jer Noble  <jer.noble@apple.com>
3052
3053         Don't add system framework paths to FRAMEWORK_SEARCH_PATHS
3054         https://bugs.webkit.org/show_bug.cgi?id=184786
3055
3056         Reviewed by Tim Horton.
3057
3058         * Configurations/BaseTarget.xcconfig:
3059         * DerivedSources.make:
3060
3061 2018-04-24  Ryan Haddad  <ryanhaddad@apple.com>
3062
3063         Unreviewed, rolling out r230938.
3064
3065         Introduced two ProcessSwap API test failures.
3066
3067         Reverted changeset:
3068
3069         "Keep around a pre-warmed process when doing process swap on
3070         navigation"
3071         https://bugs.webkit.org/show_bug.cgi?id=184765
3072         https://trac.webkit.org/changeset/230938
3073
3074 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
3075
3076         [CoordGraphics] Remove dead fixed layer code
3077         https://bugs.webkit.org/show_bug.cgi?id=184912
3078
3079         Reviewed by Michael Catanzaro.
3080
3081         Drop the unused fixed layer handling  code in CoordinatedGraphicsScene.
3082         The m_fixedLayers container can be removed, along with the
3083         adjustPositionForFixedLayers() method that operated on that container.
3084
3085         This was the only method that operated with the m_scrollPosition member
3086         variable and the contentsPosition argument that's passed to the
3087         CoordinatedGraphicsScene::paintToCurrentGLContext() method. Both of
3088         these are removed, along with the scrollPosition attribute on the
3089         CoordinatedGraphicsState struct.
3090
3091         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3092         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
3093         (WebKit::CoordinatedGraphicsScene::setLayerState):
3094         (WebKit::CoordinatedGraphicsScene::deleteLayer):
3095         (WebKit::CoordinatedGraphicsScene::commitSceneState):
3096         (WebKit::CoordinatedGraphicsScene::purgeGLResources):
3097         (WebKit::CoordinatedGraphicsScene::adjustPositionForFixedLayers): Deleted.
3098         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
3099         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3100         (WebKit::ThreadedCompositor::renderLayerTree):
3101         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
3102         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
3103
3104 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
3105
3106         REGRESSION(r230950): Faulty commit sequencing in CoordinatedGraphicsScene
3107         https://bugs.webkit.org/show_bug.cgi?id=184917
3108
3109         Reviewed by Michael Catanzaro.
3110
3111         After r230950, current animation state for a given layer is also taken
3112         into account when determining whether or not the layer requires a
3113         backing store. For that to work properly, all the animation state has
3114         to be updated before the backing store work. This patch changes the
3115         order of helper method invocations in
3116         CoordinatedGraphicsScene::setLayerState() to address that.
3117
3118         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3119         (WebKit::CoordinatedGraphicsScene::setLayerState):
3120
3121 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
3122
3123         [CoordGraphics] Remove unused fixed layout functionality
3124         https://bugs.webkit.org/show_bug.cgi?id=184908
3125
3126         Reviewed by Carlos Garcia Campos.
3127
3128         Ports using the CoordinatedGraphics subsystem don't expose fixed layout
3129         support. As such, we're able to remove a lot of unused code and
3130         unnecessary USE(COORDINATED_GRAPHICS) special cases in generic sections
3131         in both WebCore and WebKit.
3132
3133         Remove USE(COORDINATED_GRAPHICS) special-casing from the
3134         WebPage::setUseFixedLayout() method. This is not possible to enable for
3135         the GTK+ and WPE ports that use the CoordinatedGraphics subsytem via
3136         API. Removing all this unlocks removing considerable amounts of dead
3137         code and complexities in CoordinatedGraphics.
3138
3139         WebChromeClient::delegatedScrollRequested() method is removed, along
3140         with the WebPage::pageDidRequestScroll() method that was only called
3141         from there.
3142
3143         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3144         (WebKit::WebChromeClient::delegatedScrollRequested): Deleted.
3145         * WebProcess/WebCoreSupport/WebChromeClient.h:
3146         * WebProcess/WebPage/WebPage.cpp:
3147         (WebKit::WebPage::setUseFixedLayout):
3148         (WebKit::WebPage::pageDidRequestScroll): Deleted.
3149         * WebProcess/WebPage/WebPage.h:
3150
3151 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
3152
3153         [CoordGraphics] Avoid painting backing stores for zero-opacity layers
3154         https://bugs.webkit.org/show_bug.cgi?id=184143
3155
3156         Reviewed by Carlos Garcia Campos.
3157
3158         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3159         (WebKit::layerShouldHaveBackingStore):
3160         Mirror CoordinatedGraphicsLayer's backing store requirements.
3161
3162 2018-04-23  Daniel Bates  <dabates@apple.com>
3163
3164         Implement Same-Site cookies
3165         https://bugs.webkit.org/show_bug.cgi?id=159464
3166         <rdar://problem/27196358>
3167
3168         Reviewed by Brent Fulgham.
3169
3170         Pass the Same-Site info through the WebKit abstractions.
3171
3172         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3173         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
3174         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
3175         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
3176         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
3177         * NetworkProcess/NetworkConnectionToWebProcess.h:
3178         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3179         * NetworkProcess/NetworkResourceLoader.cpp:
3180         (WebKit::NetworkResourceLoader::logCookieInformation const):
3181         (WebKit::logBlockedCookieInformation):
3182         (logCookieInformationInternal):
3183         (NetworkResourceLoader::logCookieInformation):
3184         * NetworkProcess/NetworkResourceLoader.h:
3185         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
3186         (WebKit::NetworkCache::constructRevalidationRequest):
3187         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
3188         (WebKit::NetworkCache::SubresourceInfo::encode const):
3189         (WebKit::NetworkCache::SubresourceInfo::decode):
3190         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
3191         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
3192         (WebKit::NetworkCache::SubresourceInfo::isSameSite const):
3193         (WebKit::NetworkCache::SubresourceInfo::isTopSite const): Returns false; subresources do not represent
3194         a top-level navigation.
3195         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3196         (WebKit::NetworkDataTaskCocoa::isThirdPartyRequest):
3197         (WebKit::updateTaskWithFirstPartyForSameSiteCookies):
3198         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
3199         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
3200         * UIProcess/WebProcessPool.cpp:
3201         (WebKit::WebProcessPool::download):
3202         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3203         (WebKit::WebPlatformStrategies::cookiesForDOM):
3204         (WebKit::WebPlatformStrategies::setCookiesFromDOM):
3205         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
3206         (WebKit::WebPlatformStrategies::getRawCookies):
3207         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
3208
3209 2018-04-23  Youenn Fablet  <youenn@apple.com>
3210
3211         Make WebLoaderStrategy send to NetworkResourceLoader necessary parameters to handle full loads in NetworkProcess
3212         https://bugs.webkit.org/show_bug.cgi?id=184763
3213
3214         Reviewed by Chris Dumez.
3215
3216         Set all required NetworkResourceLoadParameters for asynchronous loads.
3217         This includes preflight policy, CSP response headers, SecurityOrigin and content blockers identifier.
3218
3219         Update NetworkLoadChecker to handle preflight policy.
3220         This is not needed right now since sync XHR and ping loads are using the default ConsiderPreflight policy.
3221         But this will be needed for XHR/fetch/EventSource loads. 
3222
3223         * NetworkProcess/NetworkLoadChecker.cpp:
3224         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
3225         (WebKit::NetworkLoadChecker::checkRedirection):
3226         (WebKit::NetworkLoadChecker::validateResponse):
3227         (WebKit::NetworkLoadChecker::checkCORSRequest):
3228         * NetworkProcess/NetworkLoadChecker.h:
3229         (WebKit::NetworkLoadChecker::create):
3230         * NetworkProcess/NetworkResourceLoadParameters.cpp:
3231         (WebKit::NetworkResourceLoadParameters::encode const):
3232         (WebKit::NetworkResourceLoadParameters::decode):
3233         * NetworkProcess/NetworkResourceLoadParameters.h:
3234         * NetworkProcess/NetworkResourceLoader.cpp:
3235         * NetworkProcess/PingLoad.cpp:
3236         (WebKit::PingLoad::PingLoad):
3237         * WebProcess/Network/WebLoaderStrategy.cpp:
3238         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
3239
3240 2018-04-23  Wenson Hsieh  <wenson_hsieh@apple.com>
3241
3242         [Extra zoom mode] REGRESSION(230860) Unable to change time input values using UI
3243         https://bugs.webkit.org/show_bug.cgi?id=184901
3244         <rdar://problem/39664797>
3245
3246         Reviewed by Tim Horton.
3247
3248         Fixes the bug by falling back to setting the value of the focused input element in the case where the selection
3249         is not editable. Also adds plumbing to make time pickers testable in extra zoom mode.
3250
3251         * UIProcess/API/Cocoa/WKWebView.mm:
3252         (-[WKWebView setTimePickerValueToHour:minute:]):
3253         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3254         * UIProcess/ios/WKContentViewInteraction.h:
3255         * UIProcess/ios/WKContentViewInteraction.mm:
3256         (-[WKContentView setTimePickerValueToHour:minute:]):
3257
3258         Add plumbing to make it possible for WebKitTestRunner to simulate picking a time from the given hours and
3259         minutes. This is currently only implemented for extra zoom mode, but may be implemented for UIKit's time picker
3260         as well in the future by adjusting -[WKContentView setTimePickerValueToHour:minute:].
3261
3262         * WebProcess/WebPage/WebPage.cpp:
3263         (WebKit::WebPage::setTextAsync):
3264
3265 2018-04-23  Saam Barati  <sbarati@apple.com>
3266
3267         Keep around a pre-warmed process when doing process swap on navigation
3268         https://bugs.webkit.org/show_bug.cgi?id=184765
3269
3270         Reviewed by Ryosuke Niwa.
3271
3272         This patch makes it so that WebProcessPool prewarms a process when process
3273         swap on navigation is turned on. When we do a process swap on navigation,
3274         we first try to grab a prewarmed process before creating a new one.
3275         
3276         We try to be smart about when to create these processes. The initial heuristic
3277         that this patch chooses is when we reach the DidFirstVisuallyNonEmptyLayout
3278         layout milestone. We're going to try to improve on this heuristic in:
3279         https://bugs.webkit.org/show_bug.cgi?id=184899
3280         
3281         This is a 40% progression on PLT with process swap on navigation turned on.
3282
3283         * UIProcess/ServiceWorkerProcessProxy.cpp:
3284         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
3285         * UIProcess/WebPageProxy.cpp:
3286         (WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
3287         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
3288         * UIProcess/WebPageProxy.h:
3289         * UIProcess/WebProcessPool.cpp:
3290         (WebKit::WebProcessPool::createNewWebProcess):
3291         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
3292         (WebKit::WebProcessPool::warmInitialProcess):
3293         (WebKit::WebProcessPool::disconnectProcess):
3294         (WebKit::WebProcessPool::createWebPage):
3295         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
3296         (WebKit::WebProcessPool::processForNavigation):
3297         * UIProcess/WebProcessPool.h:
3298         * UIProcess/WebProcessProxy.cpp:
3299         (WebKit::WebProcessProxy::create):
3300         (WebKit::WebProcessProxy::WebProcessProxy):
3301         (WebKit::m_isInPrewarmedPool):
3302         (WebKit::m_userMediaCaptureManagerProxy): Deleted.
3303         * UIProcess/WebProcessProxy.h:
3304         (WebKit::WebProcessProxy::isInPrewarmedPool const):
3305         (WebKit::WebProcessProxy::setIsInPrewarmedPool):
3306
3307 2018-04-23  Michael Catanzaro  <mcatanzaro@igalia.com>
3308
3309         [WPE][GTK] Remove WlUniquePtr<wl_display> footgun
3310         https://bugs.webkit.org/show_bug.cgi?id=184405
3311
3312         Reviewed by Carlos Garcia Campos.
3313
3314         Switch to std::unique_ptr.
3315
3316         * UIProcess/gtk/WaylandCompositor.cpp:
3317         (WebKit::WaylandCompositor::WaylandCompositor):
3318         * UIProcess/gtk/WaylandCompositor.h:
3319         (WebKit::WaylandCompositor::DisplayDeleter::operator()):
3320
3321 2018-04-23  Daniel Bates  <dabates@apple.com>
3322
3323         Attempt to fix the Apple Internal build following r230921
3324         (https://bugs.webkit.org/show_bug.cgi?id=159464)
3325
3326         Forward declare some SPI. Add availability guard.
3327
3328         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3329
3330 2018-04-23  Zalan Bujtas  <zalan@apple.com>
3331
3332         [LayoutFormattingContext] Initial commit.
3333         https://bugs.webkit.org/show_bug.cgi?id=184896
3334
3335         Reviewed by Antti Koivisto.
3336
3337         * Configurations/FeatureDefines.xcconfig:
3338
3339 2018-04-23  Daniel Bates  <dabates@apple.com>
3340
3341         Implement Same-Site cookies
3342         https://bugs.webkit.org/show_bug.cgi?id=159464
3343         <rdar://problem/27196358>
3344
3345         Reviewed by Brent Fulgham.
3346
3347         Pass the Same-Site info through the WebKit abstractions.
3348
3349         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3350         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
3351         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
3352         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
3353         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
3354         * NetworkProcess/NetworkConnectionToWebProcess.h:
3355         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3356         * NetworkProcess/NetworkResourceLoader.cpp:
3357         (WebKit::NetworkResourceLoader::logCookieInformation const):
3358         (WebKit::logBlockedCookieInformation):
3359         (logCookieInformationInternal):
3360         (NetworkResourceLoader::logCookieInformation):
3361         * NetworkProcess/NetworkResourceLoader.h:
3362         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
3363         (WebKit::NetworkCache::constructRevalidationRequest):
3364         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
3365         (WebKit::NetworkCache::SubresourceInfo::encode const):
3366         (WebKit::NetworkCache::SubresourceInfo::decode):
3367         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
3368         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
3369         (WebKit::NetworkCache::SubresourceInfo::isSameSite const):
3370         (WebKit::NetworkCache::SubresourceInfo::isTopSite const): Returns false; subresources do not represent
3371         a top-level navigation.
3372         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3373         (WebKit::NetworkDataTaskCocoa::isThirdPartyRequest):
3374         (WebKit::updateTaskWithFirstPartyForSameSiteCookies):
3375         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
3376         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
3377         * UIProcess/WebProcessPool.cpp:
3378         (WebKit::WebProcessPool::download):
3379         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3380         (WebKit::WebPlatformStrategies::cookiesForDOM):
3381         (WebKit::WebPlatformStrategies::setCookiesFromDOM):
3382         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
3383         (WebKit::WebPlatformStrategies::getRawCookies):
3384         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
3385
3386 2018-04-23  Chris Dumez  <cdumez@apple.com>
3387
3388         WebProcessProxy frequently re-takes a process assertion for the network process even though is already has one
3389         https://bugs.webkit.org/show_bug.cgi?id=184889
3390         <rdar://problem/38151530>
3391
3392         Reviewed by Brady Eidson.
3393
3394         In ProcessThrottler::updateAssertionNow(), if the new process assertion state is the same
3395         as the existing one, then return early. Otherwise, we would end up calling WebProcessProxy::didSetAssertionState()
3396         for the same assertion state, which would cause duplicate logging but also some unnecessary work.
3397
3398         * UIProcess/ProcessThrottler.cpp:
3399         (WebKit::ProcessThrottler::updateAssertionNow):
3400
3401 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
3402
3403         [CoordGraphics] Remove unused trajectory cruft in CoordinatedLayerTreeHost, CoordinatedGraphicsLayer
3404         https://bugs.webkit.org/show_bug.cgi?id=184881
3405
3406         Reviewed by Michael Catanzaro.
3407
3408         The CompositingCoordinator::setVisibleContentsRect() method is always
3409         called with a (0,0) FloatPoint value as the trajectory vector parameter,
3410         which is already the default value in TiledBackingStore where this ends
3411         up. Removing this call chain also enables removing some unnecessary and
3412         odd code in the CoordinatedGraphicsLayer class.
3413
3414         This doesn't yet touch the trajectory logic in the TiledBackingStore
3415         class since it's not yet a given this won't be used in the future. But
3416         if that will be necessary, hope is to not use it this way.
3417
3418         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
3419         (WebKit::CompositingCoordinator::setVisibleContentsRect):
3420         (WebKit::CompositingCoordinator::mainContentsLayer): Deleted.
3421         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
3422         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
3423         (WebKit::CoordinatedLayerTreeHost::setVisibleContentsRect):
3424         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
3425         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
3426         (WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewport):
3427
3428 2018-04-23  Fujii Hironori  <Hironori.Fujii@sony.com>
3429
3430         [Win][WK2] REGRESSION(r230834) 'getpid': identifier not found
3431         https://bugs.webkit.org/show_bug.cgi?id=184877
3432
3433         Reviewed by Yusuke Suzuki.
3434
3435         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
3436         (WebKit::WebBackForwardListProxy::addItem): Use WTF::getCurrentProcessID() instead of getpid().
3437         * WebProcess/WebPage/WebPage.cpp:
3438         (WebKit::WebPage::goToBackForwardItem): Ditto.
3439
3440 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
3441
3442         [TexMap] Drop RefCounted inheritance off of TextureMapperBackingStore
3443         https://bugs.webkit.org/show_bug.cgi?id=184810
3444
3445         Reviewed by Carlos Garcia Campos.
3446
3447         CoordinatedBackingStore should inherit directly from RefCounted<> now
3448         that TextureMapperBackingStore doesn't anymore.
3449
3450         * Shared/CoordinatedGraphics/CoordinatedBackingStore.h:
3451         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3452         (WebKit::CoordinatedGraphicsScene::createBackingStoreIfNeeded):
3453
3454 2018-04-22  Zan Dobersek  <zdobersek@igalia.com>
3455
3456         [CoordinatedGraphics] Unused contentsSize, coveredRect attributes in CoordinatedGraphicsState
3457         https://bugs.webkit.org/show_bug.cgi?id=184811
3458
3459         Reviewed by Carlos Garcia Campos.
3460
3461         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
3462         (WebKit::CompositingCoordinator::flushPendingLayerChanges): Stop setting
3463         the removed contentsSize and coveredRect attributes. These were only
3464         ever set to the appropriate values, but were then never used anywhere.
3465
3466 2018-04-22  Matt Baker  <mattbaker@apple.com>
3467
3468         Web Inspector: WebInspectorProxy releases WKWebInspectorProxyObjCAdapter without removing corresponding observer
3469         https://bugs.webkit.org/show_bug.cgi?id=184865
3470         <rdar://problem/37764960>
3471
3472         Reviewed by Brian Burg.
3473
3474         Replace the early return removed in https://bugs.webkit.org/show_bug.cgi?id=177661,
3475         so that WKWebInspectorProxyObjCAdapter and the view controller can be reused
3476         when reopening the Inspector while the WebView is still alive.
3477
3478         * UIProcess/mac/WebInspectorProxyMac.mm:
3479         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
3480
3481 2018-04-22  Paul Knight  <pknight@apple.com>
3482
3483         Add -[WKInputDelegate _webView:decidePolicyForFocusedElement:] so clients can request default focusing behavior
3484         https://bugs.webkit.org/show_bug.cgi?id=184844
3485
3486         Reviewed by Dan Bernstein.
3487
3488         If a client doesn't implement -[_WKInputDelegate _webView:focusShouldStartInputSession:] the default
3489         focus behavior only brings up the keyboard if it's already onscreen, the interaction is user driven,
3490         and other factors that even depend on what feature flags are enabled.
3491
3492         If a client implements _webView:focusShouldStartInputSession:, they don't have a good way to specifiy
3493         they'd like to fall back to the default behavior. This makes it difficult for a client to use the
3494         default in most cases, but sometimes allow programmatic focus from the page, for example.
3495
3496         Add a new delegate method -_webView:decidePolicyForFocusedElement: that returns a new enum type
3497         _WKFocusStartsInputSessionPolicy. Clients can return _WKFocusStartsInputSessionPolicyAuto to request
3498         the default behavior, or _WKFocusStartsInputSessionPolicyAllow / Disallow to directly control whether
3499         the keyboard appears to assist the focused node.
3500
3501         * UIProcess/API/Cocoa/_WKInputDelegate.h:
3502         * UIProcess/ios/WKContentViewInteraction.mm:
3503         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3504
3505 2018-04-21  Jeremy Jones  <jeremyj@apple.com>
3506
3507         Disable backward and forward navigation swipes while in fullscreen.
3508         https://bugs.webkit.org/show_bug.cgi?id=184656
3509         rdar://problem/36057535
3510
3511         Reviewed by Tim Horton.
3512
3513         Disable navigation swipes while in fullscreen.
3514
3515         * UIProcess/Cocoa/ViewGestureController.cpp:
3516         (WebKit::ViewGestureController::canSwipeInDirection const):
3517
3518 2018-04-21  Youenn Fablet  <youenn@apple.com>
3519
3520         Activate NetworkLoadChecker for media loads
3521         https://bugs.webkit.org/show_bug.cgi?id=184841
3522
3523         Reviewed by Eric Carlson.
3524
3525         Instantiate a NetworkLoadChecker for NetworkResourceLoader for audio/video loads.
3526
3527         Move CORS checks for response after handling of 304 checks.
3528         For 304 checks, we need to do the CORS checks on the validated cached response, not the 304 received response.
3529
3530         Updated ResourceError argument coder to explicitly pass the error type
3531         as some errors created by NetworkLoadChecker would otherwise be received as General errors by WebProcess.
3532         Updated platform data encoding of ResourceError accordingly.
3533
3534         All changes are covered by regular media loading layout tests.
3535
3536         * NetworkProcess/NetworkResourceLoader.cpp:
3537         (WebKit::shouldUseNetworkLoadChecker):
3538         (WebKit::NetworkResourceLoader::didReceiveResponse):
3539         * Shared/WebCoreArgumentCoders.cpp:
3540         (IPC::ArgumentCoder<ResourceError>::encode):
3541         (IPC::ArgumentCoder<ResourceError>::decode):
3542         * Shared/mac/WebCoreArgumentCodersMac.mm:
3543         (IPC::ArgumentCoder<ResourceError>::encodePlatformData):
3544         (IPC::ArgumentCoder<ResourceError>::decodePlatformData):
3545         We need to set the type after decoding the NSError as ResourceError tries to guess the type from NSError data.
3546         * Shared/soup/WebCoreArgumentCodersSoup.cpp:
3547         (IPC::ArgumentCoder<ResourceError>::encodePlatformData):
3548         (IPC::ArgumentCoder<ResourceError>::decodePlatformData):
3549
3550 2018-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3551
3552         [SOUP] Do TLS error checking on GTlsConnection::accept-certificate
3553         https://bugs.webkit.org/show_bug.cgi?id=184480
3554
3555         Reviewed by Michael Catanzaro.
3556
3557         Connect to GTlsConnection::accept-certificate signal instead of SoupMessage::notify::tls-errors to perform the
3558         TLS errors check.
3559
3560         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
3561         (WebKit::NetworkDataTaskSoup::createRequest): Do not connect to SoupMessage::notify::tls-errors.
3562         (WebKit::NetworkDataTaskSoup::tlsConnectionAcceptCertificateCallback): Call tlsConnectionAcceptCertificate() is
3563         the task is still ongoing.
3564         (WebKit::NetworkDataTaskSoup::tlsConnectionAcceptCertificate): Check TLS errors here.
3565         (WebKit::NetworkDataTaskSoup::networkEventCallback): Pass the stream to networkEvent.
3566         (WebKit::NetworkDataTaskSoup::networkEvent): Connect to GTlsConnection::accept-certificate.
3567         * NetworkProcess/soup/NetworkDataTaskSoup.h:
3568
3569 2018-04-20  Timothy Hatcher  <timothy@apple.com>
3570
3571         NULL dereference crash sometimes under [super initWithCoder:] in WebView
3572
3573         https://bugs.webkit.org/show_bug.cgi?id=184851
3574         rdar://problem/39611236
3575
3576         Reviewed by Tim Horton.
3577
3578         * UIProcess/API/Cocoa/WKWebView.mm:
3579         (-[WKWebView _initializeWithConfiguration:]):
3580         (-[WKWebView effectiveAppearanceDidChange]):
3581         Added a null check and call the code later in initialization.
3582
3583 2018-04-20  Tim Horton  <timothy_horton@apple.com>
3584
3585         Adjust geolocation feature flag
3586         https://bugs.webkit.org/show_bug.cgi?id=184856
3587
3588         Reviewed by Wenson Hsieh.
3589
3590         * Configurations/FeatureDefines.xcconfig:
3591
3592 2018-04-20  Chris Dumez  <cdumez@apple.com>
3593
3594         Unreviewed attempt to fix GTK build after r230867.
3595
3596         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
3597         (webkit_dom_dom_window_get_self):
3598         (webkit_dom_dom_window_get_window):
3599         (webkit_dom_dom_window_get_frames):
3600         (webkit_dom_dom_window_get_opener):
3601         (webkit_dom_dom_window_get_parent):
3602         (webkit_dom_dom_window_get_top):
3603
3604 2018-04-20  Commit Queue  <commit-queue@webkit.org>
3605
3606         Unreviewed, rolling out r230873.
3607         https://bugs.webkit.org/show_bug.cgi?id=184857
3608
3609         Broke the iOS build (Requested by cdumez on #webkit).
3610
3611         Reverted changeset:
3612
3613         "Disable backward and forward navigation swipes while in
3614         fullscreen."
3615         https://bugs.webkit.org/show_bug.cgi?id=184656
3616         https://trac.webkit.org/changeset/230873
3617
3618 2018-04-20  Chris Dumez  <cdumez@apple.com>
3619
3620         REGRESSION (r229828): web view doesn’t update or respond to resizing until client calls policy decision handler
3621         https://bugs.webkit.org/show_bug.cgi?id=184210
3622         <rdar://problem/39072354>
3623
3624         Reviewed by Wenson Hsieh.
3625
3626         r229828 tried to have some API tests happy on iOS by freezing the layer tree
3627         during the navigation policy decision. However, this is observable by the client
3628         application and a regression from when the policy delegate was synchronous.
3629
3630         To address the issue, this patch reverts r229828 and instead updates the iOS
3631         API tests to wait for the next presentation update after navigating
3632         before interacting with the view.
3633
3634         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3635         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
3636         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3637         (WebKit::WebFrameLoaderClient::cancelPolicyCheck):
3638         (WebKit::WebFrameLoaderClient::provisionalLoadStarted):
3639         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3640         * WebProcess/WebPage/WebPage.cpp:
3641         * WebProcess/WebPage/WebPage.h:
3642
3643 2018-04-20  Brent Fulgham  <bfulgham@apple.com>
3644
3645         Limit cookie header access to Network process
3646         https://bugs.webkit.org/show_bug.cgi?id=184764
3647         <rdar://problem/36785285>
3648
3649         Reviewed by Youenn Fablet.
3650
3651         Revise the handling of cookie request headers so that we don't interact with them in the
3652         WebContent process. They are only needed for interaction with the server and the network
3653         process, so we should limit their scope to just the Network process.
3654
3655         Instead, we should handle a token that represents the cookie headers in the WebContent
3656         process, which can be converted to the relevant cookie data in the network process when
3657         needed.
3658
3659         * NetworkProcess/NetworkSocketStream.cpp:
3660         (WebKit::NetworkSocketStream::sendHandshake):
3661         * NetworkProcess/NetworkSocketStream.h:
3662         * NetworkProcess/NetworkSocketStream.messages.in:
3663         * WebProcess/Network/WebSocketStream.cpp:
3664         (WebKit::WebSocketStream::networkProcessCrashed):
3665         (WebKit::WebSocketStream::platformSendHandshake):
3666         (WebKit::WebSocketStream::didSendHandshake):
3667         * WebProcess/Network/WebSocketStream.h:
3668         * WebProcess/Network/WebSocketStream.messages.in:
3669
3670 2018-04-20  Jeremy Jones  <jeremyj@apple.com>
3671
3672         Disable backward and forward navigation swipes while in fullscreen.
3673         https://bugs.webkit.org/show_bug.cgi?id=184656
3674         rdar://problem/36057535
3675
3676         Reviewed by Tim Horton.
3677
3678         Disable navigation swipes while in fullscreen.
3679
3680         * UIProcess/Cocoa/ViewGestureController.cpp:
3681         (WebKit::ViewGestureController::canSwipeInDirection const):
3682
3683 2018-04-20  Jeremy Jones  <jeremyj@apple.com>
3684
3685         Element fullscreen, expose WKWebView _fullScreenPlaceholderView as iOS SPI
3686         https://bugs.webkit.org/show_bug.cgi?id=184826
3687         rdar://problem/39600825
3688
3689         Reviewed by Tim Horton.
3690
3691         Add _fullScreenPlaceholderView for iOS similar to the one for Mac.
3692
3693         * UIProcess/API/Cocoa/WKWebView.mm:
3694         (-[WKWebView _fullScreenPlaceholderView]):
3695         (-[WKWebView closeFullScreenWindowController]):
3696         (-[WKWebView fullScreenPlaceholderView]): Deleted.
3697         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3698         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3699         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.h:
3700         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
3701         (-[WKFullScreenWindowController webViewPlaceholder]):
3702
3703 2018-04-20  Wenson Hsieh  <wenson_hsieh@apple.com>
3704
3705         [Extra zoom mode] Injected bundle form client should be notified when editing text fields
3706         https://bugs.webkit.org/show_bug.cgi?id=184822
3707         <rdar://problem/38807319>
3708
3709         Reviewed by Tim Horton.
3710
3711         Fixes the bug by making a couple of tweaks: (1) don't use a separate codepath for inserting text in text inputs,
3712         and (2) force a user typing gesture when inserting text using this codepath (i.e. WKTextInputListViewController).
3713         Also adds plumbing to enable testing text entry with WKTextInputListViewController in extra zoom mode.
3714
3715         * UIProcess/API/Cocoa/WKWebView.mm:
3716         (-[WKWebView _simulateTextEntered:]):
3717         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3718
3719         Introduce testing SPI to simulate text entry. Additionally, add a missing availability annotation around testing
3720         SPI added in 2017 to help test drag and drop for iOS 11.
3721
3722         * UIProcess/ios/WKContentViewInteraction.h:
3723         * UIProcess/ios/WKContentViewInteraction.mm:
3724         (-[WKContentView _simulateTextEntered:]):
3725         * WebProcess/WebPage/WebPage.cpp:
3726         (WebKit::WebPage::setTextAsync):
3727
3728 2018-04-20  Jeremy Jones  <jeremyj@apple.com>
3729
3730         EnterFullscreen must update the minimum and maximum layout sizes.
3731         https://bugs.webkit.org/show_bug.cgi?id=184828
3732         rdar://problem/38435829
3733
3734         Reviewed by Jon Lee.
3735
3736         Without this, the WKWebView won't layout to the full size in fullscreen mode.
3737
3738         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
3739         (-[WKFullScreenWindowController enterFullScreen]):
3740
3741 2018-04-18  Jer Noble  <jer.noble@apple.com>
3742
3743         Don't put build products into WK_ALTERNATE_WEBKIT_SDK_PATH for engineering builds
3744         https://bugs.webkit.org/show_bug.cgi?id=184762
3745
3746         Reviewed by Dan Bernstein.
3747
3748         * Configurations/BaseTarget.xcconfig:
3749
3750 2018-04-20  Youenn Fablet  <youenn@apple.com>
3751
3752         Refactor NetworkResourceLoader to check for m_networkLoadChecker presence before using it
3753         https://bugs.webkit.org/show_bug.cgi?id=184755
3754
3755         Reviewed by Chris Dumez.
3756
3757         Make NetworkResourceLoader always use m_networkLoadChecker if there is one.
3758         This is only used now for synchronous loads but will be used in the future for asynchronous loads as well.
3759
3760         Since we call didFail asynchronously to make sync/async handling more consistent,
3761         We need to keep track of whether we will do clean-up twice.
3762         A boolean is added for that purpose in NetworkResourceLoader.
3763
3764         There is a small change of behavior in the way we return an error.
3765         Instead of returning a platformBadResponseError, we are now returning the error as computed by NetworkLoadChecker.
3766         This allows getting some more error logging in the JS console.
3767
3768         * NetworkProcess/NetworkResourceLoader.cpp:
3769         (WebKit::NetworkResourceLoader::didReceiveResponse):
3770         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
3771         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
3772         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
3773         * NetworkProcess/NetworkResourceLoader.h:
3774
3775 2018-04-20  Timothy Hatcher  <timothy@apple.com>
3776
3777         Include missing files in WKContentViewInteraction.{mm,h}
3778
3779         https://bugs.webkit.org/show_bug.cgi?id=184832
3780         rdar://problem/35377120
3781
3782         Reviewed by Wenson Hsieh.
3783
3784         Some WebDriver files were missing and should be included.
3785
3786         * UIProcess/ios/WKContentViewInteraction.h:
3787         * UIProcess/ios/WKContentViewInteraction.mm:
3788         (-[WKContentView setupInteraction]):
3789         (-[WKContentView cleanupInteraction]):
3790         (-[WKContentView _removeDefaultGestureRecognizers]):
3791         (-[WKContentView _addDefaultGestureRecognizers]):
3792
3793 2018-04-20  Youenn Fablet  <youenn@apple.com>
3794
3795         WebPage sometimes incorrectly rules out PDF as a mime type that can be showed
3796         https://bugs.webkit.org/show_bug.cgi?id=184369
3797
3798         Reviewed by Chris Dumez.
3799
3800         Use API to check for plugin availability for response at navigation time.
3801
3802         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3803         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
3804         * WebProcess/WebPage/WebPage.cpp:
3805         (WebKit::WebPage::canShowResponse const):
3806         (WebKit::WebPage::canShowMIMEType const):
3807         * WebProcess/WebPage/WebPage.h:
3808
3809 2018-04-20  Daniel Bates  <dabates@apple.com>
3810
3811         Remove Strong Password decoration when text field type changes
3812         https://bugs.webkit.org/show_bug.cgi?id=184795
3813         <rdar://problem/38325108>
3814
3815         Reviewed by Antti Koivisto.
3816
3817         Add injected bundle API and WebKit UI delegate SPI to notify the embedding client when the
3818         Strong Password appearance of an HTML input element is resigned.
3819
3820         We add C SPI for Safari on Mac.
3821
3822         * UIProcess/API/APIUIClient.h:
3823         (API::UIClient::didResignInputElementStrongPasswordAppearance):
3824         * UIProcess/API/C/WKPage.cpp:
3825         (WKPageSetPageUIClient):
3826         * UIProcess/API/C/WKPageUIClient.h:
3827         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3828         * UIProcess/Cocoa/UIDelegate.h:
3829         * UIProcess/Cocoa/UIDelegate.mm:
3830         (WebKit::UIDelegate::setDelegate):
3831         (WebKit::UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance):
3832         * UIProcess/WebPageProxy.cpp:
3833         (WebKit::WebPageProxy::didResignInputElementStrongPasswordAppearance):
3834         * UIProcess/WebPageProxy.h:
3835         * UIProcess/WebPageProxy.messages.in:
3836         * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
3837         (API::InjectedBundle::PageUIClient::didResignInputElementStrongPasswordAppearance):
3838         * WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h:
3839         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
3840         (WebKit::InjectedBundlePageUIClient::didResignInputElementStrongPasswordAppearance):
3841         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
3842         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3843         (WebKit::WebChromeClient::inputElementDidResignStrongPasswordAppearance):
3844         * WebProcess/WebCoreSupport/WebChromeClient.h:
3845
3846 2018-04-20  Megan Gardner  <megan_gardner@apple.com>
3847
3848         Fixes for failing tests associated with switching Text Selection Assistants
3849         https://bugs.webkit.org/show_bug.cgi?id=184806
3850         <rdar://problem/39367905>
3851
3852         Reviewed by Beth Dakin and Wenson Hsieh.
3853         
3854         The major fix is the disabling the double tap noneditable text selection gesture.
3855         The other fixes are small tweaks that shouldn't even be run into with the fix to 
3856         the double tap gesture, but they are incorrect, so I am taking the opportunity to 
3857         fix them now, in case we run into them again.
3858
3859         * UIProcess/ios/WKContentViewInteraction.mm:
3860         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
3861         We should not be allowing a double tap text gestures in non-editable web content.
3862         We didn't have one with the old assistant. Fortunately, this is easily disabled.
3863         (-[WKContentView canPerformActionForWebView:withSender:]):
3864         We should not allow the lookup action if we do not actually have a selection.
3865         It is meaningless without one.
3866         (-[WKContentView selectedTextRange]):
3867         We should not return a selection to UIKit if all we have is caret selection
3868         in non-editable content. We have this for selections on Mac, but UIKit does
3869         not know how to properly handle this, and will have incorrect behavior if we 
3870         return a valid selection.
3871
3872 2018-04-20  Timothy Hatcher  <timothy@apple.com>
3873
3874         WebEvent fails to convert synthetic WebMouseEvent for automation
3875
3876         https://bugs.webkit.org/show_bug.cgi?id=184824
3877         rdar://problem/35377120
3878
3879         Reviewed by Brian Burg.
3880
3881         Add WebEvent conversions that existed in PlatformEventFactoryIOS for legacy WebKit,
3882         but never got added in WebIOSEventFactory and NativeWebMouseEvent for modern WebKit.
3883         This affected WebDriver, and some events not being deliverd to the page.
3884
3885         * Shared/NativeWebMouseEvent.h:
3886         (WebKit::NativeWebMouseEvent::nativeEvent const):
3887         * Shared/ios/NativeWebMouseEventIOS.mm: Added.
3888         (WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
3889         * Shared/ios/WebIOSEventFactory.h:
3890         * Shared/ios/WebIOSEventFactory.mm:
3891         (WebIOSEventFactory::createWebMouseEvent):
3892         * WebKit.xcodeproj/project.pbxproj:
3893
3894 2018-04-20  Michael Catanzaro  <mcatanzaro@igalia.com>
3895
3896         Unreviewed, fix -Wformat warning
3897
3898         * UIProcess/WebPageProxy.cpp:
3899         (WebKit::WebPageProxy::didFinishLoadForFrame):
3900
3901 2018-04-20  Youenn Fablet  <youenn@apple.com>
3902
3903         Make PluginData cache its web visible plugins
3904         https://bugs.webkit.org/show_bug.cgi?id=184421
3905
3906         Reviewed by Chris Dumez.
3907
3908         Rename methods.
3909         Pass an URL instead of relying on Page URL as the page URL
3910         might not always be the URL we want to check against plugins.
3911         In particular when navigation is on-going, we want to check the
3912         plugins against the being navigated URL.
3913
3914         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
3915         (WebKit::WebPluginInfoProvider::pluginInfo):
3916         (WebKit::WebPluginInfoProvider::webVisiblePluginInfo):
3917         * WebProcess/Plugins/WebPluginInfoProvider.h:
3918
3919 2018-04-19  Carlos Garcia Campos  <cgarcia@igalia.com>
3920
3921         Unreviewed. Fix GTK+ build after r230830.
3922
3923         Add SimulatedInputDispatcher.cpp to the build.
3924
3925         * CMakeLists.txt:
3926
3927 2018-04-19  Brady Eidson  <beidson@apple.com>
3928
3929         Make back forward cache work with process swapping.
3930         <rdar://problem/38676604> and https://bugs.webkit.org/show_bug.cgi?id=184793
3931
3932         Reviewed by Chris Dumez.
3933
3934         We previously saved old processes in "SuspendedPageProxy" objects.
3935         Now we reuse them when going back or forward.
3936
3937         * Platform/Logging.h:
3938
3939         * Shared/WebBackForwardListItem.cpp:
3940         (WebKit::WebBackForwardListItem::setSuspendedPage):
3941         (WebKit::WebBackForwardListItem::loggingString):
3942         * Shared/WebBackForwardListItem.h:
3943         (WebKit::WebBackForwardListItem::suspendedPage const):
3944
3945         Teach Navigation objects their source WebBackForwardListItems:
3946         * UIProcess/API/APINavigation.cpp:
3947         (API::Navigation::Navigation):
3948         (API::Navigation::loggingString const):
3949         * UIProcess/API/APINavigation.h:
3950         (API::Navigation::create):
3951         (API::Navigation::targetItem const):
3952         (API::Navigation::fromItem const):
3953         (API::Navigation::backForwardListItem): Deleted.
3954
3955         * UIProcess/Cocoa/NavigationState.mm:
3956         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3957
3958         * UIProcess/SuspendedPageProxy.cpp:
3959         (WebKit::messageNamesToIgnoreWhileSuspended):
3960         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
3961         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
3962         (WebKit::SuspendedPageProxy::webProcessDidClose):
3963         (WebKit::SuspendedPageProxy::didReceiveMessage):
3964         (WebKit::SuspendedPageProxy::loggingString const):
3965         * UIProcess/SuspendedPageProxy.h:
3966         (WebKit::SuspendedPageProxy::origin const):
3967
3968         * UIProcess/WebBackForwardList.cpp:
3969         (WebKit::WebBackForwardList::WebBackForwardList):
3970         (WebKit::WebBackForwardList::~WebBackForwardList):
3971         (WebKit::WebBackForwardList::pageClosed):
3972         (WebKit::WebBackForwardList::addItem):
3973         (WebKit::WebBackForwardList::goToItem):
3974         (WebKit::WebBackForwardList::removeAllItems):
3975         (WebKit::WebBackForwardList::clear):
3976         (WebKit::WebBackForwardList::restoreFromState):
3977         (WebKit::WebBackForwardList::filteredItemStates const):
3978         (WebKit::WebBackForwardList::itemStates const):
3979         (WebKit::WebBackForwardList::loggingString):
3980         * UIProcess/WebBackForwardList.h:
3981
3982         * UIProcess/WebNavigationState.cpp:
3983         (WebKit::WebNavigationState::createLoadRequestNavigation):
3984         (WebKit::WebNavigationState::createBackForwardNavigation):
3985         * UIProcess/WebNavigationState.h:
3986
3987         * UIProcess/WebPageProxy.cpp:
3988         (WebKit::WebPageProxy::reattachToWebProcess):
3989         (WebKit::WebPageProxy::maybeCreateSuspendedPage):
3990         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
3991         (WebKit::WebPageProxy::loadRequest):
3992         (WebKit::WebPageProxy::loadFile):
3993         (WebKit::WebPageProxy::goToBackForwardItem):
3994         (WebKit::WebPageProxy::receivedPolicyDecision):
3995         (WebKit::WebPageProxy::continueNavigationInNewProcess):
3996         (WebKit::WebPageProxy::didCreateMainFrame):
3997         (WebKit::WebPageProxy::didCreateSubframe):
3998         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
3999         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
4000         (WebKit::WebPageProxy::didCommitLoadForFrame):
4001         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
4002         (WebKit::WebPageProxy::connectionWillOpen):
4003         (WebKit::WebPageProxy::attachToProcessForNavigation): Deleted.
4004         * UIProcess/WebPageProxy.h:
4005
4006         * UIProcess/WebProcessLifetimeTracker.cpp:
4007         (WebKit::WebProcessLifetimeTracker::webPageEnteringWebProcess):
4008         (WebKit::WebProcessLifetimeTracker::connectionWillOpen): Deleted.
4009         * UIProcess/WebProcessLifetimeTracker.h:
4010
4011         * UIProcess/WebProcessPool.cpp:
4012         (WebKit::WebProcessPool::processForNavigation):
4013         (WebKit::WebProcessPool::registerSuspendedPageProxy):
4014         (WebKit::WebProcessPool::unregisterSuspendedPageProxy):
4015         * UIProcess/WebProcessPool.h:
4016
4017         * UIProcess/WebProcessProxy.cpp:
4018         (WebKit::WebProcessProxy::suspendWebPageProxy):
4019         (WebKit::WebProcessProxy::updateBackForwardItem):
4020         (WebKit::WebProcessProxy::frameCreated):
4021         * UIProcess/WebProcessProxy.h:
4022
4023         * WebProcess/WebPage/DrawingArea.h:
4024         (WebKit::DrawingArea::attachDrawingArea):
4025
4026         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
4027         (WebKit::WebBackForwardListProxy::addItemFromUIProcess):
4028         (WebKit::WebBackForwardListProxy::addItem):
4029         * WebProcess/WebPage/WebBackForwardListProxy.h:
4030
4031         * WebProcess/WebPage/WebPage.cpp:
4032         (WebKit::m_credentialsMessenger):
4033         (WebKit::WebPage::reinitializeWebPage):
4034         (WebKit::WebPage::goToBackForwardItem):
4035         (WebKit::WebPage::restoreSessionInternal):
4036         (WebKit::WebPage::restoreSession):
4037         (WebKit::WebPage::updateBackForwardListForReattach):
4038         * WebProcess/WebPage/WebPage.h:
4039         * WebProcess/WebPage/WebPage.messages.in:
4040
4041         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
4042         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
4043         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
4044         (WebKit::TiledCoreAnimationDrawingArea::attachDrawingArea): Force a reattachment of the drawing
4045           area from a resumed WebProcess to the UIProcess (to make the page cache work)
4046