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