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