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