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