Unreviewed, rolling out r224661.
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2017-11-09  Chris Dumez  <cdumez@apple.com>
2
3         Unreviewed, rolling out r224661.
4
5         Broke build on several internal Mac/iOS bots
6
7         Reverted changeset:
8
9         "Ignore HSTS for partitioned, cross-origin subresource
10         requests"
11         https://bugs.webkit.org/show_bug.cgi?id=178993
12         https://trac.webkit.org/changeset/224661
13
14 2017-11-09  Chris Dumez  <cdumez@apple.com>
15
16         ServiceWorkerRegistration objects may get recycled for different SWServerRegistration objects
17         https://bugs.webkit.org/show_bug.cgi?id=179517
18
19         Reviewed by Brady Eidson.
20
21         * Scripts/webkit/messages.py:
22         (forward_declarations_and_headers):
23         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
24         (WebKit::WebSWServerConnection::updateRegistrationStateInClient):
25         (WebKit::WebSWServerConnection::fireUpdateFoundEvent):
26         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
27         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
28         * WebProcess/Storage/WebSWClientConnection.cpp:
29         (WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer):
30         (WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer):
31         * WebProcess/Storage/WebSWClientConnection.h:
32         * WebProcess/Storage/WebSWClientConnection.messages.in:
33
34 2017-11-09  John Wilander  <wilander@apple.com>
35
36         Ignore HSTS for partitioned, cross-origin subresource requests
37         https://bugs.webkit.org/show_bug.cgi?id=178993
38         <rdar://problem/34962462>
39
40         Reviewed by Brent Fulgham.
41
42         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
43         (downgradeRequest):
44             Convenience function to downgrade a request if
45             CFNetwork as already upgraded it during
46             canonicalization. This allows the rest of 
47             WebKit's processing to function, such as UIR
48             and mixed content blocking.
49         (updateIgnoreStrictTransportSecuritySettingIfNecessary):
50             Adds and removed the ignore request accordingly.
51         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
52             Now asks CFNetwork to ignore HSTS on resource loads we
53             partition cookies for.
54         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
55             Now asks CFNetwork to ignore HSTS on resource loads we
56             partition cookies for.
57
58 2017-11-09  Chris Dumez  <cdumez@apple.com>
59
60         Implement real post 'install' event steps of the Install algorithm (steps 14+)
61         https://bugs.webkit.org/show_bug.cgi?id=179401
62
63         Reviewed by Brady Eidson.
64
65         Implement step 14+ of Install algorithm, as per:
66         - https://w3c.github.io/ServiceWorker/#installation-algorithm
67
68         * Scripts/webkit/messages.py:
69         (headers_for_type):
70         * Shared/WebCoreArgumentCoders.h:
71         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
72         (WebKit::WebSWServerConnection::resolveRegistrationJobInClient):
73         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
74         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
75         * WebProcess/Storage/WebSWClientConnection.cpp:
76         (WebKit::WebSWClientConnection::didResolveRegistrationPromise):
77         * WebProcess/Storage/WebSWClientConnection.h:
78         * WebProcess/Storage/WebSWClientConnection.messages.in:
79
80 2017-11-09  Megan Gardner  <megan_gardner@apple.com>
81
82         Clean out unused selection items from UIKitSPI
83         https://bugs.webkit.org/show_bug.cgi?id=179459
84
85         Reviewed by Tim Horton.
86
87         Many of these should have been removed from previous commits, but they were missed.
88         None of these enums or methods are being used by WebKit anymore, and removing them will keep things
89         clean and allow UIKit to remove things that are not used at all by anyone anymore.
90
91         * Platform/spi/ios/UIKitSPI.h:
92
93 2017-11-09  Christopher Reid  <chris.reid@sony.com>
94
95         Use enum classes within FileSystem
96         https://bugs.webkit.org/show_bug.cgi?id=175172
97
98         Reviewed by Darin Adler.
99
100         * NetworkProcess/Downloads/BlobDownloadClient.cpp:
101         * NetworkProcess/NetworkDataTaskBlob.cpp:
102         * NetworkProcess/cache/NetworkCache.cpp:
103         * NetworkProcess/capture/NetworkCaptureManager.cpp:
104         * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
105         * Shared/WebMemorySampler.cpp:
106         * UIProcess/API/APIContentRuleListStore.cpp:
107         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
108
109 2017-11-09  Youenn Fablet  <youenn@apple.com>
110
111         ServiceWorkerClientFetch should create not null ResourceError
112         https://bugs.webkit.org/show_bug.cgi?id=179485
113
114         Reviewed by Darin Adler.
115
116         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
117         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
118
119 2017-11-09  Andy Estes  <aestes@apple.com>
120
121         [iOS] Adopt UIPreviewDataAttachmentListIsContentManaged
122         https://bugs.webkit.org/show_bug.cgi?id=179458
123         <rdar://problem/35034691>
124
125         Reviewed by Dan Bernstein.
126
127         * Platform/spi/ios/UIKitSPI.h:
128         * UIProcess/ios/WKContentViewInteraction.mm:
129         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
130
131 2017-11-08  Joseph Pecoraro  <pecoraro@apple.com>
132
133         Include a more complete block signature in public headers to avoid potential -Wstrict-prototypes warnings
134         https://bugs.webkit.org/show_bug.cgi?id=179466
135
136         Reviewed by Dan Bernstein.
137
138         * UIProcess/API/Cocoa/WKHTTPCookieStore.h:
139         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
140         (-[WKHTTPCookieStore setCookie:completionHandler:]):
141         (-[WKHTTPCookieStore deleteCookie:completionHandler:]):
142
143 2017-11-08  Jeremy Jones  <jeremyj@apple.com>
144
145         Make WKFullScreenWidnowController more robust against modification by the embedding app.
146         https://bugs.webkit.org/show_bug.cgi?id=179413
147         rdar://problem/35408061
148
149         Reviewed by Darin Adler.
150
151         Present fullscreen UViewController in a separate UIWindow to prevent interaction with the embedding app's
152         UIViewController hierarchy.
153
154         Immediately tear down the fullscreen interface if the embedding app removes the WKWebView from the fullscreen window.
155         This prevents the fullscreen interface from getting into an invalid state.
156
157         Preserve scrollView.zoomScale because it is not effectively preserved by the more indirect _viewScale.
158
159         Use a custom root view controller to allow hiding of the status bar.
160
161         Remove the no-longer-necessary dispatch_after calls during enter and exit fullscreen.
162
163         * UIProcess/API/Cocoa/WKWebView.mm:
164         (-[WKWebView removeFromSuperview]):
165         * UIProcess/ios/WKFullScreenWindowControllerIOS.h:
166         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
167         (WebKit::WKWebViewState::applyTo):
168         (WebKit::WKWebViewState::store):
169         (-[_WKFullScreenViewController loadView]):
170         (-[_WKFullscreenRootViewController prefersStatusBarHidden]):
171         (-[WKFullScreenWindowController enterFullScreen]):
172         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
173         (-[WKFullScreenWindowController completedExitFullScreen]):
174         (-[WKFullScreenWindowController exitFullscreenImmediately]):
175         (-[WKFullScreenWindowController close]):
176         (-[WKFullScreenWindowController webViewDidRemoveFromSuperviewWhileInFullscreen]):
177         (-[_WKFullScreenViewController viewDidDisappear:]): Deleted.
178
179 2017-11-08  Jeremy Jones  <jeremyj@apple.com>
180
181         HTMLMediaElement should not use element fullscreen on iOS
182         https://bugs.webkit.org/show_bug.cgi?id=179418
183         rdar://problem/35409277
184
185         Reviewed by Eric Carlson.
186
187         Add ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN to determine if HTMLMediaElement should use element full screen or not.
188
189         * Configurations/FeatureDefines.xcconfig:
190
191 2017-11-08  Wenson Hsieh  <wenson_hsieh@apple.com>
192
193         [Attachment Support] Implement delegate hooks for attachment element insertion and removal
194         https://bugs.webkit.org/show_bug.cgi?id=179016
195         <rdar://problem/35250890>
196
197         Reviewed by Tim Horton.
198
199         See WebCore/ChangeLog for more details.
200
201         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
202         * UIProcess/API/Cocoa/WKWebView.mm:
203         (-[WKWebView _didInsertAttachment:]):
204         (-[WKWebView _didRemoveAttachment:]):
205         * UIProcess/API/Cocoa/WKWebViewInternal.h:
206         * UIProcess/Cocoa/PageClientImplCocoa.h:
207         * UIProcess/Cocoa/PageClientImplCocoa.mm:
208         (WebKit::PageClientImplCocoa::didInsertAttachment):
209         (WebKit::PageClientImplCocoa::didRemoveAttachment):
210         * UIProcess/PageClient.h:
211         (WebKit::PageClient::didInsertAttachment):
212         (WebKit::PageClient::didRemoveAttachment):
213         * UIProcess/WebPageProxy.cpp:
214         (WebKit::WebPageProxy::didInsertAttachment):
215         (WebKit::WebPageProxy::didRemoveAttachment):
216         * UIProcess/WebPageProxy.h:
217         * UIProcess/WebPageProxy.messages.in:
218         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
219         (WebKit::WebEditorClient::didInsertAttachment):
220         (WebKit::WebEditorClient::didRemoveAttachment):
221         * WebProcess/WebCoreSupport/WebEditorClient.h:
222
223 2017-11-08  Carlos Garcia Campos  <cgarcia@igalia.com>
224
225         REGRESSION(r223773): [GTK] WebKitWebInspector bring-to-front signal is emitted right after open-window
226         https://bugs.webkit.org/show_bug.cgi?id=179365
227
228         Reviewed by Michael Catanzaro.
229
230         In the GTK+ API, open-window already implies presenting the window to bring it to the front, so it's not
231         expected that bring-to-front is emitted on open. This is happening since r223773 that moved common code from
232         platform specific inspector files to the main file, but in the case of open the mac implementation was not
233         exactly the same as the GTK+ one. This broke /webkit2/WebKitWebInspector/default and
234         /webkit2/WebKitWebInspector/manual-attach-detach.
235
236         * UIProcess/WebInspectorProxy.cpp:
237         (WebKit::WebInspectorProxy::open): Set m_isOpening for the scope of the function.
238         * UIProcess/WebInspectorProxy.h: Add m_isOpening.
239         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
240         (WebKit::WebInspectorProxy::platformBringToFront): Return early if m_isOpening is true.
241
242 2017-11-07  Carlos Garcia Campos  <cgarcia@igalia.com>
243
244         REGRESSION(r224179): [GTK] Several WebViewEditor tests are failing since r224179
245         https://bugs.webkit.org/show_bug.cgi?id=179366
246
247         Reviewed by Michael Catanzaro.
248
249         In r224179, webkit_web_view_can_execute_editing_command() was optimized to use the sync path for commands
250         supported by the WebViewEditorState, but the state requires a redraw to be up to date. We can't know if
251         WebViewEditorState is in sync, when webkit_web_view_can_execute_editing_command() is called, so we always need
252         to ask the web process.
253
254         * UIProcess/API/glib/WebKitWebView.cpp:
255         (webkit_web_view_can_execute_editing_command):
256
257 2017-11-07  Carlos Garcia Campos  <cgarcia@igalia.com>
258
259         [GTK][WPE] Build inspector resources using copy-user-interface-resources.pl script
260         https://bugs.webkit.org/show_bug.cgi?id=179317
261
262         Reviewed by Michael Catanzaro.
263
264         This is the script used by Apple and it has several advantages:
265
266           - It allows to combine and minify most of the js and css files, which improves performance and binary size.
267           - It removes the debug resources and assertions in production builds.
268           - It allows to remove the test resources in production builds.
269
270         The patch also moves the common cmake code to generate the resources to a new file InspectorGResources.cmake included
271         by GTK+ and WPE platform cmake files.
272
273         * InspectorGResources.cmake: Added.
274         * PlatformGTK.cmake:
275         * PlatformWPE.cmake:
276
277 2017-11-07  Jeremy Jones  <jeremyj@apple.com>
278
279         Add downcast support for FullscreenClient.
280         https://bugs.webkit.org/show_bug.cgi?id=178824
281
282         Reviewed by Simon Fraser.
283
284         Add SPECIALIZE_TYPE_TRAITS macros for API::FullscreenClient and WebKit::Fullscreen client so 
285         downcasts can be done safely.
286
287         * UIProcess/API/APIFullscreenClient.h:
288         (API::FullscreenClient::isType const):
289         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
290         (WKPageSetFullscreenDelegate):
291         (WKPageGetFullscreenDelegate):
292         * UIProcess/API/Cocoa/WKWebView.mm:
293         (-[WKWebView _setFullscreenDelegate:]):
294         (-[WKWebView _fullscreenDelegate]):
295         * UIProcess/Cocoa/FullscreenClient.h:
296         (isType):
297         * UIProcess/Cocoa/FullscreenClient.mm:
298
299 2017-11-07  Brady Eidson  <beidson@apple.com>
300
301         Implement "UpdateWorkerState" and use it
302         https://bugs.webkit.org/show_bug.cgi?id=179318
303
304         Reviewed by Chris Dumez.
305
306         * Scripts/webkit/messages.py:
307         (headers_for_type):
308         * Shared/WebCoreArgumentCoders.h:
309  
310        * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
311         (WebKit::WebSWServerConnection::updateWorkerStateInClient):
312         (WebKit::WebSWServerConnection::installServiceWorkerContext):
313         (WebKit::WebSWServerConnection::setContextConnection):
314         (WebKit::WebSWServerConnection::updateServiceWorkerContext): Deleted.
315         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
316
317         * WebProcess/Storage/WebSWClientConnection.messages.in:
318
319         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
320         (WebKit::WebSWContextManagerConnection::installServiceWorker):
321         (WebKit::WebSWContextManagerConnection::updateServiceWorker): Deleted.
322         * WebProcess/Storage/WebSWContextManagerConnection.h:
323         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
324
325 2017-11-07  Commit Queue  <commit-queue@webkit.org>
326
327         Unreviewed, rolling out r224512 and r224521.
328         https://bugs.webkit.org/show_bug.cgi?id=179388
329
330         An API test added with this change is failing an assertion on
331         the bots. (Requested by ryanhaddad on #webkit).
332
333         Reverted changesets:
334
335         "[Attachment Support] Implement delegate hooks for attachment
336         element insertion and removal"
337         https://bugs.webkit.org/show_bug.cgi?id=179016
338         https://trac.webkit.org/changeset/224512
339
340         "Remove stray logging from a newly added API test"
341         https://trac.webkit.org/changeset/224521
342
343 2017-11-07  Chris Dumez  <cdumez@apple.com>
344
345         [Service Workers] Add support for "install" event
346         https://bugs.webkit.org/show_bug.cgi?id=179338
347
348         Reviewed by Youenn Fablet.
349
350         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
351         (WebKit::WebSWServerConnection::firePostInstallEvents):
352         (WebKit::WebSWServerConnection::fireInstallEvent):
353         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
354         * StorageProcess/StorageProcess.cpp:
355         (WebKit::StorageProcess::didFinishServiceWorkerInstall):
356         * StorageProcess/StorageProcess.h:
357         * StorageProcess/StorageProcess.messages.in:
358         * WebProcess/Storage/WebSWClientConnection.messages.in:
359         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
360         (WebKit::WebSWContextManagerConnection::fireInstallEvent):
361         (WebKit::WebSWContextManagerConnection::didFinishInstall):
362         * WebProcess/Storage/WebSWContextManagerConnection.h:
363         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
364
365 2017-11-07  Youenn Fablet  <youenn@apple.com>
366
367         Support the case of fetch events that are not responded
368         https://bugs.webkit.org/show_bug.cgi?id=179336
369
370         Reviewed by Chris Dumez.
371
372         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
373         (WebKit::WebServiceWorkerFetchTaskClient::didNotHandle):
374         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
375
376 2017-11-06  Alex Christensen  <achristensen@webkit.org>
377
378         Make ResourceLoader::willSendRequestInternal asynchronous
379         https://bugs.webkit.org/show_bug.cgi?id=179251
380
381         Reviewed by Andy Estes.
382
383         * WebProcess/Network/WebLoaderStrategy.cpp:
384         (WebKit::WebLoaderStrategy::loadResource):
385         (WebKit::WebLoaderStrategy::schedulePluginStreamLoad):
386         * WebProcess/Network/WebLoaderStrategy.h:
387         * WebProcess/Plugins/PluginView.cpp:
388         (WebKit::PluginView::Stream::start):
389
390 2017-11-06  Wenson Hsieh  <wenson_hsieh@apple.com>
391
392         [Attachment Support] Implement delegate hooks for attachment element insertion and removal
393         https://bugs.webkit.org/show_bug.cgi?id=179016
394         <rdar://problem/35250890>
395
396         Reviewed by Tim Horton.
397
398         Adds boilerplate plumbing to WebEditorClient, WebPage, and the usual machinery in the UI process to notify
399         WebKit2 clients when attachment elements have been inserted or removed from the document. See the WebCore
400         ChangeLog for more details about the implementation, or the Tools ChangeLog for more information about new API
401         tests.
402
403         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
404         * UIProcess/API/Cocoa/WKWebView.mm:
405         (-[WKWebView _didInsertAttachment:]):
406         (-[WKWebView _didRemoveAttachment:]):
407         * UIProcess/API/Cocoa/WKWebViewInternal.h:
408         * UIProcess/Cocoa/PageClientImplCocoa.h:
409         * UIProcess/Cocoa/PageClientImplCocoa.mm:
410         (WebKit::PageClientImplCocoa::didInsertAttachment):
411         (WebKit::PageClientImplCocoa::didRemoveAttachment):
412         * UIProcess/PageClient.h:
413         (WebKit::PageClient::didInsertAttachment):
414         (WebKit::PageClient::didRemoveAttachment):
415         * UIProcess/WebPageProxy.cpp:
416         (WebKit::WebPageProxy::didInsertAttachment):
417         (WebKit::WebPageProxy::didRemoveAttachment):
418         * UIProcess/WebPageProxy.h:
419         * UIProcess/WebPageProxy.messages.in:
420         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
421         (WebKit::WebEditorClient::didInsertAttachment):
422         (WebKit::WebEditorClient::didRemoveAttachment):
423         * WebProcess/WebCoreSupport/WebEditorClient.h:
424
425 2017-11-06  Jeremy Jones  <jeremyj@apple.com>
426
427         iOS element fullscreen should use a UIGestureRecognizer to detect user interaction.
428         https://bugs.webkit.org/show_bug.cgi?id=179029
429         rdar://problem/35307882
430
431         Reviewed by Simon Fraser.
432
433         Replace _WKTapDelegatingView with a UILongPressGestureRecognizer. When set with a duration of 0, it effectively
434         recognizes UITouchBegin events.
435
436         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
437         (-[_WKFullScreenViewController loadView]):
438         (-[_WKFullScreenViewController gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
439         (-[_WKTapDelegatingView setTarget:action:]): Deleted.
440         (-[_WKTapDelegatingView hitTest:withEvent:]): Deleted.
441
442 2017-11-06  Chris Dumez  <cdumez@apple.com>
443
444         [Service Workers] Add proper implementation for 'updatefound' event
445         https://bugs.webkit.org/show_bug.cgi?id=179302
446
447         Reviewed by Brady Eidson.
448
449         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
450         (WebKit::WebSWServerConnection::fireUpdateFoundEvent):
451         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
452         * WebProcess/Storage/WebSWClientConnection.messages.in:
453
454 2017-11-06  Christopher Reid  <chris.reid@sony.com>
455
456         Use enum classes within FileSystem
457         https://bugs.webkit.org/show_bug.cgi?id=175172
458
459         Reviewed by Myles C. Maxfield.
460
461         * NetworkProcess/Downloads/BlobDownloadClient.cpp:
462         * NetworkProcess/NetworkDataTaskBlob.cpp:
463         * NetworkProcess/cache/NetworkCache.cpp:
464         * NetworkProcess/capture/NetworkCaptureManager.cpp:
465         * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
466         * Shared/WebMemorySampler.cpp:
467         * UIProcess/API/APIContentRuleListStore.cpp:
468         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
469
470 2017-11-06  Michael Catanzaro  <mcatanzaro@igalia.com>
471
472         [WPE] Properly use SYSTEM_INCLUDE_DIRECTORIES for WebKit build target
473         https://bugs.webkit.org/show_bug.cgi?id=179097
474
475         Reviewed by Žan Doberšek.
476
477         * PlatformWPE.cmake:
478
479 2017-11-05  Yusuke Suzuki  <utatane.tea@gmail.com>
480
481         JIT call inline caches should cache calls to objects with getCallData/getConstructData traps
482         https://bugs.webkit.org/show_bug.cgi?id=144458
483
484         Reviewed by Saam Barati.
485
486         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
487         (WebKit::JSNPMethod::JSNPMethod):
488         (WebKit::JSNPMethod::getCallData): Deleted.
489         * WebProcess/Plugins/Netscape/JSNPMethod.h:
490         (WebKit::JSNPMethod::createStructure):
491
492 2017-11-04  Chris Dumez  <cdumez@apple.com>
493
494         REGRESSION(r223718): Leaking WebProcessPool after reconfiguration
495         https://bugs.webkit.org/show_bug.cgi?id=179123
496         <rdar://problem/35294685>
497
498         Reviewed by Geoff Garen.
499
500         Make sure we destroy the ServiceWorker WebProcess once all other WebProcesses
501         go away at there is no use keeping it running at this point. Also, this prevents
502         leaking the WebProcessPool since the WebProcessProxy holds a strong reference
503         to the WebProcessPool.
504
505         * UIProcess/WebProcessPool.cpp:
506         (WebKit::WebProcessPool::disconnectProcess):
507
508 2017-11-01  Darin Adler  <darin@apple.com>
509
510         Simplify event dispatch code and make it a bit more consistent
511         https://bugs.webkit.org/show_bug.cgi?id=178991
512
513         Reviewed by Chris Dumez.
514
515         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEvent.cpp:
516         (webkit_dom_event_get_src_element): Call target instead of srcElement.
517
518 2017-11-04  Aishwarya Nirmal  <anirmal@apple.com>
519
520         [Touch Bar Web API] Add support for menuitem tag
521         https://bugs.webkit.org/show_bug.cgi?id=179020
522
523         Reviewed by Ryosuke Niwa.
524
525         Adds in the MenuItemElementEnabled flag so that the menu item element is a runtime-
526         enabled feature. It has a default value of false.
527
528         * Shared/WebPreferences.yaml:
529         * UIProcess/API/C/WKPreferences.cpp:
530         (WKPreferencesSetMenuItemElementEnabled):
531         (WKPreferencesGetMenuItemElementEnabled):
532         * UIProcess/API/C/WKPreferencesRefPrivate.h:
533
534 2017-11-03  Chris Dumez  <cdumez@apple.com>
535
536         Unreviewed, rolling out r224438.
537
538         Has caused assertions on the bots
539
540         Reverted changeset:
541
542         "REGRESSION(r223718): Leaking WebProcessPool after
543         reconfiguration"
544         https://bugs.webkit.org/show_bug.cgi?id=179123
545         https://trac.webkit.org/changeset/224438
546
547 2017-11-03  Youenn Fablet  <youenn@apple.com>
548
549         Requests handled by Service Worker should not go through preflighting
550         https://bugs.webkit.org/show_bug.cgi?id=179250
551
552         Reviewed by Alex Christensen.
553
554         * WebProcess/Network/WebLoaderStrategy.cpp:
555         (WebKit::WebLoaderStrategy::scheduleLoad):
556         * WebProcess/Storage/WebSWClientConnection.cpp:
557         (WebKit::WebSWClientConnection::startFetch):
558         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
559         (WebKit::shouldHandleFetch):
560
561 2017-11-03  Chris Dumez  <cdumez@apple.com>
562
563         REGRESSION(r223718): Leaking WebProcessPool after reconfiguration
564         https://bugs.webkit.org/show_bug.cgi?id=179123
565         <rdar://problem/35294685>
566
567         Reviewed by Geoffrey Garen.
568
569         Make sure we destroy the ServiceWorker WebProcess once all other WebProcesses
570         go away at there is no use keeping it running at this point. Also, this prevents
571         leaking the WebProcessPool since the WebProcessProxy holds a strong reference
572         to the WebProcessPool.
573
574         * UIProcess/WebProcessPool.cpp:
575         (WebKit::WebProcessPool::disconnectProcess):
576
577 2017-11-03  Youenn Fablet  <youenn@apple.com>
578
579         Implement Service Worker Matching Registration algorithm
580         https://bugs.webkit.org/show_bug.cgi?id=178882
581
582         Reviewed by Chris Dumez.
583
584         Added IPC plumbery for matchRegistration request and response.
585         Added some limited clearing of workers and registrations.
586
587         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
588         (WebKit::WebSWServerConnection::matchRegistration):
589         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
590         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
591         * StorageProcess/StorageProcess.cpp:
592         (WebKit::StorageProcess::deleteWebsiteData):
593         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
594         * WebProcess/Storage/WebSWClientConnection.cpp:
595         (WebKit::WebSWClientConnection::didMatchRegistration):
596         (WebKit::WebSWClientConnection::matchRegistration):
597         * WebProcess/Storage/WebSWClientConnection.h:
598         * WebProcess/Storage/WebSWClientConnection.messages.in:
599         * WebProcess/Storage/WebServiceWorkerProvider.h:
600
601 2017-11-03  Jeremy Jones  <jeremyj@apple.com>
602
603         Element fullscreen should use FloatRects instead of IntRects in beganEnterFullScreenWithInitialFrame
604         https://bugs.webkit.org/show_bug.cgi?id=179033
605         rdar://problem/35309279
606         
607         Reviewed by Darin Adler.
608
609         Screen coordinates are floats, so use NSRect instead of IntRect on Mac.
610
611         * UIProcess/mac/WKFullScreenWindowController.h:
612         * UIProcess/mac/WKFullScreenWindowController.mm:
613         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
614         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
615
616 2017-11-03  Chris Dumez  <cdumez@apple.com>
617
618         Use a single identifier type to identify Service Workers
619         https://bugs.webkit.org/show_bug.cgi?id=179192
620
621         Reviewed by Brady Eidson.
622
623         Use a single identifier type to identify Service Workers. We had both a String
624         identifier and a uint64_t identifier for each service worker. We now consistently
625         use a ServiceWorkerIdentifier which is a strongly typed identifier backed by a
626         uint64_t.
627
628         * Scripts/webkit/messages.py:
629         (forward_declarations_and_headers):
630         (forward_declarations_and_headers.templates):
631         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
632         (WebKit::WebSWServerConnection::startFetch):
633         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
634         (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient):
635         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
636         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
637         * StorageProcess/StorageProcess.cpp:
638         (WebKit::StorageProcess::serviceWorkerContextFailedToStart):
639         (WebKit::StorageProcess::serviceWorkerContextStarted):
640         (WebKit::StorageProcess::postMessageToServiceWorkerClient):
641         * StorageProcess/StorageProcess.h:
642         * StorageProcess/StorageProcess.messages.in:
643         * WebProcess/Storage/WebSWClientConnection.cpp:
644         (WebKit::WebSWClientConnection::postMessageToServiceWorkerGlobalScope):
645         (WebKit::WebSWClientConnection::postMessageToServiceWorkerClient):
646         * WebProcess/Storage/WebSWClientConnection.h:
647         * WebProcess/Storage/WebSWClientConnection.messages.in:
648         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
649         (WebKit::WebSWContextManagerConnection::updateServiceWorker):
650         (WebKit::WebSWContextManagerConnection::serviceWorkerStartedWithMessage):
651         (WebKit::WebSWContextManagerConnection::startFetch):
652         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerGlobalScope):
653         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerClient):
654         * WebProcess/Storage/WebSWContextManagerConnection.h:
655         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
656
657 2017-11-03  Antti Koivisto  <antti@apple.com>
658
659         Enable display:contents by default as experimental feature
660         https://bugs.webkit.org/show_bug.cgi?id=179239
661         <rdar://problem/35334612>
662
663         Reviewed by Darin Adler.
664
665         We pass most of the WPT tests. What remains is mostly flexbox related edge cases.
666
667         * Shared/WebPreferences.yaml:
668
669 2017-11-03  Frederic Wang  <fwang@igalia.com>
670
671         Use WK_IOS_TBA instead of WK_MAC_TBA to indicate availability of private functions on iOS
672         https://bugs.webkit.org/show_bug.cgi?id=179238
673
674         Reviewed by Darin Adler.
675
676         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
677         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
678
679 2017-11-02  Maciej Stachowiak  <mjs@apple.com>
680
681         Don't try to guess plugin MIME type from a file extension in a URL (no observable effect)
682         https://bugs.webkit.org/show_bug.cgi?id=178333
683
684         Reviewed by Darin Adler.
685
686         * WebProcess/Plugins/PluginView.cpp:
687         (WebKit::PluginView::pluginDidReceiveUserInteraction): loadedMIMEType --> serviceType
688         * WebProcess/WebPage/WebPage.cpp:
689         (WebKit::WebPage::determinePrimarySnapshottedPlugIn): ditto
690
691 2017-11-02  Brady Eidson  <beidson@apple.com>
692
693         SW: Implement "Update Registration State" algorithm (unused for now)
694         https://bugs.webkit.org/show_bug.cgi?id=179186
695
696         Reviewed by Chris Dumez.
697
698         * Scripts/webkit/messages.py:
699         (headers_for_type):
700
701         * Shared/WebCoreArgumentCoders.h:
702
703         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
704         (WebKit::WebSWServerConnection::updateRegistrationStateInClient):
705         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
706         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
707
708         * WebProcess/Storage/WebSWClientConnection.cpp:
709         (WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer):
710         (WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer):
711         * WebProcess/Storage/WebSWClientConnection.h:
712         * WebProcess/Storage/WebSWClientConnection.messages.in:
713
714 2017-11-02  Alex Christensen  <achristensen@webkit.org>
715
716         Use CompletionHandlers for redirects
717         https://bugs.webkit.org/show_bug.cgi?id=179163
718
719         Reviewed by Tim Horton.
720
721         * NetworkProcess/Downloads/BlobDownloadClient.cpp:
722         (WebKit::BlobDownloadClient::willSendRequestAsync):
723         * NetworkProcess/Downloads/BlobDownloadClient.h:
724         * NetworkProcess/NetworkDataTask.h:
725         * NetworkProcess/NetworkLoad.cpp:
726         (WebKit::NetworkLoad::~NetworkLoad):
727         (WebKit::NetworkLoad::continueWillSendRequest):
728         (WebKit::NetworkLoad::willSendRequestAsync):
729         * NetworkProcess/NetworkLoad.h:
730         * NetworkProcess/NetworkLoadClient.h:
731         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
732         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
733         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
734         * UIProcess/API/APIDownloadClient.h:
735         (API::DownloadClient::willSendRequest):
736         * UIProcess/API/C/WKContext.cpp:
737         (WKContextSetDownloadClient):
738         * UIProcess/Cocoa/DownloadClient.h:
739         * UIProcess/Cocoa/DownloadClient.mm:
740         (WebKit::DownloadClient::willSendRequest):
741         * WebProcess/Network/WebResourceLoader.cpp:
742         (WebKit::WebResourceLoader::willSendRequest):
743         * WebProcess/Plugins/PluginView.cpp:
744         (WebKit::PluginView::Stream::~Stream):
745         (WebKit::PluginView::Stream::continueLoad):
746         (WebKit::PluginView::Stream::willSendRequest):
747         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
748
749 2017-11-02  Christopher Reid  <chris.reid@sony.com>
750
751         Add a FileSystem namespace to FileSystem.cpp
752         https://bugs.webkit.org/show_bug.cgi?id=179063
753
754         Reviewed by Darin Adler.
755
756         * NetworkProcess/Downloads/BlobDownloadClient.cpp:
757         * NetworkProcess/Downloads/BlobDownloadClient.h:
758         * NetworkProcess/NetworkDataTaskBlob.cpp:
759         * NetworkProcess/NetworkDataTaskBlob.h:
760         * NetworkProcess/NetworkProcess.cpp:
761         * NetworkProcess/cache/CacheStorageEngine.cpp:
762         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
763         * NetworkProcess/cache/NetworkCache.cpp:
764         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
765         * NetworkProcess/cache/NetworkCacheData.cpp:
766         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
767         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
768         * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:
769         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
770         * NetworkProcess/cache/NetworkCacheStorage.cpp:
771         * NetworkProcess/capture/NetworkCaptureManager.cpp:
772         * NetworkProcess/capture/NetworkCaptureManager.h:
773         * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
774         * NetworkProcess/capture/NetworkCaptureResource.h:
775         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
776         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
777         * NetworkProcess/soup/NetworkProcessSoup.cpp:
778         * Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp:
779         * Shared/Plugins/unix/PluginSearchPath.cpp:
780         * Shared/WebMemorySampler.cpp:
781         * Shared/WebMemorySampler.h:
782         * Shared/gtk/ProcessExecutablePathGtk.cpp:
783         * Shared/ios/ChildProcessIOS.mm:
784         * Shared/mac/ChildProcessMac.mm:
785         * Shared/mac/SandboxExtensionMac.mm:
786         * Shared/wpe/ProcessExecutablePathWPE.cpp:
787         * StorageProcess/StorageProcess.cpp:
788         * UIProcess/API/APIContentRuleListStore.cpp:
789         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
790         * UIProcess/API/glib/IconDatabase.cpp:
791         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
792         * UIProcess/API/glib/WebKitFileChooserRequest.cpp:
793         * UIProcess/API/glib/WebKitWebContext.cpp:
794         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
795         * UIProcess/Automation/WebAutomationSession.cpp:
796         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
797         * UIProcess/Cocoa/WebViewImpl.mm:
798         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
799         * UIProcess/Plugins/gtk/PluginInfoCache.cpp:
800         * UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp:
801         * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
802         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
803         * UIProcess/WebStorage/LocalStorageDatabase.cpp:
804         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
805         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
806         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
807         * UIProcess/gtk/WebProcessPoolGtk.cpp:
808         * UIProcess/mac/WebPageProxyMac.mm:
809         * UIProcess/wpe/WebProcessPoolWPE.cpp:
810         * WebProcess/InjectedBundle/API/glib/WebKitExtensionManager.cpp:
811         * WebProcess/InjectedBundle/glib/InjectedBundleGlib.cpp:
812         * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
813         * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp:
814         * WebProcess/Plugins/Netscape/NetscapePluginStream.h:
815         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
816
817 2017-11-02  Joseph Pecoraro  <pecoraro@apple.com>
818
819         Make ServiceWorker a Remote Inspector debuggable target
820         https://bugs.webkit.org/show_bug.cgi?id=179043
821         <rdar://problem/34126008>
822
823         Reviewed by Brian Burg.
824
825         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h:
826         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm:
827         (debuggableTypeString):
828         Provide a way to start a Remote Web Inspector frontend for a ServiceWorker target type.
829
830 2017-11-02  Ryan Haddad  <ryanhaddad@apple.com>
831
832         Unreviewed, rolling out r224353.
833
834         Breaks internal builds.
835
836         Reverted changeset:
837
838         "Ignore HSTS for partitioned, cross-origin subresource
839         requests"
840         https://bugs.webkit.org/show_bug.cgi?id=178993
841         https://trac.webkit.org/changeset/224353
842
843 2017-11-02  John Wilander  <wilander@apple.com>
844
845         Ignore HSTS for partitioned, cross-origin subresource requests
846         https://bugs.webkit.org/show_bug.cgi?id=178993
847         <rdar://problem/34962462>
848
849         Reviewed by Brent Fulgham and Alex Christensen.
850
851         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
852         (downgradeRequest):
853             Convenience function to downgrade a request if
854             CFNetwork as already upgraded it during
855             canonicalization. This allows the rest of 
856             WebKit's processing to function, such as UIR
857             and mixed content blocking.
858         (updateIgnoreStrictTransportSecuritySettingIfNecessary):
859             Adds and removed the ignore request accordingly.
860         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
861             Now asks CFNetwork to ignore HSTS on resource loads we
862             partition cookies for.
863         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
864             Now asks CFNetwork to ignore HSTS on resource loads we
865             partition cookies for.
866
867 2017-11-02  Yousuke Kimoto  <yousuke.kimoto@sony.com>
868
869         [WinCairo] Add IPC files for wincairo webkit
870         https://bugs.webkit.org/show_bug.cgi?id=177919
871
872         Reviewed by Alex Christensen.
873
874         * Platform/IPC/Attachment.cpp:
875         * Platform/IPC/Attachment.h:
876         (IPC::Attachment::Attachment):
877         (IPC::Attachment::handle):
878         * Platform/IPC/Connection.h:
879         (IPC::Connection::identifierIsNull):
880         (IPC::Connection::sendWithReply):
881         * Platform/IPC/win/AttachmentWin.cpp: Added.
882         (IPC::Attachment::encode const):
883         (IPC::getDuplicatedHandle):
884         (IPC::Attachment::decode):
885         * Platform/IPC/win/ConnectionWin.cpp: Added.
886         (IPC::Connection::createServerAndClientIdentifiers):
887         (IPC::Connection::platformInitialize):
888         (IPC::Connection::platformInvalidate):
889         (IPC::Connection::readEventHandler):
890         (IPC::Connection::writeEventHandler):
891         (IPC::Connection::open):
892         (IPC::Connection::platformCanSendOutgoingMessages const):
893         (IPC::Connection::sendOutgoingMessage):
894         (IPC::Connection::willSendSyncMessage):
895         (IPC::Connection::didReceiveSyncReply):
896         * PlatformWin.cmake:
897
898 2017-11-02  Megan Gardner  <megan_gardner@apple.com>
899
900         Early out selection update when data is not present
901         https://bugs.webkit.org/show_bug.cgi?id=179084
902
903         Reviewed by Ryosuke Niwa.
904
905         We should early out of a selection update when we do not have the data that is necessary to make that
906         update. This mostly helps avoid debug asserts, but will be helpful with the selection changes that are
907         ongoing.
908
909         * UIProcess/ios/WKContentViewInteraction.mm:
910         (-[WKContentView _updateChangedSelection:]):
911
912 2017-11-02  Eric Carlson  <eric.carlson@apple.com>
913
914         [MediaStream] audioTrack.label is always empty on macOS
915         https://bugs.webkit.org/show_bug.cgi?id=179175
916         <rdar://problem/35315438>
917
918         Reviewed by Youenn Fablet.
919
920         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
921         (WebKit::UserMediaCaptureManager::createCaptureSource): Pass settings.label to Source constructor.
922
923 2017-11-02  Frederic Wang  <fwang@igalia.com>
924
925         Add references to bug 179167 in FIXME comments
926         https://bugs.webkit.org/show_bug.cgi?id=179168
927
928         Reviewed by Daniel Bates.
929
930         * Configurations/FeatureDefines.xcconfig:
931
932 2017-11-01  Jeremy Jones  <jeremyj@apple.com>
933
934         Implement WKFullscreenWindowController for iOS.
935         https://bugs.webkit.org/show_bug.cgi?id=178924
936         rdar://problem/34697120
937
938         Reviewed by Simon Fraser.
939
940         Plumb relevant calls through WKWebView and PageClientImplIOS.
941
942         This forms the base implementation for element fullscreen. This will animate an element into fullscreen and back to inline.
943         It does this by replacing the WKWebView with a placeholder image and presenting the WKWebView with a fullscreen view controller.
944         This also attempts to preserve UI state of the WKWebView when it is placed back inline.
945
946         To enable _WKFullscreenDelegate for iOS, this adds an iOS version of the delegate methods that passes WKWebView instead of NSView.
947         The iOS version of these functions are renamed to be more specific and disambiguate them from the video fullscreen delegate methods.
948
949         This also adds an image asset for the done button.
950
951         * Configurations/FeatureDefines.xcconfig:
952         * UIProcess/API/Cocoa/WKWebView.mm:
953         (-[WKWebView hasFullScreenWindowController]):
954         (-[WKWebView fullScreenWindowController]):
955         (-[WKWebView closeFullScreenWindowController]):
956         (-[WKWebView fullScreenPlaceholderView]):
957         * UIProcess/API/Cocoa/WKWebViewInternal.h:
958         * UIProcess/API/Cocoa/_WKFullscreenDelegate.h:
959         * UIProcess/Cocoa/FullscreenClient.h:
960         * UIProcess/Cocoa/FullscreenClient.mm:
961         (WebKit::FullscreenClient::FullscreenClient):
962         (WebKit::FullscreenClient::setDelegate):
963         (WebKit::FullscreenClient::willEnterFullscreen):
964         (WebKit::FullscreenClient::didEnterFullscreen):
965         (WebKit::FullscreenClient::willExitFullscreen):
966         (WebKit::FullscreenClient::didExitFullscreen):
967         * UIProcess/ios/PageClientImplIOS.mm:
968         (WebKit::PageClientImpl::closeFullScreenManager):
969         (WebKit::PageClientImpl::isFullScreen):
970         (WebKit::PageClientImpl::enterFullScreen):
971         (WebKit::PageClientImpl::exitFullScreen):
972         (WebKit::PageClientImpl::beganEnterFullScreen):
973         (WebKit::PageClientImpl::beganExitFullScreen):
974         * UIProcess/ios/WKContentView.mm:
975         * UIProcess/ios/WKFullScreenWindowControllerIOS.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKFullscreenDelegate.h.
976         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm: Added.
977         (WebKit::replaceViewWithView):
978         (WebKit::WKWebViewState::applyTo):
979         (WebKit::WKWebViewState::store):
980         (-[_WKTapDelgatingView setTarget:action:]):
981         (-[_WKTapDelgatingView hitTest:withEvent:]):
982         (-[_WKFullScreenViewController dealloc]):
983         (-[_WKFullScreenViewController viewWillTransitionToSize:withTransitionCoordinator:]):
984         (+[_WKFullScreenViewController configureView:withBackgroundFillOfColor:opacity:filter:]):
985         (-[_WKFullScreenViewController _updateTransparencyOfVisualEffectView:]):
986         (-[_WKFullScreenViewController createVisualEffectViewWithFrame:]):
987         (-[_WKFullScreenViewController loadView]):
988         (-[_WKFullScreenViewController viewWillAppear:]):
989         (-[_WKFullScreenViewController viewDidDisappear:]):
990         (-[_WKFullScreenViewController cancelAction:]):
991         (-[_WKFullScreenViewController hideCancelButton]):
992         (-[_WKFullScreenViewController showCancelButton]):
993         (-[_WKFullScreenViewController setTarget:action:]):
994         (-[_WKFullScreenViewController prefersStatusBarHidden]):
995         (-[WKFullscreenAnimationController transitionDuration:]):
996         (-[WKFullscreenAnimationController animateTransition:]):
997         (-[WKFullscreenAnimationController animationEnded:]):
998         (-[WKFullScreenWindowController initWithWebView:page:]):
999         (-[WKFullScreenWindowController dealloc]):
1000         (-[WKFullScreenWindowController isFullScreen]):
1001         (-[WKFullScreenWindowController webViewPlaceholder]):
1002         (-[WKFullScreenWindowController enterFullScreen]):
1003         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
1004         (-[WKFullScreenWindowController completedEnterFullScreen]):
1005         (-[WKFullScreenWindowController exitFullScreen]):
1006         (-[WKFullScreenWindowController requestExitFullScreen]):
1007         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
1008         (-[WKFullScreenWindowController completedExitFullScreen]):
1009         (-[WKFullScreenWindowController close]):
1010         (-[WKFullScreenWindowController _manager]):
1011         (-[WKFullScreenWindowController animationControllerForPresentedController:presentingController:sourceController:]):
1012         (-[WKFullScreenWindowController animationControllerForDismissedController:]):
1013         * WebKit.xcassets/Contents.json: Added.
1014         * WebKit.xcassets/Done.imageset/Contents.json: Added.
1015         * WebKit.xcassets/Done.imageset/Done.pdf: Added.
1016         * WebKit.xcodeproj/project.pbxproj:
1017         * WebProcess/FullScreen/WebFullScreenManager.cpp:
1018         (WebKit::WebFullScreenManager::willEnterFullScreen):
1019         (WebKit::WebFullScreenManager::willExitFullScreen):
1020
1021 2017-11-01  Daniel Bates  <dabates@apple.com>
1022
1023         XMLHttpRequest should not sniff content encoding
1024         https://bugs.webkit.org/show_bug.cgi?id=175597
1025         <rdar://problem/34912624>
1026
1027         Reviewed by Alex Christensen.
1028
1029         Fixes an issue where the body of an HTTP response with headers "Content-Type: application/octet-stream" and
1030         "Content-Encoding: gzip" associated with an XHR request to a .gz file would not be automatically gzipped
1031         decompressed. Specifically, such a response would be treated analogous to a response with headers
1032         "Content-Type: application/gzip" and "Content-Encoding: identity". This behavior does not conform to the
1033         behavior of the Content-Encoding header as defined in the HTTP 1.1 and later specs. Moreover this behavior
1034         breaks the Epic Zen Garden demo: <https://s3.amazonaws.com/mozilla-games/ZenGarden/EpicZenGarden.html>.
1035
1036         On macOS 10.13.2 opt out of content encoding sniffing when making an XHR request. We likely can
1037         selectively opt out of content encoding sniffing for other network requests. This will be done
1038         in subsequent commits to make it straightforward to identify site breakage (if any).
1039
1040         * NetworkProcess/Downloads/Download.cpp:
1041         (WebKit::Download::start): Enable content encoding sniff to match existing behavior.
1042         (WebKit::Download::startWithHandle): Ditto.
1043         * NetworkProcess/NetworkDataTask.cpp:
1044         (WebKit::NetworkDataTask::create): Pass through the content encoding sniffing policy.
1045         * NetworkProcess/NetworkLoad.cpp:
1046         (WebKit::NetworkLoad::NetworkLoad): Ditto.
1047         * NetworkProcess/NetworkLoadParameters.h:
1048         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1049         (WebKit::NetworkResourceLoadParameters::encode const): Encode content encoding sniffing policy.
1050         (WebKit::NetworkResourceLoadParameters::decode): Decode content encoding sniffing policy.
1051         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
1052         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad): Enable content encoding sniff to match existing
1053         behavior. We should look to disable content encoding sniffing in a subsequent change.
1054         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1055         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1056         (WebKit::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded): Added helper function
1057         to apply sniffing policies and bind request to interface, if applicable.
1058         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Modified to take the content encoding sniffing
1059         policy. Calls applySniffingPoliciesAndBindRequestToInferfaceIfNeeded() to apply this policy. Also use
1060         convenience function URL::isLocalFile() to determine if the URL is a file URL.
1061         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1062         (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup): Pass through the content encoding sniffing policy.
1063         * NetworkProcess/soup/NetworkDataTaskSoup.h:
1064         * WebProcess/Network/WebLoaderStrategy.cpp:
1065         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): Pass through the content encoding sniffing policy.
1066         (WebKit::WebLoaderStrategy::loadResourceSynchronously): Enable content encoding sniff to match existing
1067         behavior.
1068
1069 2017-11-01  Brady Eidson  <beidson@apple.com>
1070
1071         Plumbing for handling SW scripts failing to evaluate
1072         https://bugs.webkit.org/show_bug.cgi?id=178926
1073
1074         Reviewed by Chris Dumez.
1075
1076         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1077         (WebKit::WebSWServerConnection::updateServiceWorkerContext):
1078         (WebKit::WebSWServerConnection::setContextConnection):
1079         (WebKit::WebSWServerConnection::startServiceWorkerContext): Deleted.
1080         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1081
1082         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1083         (WebKit::WebSWContextManagerConnection::updateServiceWorker):
1084         (WebKit::WebSWContextManagerConnection::serviceWorkerStartedWithMessage):
1085         (WebKit::WebSWContextManagerConnection::startServiceWorker): Deleted.
1086         * WebProcess/Storage/WebSWContextManagerConnection.h:
1087         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1088
1089 2017-11-01  Frederic Wang  <fwang@igalia.com>
1090
1091         Make iOS Find UI reveal matches in scrollable elements
1092         https://bugs.webkit.org/show_bug.cgi?id=178789
1093
1094         Reviewed by Tim Horton.
1095
1096         * WebProcess/WebPage/ios/FindControllerIOS.mm:
1097         (WebKit::FindController::didFindString): Reveal selection up to the main frame. The main frame
1098         is handled by the SmartMagnificationController.
1099
1100 2017-11-01  Michael Catanzaro  <mcatanzaro@igalia.com>
1101
1102         REGRESSION(r224192): [WPE] Fix WebEventFactory::createWebWheelEvent
1103         https://bugs.webkit.org/show_bug.cgi?id=179098
1104
1105         Reviewed by Sam Weinig.
1106
1107         * Shared/wpe/WebEventFactory.cpp:
1108         (WebKit::WebEventFactory::createWebWheelEvent):
1109
1110 2017-10-31  Tim Horton  <timothy_horton@apple.com>
1111
1112         Clean up some drag and drop feature flags
1113         https://bugs.webkit.org/show_bug.cgi?id=179082
1114
1115         Reviewed by Simon Fraser.
1116
1117         * Configurations/FeatureDefines.xcconfig:
1118
1119 2017-10-31  Wenson Hsieh  <wenson_hsieh@apple.com>
1120
1121         Followup to r224238: API::Attachment should generate a _WKAttachment ObjC wrapper
1122         https://bugs.webkit.org/show_bug.cgi?id=179080
1123
1124         Reviewed by Tim Horton.
1125
1126         Fixes a failing API test. The new Attachment object type added in r224238 was not actually being handled in
1127         Object::newObject, so a plain WKObject Objective C wrapper was being created; fix this by allocating a new
1128         _WKAttachment object for Type::Attachment.
1129
1130         * Shared/Cocoa/APIObject.mm:
1131         (API::Object::newObject):
1132
1133 2017-10-31  Tim Horton  <timothy_horton@apple.com>
1134
1135         Fix up some content filtering feature flags
1136         https://bugs.webkit.org/show_bug.cgi?id=179079
1137
1138         Reviewed by Simon Fraser.
1139
1140         * Configurations/FeatureDefines.xcconfig:
1141
1142 2017-10-31  Youenn Fablet  <youenn@apple.com>
1143
1144         rwt should allow service worker to load localhost HTTPS resources with any certificate
1145         https://bugs.webkit.org/show_bug.cgi?id=179018
1146
1147         Reviewed by Chris Dumez.
1148
1149         Allowing ServiceWorkerProcessProxy to handle authentication challenge.
1150         Temporarily adding a boolean flag through WebProcessPool to lower the SSL certificate verifications for service workers.
1151         This allows reducing flakiness in our layout tests for rwt.
1152         Future work should be done to expose a correct API for the application level to handle authentication challenges properly.
1153
1154         * UIProcess/API/C/WKContext.cpp:
1155         (WKContextSetAllowsAnySSLCertificateForServiceWorkerTesting):
1156         * UIProcess/API/C/WKContextPrivate.h:
1157         * UIProcess/API/Cocoa/WKProcessPool.mm:
1158         (-[WKProcessPool _setAllowsAnySSLCertificateForServiceWorker:]):
1159         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1160         * UIProcess/Network/NetworkProcessProxy.cpp:
1161         (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
1162         (WebKit::NetworkProcessProxy::canAuthenticateAgainstProtectionSpace):
1163         * UIProcess/ServiceWorkerProcessProxy.cpp:
1164         (WebKit::ServiceWorkerProcessProxy::didReceiveAuthenticationChallenge):
1165         * UIProcess/ServiceWorkerProcessProxy.h:
1166         * UIProcess/WebProcessPool.h:
1167
1168 2017-10-31  Joseph Pecoraro  <pecoraro@apple.com>
1169
1170         Web Inspector: UIProcess ASSERT in ~RemoteWebInspectorProxy when InspectorProcess crashes
1171         https://bugs.webkit.org/show_bug.cgi?id=179044
1172
1173         Reviewed by Alex Christensen.
1174
1175         * UIProcess/RemoteWebInspectorProxy.cpp:
1176         (WebKit::RemoteWebInspectorProxy::frontendDidClose):
1177         Add a protector to keep the proxy alive for the duration of this method.
1178
1179 2017-10-31  Youenn Fablet  <youenn@apple.com>
1180
1181         Crash in:  com.apple.WebKit: WebKit::CacheStorage::Caches::initializeSize(WTF::Function<void (std::optional<WebCore::DOMCacheEngine::Error>&&)>&&) + 30 (CacheStorageEngineCaches.cpp:163)
1182         https://bugs.webkit.org/show_bug.cgi?id=179037
1183
1184         Reviewed by Chris Dumez.
1185
1186         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1187         (WebKit::CacheStorage::Caches::initializeSize): the storage backend may be cleared when clearing caches by the UI Process.
1188         Returning early in that case. A web application will typically fail to open a cache in this case.
1189         On retry, the cache should be opened.
1190
1191 2017-10-31  Wenson Hsieh  <wenson_hsieh@apple.com>
1192
1193         [Attachment Support] Implement WKWebView SPI for inserting attachment elements
1194         https://bugs.webkit.org/show_bug.cgi?id=179013
1195         <rdar://problem/35249668>
1196
1197         Reviewed by Tim Horton.
1198
1199         Adds native SPI to insert attachment elements given a filename, an optional MIME type, and a data blob. See
1200         change-by-change comments below for more detail. Covered by a new API test.
1201
1202         * PlatformMac.cmake:
1203         * Shared/API/APIObject.h:
1204         * Shared/API/Cocoa/WebKitPrivate.h:
1205         * UIProcess/API/APIAttachment.cpp: Copied from Source/WebKit/Shared/API/Cocoa/WebKitPrivate.h.
1206         (API::Attachment::create):
1207         (API::Attachment::Attachment):
1208         (API::Attachment::~Attachment):
1209
1210         Introduce API::Attachment, which represents a platform-agnostic Attachment.
1211
1212         * UIProcess/API/APIAttachment.h: Copied from Source/WebKit/Shared/API/Cocoa/WebKitPrivate.h.
1213         * UIProcess/API/Cocoa/WKWebView.mm:
1214         (-[WKWebView _insertAttachmentWithFilename:contentType:data:options:completion:]):
1215
1216         Adds support for inserting a new attachment element. Calls out to WebPageProxy to insert the attachment from the
1217         given data blob, and creates a new API-object-backed _WKAttachment.
1218
1219         (-[WKWebView _executeEditCommand:argument:completion:]):
1220
1221         Support passing in a nil completion block.
1222
1223         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1224         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1225         * UIProcess/API/Cocoa/_WKAttachment.h: Copied from Source/WebKit/Shared/API/Cocoa/WebKitPrivate.h.
1226         * UIProcess/API/Cocoa/_WKAttachment.mm: Copied from Source/WebCore/html/HTMLAttachmentElement.h.
1227
1228         Introduces _WKAttachment, an Objective C wrapper around the API::Attachment.
1229
1230         (-[_WKAttachment _apiObject]):
1231         (-[_WKAttachment isEqual:]):
1232         (-[_WKAttachment uniqueIdentifier]):
1233         (-[_WKAttachment hash]):
1234
1235         Add _WKAttachment, a WebKit SPI object that wraps an attachment element unique identifier. Also, allow
1236         _WKAttachment to be used as a hashable NSDictionary key.
1237
1238         (-[_WKAttachment description]):
1239         * UIProcess/API/Cocoa/_WKAttachmentInternal.h: Copied from Source/WebKit/Shared/API/Cocoa/WebKitPrivate.h.
1240         (API::wrapper):
1241         * UIProcess/WebPageProxy.cpp:
1242         (WebKit::WebPageProxy::insertAttachment):
1243
1244         Implement IPC support for inserting an attachment.
1245
1246         * UIProcess/WebPageProxy.h:
1247         * WebKit.xcodeproj/project.pbxproj:
1248         * WebProcess/WebPage/WebPage.cpp:
1249         (WebKit::WebPage::insertAttachment):
1250         * WebProcess/WebPage/WebPage.h:
1251         * WebProcess/WebPage/WebPage.messages.in:
1252
1253 2017-10-31  Alex Christensen  <achristensen@webkit.org>
1254
1255         Fix custom header field setting with reloads and asynchronous navigation action policy decisions
1256         https://bugs.webkit.org/show_bug.cgi?id=179064
1257
1258         Reviewed by Tim Horton.
1259
1260         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1261         (WebKit::WebFrameLoaderClient::applyToDocumentLoader):
1262         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1263         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1264         * WebProcess/WebPage/WebFrame.cpp:
1265         (WebKit::WebFrame::didReceivePolicyDecision):
1266         * WebProcess/WebPage/WebFrame.h:
1267         * WebProcess/WebPage/WebPage.cpp:
1268         (WebKit::WebPage::didReceivePolicyDecision):
1269
1270 2017-10-31  Carlos Garcia Campos  <cgarcia@igalia.com>
1271
1272         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.19.1 release.
1273
1274         * gtk/NEWS: Add release notes for 2.19.1.
1275
1276 2017-10-31  Carlos Garcia Campos  <cgarcia@igalia.com>
1277
1278         Unreviewed. Fix GTK+ make distcheck.
1279
1280         Include WebCore/TextEncodingRegistry.h to ensure the forwarding header is generated.
1281
1282         * UIProcess/API/glib/WebKitSettings.cpp:
1283
1284 2017-10-31  Commit Queue  <commit-queue@webkit.org>
1285
1286         Unreviewed, rolling out r223884.
1287         https://bugs.webkit.org/show_bug.cgi?id=179055
1288
1289         It broke GTK+ make distcheck (Requested by KaL on #webkit).
1290
1291         Reverted changeset:
1292
1293         "[GTK][WPE] generate-forwarding-headers.pl should also scan
1294         derived sources in WebKit framework"
1295         https://bugs.webkit.org/show_bug.cgi?id=178579
1296         https://trac.webkit.org/changeset/223884
1297
1298 2017-10-30  Fujii Hironori  <Hironori.Fujii@sony.com>
1299
1300         Use LazyNeverDestroyed instead of DEFINE_GLOBAL for XMLNames, HTMLNames, MathMLNames and SVGNames
1301         https://bugs.webkit.org/show_bug.cgi?id=175118
1302
1303         Reviewed by Alex Christensen.
1304
1305         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLPrivate.cpp:
1306         (WebKit::wrap):
1307
1308 2017-10-27  Megan Gardner  <megan_gardner@apple.com>
1309
1310         Correctly determine affinity when inserting text via Keyboard Suggestions
1311         https://bugs.webkit.org/show_bug.cgi?id=178969
1312
1313         Reviewed by Ryosuke Niwa.
1314
1315         Use the logic of VisiblePosition to correctly determine cursor affinity. We were
1316         defaulting to upstream, but that in incorrect and resulted in hitting asserts that
1317         we should not. This should give us the correct affinity in all cases.
1318
1319         * WebProcess/WebPage/ios/WebPageIOS.mm:
1320         (WebKit::WebPage::syncApplyAutocorrection):
1321
1322 2017-10-30  Commit Queue  <commit-queue@webkit.org>
1323
1324         Unreviewed, rolling out r224078.
1325         https://bugs.webkit.org/show_bug.cgi?id=179026
1326
1327         MotionMark regression (Requested by shallawa on #webkit).
1328
1329         Reverted changeset:
1330
1331         "When navigating back to a page, compositing layers may not
1332         use accelerated drawing"
1333         https://bugs.webkit.org/show_bug.cgi?id=178749
1334         https://trac.webkit.org/changeset/224078
1335
1336 2017-10-30  Sam Weinig  <sam@webkit.org>
1337
1338         [Setting] Only expose experimental features that are compiled in
1339         https://bugs.webkit.org/show_bug.cgi?id=179023
1340
1341         Reviewed by Tim Horton.
1342
1343         * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb:
1344         
1345             Update template to conditionally expose experimental features based on their
1346             'condition' option in WebPreferences.yaml
1347
1348 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
1349
1350         [WPE] Fix build warnings
1351         https://bugs.webkit.org/show_bug.cgi?id=178899
1352
1353         Reviewed by Carlos Alberto Lopez Perez.
1354
1355         * PlatformWPE.cmake:
1356
1357 2017-10-30  Sam Weinig  <sam@webkit.org>
1358
1359         [Settings] Replace macro driven experimental features code with generated code
1360         https://bugs.webkit.org/show_bug.cgi?id=178994
1361
1362         Reviewed by Simon Fraser.
1363
1364         As a first step toward allowing experimental features to vary based on compile
1365         time flags, replace the macro driven implementation of the WebPreferences part
1366         of experimental features, with one generated from a template file.
1367
1368         * CMakeLists.txt:
1369         * DerivedSources.make:
1370         * Scripts/GeneratePreferences.rb:
1371         * WebKit.xcodeproj/project.pbxproj:
1372
1373             Generate the new template.
1374         
1375         * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb: Added.
1376         * UIProcess/WebPreferences.cpp:
1377         (WebKit::createExperimentalFeaturesVector): Deleted.
1378         (WebKit::WebPreferences::experimentalFeatures): Deleted.
1379         (WebKit::WebPreferences::isEnabledForFeature const): Deleted.
1380         (WebKit::WebPreferences::setEnabledForFeature): Deleted.
1381         (WebKit::WebPreferences::enableAllExperimentalFeatures): Deleted.
1382         
1383             Replace macro implementation with template generated one.
1384
1385 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
1386
1387         [WPE] Build more files under WebCore as unified sources and get rid of WebCorePlatformWPE build target
1388         https://bugs.webkit.org/show_bug.cgi?id=178964
1389
1390         Reviewed by Carlos Alberto Lopez Perez.
1391
1392         * PlatformWPE.cmake:
1393
1394 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
1395
1396         [WPE][GTK] Expose availability of certain editing commands in WebKitEditorState
1397         https://bugs.webkit.org/show_bug.cgi?id=168219
1398
1399         Reviewed by Ryosuke Niwa.
1400
1401         Expose canCut, canCopy, canPaste, canUndo, and canRedo in EditorState::PostLayouData.
1402
1403         Add corresponding new WPE/GTK API.
1404
1405         Remove allowsCopy from WebKitTestResultData. It's unused, does not work correctly in all
1406         circumstances, and irritates Ryosuke.
1407
1408         Also, remove a bunch of #ifs guarding post layout data, since it's now used on all ports.
1409
1410         * Shared/EditorState.cpp:
1411         (WebKit::EditorState::encode const):
1412         (WebKit::EditorState::decode):
1413         (WebKit::EditorState::PostLayoutData::encode const):
1414         (WebKit::EditorState::PostLayoutData::decode):
1415         * Shared/EditorState.h:
1416         (WebKit::EditorState::postLayoutData const const):
1417         * Shared/WebHitTestResultData.cpp:
1418         (WebKit::WebHitTestResultData::WebHitTestResultData):
1419         (WebKit::WebHitTestResultData::encode const):
1420         (WebKit::WebHitTestResultData::decode):
1421         * Shared/WebHitTestResultData.h:
1422         * UIProcess/API/APIHitTestResult.h:
1423         (API::HitTestResult::allowsCopy const): Deleted.
1424         * UIProcess/API/glib/WebKitEditorState.cpp:
1425         (webkitEditorStateChanged):
1426         (webkit_editor_state_is_cut_available):
1427         (webkit_editor_state_is_copy_available):
1428         (webkit_editor_state_is_paste_available):
1429         (webkit_editor_state_is_undo_available):
1430         (webkit_editor_state_is_redo_available):
1431         * UIProcess/API/glib/WebKitWebView.cpp:
1432         (webkit_web_view_can_execute_editing_command):
1433         * UIProcess/API/gtk/WebKitEditorState.h:
1434         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1435         * UIProcess/API/wpe/WebKitEditorState.h:
1436         * WebProcess/WebPage/WebPage.cpp:
1437         (WebKit::WebPage::editorState const):
1438         * WebProcess/WebPage/mac/WebPageMac.mm:
1439         (WebKit::WebPage::performImmediateActionHitTestAtLocation):
1440
1441 2017-10-27  Sam Weinig  <sam@webkit.org>
1442
1443         [Settings] Generate more of the WebKit preferences code
1444         https://bugs.webkit.org/show_bug.cgi?id=178945
1445
1446         Reviewed by Chris Dumez.
1447
1448         Generate WebPreferencesKeys.{h,cpp} and WebPreferencesStoreDefaultsMap.cpp
1449
1450         * CMakeLists.txt:
1451         * DerivedSources.make:
1452         * WebKit.xcodeproj/project.pbxproj:
1453         * Scripts/GeneratePreferences.rb:
1454         
1455             Generate new files.
1456         
1457         * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
1458         
1459             Update include.
1460         
1461         * Scripts/PreferencesTemplates/WebPreferencesKeys.cpp.erb: Added.
1462         * Scripts/PreferencesTemplates/WebPreferencesKeys.h.erb: Added.
1463         * Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb: Added.
1464
1465             Add template files for new generated files.
1466
1467         * Shared/WebPreferencesDefaultValues.h: Copied from Source/WebKit/Shared/WebPreferencesDefinitionsBase.h.
1468         * Shared/WebPreferencesDefinitionsBase.h:
1469         
1470             Renamed WebPreferencesDefinitionsBase.h to WebPreferencesDefaultValues.h to better indicate what it is.
1471         
1472         * Shared/WebPreferencesKeys.cpp: Removed.
1473         * Shared/WebPreferencesKeys.h: Removed.
1474         
1475             Replaced with generated versions.
1476
1477         * Shared/WebPreferencesStore.cpp:
1478         (WebKit::defaults): Deleted.
1479         * Shared/WebPreferencesStore.h:
1480         
1481             Replace macro driven defaults map with generated WebPreferencesStoreDefaultsMap.cpp.
1482
1483 2017-10-28  Chris Dumez  <cdumez@apple.com>
1484
1485         self.ExtendableEvent / Client / Clients / WindowClient do not exist in a Service Worker
1486         https://bugs.webkit.org/show_bug.cgi?id=178976
1487
1488         Reviewed by Sam Weinig.
1489
1490         Actually enable the Service Worker RuntimeEnabledFeature in the Service Worker
1491         WebProcess.
1492
1493         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1494         (WebKit::WebSWContextManagerConnection::updatePreferences):
1495
1496 2017-10-28  Joseph Pecoraro  <pecoraro@apple.com>
1497
1498         Make postprocess-framework-headers.sh a little easier to read
1499         https://bugs.webkit.org/show_bug.cgi?id=178971
1500
1501         Reviewed by Sam Weinig.
1502
1503         * mac/postprocess-framework-headers.sh:
1504
1505 2017-10-27  Daniel Bates  <dabates@apple.com>
1506
1507         Attempt to fix the Apple El Capitan build following <https://trac.webkit.org/changeset/224134>
1508         (https://bugs.webkit.org/show_bug.cgi?id=178919)
1509
1510         Move definition of NetworkLoad::isAllowedToAskUserForCredentials() outside of USE(NETWORK_SESSION)-guarded section.
1511
1512         * NetworkProcess/NetworkLoad.cpp:
1513         (WebKit::NetworkLoad::isAllowedToAskUserForCredentials const):
1514
1515 2017-10-27  Daniel Bates  <dabates@apple.com>
1516
1517         Only allow non-mixed content protected subresources to ask for credentials
1518         https://bugs.webkit.org/show_bug.cgi?id=178919
1519         <rdar://problem/35015245>
1520
1521         Reviewed by Alex Christensen.
1522
1523         Only allow non-mixed content protected subresources to ask for credentials. It is not meaningful
1524         to allow protected mixed-content subresources to ask for credentials.
1525
1526         * NetworkProcess/Downloads/PendingDownload.cpp:
1527         (WebKit::PendingDownload::PendingDownload): Initialize m_isAllowedToAskUserForCredentials based on
1528         the specified resource load parameters or NetworkLoad object.
1529         * NetworkProcess/Downloads/PendingDownload.h: Add override for NetworkLoadClient::isAllowedToAskUserForCredentials().
1530         * NetworkProcess/NetworkLoad.cpp:
1531         (WebKit::NetworkLoad::isAllowedToAskUserForCredentials const): Added.
1532         (WebKit::NetworkLoad::completeAuthenticationChallenge): Ask NetworkLoadClient whether the load is
1533         allowed to prompt for credentials.
1534         (WebKit::NetworkLoad::didReceiveAuthenticationChallenge): Ditto.
1535         * NetworkProcess/NetworkLoad.h:
1536         * NetworkProcess/NetworkLoadClient.h:
1537         * NetworkProcess/NetworkResourceLoader.cpp:
1538         (WebKit::NetworkResourceLoader::NetworkResourceLoader): Initialize m_isAllowedToAskUserForCredentials
1539         based on the specified resource load parameters.
1540         (WebKit::NetworkResourceLoader::willSendRedirectedRequest): We do not support prompting for credentials
1541         for synchronous loads.
1542         (WebKit::NetworkResourceLoader::continueWillSendRequest): Modified to take an argument as to whether the
1543         load is allowed to ask the user for credentials and updates state.
1544         * NetworkProcess/NetworkResourceLoader.h:
1545         * NetworkProcess/NetworkResourceLoader.messages.in: Modified message ContinueWillSendRequest to take a
1546         boolean as to whether the load is allowed to ask the user for credentials.
1547         * NetworkProcess/PreconnectTask.h: Override NetworkLoadClient::isAllowedToAskUserForCredentials()
1548         such that we never ask for credentials. This matches our current behavior.
1549         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h: Ditto.
1550         * WebProcess/Network/WebResourceLoader.cpp:
1551         (WebKit::WebResourceLoader::willSendRequest): Query ResourceLoader as to whether the load is allowed to
1552         ask the user for credentials and pass this state to NetworkResourceLoader.
1553
1554 2017-10-27  Adrian Perez de Castro  <aperez@igalia.com>
1555
1556         [GTK][CMake] Incorrect conditional check when adding build dir to GIR runtime library path
1557         https://bugs.webkit.org/show_bug.cgi?id=178936
1558
1559         Reviewed by Michael Catanzaro.
1560
1561         * PlatformGTK.cmake: Fix spelling of variable used in conditional.
1562
1563 2017-10-27  Chris Dumez  <cdumez@apple.com>
1564
1565         Add initial support for serviceWorkerClient.postMessage()
1566         https://bugs.webkit.org/show_bug.cgi?id=178794
1567
1568         Reviewed by Youenn Fablet.
1569
1570         Add initial support for serviceWorkerClient.postMessage():
1571         - https://w3c.github.io/ServiceWorker/#client-postmessage
1572
1573         It is now possible to do bi-directional communication with a service worker
1574         via postMessage().
1575
1576         * Shared/WebCoreArgumentCoders.cpp:
1577         (IPC::ArgumentCoder<ServiceWorkerClientIdentifier>::encode):
1578         (IPC::ArgumentCoder<ServiceWorkerClientIdentifier>::decode):
1579         * Shared/WebCoreArgumentCoders.h:
1580         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1581         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
1582         (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient):
1583         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1584         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1585         * StorageProcess/StorageProcess.cpp:
1586         (WebKit::StorageProcess::postMessageToServiceWorkerClient):
1587         * StorageProcess/StorageProcess.h:
1588         * StorageProcess/StorageProcess.messages.in:
1589         * WebProcess/Storage/WebSWClientConnection.cpp:
1590         (WebKit::WebSWClientConnection::postMessageToServiceWorkerGlobalScope):
1591         (WebKit::WebSWClientConnection::postMessageToServiceWorkerClient):
1592         * WebProcess/Storage/WebSWClientConnection.h:
1593         * WebProcess/Storage/WebSWClientConnection.messages.in:
1594         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1595         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerGlobalScope):
1596         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerClient):
1597         * WebProcess/Storage/WebSWContextManagerConnection.h:
1598         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1599
1600 2017-10-27  David Kilzer  <ddkilzer@apple.com>
1601
1602         REGRESSION (r224077): DeprecatedGlobalSettings::setAVKitEnabled() not protected by HAVE(AVKIT)
1603
1604         Unreviewed build fix.
1605
1606         * WebProcess/WebPage/WebPage.cpp:
1607         (WebKit::WebPage::updatePreferences): Fix build.
1608
1609 2017-10-26  Jeremy Jones  <jeremyj@apple.com>
1610
1611         Implement seek tolerance methods in WebAVPlayerController.
1612         https://bugs.webkit.org/show_bug.cgi?id=178838
1613         rdar://problem/33781777
1614
1615         Reviewed by Eric Carlson.
1616
1617         This implementes additional methods on WebAVPlayerController that allows AVKit more control over seeking.
1618
1619         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
1620         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
1621         (WebKit::PlaybackSessionModelContext::seekToTime):
1622         (WebKit::PlaybackSessionManagerProxy::seekToTime):
1623         * WebProcess/cocoa/PlaybackSessionManager.h:
1624         * WebProcess/cocoa/PlaybackSessionManager.messages.in:
1625         * WebProcess/cocoa/PlaybackSessionManager.mm:
1626         (WebKit::PlaybackSessionManager::seekToTime):
1627
1628 2017-10-26  Brian Burg  <bburg@apple.com>
1629
1630         Web Automation: denying user permission for getUserMedia doesn't work
1631         https://bugs.webkit.org/show_bug.cgi?id=178895
1632
1633         Reviewed by Youenn Fablet.
1634
1635         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1636         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
1637         The ordering of special cases is incorrect. Safari configures its automation views to
1638         allow mock devices and never prompt for them. These checks were before the check for
1639         the automation session's getUserMedia permission. Switch these checks.
1640
1641         Also change the deny reason so that subsequent requests are also denied. This matches
1642         behavior when a user denies a permission request on a real dialog. With this change,
1643         the DOM error changes from SecurityError to NotAllowedError, which makes more sense.
1644
1645 2017-10-26  Michael Catanzaro  <mcatanzaro@igalia.com>
1646
1647         Unreviewed, fix GCC warning spam after r224077
1648         https://bugs.webkit.org/show_bug.cgi?id=178823
1649
1650         Need to leave a blank line at the bottom of the file.
1651
1652         * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
1653
1654 2017-10-25  Simon Fraser  <simon.fraser@apple.com>
1655
1656         When navigating back to a page, compositing layers may not use accelerated drawing
1657         https://bugs.webkit.org/show_bug.cgi?id=178749
1658         rdar://problem/35158946
1659
1660         Reviewed by Dean Jackson.
1661
1662         Avoid assertions when a test enables accelerated drawing (which we can't support
1663         in the iOS simulator).
1664
1665         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
1666         (WebKit::RemoteLayerBackingStore::ensureBackingStore):
1667
1668 2017-10-26  Sam Weinig  <sam@webkit.org>
1669
1670         [Settings] Generate the bulk of WebPage::updatePreferences(...)
1671         https://bugs.webkit.org/show_bug.cgi?id=178823
1672
1673         Reviewed by Tim Horton.
1674
1675         * CMakeLists.txt:
1676         * DerivedSources.make:
1677         * WebKit.xcodeproj/project.pbxproj:
1678
1679             Add new file generation.
1680
1681         * Scripts/GeneratePreferences.rb:
1682         
1683             Replace 'webkitOnly' boolean option with a new 'webcoreBinding' option.
1684             'webcoreBinding' supports the following values:
1685                 - none (same as webkit only)
1686                 - custom (means that you do bind to a webcore concept, but currently it must
1687                   be done in a custom manner)
1688                 - DeprecatedGlobalSettings (binds to a DeprecatedGlobalSettings setting)
1689                 - RuntimeEnabledFeatures (binds to a RuntimeEnabledFeatures setting)
1690             If 'webcoreBinding' is not provided, the preference binds to WebCore Setting
1691             of either the same name or the override name provided by the new 'webcoreName'
1692             option (we should try to remove the need for 'webcoreName' by unifying with 
1693             WebCore on preference/setting naming).
1694             
1695             A 'condition' option was also added to indicate that the preference is only available
1696             when that macro condition is true.
1697             
1698             Since we are generating most of WebPage::updatePreferences, we can simplify the
1699             macros in WebPreferencesDefinitions.h to only have normal/debug/experimental variants
1700             and remove the need for per-type macros, which were only used in WebPage::updatePreferences.
1701         
1702         * Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb: Added.
1703         
1704             Generates bindings from WebPreferences to WebCore::Settings/DeprecatedGlobalSettings/RuntimeEnabledFeatures.
1705             Does not generate a binding if the 'webcoreBinding' option is set to either 'none' or 'custom'.
1706         
1707         * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
1708     
1709             Simplify down to just normal/debug/experimental macros.
1710         
1711         * Shared/WebPreferences.yaml:
1712         
1713             Annotate perferences with new optional 'webcoreBinding', 'webcoreName', and 'condition'
1714             options.
1715         
1716         * WebProcess/WebPage/WebPage.cpp:
1717         (WebKit::WebPage::updatePreferences):
1718         
1719             Replace a ton of hand written preference to settings bindings with a call to updatePreferencesGenerated().
1720         
1721         * WebProcess/WebPage/WebPage.h:
1722         
1723             Add declaration of updatePreferencesGenerated, remove platformPreferencesDidChange.
1724
1725         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
1726         (WebKit::WebPage::platformPreferencesDidChange): Deleted.
1727         * WebProcess/WebPage/ios/WebPageIOS.mm:
1728         (WebKit::WebPage::platformPreferencesDidChange): Deleted.
1729         * WebProcess/WebPage/mac/WebPageMac.mm:
1730         (WebKit::WebPage::platformPreferencesDidChange): Deleted.
1731         * WebProcess/WebPage/win/WebPageWin.cpp:
1732         (WebKit::WebPage::platformPreferencesDidChange): Deleted.
1733         * WebProcess/WebPage/wpe/WebPageWPE.cpp:
1734         (WebKit::WebPage::platformPreferencesDidChange): Deleted.
1735         
1736             Remove all the empty platformPreferencesDidChange functions.
1737
1738 2017-10-26  Alex Christensen  <achristensen@webkit.org>
1739
1740         Move WKWebViewConfiguration validation to WKWebView construction
1741         https://bugs.webkit.org/show_bug.cgi?id=178840
1742
1743         Reviewed by Tim Horton.
1744         
1745         I'm trying to remove WKWebViewConfigurationInternal methods so I can make WKWebViewConfiguration
1746         a wrapper around an APIObject like all the other API objects.  A small step towards making this easier
1747         is to remove the unnecessary method _validate and move its logic to its one callsite.  I added an API test
1748         that ensures no change in behavior.
1749
1750         * UIProcess/API/Cocoa/WKWebView.mm:
1751         (-[WKWebView _initializeWithConfiguration:]):
1752         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1753         (-[WKWebViewConfiguration _validate]): Deleted.
1754         * UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h:
1755
1756 2017-10-26  Megan Gardner  <megan_gardner@apple.com>
1757
1758         Remove unneeded block selection calculation code
1759         https://bugs.webkit.org/show_bug.cgi?id=178889
1760
1761         Reviewed by Tim Horton.
1762
1763         Removing more block selection code. Much of this should have been removed
1764         before, as the only things that were using these functions were removed in the
1765         last patch. Also remove the code decided if you should move to block mode or not,
1766         as the answer now is always NO.
1767
1768         * WebProcess/WebPage/WebPage.h:
1769         * WebProcess/WebPage/ios/WebPageIOS.mm:
1770         (WebKit::WebPage::updateSelectionWithTouches):
1771         (WebKit::WebPage::rangeForBlockAtPoint): Deleted.
1772         (WebKit::distanceBetweenRectsForPosition): Deleted.
1773         (WebKit::rectsEssentiallyTheSame): Deleted.
1774         (WebKit::unionDOMRanges): Deleted.
1775         (WebKit::computeEdgeCenter): Deleted.
1776         (WebKit::WebPage::expandedRangeFromHandle): Deleted.
1777         (WebKit::WebPage::contractedRangeFromHandle): Deleted.
1778         (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle): Deleted.
1779         (WebKit::WebPage::switchToBlockSelectionAtPoint): Deleted.
1780         (WebKit::WebPage::shouldSwitchToBlockModeForHandle): Deleted.
1781
1782 2017-10-26  Jeremy Jones  <jeremyj@apple.com>
1783
1784         Call setFullscreenClient on iOS.
1785         https://bugs.webkit.org/show_bug.cgi?id=178089
1786
1787         Reviewed by Simon Fraser.
1788
1789         This was only being set for MacOS.
1790
1791         * UIProcess/ios/WKContentView.mm:
1792         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
1793
1794 2017-10-26  Eric Carlson  <eric.carlson@apple.com>
1795
1796         NowPlayingInfo should contain a unique identifier
1797         https://bugs.webkit.org/show_bug.cgi?id=178872
1798
1799         Reviewed by Jer Noble.
1800
1801         * UIProcess/API/Cocoa/WKWebView.mm:
1802         (-[WKWebView _requestActiveNowPlayingSessionInfo:]): Take a completion handler.
1803         (-[WKWebView _requestActiveNowPlayingSessionInfo]): Deleted.
1804         (-[WKWebView _handleActiveNowPlayingSessionInfoResponse:title:duration:elapsedTime:]): Deleted.
1805         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1806         * UIProcess/PageClient.h:
1807
1808         * UIProcess/WebPageProxy.cpp:
1809         (WebKit::WebPageProxy::requestActiveNowPlayingSessionInfo): Ditto.
1810         (WebKit::WebPageProxy::nowPlayingInfoCallback): Lookup and call completion handler.
1811         (WebKit::WebPageProxy::handleActiveNowPlayingSessionInfoResponse const): Deleted.
1812         * UIProcess/WebPageProxy.h:
1813         * UIProcess/WebPageProxy.messages.in:
1814
1815         * UIProcess/ios/PageClientImplIOS.h:
1816         * UIProcess/ios/PageClientImplIOS.mm:
1817         (WebKit::PageClientImpl::handleActiveNowPlayingSessionInfoResponse): Deleted.
1818
1819         * UIProcess/mac/PageClientImplMac.h:
1820         * UIProcess/mac/PageClientImplMac.mm:
1821         (WebKit::PageClientImpl::handleActiveNowPlayingSessionInfoResponse): Deleted.
1822
1823         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1824         (WebKit::WebPage::requestActiveNowPlayingSessionInfo): Take callback ID. Pass unique ID.
1825         * WebProcess/WebPage/WebPage.h:
1826         * WebProcess/WebPage/WebPage.messages.in:
1827
1828 2017-10-26  Andy Estes  <aestes@apple.com>
1829
1830         [Payment Request] Enable Payment Request whenever Apple Pay is enabled
1831         https://bugs.webkit.org/show_bug.cgi?id=178880
1832
1833         Reviewed by Tim Horton.
1834
1835         * Shared/WebPreferences.yaml:
1836         * UIProcess/API/C/WKPreferences.cpp:
1837         (WKPreferencesSetPaymentRequestEnabled): Deleted.
1838         (WKPreferencesGetPaymentRequestEnabled): Deleted.
1839         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1840         * WebProcess/WebPage/WebPage.cpp:
1841         (WebKit::WebPage::updatePreferences):
1842
1843 2017-10-26  Chris Dumez  <cdumez@apple.com>
1844
1845         Bring back SWContextManager abstraction in WebCore
1846         https://bugs.webkit.org/show_bug.cgi?id=178876
1847
1848         Reviewed by Geoffrey Garen.
1849
1850         Bring back SWContextManager abstraction in WebCore. It was killed in <https://trac.webkit.org/changeset/223718> but
1851         is actually useful when the ServiceWorker wants to message the storage process.
1852
1853         * CMakeLists.txt:
1854         * DerivedSources.make:
1855         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1856         (WebKit::WebSWServerConnection::startServiceWorkerContext):
1857         (WebKit::WebSWServerConnection::startFetch):
1858         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
1859         * WebKit.xcodeproj/project.pbxproj:
1860         * WebProcess/Storage/WebSWContextManagerConnection.cpp: Renamed from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.cpp.
1861         (WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection):
1862         (WebKit::WebSWContextManagerConnection::updatePreferences):
1863         (WebKit::WebSWContextManagerConnection::startServiceWorker):
1864         (WebKit::WebSWContextManagerConnection::startFetch):
1865         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerGlobalScope):
1866         * WebProcess/Storage/WebSWContextManagerConnection.h: Renamed from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h.
1867         * WebProcess/Storage/WebSWContextManagerConnection.messages.in: Renamed from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.messages.in.
1868         * WebProcess/WebProcess.cpp:
1869         (WebKit::WebProcess::didReceiveMessage):
1870         (WebKit::WebProcess::getWorkerContextConnection):
1871         * WebProcess/WebProcess.h:
1872
1873 2017-10-26  Alexey Proskuryakov  <ap@apple.com>
1874
1875         Remove deprecated WebKit symbols
1876         https://bugs.webkit.org/show_bug.cgi?id=178875
1877         rdar://problem/31139070
1878
1879         Reviewed by Dan Bernstein.
1880
1881         * PlatformMac.cmake:
1882         * Shared/API/c/WKDeprecatedFunctions.cpp:
1883         (WKContextSetProcessModel):
1884         (WKPageGroupCopyIdentifier): Deleted.
1885         (WKPageGroupAddUserContentFilter): Deleted.
1886         (WKPageGroupRemoveUserContentFilter): Deleted.
1887         * UIProcess/API/C/WKPageGroup.h:
1888         * UIProcess/API/Cocoa/_WKVisitedLinkProvider.mm: Removed.
1889         * UIProcess/API/Cocoa/_WKVisitedLinkStore.h:
1890         * WebKit.xcodeproj/project.pbxproj:
1891
1892 2017-10-26  Ryan Haddad  <ryanhaddad@apple.com>
1893
1894         Unreviewed, rolling out r223984.
1895
1896         Caused LayoutTest assertion failures.
1897
1898         Reverted changeset:
1899
1900         "When navigating back to a page, compositing layers may not
1901         use accelerated drawing"
1902         https://bugs.webkit.org/show_bug.cgi?id=178749
1903         https://trac.webkit.org/changeset/223984
1904
1905 2017-10-26  Megan Gardner  <megan_gardner@apple.com>
1906
1907         Remove code to update block selection
1908         https://bugs.webkit.org/show_bug.cgi?id=178843
1909
1910         Reviewed by Tim Horton.
1911
1912         Removes code for updating block selection, which has been disabled.
1913         This code is being slowly pruned to avoid regressions and accidental removal of code that is being used.
1914
1915         * Platform/spi/ios/UIKitSPI.h:
1916         * UIProcess/PageClient.h:
1917         * UIProcess/WebPageProxy.h:
1918         * UIProcess/WebPageProxy.messages.in:
1919         * UIProcess/ios/PageClientImplIOS.h:
1920         * UIProcess/ios/PageClientImplIOS.mm:
1921         (WebKit::PageClientImpl::didUpdateBlockSelectionWithTouch): Deleted.
1922         * UIProcess/ios/WKContentViewInteraction.h:
1923         * UIProcess/ios/WKContentViewInteraction.mm:
1924         (toSelectionHandlePosition): Deleted.
1925         (-[WKContentView _didUpdateBlockSelectionWithTouch:withFlags:growThreshold:shrinkThreshold:]): Deleted.
1926         (-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]): Deleted.
1927         * UIProcess/ios/WebPageProxyIOS.mm:
1928         (WebKit::WebPageProxy::updateBlockSelectionWithTouch): Deleted.
1929         (WebKit::WebPageProxy::didUpdateBlockSelectionWithTouch): Deleted.
1930         * WebProcess/WebPage/WebPage.h:
1931         * WebProcess/WebPage/WebPage.messages.in:
1932         * WebProcess/WebPage/ios/WebPageIOS.mm:
1933         (WebKit::shouldExpand): Deleted.
1934         (WebKit::WebPage::changeBlockSelection): Deleted.
1935         (WebKit::WebPage::updateBlockSelectionWithTouch): Deleted.
1936
1937 2017-10-26  Ryan Haddad  <ryanhaddad@apple.com>
1938
1939         Unreviewed, rolling out r223994.
1940
1941         The LayoutTest for this change is failing.
1942
1943         Reverted changeset:
1944
1945         "Add service worker handle fetch support for all subresource
1946         requests"
1947         https://bugs.webkit.org/show_bug.cgi?id=178769
1948         https://trac.webkit.org/changeset/223994
1949
1950 2017-10-26  Ryan Haddad  <ryanhaddad@apple.com>
1951
1952         Unreviewed, rolling out r223908.
1953
1954         Causes LayoutTest crashes with newer SDKs.
1955
1956         Reverted changeset:
1957
1958         "Adopt new secure coding APIs"
1959         https://bugs.webkit.org/show_bug.cgi?id=178484
1960         https://trac.webkit.org/changeset/223908
1961
1962 2017-10-26  Christopher Reid  <chris.reid@sony.com>
1963
1964         Remove scopeguard from platform
1965         https://bugs.webkit.org/show_bug.cgi?id=178681
1966
1967         Reviewed by Brady Eidson.
1968
1969         * Shared/mac/ChildProcessMac.mm:
1970
1971 2017-10-25  Per Arne Vollan  <pvollan@apple.com>
1972
1973         Network process crash under WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge.
1974         https://bugs.webkit.org/show_bug.cgi?id=160234
1975         rdar://problem/30675510
1976
1977         Reviewed by Geoffrey Garen.
1978
1979         An exception is raised because we call the method rejectProtectionSpaceAndContinueWithChallenge on the CFNetwork
1980         challenge sender, which does not implement this optional method. The methods on the authentication challenge
1981         sender are deprecated when network session is used, so we should not call them in that case.
1982
1983         * Shared/Authentication/AuthenticationManager.cpp:
1984         (WebKit::AuthenticationManager::useCredentialForSingleChallenge):
1985         (WebKit::AuthenticationManager::continueWithoutCredentialForSingleChallenge):
1986         (WebKit::AuthenticationManager::cancelSingleChallenge):
1987         (WebKit::AuthenticationManager::performDefaultHandlingForSingleChallenge):
1988         (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge):
1989         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
1990         (WebKit::AuthenticationManager::receivedCredential):
1991         (WebKit::AuthenticationManager::receivedRequestToContinueWithoutCredential):
1992         (WebKit::AuthenticationManager::receivedCancellation):
1993         (WebKit::AuthenticationManager::receivedRequestToPerformDefaultHandling):
1994         (WebKit::AuthenticationManager::receivedChallengeRejection):
1995         * Shared/Authentication/soup/AuthenticationManagerSoup.cpp:
1996
1997 2017-10-25  Youenn Fablet  <youenn@apple.com>
1998
1999         Move DNS resolution outside of NetworkRTCProvider
2000         https://bugs.webkit.org/show_bug.cgi?id=178796
2001
2002         Reviewed by Geoffrey Garen.
2003
2004        Tested through manual testing on external STUN servers.
2005        Moving NetworkRTCProvider::Resolver into NetworkRTCResolver.
2006        Updating the implementation to use a completion handler.
2007
2008         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
2009         (WebKit::NetworkRTCProvider::createResolver):
2010         * NetworkProcess/webrtc/NetworkRTCProvider.h:
2011         * NetworkProcess/webrtc/NetworkRTCResolver.cpp:
2012         (WebKit::NetworkRTCResolver::NetworkRTCResolver):
2013         (WebKit::NetworkRTCResolver::~NetworkRTCResolver):
2014         (WebKit::NetworkRTCResolver::start):
2015         (WebKit::NetworkRTCResolver::stop):
2016         (WebKit::NetworkRTCResolver::completed):
2017         (WebKit::NetworkRTCProvider::Resolver::~Resolver): Deleted.
2018         (WebKit::NetworkRTCProvider::stop): Deleted.
2019         (WebKit::NetworkRTCProvider::resolutionCompleted): Deleted.
2020         * NetworkProcess/webrtc/NetworkRTCResolver.h:
2021         * WebKit.xcodeproj/project.pbxproj:
2022
2023 2017-10-25  Eric Carlson  <eric.carlson@apple.com>
2024
2025         [MediaStream] Clear cached gUM prompt state
2026         https://bugs.webkit.org/show_bug.cgi?id=178754
2027         <rdar://problem/32742356>
2028
2029         Reviewed by Youenn Fablet.
2030
2031         * Shared/WebPreferences.yaml: Define new settings.
2032
2033         * Shared/WebPreferencesDefinitionsBase.h: New default values.
2034
2035         * UIProcess/API/C/WKPreferences.cpp:
2036         (WKPreferencesSetInactiveMediaCaptureSteamRepromptIntervalInMinutes): New.
2037         (WKPreferencesGetInactiveMediaCaptureSteamRepromptIntervalInMinutes): Ditto.
2038         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2039
2040         * UIProcess/API/Cocoa/WKPreferences.mm:
2041         (-[WKPreferences _inactiveMediaCaptureSteamRepromptIntervalInMinutes]): Ditto.
2042         (-[WKPreferences _setInactiveMediaCaptureSteamRepromptIntervalInMinutes:]): Ditto.
2043         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2044
2045         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2046         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy): Initialize
2047         the timer.
2048         (WebKit::UserMediaPermissionRequestManagerProxy::createRequest): Remove unneeded namespace.
2049         (WebKit::toWebCore): Remove unneeded breaks.
2050         (WebKit::UserMediaPermissionRequestManagerProxy::searchForGrantedRequest const): Remove unneeded namespace.
2051         (WebKit::UserMediaPermissionRequestManagerProxy::wasRequestDenied): Ditto.
2052         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): Ditto.
2053         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo): Ditto.
2054         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame): Ditto.
2055         (WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs const): Ditto.
2056         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged): Set the watchdog timer
2057         to the correct interval based on capture state.
2058         (WebKit::UserMediaPermissionRequestManagerProxy::watchdogTimerFired): Clear cached state.
2059         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2060
2061 2017-10-25  Simon Fraser  <simon.fraser@apple.com>
2062
2063         When navigating back to a page, compositing layers may not use accelerated drawing
2064         https://bugs.webkit.org/show_bug.cgi?id=178749
2065         rdar://problem/35158946
2066
2067         Reviewed by Dean Jackson.
2068
2069         Avoid assertions when a test enables accelerated drawing (which we can't support
2070         in the iOS simulator).
2071
2072         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
2073         (WebKit::RemoteLayerBackingStore::ensureBackingStore):
2074
2075 2017-10-25  Youenn Fablet  <youenn@apple.com>
2076
2077         Enable ServiceWorker to fetch resources
2078         https://bugs.webkit.org/show_bug.cgi?id=178673
2079
2080         Reviewed by Brady Eidson.
2081
2082         ServiceWorkerContextManager makes use of the new ServiceWorkerThreadProxy.
2083         It creates the necessary environment for the thread to make use of network loads, web sockets and cache storage.
2084         Fetch is functional with these changes.
2085
2086         ServiceWorkerProcessProxy is introduced as a UIProcess proxy to the service worker process.
2087         This process proxy is responsible to give the pageID used by all service worker thread instances for network loads.
2088         ServiceWorkerContextManager is responsible to give a unique frameID for all service worker threads.
2089         This is necessary as these two ids are currently needed for any network load.
2090
2091         ServiceWorkerThreadProxy creates its own FrameLoaderClient which is now used to get pageID, frameID and sessionID.
2092
2093         * UIProcess/ServiceWorkerProcessProxy.cpp: Added.
2094         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
2095         (WebKit::m_serviceWorkerPageID):
2096         (WebKit::ServiceWorkerProcessProxy::~ServiceWorkerProcessProxy):
2097         (WebKit::ServiceWorkerProcessProxy::start):
2098         * UIProcess/ServiceWorkerProcessProxy.h: Added.
2099         * UIProcess/WebProcessPool.cpp:
2100         (WebKit::WebProcessPool::getWorkerContextProcessConnection):
2101         (WebKit::WebProcessPool::createNewWebProcess):
2102         (WebKit::WebProcessPool::initializeNewWebProcess):
2103         (WebKit::WebProcessPool::disconnectProcess):
2104         (WebKit::WebProcessPool::createNewWebProcessRespectingProcessCountLimit):
2105         (WebKit::WebProcessPool::createWebPage):
2106         * UIProcess/WebProcessPool.h:
2107         * UIProcess/WebProcessProxy.cpp:
2108         (WebKit::WebProcessProxy::generatePageID):
2109         * UIProcess/WebProcessProxy.h:
2110         * WebKit.xcodeproj/project.pbxproj:
2111         * WebProcess/Network/WebLoaderStrategy.cpp:
2112         (WebKit::WebLoaderStrategy::scheduleLoad):
2113         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2114         (WebKit::WebLoaderStrategy::startPingLoad):
2115         * WebProcess/Network/WebLoaderStrategy.h:
2116         * WebProcess/Storage/ServiceWorkerContextManager.cpp:
2117         (WebKit::ServiceWorkerContextManager::ServiceWorkerContextManager):
2118         (WebKit::ServiceWorkerContextManager::startServiceWorker):
2119         (WebKit::ServiceWorkerContextManager::startFetch):
2120         * WebProcess/Storage/ServiceWorkerContextManager.h:
2121         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2122         (WebKit::WebFrameLoaderClient::pageID const):
2123         (WebKit::WebFrameLoaderClient::frameID const):
2124         (WebKit::WebFrameLoaderClient::sessionID const):
2125         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2126         * WebProcess/WebProcess.cpp:
2127         (WebKit::WebProcess::getWorkerContextConnection):
2128         * WebProcess/WebProcess.h:
2129         * WebProcess/WebProcess.messages.in:
2130
2131 2017-10-25  Yousuke Kimoto  <yousuke.kimoto@sony.com>
2132
2133         [WinCairo] Add WebKit platform files for wincairo webkit
2134         https://bugs.webkit.org/show_bug.cgi?id=178000
2135
2136         Reviewed by Alex Christensen.
2137
2138         * Platform/Module.h:
2139         * Platform/SharedMemory.h:
2140         (WebKit::SharedMemory::handle const):
2141         * Platform/win/LoggingWin.cpp: Added. It is based on Source/WebCore/platform/win/LoggingWin.cpp
2142         (WebKit::logLevelString):
2143         * Platform/win/ModuleWin.cpp: Added.
2144         (WebKit::Module::load):
2145         (WebKit::Module::unload):
2146         (WebKit::Module::platformFunctionPointer const):
2147         * Platform/win/SharedMemoryWin.cpp: Added.
2148         (WebKit::SharedMemory::Handle::Handle):
2149         (WebKit::SharedMemory::Handle::~Handle):
2150         (WebKit::SharedMemory::Handle::isNull const):
2151         (WebKit::SharedMemory::Handle::encode const):
2152         (WebKit::SharedMemory::Handle::clear):
2153         (WebKit::getDuplicatedHandle):
2154         (WebKit::SharedMemory::Handle::decode):
2155         (WebKit::protectAttribute):
2156         (WebKit::SharedMemory::allocate):
2157         (WebKit::SharedMemory::create):
2158         (WebKit::accessRights):
2159         (WebKit::SharedMemory::map):
2160         (WebKit::SharedMemory::adopt):
2161         (WebKit::SharedMemory::~SharedMemory):
2162         (WebKit::SharedMemory::createHandle):
2163         (WebKit::SharedMemory::systemPageSize):
2164         * PlatformWin.cmake:
2165
2166 2017-10-25  Chris Dumez  <cdumez@apple.com>
2167
2168         Add support for unregistering a service worker
2169         https://bugs.webkit.org/show_bug.cgi?id=178735
2170
2171         Reviewed by Brady Eidson.
2172
2173         Add support for unregistering a service worker:
2174         - https://w3c.github.io/ServiceWorker/#navigator-service-worker-unregister
2175
2176         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2177         (WebKit::WebSWServerConnection::resolveRegistrationJobInClient):
2178         (WebKit::WebSWServerConnection::resolveUnregistrationJobInClient):
2179         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2180         * WebProcess/Storage/WebSWClientConnection.messages.in:
2181
2182 2017-10-25  Chris Dumez  <cdumez@apple.com>
2183
2184         Make SharedStringHashTable less error prone
2185         https://bugs.webkit.org/show_bug.cgi?id=178764
2186
2187         Reviewed by Youenn Fablet.
2188
2189         SharedStringHashTable is backed by SharedMemory and this SharedMemory
2190         may be readonly (and is when used in the WebContent process). As a result,
2191         some of the operations on SharedStringHashTable that write to this shared
2192         memory will crash if called and the SharedMemory is readonly.
2193
2194         To make this less error prone, introduce a new SharedStringHashTableReadOnly
2195         base class for SharedStringHashTable and only keep the operations that
2196         write to the shared memory on SharedStringHashTableReadOnly (namely, add() /
2197         remove() / clear(). Update VisitedLinkTableController and WebSWOriginTable
2198         to use SharedStringHashTableReadOnly since they are instantiated in the
2199         WebContent process and use readonly shared memory.
2200
2201         * Shared/SharedStringHashTable.cpp:
2202         (WebKit::SharedStringHashTableReadOnly::SharedStringHashTableReadOnly):
2203         (WebKit::SharedStringHashTableReadOnly::~SharedStringHashTableReadOnly):
2204         (WebKit::SharedStringHashTableReadOnly::setSharedMemory):
2205         (WebKit::doubleHash):
2206         (WebKit::SharedStringHashTableReadOnly::contains const):
2207         (WebKit::SharedStringHashTableReadOnly::findSlot const):
2208         (WebKit::SharedStringHashTable::SharedStringHashTable):
2209         (WebKit::SharedStringHashTable::~SharedStringHashTable):
2210         (WebKit::SharedStringHashTable::add):
2211         (WebKit::SharedStringHashTable::remove):
2212         (WebKit::SharedStringHashTable::clear):
2213         * Shared/SharedStringHashTable.h:
2214         * WebProcess/Storage/WebSWOriginTable.h:
2215         * WebProcess/WebPage/VisitedLinkTableController.cpp:
2216         (WebKit::VisitedLinkTableController::removeAllVisitedLinks):
2217         * WebProcess/WebPage/VisitedLinkTableController.h:
2218
2219 2017-10-25  Adrian Perez de Castro  <aperez@igalia.com>
2220
2221         [WPE] Remove GLib API functions which use Cairo
2222         https://bugs.webkit.org/show_bug.cgi?id=178205
2223
2224         Reviewed by Michael Catanzaro.
2225
2226         Add PLATFORM(GTK) guards for the parts of of the GLib API which use cairo_surface_t (web
2227         page snapshots and favicons), and remove the affected function prototypes from public API
2228         headers. This way, the WPE version of the API is not tied to Cairo.
2229
2230         * PlatformWPE.cmake:
2231         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
2232         * UIProcess/API/glib/WebKitFaviconDatabasePrivate.h:
2233         * UIProcess/API/glib/WebKitInjectedBundleClient.cpp:
2234         * UIProcess/API/glib/WebKitWebView.cpp:
2235         (webkitWebViewConstructed):
2236         (webkitWebViewGetProperty):
2237         (webkitWebViewDispose):
2238         (webkit_web_view_class_init):
2239         (webkitWebViewLoadChanged):
2240         * UIProcess/API/glib/WebKitWebViewPrivate.h:
2241         * UIProcess/API/wpe/WebKitFaviconDatabase.h:
2242         * UIProcess/API/wpe/WebKitWebView.h:
2243         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
2244         (webkitWebPageDidReceiveMessage):
2245
2246 2017-10-25  Zan Dobersek  <zdobersek@igalia.com>
2247
2248         Make SERVICE_WORKER feature buildable on GTK, WPE
2249         https://bugs.webkit.org/show_bug.cgi?id=178574
2250
2251         Reviewed by Carlos Garcia Campos.
2252
2253         * CMakeLists.txt: Add missing files to the build.
2254         * StorageProcess/StorageProcess.cpp:
2255         (WebKit::StorageProcess::didGetWorkerContextProcessConnection):
2256         IPC::Attachment object should be accessed through an rvalue reference,
2257         making it mutable and enabling releasing the file descriptor.
2258         * StorageProcess/StorageProcess.h: Adjust the method signature.
2259         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2260         Explicitly include the ResourceError header from WebCore (using a forwarding header).
2261         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2262         Include the CachedResource header from WebCore (again using a forwarding header).
2263         * WebProcess/Storage/WebServiceWorkerProvider.h: Forward-declare the WebCore::CachedResource type.
2264
2265 2017-10-24  Youenn Fablet  <youenn@apple.com>
2266
2267         ServiceWorkerClientFetch should return an error that is not null in case of failure
2268         https://bugs.webkit.org/show_bug.cgi?id=178761
2269
2270         Reviewed by Geoffrey Garen.
2271
2272         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2273         (WebKit::ServiceWorkerClientFetch::didFail): Generating a General error.
2274
2275 2017-10-24  Youenn Fablet  <youenn@apple.com>
2276
2277         Enable service worker to use cache storage api
2278         https://bugs.webkit.org/show_bug.cgi?id=178684
2279
2280         Reviewed by Brady Eidson.
2281
2282         Passing the WebPreferences store of the default page group of the WebProcessPool to its ServiceWorker process.
2283         ServiceWorkerContextManager then uses it to initialize the preferences accordingly.
2284         Patch is covered by new test which is using cache api previously disabled and now enabled through the store.
2285
2286         Made use of the new ServiceWorkerThreadProxy in ServiceWorkerContextManager to enable a cache storage connection.
2287         Fixed the default size of quota in WebsiteDataStore.
2288
2289         * UIProcess/WebProcessPool.cpp:
2290         (WebKit::WebProcessPool::getWorkerContextProcessConnection):
2291         * UIProcess/WebsiteData/WebsiteDataStore.h:
2292         * WebProcess/Storage/ServiceWorkerContextManager.cpp:
2293         (WebKit::ServiceWorkerContextManager::ServiceWorkerContextManager):
2294         (WebKit::ServiceWorkerContextManager::updatePreferences):
2295         (WebKit::ServiceWorkerContextManager::startServiceWorker):
2296         (WebKit::ServiceWorkerContextManager::startFetch):
2297         * WebProcess/Storage/ServiceWorkerContextManager.h:
2298         (WebKit::ServiceWorkerContextManager::ServiceWorkerContextManager): Deleted.
2299         * WebProcess/WebProcess.cpp:
2300         (WebKit::WebProcess::getWorkerContextConnection):
2301         * WebProcess/WebProcess.h:
2302         * WebProcess/WebProcess.messages.in:
2303
2304 2017-10-24  Alex Christensen  <achristensen@webkit.org>
2305
2306         Selecting and right-clicking URL-like strings with IDNA-disallowed characters in host or authority causes rendering engine crash
2307         https://bugs.webkit.org/show_bug.cgi?id=174267
2308
2309         Reviewed by Tim Horton.
2310
2311         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2312         (WKBundlePageCanHandleRequest):
2313
2314 2017-10-24  Chris Dumez  <cdumez@apple.com>
2315
2316         Add initial implementation for serviceWorker.postMessage()
2317         https://bugs.webkit.org/show_bug.cgi?id=178534
2318
2319         Reviewed by Youenn Fablet.
2320
2321         Add initial implementation for serviceWorker.postMessage():
2322         - https://w3c.github.io/ServiceWorker/#service-worker-postmessage
2323
2324         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2325         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
2326         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2327         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2328         * WebProcess/Storage/ServiceWorkerContextManager.cpp:
2329         (WebKit::ServiceWorkerContextManager::postMessageToServiceWorkerGlobalScope):
2330         * WebProcess/Storage/ServiceWorkerContextManager.h:
2331         * WebProcess/Storage/ServiceWorkerContextManager.messages.in:
2332         * WebProcess/Storage/WebSWClientConnection.cpp:
2333         (WebKit::WebSWClientConnection::postMessageToServiceWorkerGlobalScope):
2334         * WebProcess/Storage/WebSWClientConnection.h:
2335
2336 2017-10-24  Brent Fulgham  <bfulgham@apple.com>
2337
2338         Adopt new secure coding APIs
2339         https://bugs.webkit.org/show_bug.cgi?id=178484
2340         <rdar://problem/34837193>
2341
2342         Reviewed by Tim Horton.
2343
2344         Switch to new NSKeyed[Un]Archiver methods that active and use
2345         NSSecureCoding by default.
2346
2347         * Platform/ios/AccessibilityIOS.mm:
2348         (WebKit::newAccessibilityRemoteToken): Use secure-by-default API.
2349         * Shared/Cocoa/DataDetectionResult.mm:
2350         (WebKit::DataDetectionResult::encode const): Ditto.
2351         (WebKit::DataDetectionResult::decode): Ditto.
2352         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
2353         (IPC::ArgumentCoder<WebCore::Payment>::encode): Ditto.
2354         (IPC::ArgumentCoder<WebCore::Payment>::decode): Ditto.
2355         (IPC::ArgumentCoder<WebCore::PaymentContact>::encode): Ditto.
2356         (IPC::ArgumentCoder<WebCore::PaymentContact>::decode): Ditto.
2357         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode): Ditto.
2358         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::decode): Ditto.
2359         (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode): Ditto.
2360         (IPC::ArgumentCoder<WebCore::PaymentMethod>::decode): Ditto.
2361         * Shared/ios/InteractionInformationAtPosition.mm:
2362         (WebKit::InteractionInformationAtPosition::encode const): Ditto.
2363         (WebKit::InteractionInformationAtPosition::decode): Ditto.
2364         * Shared/mac/WebCoreArgumentCodersMac.mm:
2365         (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData): Ditto.
2366         (IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData): Ditto.
2367         (IPC::ArgumentCoder<Credential>::encodePlatformData): Ditto.
2368         (IPC::ArgumentCoder<Credential>::decodePlatformData): Ditto.
2369         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode): Ditto.
2370         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::decode): Ditto.
2371         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData): Ditto.
2372         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::decodePlatformData): Ditto.
2373         * Shared/mac/WebHitTestResultData.mm:
2374         (WebKit::WebHitTestResultData::platformEncode const): Ditto.
2375         (WebKit::WebHitTestResultData::platformDecode): Ditto.
2376         * UIProcess/API/Cocoa/WKProcessPool.mm:
2377         (-[WKProcessPool _setObject:forBundleParameter:]): Ditto.
2378         (-[WKProcessPool _setObjectsForBundleParametersWithDictionary:]): Ditto.
2379         * UIProcess/API/Cocoa/WKWebView.mm:
2380         (-[WKWebView _setInputDelegate:]): Ditto.
2381         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2382         (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto.
2383         * UIProcess/ios/PageClientImplIOS.mm:
2384         (WebKit::PageClientImpl::startAssistingNode): Ditto.
2385         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2386         (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): Ditto.
2387         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
2388         (WebKit::InjectedBundle::initialize): Ditto.
2389         (WebKit::InjectedBundle::setBundleParameter): Ditto.
2390         (WebKit::InjectedBundle::setBundleParameters): Ditto.
2391
2392 2017-10-24  Sam Weinig  <sam@webkit.org>
2393
2394         [Settings] Add initial support for generating preferences related code
2395         https://bugs.webkit.org/show_bug.cgi?id=178656
2396
2397         Reviewed by Dean Jackson.
2398
2399         As a first step towards getting off the macros in WebPreferencesDefinitions.h
2400         and reducing the overhead of adding a preference, this change generates adds
2401         WebPreferences.yaml where preference changes will go, and generates much of
2402         WebPreferencesDefinitions.h from it (all the custom defaults moved to 
2403         WebPreferencesDefinitionsBase.h). Subsequent changes will remove the need for 
2404         the macros in WebPreferencesDefinitions.h entirely.
2405
2406         * CMakeLists.txt:
2407         * DerivedSources.make:
2408         * WebKit.xcodeproj/project.pbxproj:
2409         
2410             Add new files / rules to generate WebPreferencesDefinitions.h.
2411         
2412         * Scripts/GeneratePreferences.rb: Added.
2413         * Scripts/PreferencesTemplates: Added.
2414         * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
2415         
2416             Add scripts and template to generate WebPreferencesDefinitions.h from
2417             WebPreferences.yaml.
2418
2419         * Shared/WebPreferences.yaml: Added.
2420         
2421             Configuration file for preferences.
2422         
2423         * Shared/WebPreferencesDefinitions.h: Removed.
2424         * Shared/WebPreferencesDefinitionsBase.h: Copied from Source/WebKit/Shared/WebPreferencesDefinitions.h.
2425         
2426             Moved custom defaults to new WebPreferencesDefinitionsBase.h. Removed the need for 
2427             FOR_EACH_WEBKIT_STRING_PREFERENCE by using custom defaults for the font family values.
2428
2429 2017-10-24  Matt Lewis  <jlewis3@apple.com>
2430
2431         Unreviewed, rolling out r223889.
2432
2433         This caused multiple crashes on all platforms
2434
2435         Reverted changeset:
2436
2437         "Adopt new secure coding APIs"
2438         https://bugs.webkit.org/show_bug.cgi?id=178484
2439         https://trac.webkit.org/changeset/223889
2440
2441 2017-10-24  Youenn Fablet  <youenn@apple.com>
2442
2443         ASSERTION FAILED: !m_serviceWorkerManager in WebProcess::getWorkerContextConnection() on API tests
2444         https://bugs.webkit.org/show_bug.cgi?id=178586
2445         <rdar://problem/35115902>
2446
2447         Reviewed by Brady Eidson.
2448
2449        Covered by API tests no longer crashing.
2450
2451         * UIProcess/WebProcessPool.cpp:
2452         (WebKit::WebProcessPool::getWorkerContextProcessConnection): Sending a worker context process connection message only at creation of the service worker process.
2453
2454 2017-10-24  Brent Fulgham  <bfulgham@apple.com>
2455
2456         Adopt new secure coding APIs
2457         https://bugs.webkit.org/show_bug.cgi?id=178484
2458         <rdar://problem/34837193>
2459
2460         Reviewed by Tim Horton.
2461
2462         Switch to new NSKeyed[Un]Archiver methods that active and use
2463         NSSecureCoding by default.
2464
2465         * Platform/ios/AccessibilityIOS.mm:
2466         (WebKit::newAccessibilityRemoteToken): Use secure-by-default API.
2467         * Shared/Cocoa/DataDetectionResult.mm:
2468         (WebKit::DataDetectionResult::encode const): Ditto.
2469         (WebKit::DataDetectionResult::decode): Ditto.
2470         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
2471         (IPC::ArgumentCoder<WebCore::Payment>::encode): Ditto.
2472         (IPC::ArgumentCoder<WebCore::Payment>::decode): Ditto.
2473         (IPC::ArgumentCoder<WebCore::PaymentContact>::encode): Ditto.
2474         (IPC::ArgumentCoder<WebCore::PaymentContact>::decode): Ditto.
2475         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode): Ditto.
2476         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::decode): Ditto.
2477         (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode): Ditto.
2478         (IPC::ArgumentCoder<WebCore::PaymentMethod>::decode): Ditto.
2479         * Shared/ios/InteractionInformationAtPosition.mm:
2480         (WebKit::InteractionInformationAtPosition::encode const): Ditto.
2481         (WebKit::InteractionInformationAtPosition::decode): Ditto.
2482         * Shared/mac/WebCoreArgumentCodersMac.mm:
2483         (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData): Ditto.
2484         (IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData): Ditto.
2485         (IPC::ArgumentCoder<Credential>::encodePlatformData): Ditto.
2486         (IPC::ArgumentCoder<Credential>::decodePlatformData): Ditto.
2487         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode): Ditto.
2488         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::decode): Ditto.
2489         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData): Ditto.
2490         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::decodePlatformData): Ditto.
2491         * Shared/mac/WebHitTestResultData.mm:
2492         (WebKit::WebHitTestResultData::platformEncode const): Ditto.
2493         (WebKit::WebHitTestResultData::platformDecode): Ditto.
2494         * UIProcess/API/Cocoa/WKProcessPool.mm:
2495         (-[WKProcessPool _setObject:forBundleParameter:]): Ditto.
2496         (-[WKProcessPool _setObjectsForBundleParametersWithDictionary:]): Ditto.
2497         * UIProcess/API/Cocoa/WKWebView.mm:
2498         (-[WKWebView _setInputDelegate:]): Ditto.
2499         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2500         (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto.
2501         * UIProcess/ios/PageClientImplIOS.mm:
2502         (WebKit::PageClientImpl::startAssistingNode): Ditto.
2503         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2504         (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): Ditto.
2505         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
2506         (WebKit::InjectedBundle::initialize): Ditto.
2507         (WebKit::InjectedBundle::setBundleParameter): Ditto.
2508         (WebKit::InjectedBundle::setBundleParameters): Ditto.
2509
2510 2017-10-24  Zan Dobersek  <zdobersek@igalia.com>
2511
2512         [GTK][WPE] generate-forwarding-headers.pl should also scan derived sources in WebKit framework
2513         https://bugs.webkit.org/show_bug.cgi?id=178579
2514
2515         Reviewed by Carlos Garcia Campos.
2516
2517         * PlatformGTK.cmake: When generating forwarding headers, derived sources
2518         should be scanned as well. The DERIVED_SOURCES_WEBKIT_DIR value has to
2519         be passed as an include path to the generate-forward-headers.pl script
2520         to achieve that. This target then also has to depend on all the derived
2521         source files to be generated before this can be performed.
2522         * PlatformWPE.cmake: Ditto.
2523
2524 2017-10-23  Brian Burg  <bburg@apple.com>
2525
2526         [Cocoa] Web Automation: add SPI to tell whether the automation session is currently simulating user interactions
2527         https://bugs.webkit.org/show_bug.cgi?id=178616
2528
2529         Reviewed by Joseph Pecoraro.
2530
2531         This is needed to disambiguate whether an action (such as selectAll:) came from
2532         a user clicking on "Edit > Select All" in a menu or whether it was produced by
2533         simulating the keystrokes to produce the chord for "Command + a". Some clients,
2534         such as Safari, would allow the latter but not the former during automation.
2535
2536         * UIProcess/API/Cocoa/_WKAutomationSession.h:
2537         * UIProcess/API/Cocoa/_WKAutomationSession.mm:
2538         (-[_WKAutomationSession isSimulatingUserInteraction]):
2539         Add new SPI property that's backed by the same WebAutomationSession method.
2540
2541         * UIProcess/Automation/WebAutomationSession.h:
2542         * UIProcess/Automation/WebAutomationSession.cpp:
2543         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
2544         (WebKit::WebAutomationSession::performMouseInteraction):
2545         (WebKit::WebAutomationSession::performKeyboardInteractions):
2546         Set m_simulatingUserInteraction prior to sending the synthesized events. It will
2547         be cleared when keyboardEventsFlushedForPage() is called by WebPageProxy.
2548
2549         * UIProcess/WebPageProxy.cpp:
2550         (WebKit::WebPageProxy::didReceiveEvent):
2551         Notify the automation session that the key event queue was flushed *after* giving
2552         delegates a chance to do something with the key event. This is necessary so that
2553         any actions that are created from the NSEvent by the delegates are handled prior
2554         to the automation session finishing its keyboard interaction command.
2555
2556 2017-10-23  Brian Burg  <bburg@apple.com>
2557
2558         [Mac] Web Automation: key modifiers for synthesized NSEvents are incorrect
2559         https://bugs.webkit.org/show_bug.cgi?id=178615
2560
2561         Reviewed by Joseph Pecoraro.
2562
2563         In both PLATFORM(MAC) platform methods for simulating keyboard interactions,
2564         we errantly relied on +[NSEvent modifierFlags] to get the current state of
2565         sticky modifiers when creating synthesized events. This is incorrect for two reasons:
2566         modifierFlags is never updated when simulating a sequence of events (because
2567         all the events are synthesized before any are delivered); and the NSEvent class
2568         method only reflects the modifier state of the primary physical keyboard, which
2569         is not affected by synthesized NSEvents that happen to have modifier flags.
2570
2571         Instead, just keep our own m_currentModifiers state in the session and compute
2572         the necessary NSEventModifierFlags to put on each synthesized event. This aligns
2573         the implementation with the treatment of sticky keys in the iOS and GTK platform methods.
2574
2575         * UIProcess/Automation/WebAutomationSession.h: Every port gets this variable now.
2576         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
2577         (WebKit::WebAutomationSession::platformSimulateKeyStroke):
2578         (WebKit::WebAutomationSession::platformSimulateKeySequence):
2579         Use and update m_currentModifiers.
2580
2581 2017-10-23  Alex Christensen  <achristensen@webkit.org>
2582
2583         Fix ASAN test after r222824
2584         https://bugs.webkit.org/show_bug.cgi?id=178688
2585         <rdar://problem/35104706>
2586
2587         Reviewed by Tim Horton.
2588
2589         * UIProcess/WebBackForwardList.cpp:
2590         (WebKit::WebBackForwardList::clear):
2591         Resizing a list of Ref<T> after we've WTFMoved all the elements doesn't make ASAN happy.
2592
2593 2017-10-23  Tim Horton  <timothy_horton@apple.com>
2594
2595         Stop using _UIApplicationUsesLegacyUI()
2596         https://bugs.webkit.org/show_bug.cgi?id=178680
2597         <rdar://problem/35131949>
2598
2599         Reviewed by Dan Bernstein.
2600
2601         * Platform/spi/ios/UIKitSPI.h:
2602         * UIProcess/ios/forms/WKFormSelectPopover.mm:
2603         (-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]):
2604         (-[WKSelectPopover initWithView:hasGroups:]):
2605         Resolve _UIApplicationUsesLegacyUI to false and simplify.
2606
2607 2017-10-23  Ryan Haddad  <ryanhaddad@apple.com>
2608
2609         Unreviewed, suppress deprecation warnings to fix the build.
2610         <rdar://problem/35131949>
2611
2612         * UIProcess/ios/forms/WKFormSelectPopover.mm:
2613         (-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]):
2614         (-[WKSelectPopover initWithView:hasGroups:]):
2615
2616 2017-10-23  Youenn Fablet  <youenn@apple.com>
2617
2618         TestController should clear all fetch caches when resetting its state
2619         https://bugs.webkit.org/show_bug.cgi?id=178486
2620         <rdar://problem/35066305>
2621
2622         Reviewed by Chris Dumez.
2623
2624         Adding a new DidNotHandle message to disambiguate with the DidFail fetch case.
2625         With DidNotHandle, the loading should go the network process.
2626         With DidFail, the loading should return a network error.
2627
2628         On receiving an order to start a fetch, ServiceWorkerThread will dispatch a fetch event.
2629         The client of this event will retrieve the response and return it to the WebProcess through IPC.
2630
2631         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2632         (WebKit::WebSWServerConnection::didNotHandleFetch):
2633         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2634         * StorageProcess/StorageProcess.cpp:
2635         (WebKit::StorageProcess::didNotHandleFetch):
2636         * StorageProcess/StorageProcess.h:
2637         * StorageProcess/StorageProcess.messages.in:
2638         * WebKit.xcodeproj/project.pbxproj:
2639         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2640         (WebKit::ServiceWorkerClientFetch::didFail):
2641         (WebKit::ServiceWorkerClientFetch::didNotHandle):
2642         * WebProcess/Storage/ServiceWorkerClientFetch.h:
2643         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in:
2644         * WebProcess/Storage/ServiceWorkerContextManager.cpp:
2645         (WebKit::ServiceWorkerContextManager::startFetch):
2646         * WebProcess/Storage/ServiceWorkerContextManager.h:
2647         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp: Added.
2648         (WebKit::WebServiceWorkerFetchTaskClient::~WebServiceWorkerFetchTaskClient):
2649         (WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
2650         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveResponse):
2651         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
2652         (WebKit::WebServiceWorkerFetchTaskClient::didFail):
2653         (WebKit::WebServiceWorkerFetchTaskClient::didFinish):
2654         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h: Added.
2655         * WebProcess/WebProcess.cpp:
2656         (WebKit::WebProcess::startFetchInServiceWorker):
2657         * WebProcess/WebProcess.h:
2658
2659 2017-10-22  Wenson Hsieh  <wenson_hsieh@apple.com>
2660
2661         [iOS] WebProcess::initializeWebProcess spends ~150ms spinning up AVSystemController on some devices
2662         https://bugs.webkit.org/show_bug.cgi?id=178640
2663         <rdar://problem/35113105>
2664
2665         Reviewed by Youenn Fablet.
2666
2667         In r213933, we added a mechanism to allow the web process to drive media capture, by setting an attribute on the
2668         shared AVSystemController. This requires us to fault in the Celestial framework, which is a slight performance
2669         hit on some hardware. Instead of doing this at the start of every web process launch, we can just do this work
2670         lazily, the first time the web process requests permissions for user media access.
2671
2672         * WebProcess/WebCoreSupport/WebUserMediaClient.cpp:
2673         (WebKit::WebUserMediaClient::requestUserMediaAccess):
2674         * WebProcess/WebPage/WebPage.cpp:
2675         (WebKit::WebPage::prepareToSendUserMediaPermissionRequest):
2676         * WebProcess/WebPage/WebPage.h:
2677         * WebProcess/WebPage/ios/WebPageIOS.mm:
2678         (WebKit::WebPage::prepareToSendUserMediaPermissionRequest):
2679         * WebProcess/cocoa/WebProcessCocoa.mm:
2680         (WebKit::WebProcess::platformInitializeWebProcess):
2681
2682 2017-10-21  Michael Catanzaro  <mcatanzaro@igalia.com>
2683
2684         Unreviewed, silence a -Wunused-but-set-variable warning
2685
2686         * WebProcess/WebPage/EventDispatcher.cpp:
2687         (WebKit::EventDispatcher::wheelEvent):
2688
2689 2017-10-20  Alex Christensen  <achristensen@webkit.org>
2690
2691         Add FIXME comment after r223803
2692         https://bugs.webkit.org/show_bug.cgi?id=178418
2693
2694         * UIProcess/WebProcessPool.cpp:
2695         (WebKit::WebProcessPool::ensureNetworkProcess):
2696         We need some work to better support customized persistent data stores.  Add a comment indicating such.
2697
2698 2017-10-20  Alex Christensen  <achristensen@webkit.org>
2699
2700         Fix API tests after r223791.
2701         https://bugs.webkit.org/show_bug.cgi?id=178418
2702
2703         * UIProcess/WebProcessPool.cpp:
2704         (WebKit::WebProcessPool::ensureNetworkProcess):
2705         Whatever NetworkSessionInitializationParameters we send with the NetworkProcess initialization message,
2706         that's the default session.  This is needed for WebKit.WebsiteDataStoreCustomPaths.
2707         (WebKit::WebProcessPool::createNewWebProcess):
2708         Don't change behavior or NetworkProcess initialization like I did in r223791.
2709
2710 2017-10-20  Alex Christensen  <achristensen@webkit.org>
2711
2712         Fix download tests on El Capitan after r223730
2713         https://bugs.webkit.org/show_bug.cgi?id=178547
2714
2715         * UIProcess/Downloads/DownloadProxy.cpp:
2716         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
2717         Revert to original behavior.  This uses suggestedFilename, which may have come from places like
2718         the download attribute, instead of always using the filename from CFNetwork.
2719
2720 2017-10-20  Alex Christensen  <achristensen@webkit.org>
2721
2722         Expose _boundInterfaceIdentifier and _allowsCellularAccess to WKWebsiteDataStorePrivate
2723         https://bugs.webkit.org/show_bug.cgi?id=178418
2724         <rdar://problem/29599569>
2725
2726         Reviewed by Tim Horton.
2727         
2728         In r213747 I introduced allowsCellularAccess to _WKProcessPoolConfiguration because there
2729         was no way to add parameters to the default (and other) NetworkSession constructors.  Since
2730         clients have not adopted this SPI, we can introduce such a way in NetworkSessionCreationParameters
2731         and move the SPI to WKWebsiteDataStore, which is where it and other NetworkSession properties
2732         ought to be instead of making them WKProcessPool global.
2733
2734         We also need to expose access to NSURLRequest.boundInterfaceIdentifier.  Instead of serializing and
2735         deserializing that property for each NSURLRequest and then having subresources mysteriously jump back
2736         to having no bound interface identifiers, I'm adding this to WKWebsiteDataStore, too, to make it a
2737         session networking property.
2738         
2739         I manually verified that these properties are being set properly with a custom test app and added logs.
2740         Unfortunately, these properties don't do anything under circumstances anywhere close to what we test.
2741         The architecture change of having NetworkSessionCreationParameters is verified to not have a change in
2742         behavior by existing tests, such as any test that uses TestProtocol (which we should eventually remove).
2743
2744         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2745         (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
2746         * NetworkProcess/NetworkProcess.cpp:
2747         (WebKit::NetworkProcess::NetworkProcess):
2748         (WebKit::NetworkProcess::initializeNetworkProcess):
2749         (WebKit::NetworkProcess::clearCachedCredentials):
2750         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2751         (WebKit::NetworkProcessCreationParameters::encode const):
2752         (WebKit::NetworkProcessCreationParameters::decode):
2753         * NetworkProcess/NetworkProcessCreationParameters.h:
2754         * NetworkProcess/NetworkSession.cpp:
2755         (WebKit::NetworkSession::create):
2756         (WebKit::NetworkSession::defaultSession): Deleted.
2757         * NetworkProcess/NetworkSession.h:
2758         * NetworkProcess/NetworkSessionCreationParameters.h: Added.
2759         (WebKit::NetworkSessionCreationParameters::encode const):
2760         (WebKit::NetworkSessionCreationParameters::decode):
2761         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
2762         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
2763         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2764         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2765         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2766         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2767         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
2768         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2769         (WebKit::NetworkSessionCocoa::setSourceApplicationSecondaryIdentifier):
2770         (WebKit::NetworkSessionCocoa::create):
2771         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2772         (WebKit::NetworkSessionCocoa::setLegacyCustomProtocolManager): Deleted.
2773         (WebKit::NetworkSessionCocoa::setAllowsCellularAccess): Deleted.
2774         (WebKit::NetworkSessionCocoa::defaultSession): Deleted.
2775         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2776         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
2777         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2778         * Shared/SessionTracker.cpp:
2779         (WebKit::SessionTracker::networkSession):
2780         (WebKit::SessionTracker::setSession):
2781         * Shared/WebsiteDataStoreParameters.cpp:
2782         (WebKit::WebsiteDataStoreParameters::encode const):
2783         (WebKit::WebsiteDataStoreParameters::decode):
2784         * Shared/WebsiteDataStoreParameters.h:
2785         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2786         (API::ProcessPoolConfiguration::copy):
2787         * UIProcess/API/APIProcessPoolConfiguration.h:
2788         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2789         (-[WKWebsiteDataStore _setBoundInterfaceIdentifier:]):
2790         (-[WKWebsiteDataStore _boundInterfaceIdentifier]):
2791         (-[WKWebsiteDataStore _setAllowsCellularAccess:]):
2792         (-[WKWebsiteDataStore _allowsCellularAccess]):
2793         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2794         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2795         (-[_WKProcessPoolConfiguration allowsCellularAccess]):
2796         (-[_WKProcessPoolConfiguration setAllowsCellularAccess:]):
2797         * UIProcess/WebProcessPool.cpp:
2798         (WebKit::WebProcessPool::ensureNetworkProcess):
2799         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
2800         * UIProcess/WebsiteData/WebsiteDataStore.h:
2801         (WebKit::WebsiteDataStore::setBoundInterfaceIdentifier):
2802         (WebKit::WebsiteDataStore::boundInterfaceIdentifier):
2803         (WebKit::WebsiteDataStore::setAllowsCellularAccess):
2804         (WebKit::WebsiteDataStore::allowsCellularAccess):
2805         * WebKit.xcodeproj/project.pbxproj:
2806         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2807         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
2808         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
2809         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
2810         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
2811         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
2812         * WebProcess/WebProcess.cpp:
2813         (WebKit::WebProcess::ensurePrivateBrowsingSession):
2814         (WebKit::WebProcess::clearCachedCredentials):
2815
2816 2017-10-20  Alex Christensen  <achristensen@webkit.org>
2817
2818         Add ObjC SPI to _WKDownloadDelegate missing from WKContextDownloadClient
2819         https://bugs.webkit.org/show_bug.cgi?id=178566
2820         <rdar://problem/23041906>
2821
2822         Reviewed by Brady Eidson.
2823
2824         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
2825         * UIProcess/Cocoa/DownloadClient.h:
2826         * UIProcess/Cocoa/DownloadClient.mm:
2827         (WebKit::DownloadClient::DownloadClient):
2828         (WebKit::DownloadClient::didReceiveAuthenticationChallenge):
2829         (WebKit::DownloadClient::shouldDecodeSourceDataOfMIMEType):
2830         (WebKit::DownloadClient::didCreateDestination):
2831         (WebKit::DownloadClient::processDidCrash):
2832
2833 2017-10-20  Youenn Fablet  <youenn@apple.com>
2834
2835         ResourceResponse should have a ServiceWorker source
2836         https://bugs.webkit.org/show_bug.cgi?id=178593
2837
2838         Reviewed by Alex Christensen.
2839
2840         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2841         (WebKit::ServiceWorkerClientFetch::didReceiveResponse): setting response source to ServiceWorker.
2842         * WebProcess/Storage/ServiceWorkerClientFetch.h:
2843
2844 2017-10-20  Antoine Quint  <graouts@apple.com>
2845
2846         [Web Animations] Provide basic timeline and animation interfaces
2847         https://bugs.webkit.org/show_bug.cgi?id=178526
2848
2849         Reviewed by Dean Jackson.
2850
2851         Remove the WEB_ANIMATIONS compile-time flag.
2852
2853         * Configurations/FeatureDefines.xcconfig:
2854         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2855         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2856         (WebKit::InjectedBundle::setWebAnimationsEnabled):
2857         * WebProcess/WebPage/WebPage.cpp:
2858         (WebKit::WebPage::updatePreferences):
2859
2860 2017-10-02  Brian Burg  <bburg@apple.com>
2861
2862         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
2863         https://bugs.webkit.org/show_bug.cgi?id=177661
2864         <rdar://problem/34740286>
2865
2866         Reviewed by Joseph Pecoraro.
2867
2868         Move setup and delegates of the inspector frontend page into implementations of
2869         WebInspectorProxy::platformCreateFrontendPage. The Mac implementation
2870         will be subsumed by WKInspectorViewController, while the GTK implementation
2871         is inherited from the cross-platform version that uses C API. Eventually the
2872         GTK version should use GTK API rather than the soon to be deprecated C API.
2873
2874         * UIProcess/WebInspectorProxy.cpp:
2875         (WebKit::WebInspectorProxy::createFrontendPage):
2876         (WebKit::webProcessDidCrash): Deleted.
2877         (WebKit::decidePolicyForNavigationAction): Deleted.
2878         (WebKit::getContextMenuFromProposedMenu): Deleted.
2879         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
2880         (WebKit::exceededDatabaseQuota):
2881         (WebKit::webProcessDidCrash):
2882         (WebKit::decidePolicyForNavigationAction):
2883         (WebKit::getContextMenuFromProposedMenu):
2884         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
2885         * UIProcess/mac/WebInspectorProxyMac.mm:
2886         (WebKit::exceededDatabaseQuota):
2887         (WebKit::webProcessDidCrash):
2888         (WebKit::decidePolicyForNavigationAction):
2889         (WebKit::getContextMenuFromProposedMenu):
2890         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
2891
2892 2017-10-02  Brian Burg  <bburg@apple.com>
2893
2894         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
2895         https://bugs.webkit.org/show_bug.cgi?id=177661
2896         <rdar://problem/34740286>
2897
2898         Reviewed by Joseph Pecoraro.
2899
2900         Adopt WKInspectorViewController in WebInspectorProxyMac to set up the
2901         frontend's web view.
2902
2903         * UIProcess/WebInspectorProxy.cpp:
2904         (WebKit::WebInspectorProxy::invalidate):
2905         (WebKit::WebInspectorProxy::close):
2906         (WebKit::WebInspectorProxy::didClose):
2907         (WebKit::WebInspectorProxy::closeFrontendPageAndWindow):
2908         Make closeFrontendPageAndWindow into the method that does work.
2909         Only use didClose() as the IPC message entry point.
2910
2911         * UIProcess/WebInspectorProxy.h:
2912         (WebKit::WebInspectorProxy::isUnderTest const): Make public.
2913
2914         * UIProcess/mac/WKInspectorViewController.h:
2915         * UIProcess/mac/WKInspectorViewController.mm:
2916         (+[WKInspectorViewController viewIsInspectorWebView:]):
2917         Abstract away the -isInstanceOfClass: check for WKInspectorWKWebView.
2918         Clients shouldn't need to know whether we use a subclass or what its name is.
2919
2920         * UIProcess/mac/WebInspectorProxyMac.mm:
2921         (-[WKWebInspectorProxyObjCAdapter inspectorViewControllerInspectorDidCrash:]):
2922         (-[WKWebInspectorProxyObjCAdapter inspectorViewControllerInspectorIsUnderTest:]):
2923         Hook up view controller delegates.
2924
2925         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
2926         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
2927         (WebKit::WebInspectorProxy::closeFrontendPage):
2928         New implementation based on the view controller.
2929
2930         (WebKit::WebInspectorProxy::platformBringToFront):
2931         (WebKit::WebInspectorProxy::platformIsFront):
2932         (WebKit::WebInspectorProxy::platformCanAttach):
2933         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
2934         (WebKit::WebInspectorProxy::platformAttach):
2935         (WebKit::WebInspectorProxy::platformDetach):
2936         (WebKit::WebInspectorProxy::platformStartWindowDrag):
2937         Adjust to get the WKWebView out of the view controller for code that needs
2938         to do something with the NSView, such as get/set the frame.
2939
2940         (WebKit::WebInspectorProxy::createFrontendConfiguration): Deleted.
2941         (WebKit::exceededDatabaseQuota): Deleted.
2942         (WebKit::webProcessDidCrash): Deleted.
2943         (WebKit::decidePolicyForNavigationAction): Deleted.
2944         (WebKit::getContextMenuFromProposedMenu): Deleted.
2945
2946 2017-10-02  Brian Burg  <bburg@apple.com>
2947
2948         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
2949         https://bugs.webkit.org/show_bug.cgi?id=177661
2950         <rdar://problem/34740286>
2951
2952         Reviewed by Joseph Pecoraro.
2953
2954         Introduce new platform methods to open and close the frontend page and window.
2955         This matches how RemoteWebInspectorProxy divides work up into platform methods.
2956         Move existing code from platformDidClose, platformOpen, and other methods into
2957         the new platform methods. Move some identical platform code into WebInspectorProxy.cpp.
2958
2959         * UIProcess/WebInspectorProxy.h:
2960         * UIProcess/WebInspectorProxy.cpp:
2961         (WebKit::WebInspectorProxy::connect):
2962         (WebKit::WebInspectorProxy::showConsole):
2963         (WebKit::WebInspectorProxy::showResources):
2964         (WebKit::WebInspectorProxy::showTimelines):
2965         (WebKit::WebInspectorProxy::showMainResourceForFrame):
2966         (WebKit::WebInspectorProxy::createFrontendPage):
2967         (WebKit::WebInspectorProxy::createInspectorPage):
2968         (WebKit::WebInspectorProxy::open):
2969         (WebKit::WebInspectorProxy::didClose):
2970         (WebKit::WebInspectorProxy::eagerlyCreateInspectorPage): Renamed.
2971
2972         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
2973         (WebKit::WebInspectorProxy::updateInspectorWindowTitle const):
2974         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
2975         Do everything necessary to set up the frontend page WebView.
2976
2977         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
2978         Do everything necessary to set up the detached NSWindow for the frontend.
2979
2980         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
2981         (WebKit::WebInspectorProxy::platformDetach):
2982         (WebKit::WebInspectorProxy::platformCreateInspectorPage): Deleted.
2983         (WebKit::WebInspectorProxy::createInspectorWindow): Deleted.
2984         (WebKit::WebInspectorProxy::platformOpen): Deleted.
2985         (WebKit::WebInspectorProxy::platformDidClose): Deleted.
2986
2987         * UIProcess/mac/WebInspectorProxyMac.mm:
2988         (WebKit::WebInspectorProxy::updateInspectorWindowTitle const):
2989         (WebKit::WebInspectorProxy::platformCreateFrontendPage): Added.
2990         Do everything necessary to set up the frontend page WebView.
2991
2992         (WebKit::WebInspectorProxy::platformCreateFrontendWindow): Added.
2993         Do everything necessary to set up the detached NSWindow for the frontend.
2994
2995         (WebKit::WebInspectorProxy::closeFrontendPage):
2996         (WebKit::WebInspectorProxy::closeFrontendAfterInactivityTimerFired):
2997         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
2998         (WebKit::WebInspectorProxy::platformDidCloseForCrash):
2999         (WebKit::WebInspectorProxy::platformInvalidate):
3000         (WebKit::WebInspectorProxy::platformBringToFront): Carry through renamings.
3001
3002         (WebKit::WebInspectorProxy::platformDetach):
3003         Defer to the general open() method to create a window if needed and bring it to front.
3004
3005         (WebKit::WebInspectorProxy::platformCanAttach): Move this below open/close code.
3006
3007         (WebKit::WebInspectorProxy::closeFrontend): Deleted.
3008         (WebKit::WebInspectorProxy::createInspectorWindow): Deleted.
3009         (WebKit::WebInspectorProxy::platformCreateInspectorPage): Deleted.
3010         (WebKit::WebInspectorProxy::platformOpen): Deleted.
3011         (WebKit::WebInspectorProxy::platformDidClose): Deleted.
3012         Defer to the general open() method to create a window if needed and bring it to front.
3013
3014         * UIProcess/wpe/WebInspectorProxyWPE.cpp:
3015         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
3016         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
3017         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
3018         (WebKit::WebInspectorProxy::platformCreateInspectorPage): Deleted.
3019         (WebKit::WebInspectorProxy::createInspectorWindow): Deleted.
3020         (WebKit::WebInspectorProxy::platformOpen): Deleted.
3021         (WebKit::WebInspectorProxy::platformDidClose): Deleted.
3022         Update stubs.
3023
3024 2017-10-02  Brian Burg  <bburg@apple.com>
3025
3026         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
3027         https://bugs.webkit.org/show_bug.cgi?id=177661
3028         <rdar://problem/34740286>
3029
3030         Reviewed by Joseph Pecoraro.
3031
3032         This patch refactors some Cocoa code pathas.
3033         Rename the timer that closes the WebView so it's more obvious what it is for.
3034         Extract the common code to close the frontend window so its not implemented by
3035         the timer callback.
3036
3037         In later patches, this will be extracted further into platform methods to open/close
3038         the frontend and window, like how it is for RemoteWebInspectorProxy.
3039
3040         * UIProcess/WebInspectorProxy.cpp:
3041         (WebKit::WebInspectorProxy::WebInspectorProxy):
3042         * UIProcess/WebInspectorProxy.h:
3043         * UIProcess/mac/WebInspectorProxyMac.mm:
3044         (WebKit::WebInspectorProxy::closeFrontendAfterInactivityTimerFired):
3045         (WebKit::WebInspectorProxy::closeFrontend):
3046         (WebKit::WebInspectorProxy::platformCreateInspectorPage):
3047         (WebKit::WebInspectorProxy::platformDidClose):
3048         (WebKit::WebInspectorProxy::platformDidCloseForCrash):
3049         (WebKit::WebInspectorProxy::platformInvalidate):
3050         (WebKit::WebInspectorProxy::closeTimerFired): Deleted.
3051
3052 2017-09-30  Brian Burg  <bburg@apple.com>
3053
3054         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
3055         https://bugs.webkit.org/show_bug.cgi?id=177661
3056         <rdar://problem/34740286>
3057
3058         Reviewed by Joseph Pecoraro.
3059
3060         Modernize the ObjC adapter and related code a bit before it is hooked
3061         into WKInspectorViewController.
3062
3063         * UIProcess/API/C/mac/WKInspectorPrivateMac.h: No need for the
3064         ivar to be declared here, move to @implementation.
3065
3066         * UIProcess/WebInspectorProxy.h: Simplify the name to match modern convention.
3067
3068         * UIProcess/mac/WebInspectorProxyMac.mm:
3069         (-[WKWebInspectorProxyObjCAdapter inspectorRef]):
3070         (-[WKWebInspectorProxyObjCAdapter initWithWebInspectorProxy:]):
3071         (-[WKWebInspectorProxyObjCAdapter invalidate]):
3072         (-[WKWebInspectorProxyObjCAdapter windowDidMove:]):
3073         (-[WKWebInspectorProxyObjCAdapter windowDidResize:]):
3074         (-[WKWebInspectorProxyObjCAdapter windowWillClose:]):
3075         (-[WKWebInspectorProxyObjCAdapter windowDidEnterFullScreen:]):
3076         (-[WKWebInspectorProxyObjCAdapter windowDidExitFullScreen:]):
3077         (-[WKWebInspectorProxyObjCAdapter inspectedViewFrameDidChange:]):
3078         Remove unnecessary casts to and from void*.
3079
3080         (WebKit::WebInspectorProxy::attachmentViewDidChange):
3081         (WebKit::WebInspectorProxy::setInspectorWindowFrame):
3082         (WebKit::WebInspectorProxy::closeTimerFired):
3083         (WebKit::WebInspectorProxy::createInspectorWindow):
3084         (WebKit::WebInspectorProxy::platformCreateInspectorPage):
3085         Fix uses of member variable m_objCAdapter.
3086
3087         (-[WKWebInspectorProxyObjCAdapter close]): Deleted.
3088         Rename this to invalidate to match modern convention. In this context,
3089         'close' might trick someone into thinking that this closes a window/page.
3090
3091 2017-09-30  Brian Burg  <bburg@apple.com>
3092
3093         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
3094         https://bugs.webkit.org/show_bug.cgi?id=177661
3095         <rdar://problem/34740286>
3096
3097         Reviewed by Joseph Pecoraro.
3098
3099         Move code that sets up and controls the inspector WebView into WKInspectorViewController.
3100         This will be shared between RemoteWebInspectorProxy and WebInspectorProxy eventually,
3101         but for now just pull out code from RemoteWebInspectorProxy. The next patch will move
3102         over WebInspectorProxy.
3103
3104         WKInspectorViewController uses the ObjC API for setting up the WKWebView's delegates.
3105         Previously, a WKWebView was used but the delegates were set up using the C API. In
3106         a few cases it uses delegate methods to ask the owning [Remote]WebInspectorProxy some
3107         things. In general, WKInspectorViewController doesn't dig into any internals of
3108         WebPageProxy or WebInspectorProxy; that is delegated to the client.
3109
3110         * UIProcess/RemoteWebInspectorProxy.h:
3111         (WebKit::RemoteWebInspectorProxy::isUnderTest const): Add a method stub for now.
3112         We might want to enable tests for a _WKRemoteWebInspectorViewController-based UI
3113         in the future, and WebInspectorProxy has the same method. Add this and connect it
3114         to the view controller delegate method.
3115
3116         (WebKit::RemoteWebInspectorProxy::webView const):
3117         This returns a plain WKWebView type now.
3118
3119         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
3120         (-[WKRemoteWebInspectorProxyObjCAdapter inspectorViewControllerInspectorDidCrash:]):
3121         (-[WKRemoteWebInspectorProxyObjCAdapter inspectorViewControllerInspectorIsUnderTest:]):
3122         (-[WKRemoteWebInspectorProxyObjCAdapter webViewWebContentProcessDidTerminate:]): Deleted.
3123         (-[WKRemoteWebInspectorProxyObjCAdapter webView:decidePolicyForNavigationAction:decisionHandler:]): Deleted.
3124         Make the ObjCAdapter forward view controller delegate calls to the C++ class.
3125         It no longer needs to be the delegate of the WebView, as the view controller handles that.
3126
3127         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
3128         Clean up and move WKWebView setup code into the view controller.
3129
3130         (WebKit::RemoteWebInspectorProxy::platformCloseFrontendPageAndWindow):
3131         The m_inspectorPage is closed by the caller before calling this method, so we don't need to do it here.
3132
3133         (WebKit::RemoteWebInspectorProxy::platformBringToFront):
3134         (WebKit::RemoteWebInspectorProxy::platformSave):
3135         (WebKit::RemoteWebInspectorProxy::platformAppend):
3136         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag):
3137         Use webView() instead of m_webView.
3138
3139         * UIProcess/mac/WKInspectorViewController.h: Added.
3140         * UIProcess/mac/WKInspectorViewController.mm: Added.
3141         (-[WKInspectorWKWebView tag]):
3142         (-[WKInspectorViewController initWithInspectedPage:]):
3143         (-[WKInspectorViewController dealloc]):
3144         (-[WKInspectorViewController delegate]):
3145         (-[WKInspectorViewController webView]):
3146         (-[WKInspectorViewController setDelegate:]):
3147         (-[WKInspectorViewController configuration]):
3148         (-[WKInspectorViewController _webView:getWindowFrameWithCompletionHandler:]):
3149         (-[WKInspectorViewController _webView:setWindowFrame:]):
3150         (-[WKInspectorViewController webView:runOpenPanelWithParameters:initiatedByFrame:completionHandler:]):
3151         (-[WKInspectorViewController _webView:decideDatabaseQuotaForSecurityOrigin:currentQuota:currentOriginUsage:currentDatabaseUsage:expectedUsage:decisionHandler:]):
3152         (-[WKInspectorViewController webViewWebContentProcessDidTerminate:]):
3153         (-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]):
3154         Move code from RemoteWebInspectorProxyMac into here.
3155
3156         * UIProcess/mac/WebInspectorProxyMac.mm:
3157         (WebKit::WebInspectorProxy::createFrontendWindow):
3158         Remove commented out code left over from the last time that this method got moved around.
3159
3160         * WebKit.xcodeproj/project.pbxproj:
3161         Add new class.
3162
3163 2017-10-20  Zan Dobersek  <zdobersek@igalia.com>
3164
3165         [WK2] Drop 'CoordinatedGraphics' as a platform prefix from generate-forwarding-headers.pl
3166         https://bugs.webkit.org/show_bug.cgi?id=178575
3167
3168         Reviewed by Carlos Garcia Campos.
3169
3170         * Scripts/generate-forwarding-headers.pl: Remove CoordinatedGraphics as
3171         a supported platform prefix. No one invokes the script with this
3172         argument anymore.
3173
3174 2017-10-19  Alex Christensen  <achristensen@webkit.org>
3175
3176         Introduce completionHandler-based SPI for _WKDownloadDelegate.decideDestinationWithSuggestedFilename
3177         https://bugs.webkit.org/show_bug.cgi?id=178560
3178
3179         Reviewed by Tim Horton.
3180
3181         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
3182         * UIProcess/Cocoa/DownloadClient.h:
3183         * UIProcess/Cocoa/DownloadClient.mm:
3184         (WebKit::DownloadClient::DownloadClient):
3185         (WebKit::DownloadClient::didStart):
3186         (WebKit::DownloadClient::didReceiveResponse):
3187         (WebKit::DownloadClient::didReceiveData):
3188         (WebKit::DownloadClient::decideDestinationWithSuggestedFilename):
3189         (WebKit::DownloadClient::didFinish):
3190         (WebKit::DownloadClient::didFail):
3191         (WebKit::DownloadClient::didCancel):
3192         (WebKit::DownloadClient::willSendRequest):
3193
3194 2017-10-19  Chris Dumez  <cdumez@apple.com>
3195
3196         ServiceWorkerContextManager should be an IPC::MessageReceiver
3197         https://bugs.webkit.org/show_bug.cgi?id=178552
3198
3199         Reviewed by Youenn Fablet.
3200
3201         ServiceWorkerContextManager should be an IPC::MessageReceiver, to avoid putting too many
3202         ServiceWorker related methods on WebProcess class.
3203
3204         * DerivedSources.make:
3205         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3206         (WebKit::WebSWServerConnection::startServiceWorkerContext):
3207         (WebKit::WebSWServerConnection::startFetch):
3208         * WebKit.xcodeproj/project.pbxproj:
3209         * WebProcess/Storage/ServiceWorkerContextManager.cpp:
3210         (WebKit::ServiceWorkerContextManager::startFetchInServiceWorker):
3211         (WebKit::ServiceWorkerContextManager::startFetch): Deleted.
3212         * WebProcess/Storage/ServiceWorkerContextManager.h:
3213         * WebProcess/Storage/ServiceWorkerContextManager.messages.in: Added.
3214         * WebProcess/WebProcess.cpp:
3215         (WebKit::WebProcess::didReceiveMessage):
3216         (WebKit::WebProcess::getWorkerContextConnection):
3217         (WebKit::WebProcess::startServiceWorkerContext): Deleted.
3218         (WebKit::WebProcess::startFetchInServiceWorker): Deleted.
3219         * WebProcess/WebProcess.h:
3220         * WebProcess/WebProcess.messages.in:
3221
3222 2017-10-19  Alex Christensen  <achristensen@webkit.org>
3223
3224         Modernize authentication challenge handling in WebKit
3225         https://bugs.webkit.org/show_bug.cgi?id=178555
3226
3227         Reviewed by Tim Horton.
3228
3229         * UIProcess/API/APILoaderClient.h:
3230         (API::LoaderClient::didReceiveAuthenticationChallengeInFrame):
3231         * UIProcess/API/APINavigationClient.h:
3232         (API::NavigationClient::didReceiveAuthenticationChallenge):
3233         * UIProcess/API/C/WKPage.cpp:
3234         (WKPageSetPageLoaderClient):
3235         (WKPageSetPageNavigationClient):
3236         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
3237         * UIProcess/Cocoa/NavigationState.h:
3238         * UIProcess/Cocoa/NavigationState.mm:
3239         (WebKit::NavigationState::NavigationClient::canAuthenticateAgainstProtectionSpace):
3240         (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):
3241         * UIProcess/WebPageProxy.cpp:
3242         (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
3243
3244 2017-10-19  Alex Christensen  <achristensen@webkit.org>
3245
3246         Modernize API::DownloadClient
3247         https://bugs.webkit.org/show_bug.cgi?id=178547
3248
3249         Reviewed by Andy Estes.
3250
3251         Use more C++ references instead of pointers because they're never null.
3252
3253         Remove canAuthenticateAgainstProtectionSpace because there are no implementations
3254         except the default implementation which always returns true and we don't intend to
3255         add this to the SPI because that's just a legacy call anyways from when NSURLConnection
3256         hadn't fully evolved, and we're moving away from NSURLConnection, especially in our API design.
3257
3258         Separate the NetworkSession-only and pre-NetworkSession-only callbacks.  All the synchronous
3259         IPC messages are only used in the pre-NetworkSession code, so once we remove it we can remove them!
3260
3261         Make API::DownloadClient calls that NetworkSession uses use a completion handler so we will be able to
3262         design an asynchronous API.
3263
3264         * NetworkProcess/Downloads/DownloadManager.cpp:
3265         (WebKit::DownloadManager::continueCanAuthenticateAgainstProtectionSpace): Deleted.
3266         * NetworkProcess/Downloads/DownloadManager.h:
3267         * NetworkProcess/Downloads/PendingDownload.cpp:
3268         (WebKit::PendingDownload::canAuthenticateAgainstProtectionSpaceAsync):
3269         (WebKit::PendingDownload::continueCanAuthenticateAgainstProtectionSpace): Deleted.
3270         * NetworkProcess/Downloads/PendingDownload.h:
3271         * NetworkProcess/NetworkProcess.cpp:
3272         (WebKit::NetworkProcess::continueCanAuthenticateAgainstProtectionSpaceDownload): Deleted.
3273         * NetworkProcess/NetworkProcess.h:
3274         * NetworkProcess/NetworkProcess.messages.in:
3275         * UIProcess/API/APIDownloadClient.h:
3276         (API::DownloadClient::didStart):
3277         (API::DownloadClient::didReceiveAuthenticationChallenge):
3278         (API::DownloadClient::didReceiveResponse):
3279         (API::DownloadClient::didReceiveData):
3280         (API::DownloadClient::shouldDecodeSourceDataOfMIMEType):
3281         (API::DownloadClient::decideDestinationWithSuggestedFilename):
3282         (API::DownloadClient::didCreateDestination):
3283         (API::DownloadClient::didFinish):
3284         (API::DownloadClient::didFail):
3285         (API::DownloadClient::didCancel):
3286         (API::DownloadClient::processDidCrash):
3287         (API::DownloadClient::willSendRequest):
3288         (API::DownloadClient::canAuthenticateAgainstProtectionSpace): Deleted.
3289         * UIProcess/API/C/WKContext.cpp:
3290         (WKContextSetDownloadClient):
3291         * UIProcess/API/glib/WebKitDownloadClient.cpp:
3292         * UIProcess/Cocoa/DownloadClient.h:
3293         * UIProcess/Cocoa/DownloadClient.mm:
3294         (WebKit::DownloadClient::didStart):
3295         (WebKit::DownloadClient::didReceiveResponse):
3296         (WebKit::DownloadClient::didReceiveData):
3297         (WebKit::DownloadClient::decideDestinationWithSuggestedFilename):
3298         (WebKit::DownloadClient::didFinish):
3299         (WebKit::DownloadClient::didFail):
3300         (WebKit::DownloadClient::didCancel):
3301         (WebKit::DownloadClient::willSendRequest):
3302         * UIProcess/Downloads/DownloadProxy.cpp:
3303         (WebKit::DownloadProxy::processDidClose):
3304         (WebKit::DownloadProxy::didStart):
3305         (WebKit::DownloadProxy::didReceiveAuthenticationChallenge):
3306         (WebKit::DownloadProxy::willSendRequest):
3307         (WebKit::DownloadProxy::didReceiveResponse):
3308         (WebKit::DownloadProxy::didReceiveData):
3309         (WebKit::DownloadProxy::shouldDecodeSourceDataOfMIMEType):
3310         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync):
3311         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
3312         (WebKit::DownloadProxy::didCreateDestination):
3313         (WebKit::DownloadProxy::didFinish):
3314         (WebKit::DownloadProxy::didFail):
3315         (WebKit::DownloadProxy::didCancel):
3316         (WebKit::DownloadProxy::canAuthenticateAgainstProtectionSpace): Deleted.
3317         * UIProcess/Downloads/DownloadProxy.h:
3318         * UIProcess/Downloads/DownloadProxy.messages.in:
3319
3320 2017-10-19  Nan Wang  <n_wang@apple.com>
3321
3322         AX: Provide a way for Accessibility to cache the selection while retrieving rects for speak selection
3323         https://bugs.webkit.org/show_bug.cgi?id=176247
3324         <rdar://problem/34217143>
3325
3326         Reviewed by Ryosuke Niwa.
3327
3328         When getting the rects for highlighting the spoken text within a selection range on iOS, we can get a
3329         list of totally wrong rects if the user changed the selection to some other text. This is because the
3330         calculation is based on the current selection range. Therefore, we need to provide a way for accessibility
3331         codepath to store the selection during a speaking session.
3332
3333         * UIProcess/API/Cocoa/WKWebView.mm:
3334         (-[WKWebView _accessibilityStoreSelection]):
3335         (-[WKWebView _accessibilityClearSelection]):
3336         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3337         * UIProcess/WebPageProxy.h:
3338         * UIProcess/ios/WKContentViewInteraction.h:
3339         * UIProcess/ios/WKContentViewInteraction.mm:
3340         (-[WKContentView _accessibilityStoreSelection]):
3341         (-[WKContentView _accessibilityClearSelection]):
3342         * UIProcess/ios/WebPageProxyIOS.mm:
3343         (WebKit::WebPageProxy::storeSelectionForAccessibility):
3344         * WebProcess/WebPage/WebPage.h:
3345         * WebProcess/WebPage/WebPage.messages.in:
3346         * WebProcess/WebPage/ios/WebPageIOS.mm:
3347         (WebKit::WebPage::getRectsForGranularityWithSelectionOffset):
3348         (WebKit::WebPage::storeSelectionForAccessibility):
3349         (WebKit::WebPage::getRectsAtSelectionOffsetWithText):
3350
3351 2017-10-19  Sam Weinig  <sam@webkit.org>
3352
3353         [Settings] Move global settings into their own file
3354         https://bugs.webkit.org/show_bug.cgi?id=178512
3355
3356         Reviewed by Darin Adler.
3357
3358         Moves all global settigns out of SettingsBase and into the new DeprecatedGlobalSettings.
3359
3360         * NetworkProcess/NetworkProcess.cpp:
3361         (WebKit::NetworkProcess::setAllowsAnySSLCertificateForWebSocket):
3362         * Shared/WebPreferencesDefinitions.h:
3363         * Shared/WebPreferencesStore.cpp:
3364         * WebProcess/WebPage/WebPage.cpp:
3365         (WebKit::m_cpuLimit):
3366         (WebKit::WebPage::updatePreferences):
3367         * WebProcess/WebProcess.cpp:
3368         (WebKit::WebProcess::setResourceLoadStatisticsEnabled):
3369         * WebProcess/cocoa/VideoFullscreenManager.mm:
3370         (WebKit::VideoFullscreenManager::supportsVideoFullscreen const):
3371
3372 2017-10-19  Andy Estes  <aestes@apple.com>
3373
3374         [iOS] Conditionally rename DatabaseProcess to StorageProcess when building for iOS devices
3375         https://bugs.webkit.org/show_bug.cgi?id=178181
3376         <rdar://problem/33660282>
3377
3378         Reviewed by Dan Bernstein.
3379
3380         * Configurations/BaseTarget.xcconfig:
3381         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
3382         (WebKit::serviceName):
3383         * WebKit.xcodeproj/project.pbxproj:
3384
3385 2017-10-19  Youenn Fablet  <youenn@apple.com>
3386
3387         Add preliminary support for ServiceWorker Handle Fetch
3388         https://bugs.webkit.org/show_bug.cgi?id=178475
3389         <rdar://problem/35066424>
3390
3391         Reviewed by Chris Dumez.
3392
3393         Relanding now that underlying issue is fixed in https://bugs.webkit.org/show_bug.cgi?id=178527.
3394
3395         Preliminary support of Handle Fetch algorithm and integration with fetch spec.
3396         Adding ServiceWorkerClientFetch as the class responsible to do the load through ServiceWorker.
3397         It is similar to WebResourceLoader that do the load through NetworkProcess.
3398         In case ServiceWorkerClientFetch is not able to load through ServiceWorker,
3399         it will fallback to WebResourceLoader through a fallback callback.
3400
3401         Loading through Service Worker is done currently if:
3402         - There is a service worker registered for that origin
3403         - Request is a subresource
3404         - service workers mode is all
3405         There will be cases where the service worker will not do the loading, for instance when fetch event handler is not set.
3406         Future work should try to reduce the cases where the IPC dance is done unnecessarily.
3407
3408         ServiceWorkerClientFetch is responsible to adapt the ServiceWorker response to ResourceLoader.
3409         In particular, it is calling ResourceLoader error callback if response is of type error.
3410         It should call ResourceLoader redirection callback if response is a redirection response.
3411         This will be done as a follow-up.
3412
3413         Implementing the IPC communication dedicated to fetch between WebProcess and ServiceWorker through StorageProcess.
3414         In the future, WebProcess should create a direct IPC communication to the ServiceWorker process.
3415
3416         Moved SWContextManager from WebCore to WebKit and renamed it to ServiceWorkerContextManager.
3417         This class is moved to WebKit as it will have to handle IPC and having a separation will add some unnecessary boilerplate.
3418
3419         * CMakeLists.txt:
3420         * DerivedSources.make:
3421         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3422         (WebKit::WebSWServerConnection::startFetch):
3423         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
3424         (WebKit::WebSWServerConnection::didReceiveFetchData):
3425         (WebKit::WebSWServerConnection::didFinishFetch):
3426         (WebKit::WebSWServerConnection::didFailFetch):
3427         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3428         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
3429         * StorageProcess/StorageProcess.cpp:
3430         (WebKit::StorageProcess::didFailFetch):
3431         (WebKit::StorageProcess::didReceiveFetchResponse):
3432         (WebKit::StorageProcess::didReceiveFetchData):
3433         (WebKit::StorageProcess::didFinishFetch):
3434         * StorageProcess/StorageProcess.h:
3435         * StorageProcess/StorageProcess.messages.in:
3436         * WebKit.xcodeproj/project.pbxproj:
3437         * WebProcess/Network/WebLoaderStrategy.cpp:
3438         (WebKit::WebLoaderStrategy::scheduleLoad):
3439         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
3440         (WebKit::WebLoaderStrategy::remove):
3441         * WebProcess/Network/WebLoaderStrategy.h:
3442         * WebProcess/Storage/ServiceWorkerClientFetch.cpp: Added.
3443         (WebKit::ServiceWorkerClientFetch::ServiceWorkerClientFetch):
3444         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
3445         (WebKit::ServiceWorkerClientFetch::didReceiveData):
3446         (WebKit::ServiceWorkerClientFetch::didFinish):
3447         (WebKit::ServiceWorkerClientFetch::didFail):
3448         (WebKit::ServiceWorkerClientFetch::cancel):
3449         * WebProcess/Storage/ServiceWorkerClientFetch.h: Copied from Source/WebKit/WebProcess/Storage/WebSWClientConnection.h.
3450         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in: Copied from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in.
3451         * WebProcess/Storage/ServiceWorkerContextManager.cpp: Added.
3452         (WebKit::ServiceWorkerContextManager::startServiceWorkerContext):
3453         (WebKit::ServiceWorkerContextManager::startFetch):
3454         * WebProcess/Storage/ServiceWorkerContextManager.h: Renamed from Source/WebCore/workers/service/context/SWContextManager.h.
3455         (WebKit::ServiceWorkerContextManager::ServiceWorkerContextManager):
3456         * WebProcess/Storage/WebSWClientConnection.cpp:
3457         (WebKit::WebSWClientConnection::startFetch):
3458         * WebProcess/Storage/WebSWClientConnection.h:
3459         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
3460         (WebKit::shouldHandleFetch):
3461         (WebKit::WebServiceWorkerProvider::handleFetch):
3462         (WebKit::WebServiceWorkerProvider::cancelFetch):
3463         (WebKit::WebServiceWorkerProvider::fetchFinished):
3464         (WebKit::WebServiceWorkerProvider::didReceiveServiceWorkerClientFetchMessage):
3465         * WebProcess/Storage/WebServiceWorkerProvider.h:
3466         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
3467         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
3468         * WebProcess/WebProcess.cpp:
3469         (WebKit::WebProcess::getWorkerContextConnection):
3470         (WebKit::WebProcess::startServiceWorkerContext):
3471         (WebKit::WebProcess::startFetchInServiceWorker):
3472         * WebProcess/WebProcess.h:
3473         * WebProcess/WebProcess.messages.in:
3474
3475 2017-10-19  Youenn Fablet  <youenn@apple.com>
3476
3477         Service Worker process should not be selected to open WebView on it
3478         https://bugs.webkit.org/show_bug.cgi?id=178527
3479
3480         Reviewed by Chris Dumez.
3481
3482         Selection of process to open a page will no longer use an existing web process if it is the service worker process.
3483
3484         * UIProcess/WebProcessPool.cpp:
3485         (WebKit::WebProcessPool::createNewWebProcessRespectingProcessCountLimit):
3486
3487 2017-10-19  Tim Horton  <timothy_horton@apple.com>
3488
3489         Display link bringup can block the main thread for ~150ms during WKWebView init
3490         https://bugs.webkit.org/show_bug.cgi?id=178524
3491
3492         Reviewed by Dean Jackson.
3493
3494         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
3495         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
3496         (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
3497         (WebKit::RemoteLayerTreeDrawingAreaProxy::displayLinkHandler):
3498         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
3499         (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
3500         Lazily initialize the display link at first use.
3501
3502 2017-10-19  Tim Horton  <timothy_horton@apple.com>
3503
3504         Expand r209943 to suppress paste during provisional navigation as well
3505         https://bugs.webkit.org/show_bug.cgi?id=178429
3506         <rdar://problem/33952830>
3507
3508         Reviewed by Dean Jackson.
3509
3510         * Shared/WebPreferencesDefinitions.h:
3511         * UIProcess/API/C/WKPreferences.cpp:
3512         (WKPreferencesSetShouldSuppressKeyboardInputDuringProvisionalNavigation):
3513         (WKPreferencesGetShouldSuppressKeyboardInputDuringProvisionalNavigation):
3514         * UIProcess/API/Cocoa/WKPreferences.mm:
3515         (-[WKPreferences _shouldSuppressKeyboardInputDuringProvisionalNavigation]):
3516         (-[WKPreferences _setShouldSuppressKeyboardInputDuringProvisionalNavigation:]):
3517         * WebProcess/WebPage/WebPage.cpp:
3518         (WebKit::WebPage::updatePreferences):
3519         Adjust to the changed preference name, except at the SPI level.
3520
3521 2017-10-19  Youenn Fablet  <youenn@apple.com>
3522
3523         Add API to clean CacheStorage data
3524         https://bugs.webkit.org/show_bug.cgi?id=178034
3525
3526         Unreviewed.
3527
3528         * UIProcess/API/Cocoa/WKWebsiteDataRecord.h: Using WK_IOS_TBA instead of WK_MAC_TBA for iOS.
3529
3530 2017-10-19  Chris Dumez  <cdumez@apple.com>
3531
3532         Unreviewed build fix after r223692.
3533
3534         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3535
3536 2017-10-19  Chris Dumez  <cdumez@apple.com>
3537
3538         Unreviewed, revert r223650 as it caused crashes on the bots.
3539
3540         * CMakeLists.txt:
3541         * DerivedSources.make:
3542         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3543         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3544         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
3545         * StorageProcess/StorageProcess.cpp:
3546         * StorageProcess/StorageProcess.h:
3547         * StorageProcess/StorageProcess.messages.in:
3548         * WebKit.xcodeproj/project.pbxproj:
3549         * WebProcess/Network/WebLoaderStrategy.cpp:
3550         (WebKit::WebLoaderStrategy::scheduleLoad):
3551         (WebKit::WebLoaderStrategy::remove):
3552         * WebProcess/Network/WebLoaderStrategy.h:
3553         * WebProcess/Storage/ServiceWorkerClientFetch.cpp: Removed.
3554         * WebProcess/Storage/ServiceWorkerClientFetch.h: Removed.
3555         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in: Removed.
3556         * WebProcess/Storage/ServiceWorkerContextManager.cpp: Removed.
3557         * WebProcess/Storage/WebSWClientConnection.cpp:
3558         * WebProcess/Storage/WebSWClientConnection.h:
3559         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
3560         * WebProcess/Storage/WebServiceWorkerProvider.h:
3561         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
3562         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
3563         * WebProcess/WebProcess.cpp:
3564         (WebKit::WebProcess::getWorkerContextConnection):
3565         (WebKit::WebProcess::startServiceWorkerContext):
3566         * WebProcess/WebProcess.h:
3567         * WebProcess/WebProcess.messages.in:
3568
3569 2017-10-19  Chris Dumez  <cdumez@apple.com>
3570
3571         http/tests/workers/service/basic-register.html is a flaky failure.
3572         https://bugs.webkit.org/show_bug.cgi?id=178494
3573         <rdar://problem/35065315>
3574
3575         Reviewed by Youenn Fablet.
3576
3577         In WebSWServerConnection::resolveJobInClient(), when a service worker is
3578         registered, we:
3579         1. Add the origin to the WebSWOriginStore
3580         2. Send the IPC to the WebProcess to notify it that the registration succeeded.
3581
3582         The assumption was that step 1 would be synchronous and would therefore send
3583         the shared memory handle to the WebProcess (if the SharedMemory was invalidated)
3584         *before* step 2.
3585
3586         The issue is that step 1 was scheduling a zero-timer to schedule the addition.
3587         As a result, there was a race and the WebContent process could check the
3588         the WebSWOriginTable *after* being notified that a service worker was registered
3589         but *before* it received the SharedMemory handle for the WebSWOriginTable. This
3590         could lead to false negatives and was causing the layout test to be flaky.
3591
3592         To address the issue, step 1 is now synchronous.
3593
3594         * Shared/SharedStringHashStore.cpp:
3595         (WebKit::SharedStringHashStore::SharedStringHashStore):
3596         (WebKit::SharedStringHashStore::scheduleAddition):
3597         (WebKit::SharedStringHashStore::scheduleRemoval):
3598         (WebKit::SharedStringHashStore::contains):
3599         (WebKit::SharedStringHashStore::flushPendingChanges):
3600         (WebKit::SharedStringHashStore::processPendingOperations):
3601         * Shared/SharedStringHashStore.h:
3602         * StorageProcess/ServiceWorker/WebSWOriginStore.cpp:
3603         (WebKit::WebSWOriginStore::add):
3604         (WebKit::WebSWOriginStore::addAll):
3605         (WebKit::WebSWOriginStore::remove):
3606         * StorageProcess/ServiceWorker/WebSWOriginStore.h:
3607         * UIProcess/VisitedLinkStore.cpp:
3608         (WebKit::VisitedLinkStore::addVisitedLinkHash):
3609         (WebKit::VisitedLinkStore::removeVisitedLinkHash):
3610
3611 2017-10-18  Ryosuke Niwa  <rniwa@webkit.org>
3612
3613         Don't expose raw HTML in pasteboard to the web content
3614         https://bugs.webkit.org/show_bug.cgi?id=178422
3615
3616         Reviewed by Wenson Hsieh.
3617
3618         Encode & decode the origin string of the copied content written into the system pasteboard.
3619
3620         * Shared/WebCoreArgumentCoders.cpp:
3621         (IPC::ArgumentCoder<PasteboardWebContent>::encode):
3622         (IPC::ArgumentCoder<PasteboardWebContent>::decode):
3623
3624 2017-10-18  Chris Dumez  <cdumez@apple.com>
3625
3626         Implement ServiceWorkerRegistration.scope / updateViaCache
3627         https://bugs.webkit.org/show_bug.cgi?id=178497
3628
3629         Reviewed by Youenn Fablet.
3630
3631         * Shared/WebCoreArgumentCoders.h:
3632         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3633
3634 2017-10-18  Youenn Fablet  <youenn@apple.com>
3635
3636         Add preliminary support for ServiceWorker Handle Fetch
3637         https://bugs.webkit.org/show_bug.cgi?id=178475
3638
3639         Reviewed by Chris Dumez.
3640
3641         Preliminary support of Handle Fetch algorithm and integration with fetch spec.
3642         Adding ServiceWorkerClientFetch as the class responsible to do the load through ServiceWorker.
3643         It is similar to WebResourceLoader that do the load through NetworkProcess.
3644         In case ServiceWorkerClientFetch is not able to load through ServiceWorker,
3645         it will fallback to WebResourceLoader through a fallback callback.
3646
3647         Loading through Service Worker is done currently if:
3648         - There is a service worker registered for that origin
3649         - Request is a subresource
3650         - service workers mode is all
3651         There will be cases where the service worker will not do the loading, for instance when fetch event handler is not set.
3652         Future work should try to reduce the cases where the IPC dance is done unnecessarily.
3653
3654         ServiceWorkerClientFetch is responsible to adapt the ServiceWorker response to ResourceLoader.
3655         In particular, it is calling ResourceLoader error callback if response is of type error.
3656         It should call ResourceLoader redirection callback if response is a redirection response.
3657         This will be done as a follow-up.
3658
3659         Implementing the IPC communication dedicated to fetch between WebProcess and ServiceWorker through StorageProcess.
3660         In the future, WebProcess should create a direct IPC communication to the ServiceWorker process.
3661
3662         Moved SWContextManager from WebCore to WebKit and renamed it to ServiceWorkerContextManager.
3663         This class is moved to WebKit as it will have to handle IPC and having a separation will add some unnecessary boilerplate.
3664
3665         * DerivedSources.make:
3666         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3667         (WebKit::WebSWServerConnection::startFetch):
3668         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
3669         (WebKit::WebSWServerConnection::didReceiveFetchData):
3670         (WebKit::WebSWServerConnection::didFinishFetch):
3671         (WebKit::WebSWServerConnection::failedFetch):
3672         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3673         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
3674         * StorageProcess/StorageProcess.cpp:
3675         (WebKit::StorageProcess::failedFetch):
3676         (WebKit::StorageProcess::didReceiveFetchResponse):
3677         (WebKit::StorageProcess::didReceiveFetchData):
3678         (WebKit::StorageProcess::didFinishFetch):
3679         * StorageProcess/StorageProcess.h:
3680         * StorageProcess/StorageProcess.messages.in:
3681         * WebKit.xcodeproj/project.pbxproj:
3682         * WebProcess/Network/WebLoaderStrategy.cpp:
3683         (WebKit::WebLoaderStrategy::scheduleLoad):
3684         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
3685         * WebProcess/Network/WebLoaderStrategy.h:
3686         * WebProcess/Storage/ServiceWorkerClientFetch.cpp: Added.
3687         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
3688         (WebKit::ServiceWorkerClientFetch::didReceiveData):
3689         (WebKit::ServiceWorkerClientFetch::didFinishFetch):
3690         (WebKit::ServiceWorkerClientFetch::didFail):
3691         * WebProcess/Storage/ServiceWorkerClientFetch.h: Added.
3692         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in: Added.
3693         * WebProcess/Storage/ServiceWorkerContextManager.cpp: Renamed from Source/WebCore/workers/service/context/SWContextManager.cpp.
3694         (WebKit::ServiceWorkerContextManager::startServiceWorkerContext):
3695         (WebKit::ServiceWorkerContextManager::startFetch):
3696         * WebProcess/Storage/ServiceWorkerContextManager.h: Renamed from Source/WebCore/workers/service/context/SWContextManager.h.
3697         (WebKit::ServiceWorkerContextManager::ServiceWorkerContextManager):
3698         * WebProcess/Storage/WebSWClientConnection.cpp:
3699         (WebKit::WebSWClientConnection::startFetch):
3700         * WebProcess/Storage/WebSWClientConnection.h:
3701         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
3702         (WebKit::shouldHandleFetch):
3703         (WebKit::WebServiceWorkerProvider::handleFetch):
3704         (WebKit::WebServiceWorkerProvider::didReceiveServiceWorkerClientFetchMessage):
3705         * WebProcess/Storage/WebServiceWorkerProvider.h:
3706         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
3707         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
3708         * WebProcess/WebProcess.cpp:
3709         (WebKit::WebProcess::getWorkerContextConnection):
3710         (WebKit::WebProcess::startServiceWorkerContext):
3711         (WebKit::WebProcess::startFetchInServiceWorker):
3712         * WebProcess/WebProcess.h:
3713         * WebProcess/WebProcess.messages.in:
3714
3715 2017-10-18  Chelsea Pugh  <cpugh@apple.com>
3716
3717         [iOS] Use new class name from UIKit when checking UITextSuggestion type
3718         https://bugs.webkit.org/show_bug.cgi?id=178416
3719         <rdar://problem/35010840>
3720
3721         Reviewed by Tim Horton.
3722
3723         Here we start using UITextAutofillSuggestion instead of the old name that was being used for
3724         AutoFill text suggestions.
3725
3726         * Platform/spi/ios/UIKitSPI.h:
3727         * UIProcess/ios/WKContentViewInteraction.mm:
3728         (-[WKContentView insertTextSuggestion:]): Use UITextAutofillSuggestion when checking the class
3729         and when casting instead of UIKeyboardLoginCredentialsSuggestion.
3730
3731 2017-10-17  Jiewen Tan  <jiewen_tan@apple.com>
3732
3733         Replace some stack raw pointers with RefPtrs within WebCore/html
3734         https://bugs.webkit.org/show_bug.cgi?id=178201
3735         <rdar://problem/34841692>
3736
3737         Reviewed by Ryosuke Niwa.
3738
3739         Change the type of node as toNode() is changed to return RefPtr.
3740
3741         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivate.cpp:
3742         (WebKit::wrap):
3743         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
3744         (WebKit::WebEditorClient::handleKeyboardEvent):
3745         * WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp:
3746         (WebKit::WebEditorClient::handleKeyboardEvent):
3747         * WebProcess/WebPage/WebPage.cpp:
3748         (WebKit::WebPage::handleEditingKeyboardEvent):
3749         * WebProcess/WebPage/mac/WebPageMac.mm:
3750         (WebKit::frameForEvent):
3751
3752 2017-10-18  Chris Dumez  <cdumez@apple.com>
3753
3754         [Service Worker] Add stubs for Client / WindowClient / Clients
3755         https://bugs.webkit.org/show_bug.cgi?id=178469
3756
3757         Reviewed by Youenn Fablet.
3758
3759         Rename PageVisibilityState to VisibilityState.
3760
3761         * Shared/API/c/WKSharedAPICast.h:
3762         (WebKit::toVisibilityState):
3763         * WebProcess/WebPage/WebPage.h:
3764
3765 2017-10-18  John Wilander  <wilander@apple.com>
3766
3767         Check notifyPagesWhenTelemetryWasCaptured before notifying pages if there is no WebPageProxy
3768         https://bugs.webkit.org/show_bug.cgi?id=178470
3769         <rdar://problem/34417518>
3770
3771         Reviewed by Brian Burg.
3772
3773         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
3774         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
3775             Add a missing check of notifyPagesWhenTelemetryWasCaptured.
3776             The page notification is only for testing purposes.
3777
3778 2017-10-18  Chris Dumez  <cdumez@apple.com>
3779
3780         Unreviewed, fix build error after r223608 with some SDKs.
3781
3782         * StorageProcess/StorageProcess.cpp:
3783         (WebKit::StorageProcess::ensureSWOriginStoreForSession):
3784
3785 2017-10-18  Chris Dumez  <cdumez@apple.com>
3786
3787         Add an efficient data structure for WebCore to query if there is a Service Worker registered for a given origin
3788         https://bugs.webkit.org/show_bug.cgi?id=177876
3789         <rdar://problem/34813129>
3790
3791         Reviewed by Ryosuke Niwa.
3792
3793         Introduce a Service Worker origin store which gets populated / updated on the StorageProcess side
3794         and queried on the WebContent process side via the WebSWOriginTable so that the WebProcess can
3795         efficiently check if there is a ServiceWorker registered for a given origin without actually doing
3796         an IPC to the StorageProcess.
3797
3798         For efficiency, the hash table is backed by SharedMemory so we only pass shared memory handles
3799         between the StorageProcess and the WebProcesses.
3800
3801         We currently add entries to the WebSWOriginStore whenever a service worker registration succeeds
3802         on the StorageProcess side. We also clear this store whenever the API to clear service worker
3803         registrations is called. Code to query the WebSWOriginTable from the WebContent process side is
3804         there but currently only used by Internals for testing. We will later leverage this code when
3805         integrating with Fetch API.
3806
3807         * CMakeLists.txt:
3808         * Shared/SharedStringHashStore.h:
3809         (WebKit::SharedStringHashStore::Client::didUpdateSharedStringHashes):
3810         * Shared/SharedStringHashTable.cpp:
3811         (WebKit::SharedStringHashTable::clear):
3812         * StorageProcess/ServiceWorker/WebSWOriginStore.cpp: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp.
3813         (WebKit::WebSWOriginStore::WebSWOriginStore):
3814         (WebKit::WebSWOriginStore::add):
3815         (WebKit::WebSWOriginStore::remove):
3816         (WebKit::WebSWOriginStore::clear):
3817         (WebKit::WebSWOriginStore::registerSWServerConnection):
3818         (WebKit::WebSWOriginStore::unregisterSWServerConnection):
3819         (WebKit::WebSWOriginStore::sendStoreHandle):
3820         (WebKit::WebSWOriginStore::didInvalidateSharedMemory):
3821         * StorageProcess/ServiceWorker/WebSWOriginStore.h: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h.
3822         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3823         (WebKit::WebSWServerConnection::WebSWServerConnection):
3824         (WebKit::WebSWServerConnection::resolveJobInClient):
3825         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3826         (WebKit::WebSWServerConnection::sessionID const):
3827         * StorageProcess/StorageProcess.cpp:
3828         (WebKit::StorageProcess::deleteWebsiteData):
3829         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
3830         (WebKit::StorageProcess::ensureSWOriginStoreForSession):
3831         (WebKit::StorageProcess::swOriginStoreForSession const):
3832         (WebKit::StorageProcess::serviceWorkerContextStarted):
3833         (WebKit::StorageProcess::registerSWServerConnection):
3834         (WebKit::StorageProcess::unregisterSWServerConnection):
3835         * StorageProcess/StorageProcess.h:
3836         * StorageProcess/StorageProcess.messages.in:
3837         * WebKit.xcodeproj/project.pbxproj:
3838         * WebProcess/Storage/WebSWClientConnection.cpp:
3839         (WebKit::WebSWClientConnection::WebSWClientConnection):
3840         (WebKit::WebSWClientConnection::hasServiceWorkerRegisteredForOrigin const):
3841         (WebKit::WebSWClientConnection::setSWOriginTableSharedMemory):
3842         * WebProcess/Storage/WebSWClientConnection.h:
3843         * WebProcess/Storage/WebSWClientConnection.messages.in:
3844         * WebProcess/Storage/WebSWOriginTable.cpp: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h.
3845         (WebKit::WebSWOriginTable::contains const):
3846         (WebKit::WebSWOriginTable::setSharedMemory):
3847         * WebProcess/Storage/WebSWOriginTable.h: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h.
3848         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
3849         (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession):
3850         * WebProcess/Storage/WebServiceWorkerProvider.h:
3851         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
3852         (WebKit::WebToStorageProcessConnection::serviceWorkerConnectionForSession):
3853         * WebProcess/Storage/WebToStorageProcessConnection.h:
3854         * WebProcess/WebProcess.cpp:
3855         (WebKit::WebProcess::startServiceWorkerContext):
3856
3857 2017-10-16  Andy Estes  <aestes@apple.com>
3858
3859         [Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact and ApplePayError
3860         https://bugs.webkit.org/show_bug.cgi?id=178191
3861         <rdar://problem/34906367>
3862
3863         Reviewed by Tim Horton.
3864
3865         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3866         (WebKit::toNSError):
3867
3868 2017-10-17  Sam Weinig  <sam@webkit.org>
3869
3870         [Settings] Generate Settings.h/cpp
3871         https://bugs.webkit.org/show_bug.cgi?id=178361
3872
3873         Reviewed by Dean Jackson.
3874
3875         * PlatformGTK.cmake:
3876         * PlatformWPE.cmake:
3877
3878             Delete the old Settings.h from the forwarding 
3879             headers directory to allow the build to work.
3880
3881 2017-10-17  John Wilander  <wilander@apple.com>
3882
3883         Add and remove cookie partition accordingly in intermediary redirect requests
3884         https://bugs.webkit.org/show_bug.cgi?id=178369
3885         <rdar://problem/34467603>
3886
3887         Reviewed by Brent Fulgham.
3888
3889         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3890         (WebKit::shouldChangePartition):
3891             Convenience function. Comment documents the logic.
3892         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
3893             Now adds and removes cookie partition based on the
3894             redirect-to URL's domain.
3895         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
3896         (WKBundleResourceLoadStatisticsNotifyObserver):
3897             Test infrastructure.
3898         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
3899
3900 2017-10-17  Youenn Fablet  <youenn@apple.com>
3901
3902         Cache API implementation should be able to compute storage size for WebKit client applications.
3903         https://bugs.webkit.org/show_bug.cgi?id=178350
3904
3905         Reviewed by Chris Dumez.
3906
3907         When gathering data from DOM Cache, we compute the size as follows:
3908         - If Caches object is not persistent, size is zero
3909         - If Caches object is persistent, we use the size computed by NetworkCache::Storage. 
3910         Covered by updated tests.
3911
3912         * NetworkProcess/cache/CacheStorageEngine.cpp:
3913         (WebKit::CacheStorage::ReadOriginsTaskCounter::create):
3914         (WebKit::CacheStorage::ReadOriginsTaskCounter::addOrigin):
3915         (WebKit::CacheStorage::Engine::fetchEntries):
3916         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
3917         (WebKit::CacheStorage::Caches::storageSize const):
3918         * NetworkProcess/cache/CacheStorageEngineCaches.h:
3919         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3920         (WKWebsiteDataStoreGetFetchCacheSizeForOrigin):
3921         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3922
3923 2017-10-17  Keith Miller  <keith_miller@apple.com>
3924
3925         Change WebCore sources to work with unified source builds
3926         https://bugs.webkit.org/show_bug.cgi?id=178229
3927
3928         Rubber stamped by Tim Horton.
3929
3930         * Configurations/FeatureDefines.xcconfig:
3931
3932 2017-10-16  Wenson Hsieh  <wenson_hsieh@apple.com>
3933
3934         Unreviewed, fix the iOS build after r223431
3935
3936         Remove an unused variable captured in a lambda.
3937
3938         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3939         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
3940
3941 2017-10-12  Matt Rajca  <mrajca@apple.com>
3942
3943         Add API support for quirk that lets an arbitrary click allow auto-play.
3944         https://bugs.webkit.org/show_bug.cgi?id=178227
3945
3946         Reviewed by Alex Christensen.
3947
3948         Instead of hardcoding sites in WebCore, let API clients control which websites opt into the quirk that lets
3949         an arbitrary click allow auto-play via website policies.
3950
3951         * Shared/WebsitePolicies.h:
3952         * UIProcess/API/C/WKWebsitePolicies.cpp:
3953         (WKWebsitePoliciesSetAllowedAutoplayQuirks):
3954         (WKWebsitePoliciesGetAllowedAutoplayQuirks):
3955         * UIProcess/API/C/WKWebsitePolicies.h:
3956         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
3957         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
3958         (-[_WKWebsitePolicies setAllowedAutoplayQuirks:]):
3959         (-[_WKWebsitePolicies allowedAutoplayQuirks]):
3960         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3961         (WebKit::WebFrameLoaderClient::applyToDocumentLoader):
3962         * WebProcess/WebPage/WebPage.cpp:
3963         (WebKit::WebPage::updateWebsitePolicies):
3964
3965 2017-10-16  Andy Estes  <aestes@apple.com>
3966
3967         [Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact and ApplePayError
3968         https://bugs.webkit.org/show_bug.cgi?id=178191
3969         <rdar://problem/34906367>
3970
3971         Reviewed by Tim Horton.
3972
3973         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3974         (WebKit::toNSError):
3975
3976 2017-10-16  Tim Horton  <timothy_horton@apple.com>
3977
3978         Safari crashes after searching PDF (under [WKPDFView zoom:to:atPoint:kind:])
3979         https://bugs.webkit.org/show_bug.cgi?id=178358
3980         <rdar://problem/34676899>
3981
3982         Reviewed by Wenson Hsieh.
3983
3984         * UIProcess/ios/WKPDFView.mm:
3985         (-[WKPDFView _didFindMatch:]):
3986         UIPDFSelection can return a null rect as the selection's bounds.
3987         We can't zoom to a null rect (and doing so results in CA throwing an
3988         exception later).
3989
3990 2017-10-16  Alex Christensen  <achristensen@webkit.org>
3991
3992         Add a _WKThumbnailView initializer with a WKWebView
3993         https://bugs.webkit.org/show_bug.cgi?id=178351
3994         <rdar://problem/34979453>
3995
3996         Reviewed by Tim Horton.
3997
3998         * UIProcess/API/Cocoa/WKWebView.mm:
3999         (-[WKWebView _page]):
4000         (-[WKWebView _setThumbnailView:]):
4001         (-[WKWebView _thumbnailView]):
4002         (-[WKWebView _setIgnoresAllEvents:]):
4003         (-[WKWebView _ignoresAllEvents]):
4004         * UIProcess/API/Cocoa/WKWebViewInternal.h:
4005         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
4006         * UIProcess/API/Cocoa/_WKThumbnailView.h:
4007         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
4008         (-[_WKThumbnailView initWithFrame:fromWKWebView:]):
4009         (-[_WKThumbnailView _viewWasUnparented]):
4010         (-[_WKThumbnailView _viewWasParented]):
4011
4012 2017-10-16  Alex Christensen  <achristensen@webkit.org>
4013
4014         Expose more WKView properties as WKWebViewPrivate SPI
4015         https://bugs.webkit.org/show_bug.cgi?id=178349
4016         <rdar://problem/34980919>