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