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