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