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