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