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