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