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