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