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