[iOS] Don't import 'UIKit-apps.sb' to the WebContent process sandbox
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2017-12-11  Brent Fulgham  <bfulgham@apple.com>
2
3         [iOS] Don't import 'UIKit-apps.sb' to the WebContent process sandbox
4         https://bugs.webkit.org/show_bug.cgi?id=180610
5         <rdar://problem/18899506>
6
7         Reviewed by Dean Jackson.
8
9         Stop including 'system.sb', and just include the portions of that sandbox that we
10         actually use in WebContent Process. This is the first step in some further sandbox
11         tightening.
12
13         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
14
15 2017-12-11  Yusuke Suzuki  <utatane.tea@gmail.com>
16
17         [WTF] Add Converter traits to StringHasher instead of function pointer
18         https://bugs.webkit.org/show_bug.cgi?id=180656
19
20         Reviewed by JF Bastien.
21
22         * WebProcess/WebProcess.cpp:
23         (WebKit::addCaseFoldedCharacters):
24
25 2017-12-11  David Quesada  <david_quesada@apple.com>
26
27         Turn on ENABLE_APPLICATION_MANIFEST
28         https://bugs.webkit.org/show_bug.cgi?id=180562
29         rdar://problem/35924737
30
31         Reviewed by Geoffrey Garen.
32
33         * Configurations/FeatureDefines.xcconfig:
34
35 2017-12-11  Dean Jackson  <dino@apple.com>
36
37         Add a runtime feature flag for ImageBitmap and OffscreenCanvas
38         https://bugs.webkit.org/show_bug.cgi?id=180652
39         <rdar://problem/35969611>
40
41         Reviewed by Antoine Quint.
42
43         Add an experimental feature flag for these interfaces.
44
45         * Shared/WebPreferences.yaml:
46
47 2017-12-10  Stephan Szabo  <stephan.szabo@sony.com>
48
49         APIClient.h uses things from <tuple> without including it explicitly
50         https://bugs.webkit.org/show_bug.cgi?id=180609
51
52         Reviewed by Darin Adler.
53
54         * Shared/API/APIClient.h:
55
56 2017-12-08  Youenn Fablet  <youenn@apple.com>
57
58         Service Worker should use a correct user agent
59         https://bugs.webkit.org/show_bug.cgi?id=180566
60         <rdar://problem/35926295>
61
62         Reviewed by Chris Dumez.
63
64         Addendum to landed patch.
65         This change was removed from the last version of the patch but proves to be needed by Safari.
66
67         * UIProcess/WebProcessPool.cpp:
68         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
69         Added back setting the user agent at start of service worker in case a page is already created.
70
71 2017-12-08  Brady Eidson  <beidson@apple.com>
72
73         Delay some service worker operations until after the database import completes.
74         https://bugs.webkit.org/show_bug.cgi?id=180573
75
76         Reviewed by Chris Dumez.
77
78         * StorageProcess/ServiceWorker/WebSWOriginStore.cpp:
79         (WebKit::WebSWOriginStore::importComplete): Tell the Origin Table on all connects that
80           the import is complete.
81         (WebKit::WebSWOriginStore::registerSWServerConnection):
82         * StorageProcess/ServiceWorker/WebSWOriginStore.h:
83
84         * WebProcess/Storage/WebSWClientConnection.cpp:
85         (WebKit::WebSWClientConnection::mayHaveServiceWorkerRegisteredForOrigin const):
86         (WebKit::WebSWClientConnection::setSWOriginTableIsImported): Run deferred tasks!
87         (WebKit::WebSWClientConnection::matchRegistration): If the import isn't complete yet, delay
88           the match registration task until later.
89         (WebKit::WebSWClientConnection::runOrDelayTask): Either send the message now or save off
90           the task to wait until the import is complete.
91         (WebKit::WebSWClientConnection::getRegistrations): If the import isn't complete yet, delay
92           the get registrations task until later.
93         (WebKit::WebSWClientConnection::initializeSWOriginTableAsEmpty): Deleted.
94         * WebProcess/Storage/WebSWClientConnection.h:
95         * WebProcess/Storage/WebSWClientConnection.messages.in:
96
97         * WebProcess/Storage/WebSWOriginTable.cpp:
98         (WebKit::WebSWOriginTable::setSharedMemory):
99         * WebProcess/Storage/WebSWOriginTable.h:
100         (WebKit::WebSWOriginTable::isImported const):
101         (WebKit::WebSWOriginTable::setIsImported):
102         (WebKit::WebSWOriginTable::isInitialized const): Deleted.
103         (WebKit::WebSWOriginTable::initializeAsEmpty): Deleted.
104
105 2017-12-08  Youenn Fablet  <youenn@apple.com>
106
107         Service Worker should use a correct user agent
108         https://bugs.webkit.org/show_bug.cgi?id=180566
109         <rdar://problem/35926295>
110
111         Reviewed by Chris Dumez.
112
113         Add support to set service worker user agent from UIProcess to service worker process.
114         One user agent is currently supported per service worker process and it can be changed at any given time.
115         Only new service worker will use the new value.
116         Once a service worker is launched, it will stay with the same user agent value.
117
118         This sets both navigator.userAgent and User-Agent header name used for fetch within a service worker.
119         Compute the service worker process user agent by picking the last user agent set for a web page.
120
121         * UIProcess/ServiceWorkerProcessProxy.cpp:
122         (WebKit::ServiceWorkerProcessProxy::start):
123         (WebKit::ServiceWorkerProcessProxy::setUserAgent):
124         * UIProcess/ServiceWorkerProcessProxy.h:
125         * UIProcess/WebPageProxy.cpp:
126         (WebKit::WebPageProxy::setApplicationNameForUserAgent):
127         * UIProcess/WebProcessPool.cpp:
128         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
129         (WebKit::WebProcessPool::createWebPage):
130         (WebKit::WebProcessPool::updateServiceWorkerUserAgent):
131         * UIProcess/WebProcessPool.h:
132         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
133         (WebKit::WebSWContextManagerConnection::installServiceWorker):
134         (WebKit::WebSWContextManagerConnection::setUserAgent):
135         (WebKit::WebSWContextManagerConnection::removeFrameLoaderClient):
136         * WebProcess/Storage/WebSWContextManagerConnection.h:
137         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
138
139 2017-12-07  Simon Fraser  <simon.fraser@apple.com>
140
141         Wrong caret position for input field inside a fixed position parent on iOS 11
142         https://bugs.webkit.org/show_bug.cgi?id=176896
143         rdar://problem/33726145
144
145         Reviewed by Tim Horton.
146
147         In r219668 I added code to compute a layout viewport rect in the web process, so that
148         after programmatic scrolling, getBoundingClientRect() would return the correct values.
149         However, that computation sometimes used a different visual viewport than the UI process,
150         resulting in a different layout viewport being set. This would happen when the keyboard
151         was visible, and the combination of this and zooming when focusing an input would result
152         in a state where the scrolling tree contained notes computed with the bad layout viewport.
153         This could cause apparently offset fixed elements, and bad caret positioning if those fixed
154         elements contained the focused input.
155
156         Fix by passing to the web process the same visual viewport rect that the UI process is using,
157         namely "unobscuredContentRectRespectingInputViewBounds". This was already being set in
158         VisibleContentRectUpdateInfo but wasn't encoded/decoded, so fix that. Set it as an optional<>
159         on FrameView when different from the normal visual viewport, and return it from
160         visualViewportRect().
161
162         Some other minor logging changes.
163
164         * Shared/VisibleContentRectUpdateInfo.cpp:
165         (WebKit::VisibleContentRectUpdateInfo::encode const):
166         (WebKit::VisibleContentRectUpdateInfo::decode):
167         (WebKit::operator<<):
168         * Shared/VisibleContentRectUpdateInfo.h:
169         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
170         * WebProcess/WebPage/ios/WebPageIOS.mm:
171         (WebKit::WebPage::updateVisibleContentRects):
172
173 2017-12-06  Simon Fraser  <simon.fraser@apple.com>
174
175         When the iPhone keyboard is up, sometimes we never commit a stable update and re-show the caret
176         https://bugs.webkit.org/show_bug.cgi?id=180498
177
178         Reviewed by Tim Horton.
179
180         When the keyboard is showing, we would think that the page was in a rubber-banding state
181         because contentOffsetBoundedInValidRange() would always clamp the content offset to a different
182         value.
183
184         This happened because scrollView.contentInset don't change when the keyboard is showing,
185         but UIKit actually consults scrollView.adjustedContentInset, which does. If we use
186         scrollView.adjustedContentInset in this computation, we'll get a correct answer.
187
188         Also rewrote the clamping logic to be more similar to what UIKit does internally when computing
189         min/max content offset.
190
191         * UIProcess/API/Cocoa/WKWebView.mm:
192         (contentOffsetBoundedInValidRange):
193
194 2017-12-08  Chris Dumez  <cdumez@apple.com>
195
196         Clearing all Website Data should remove service worker registrations on disk
197         https://bugs.webkit.org/show_bug.cgi?id=180558
198
199         Reviewed by Youenn Fablet.
200
201         * StorageProcess/StorageProcess.cpp:
202         (WebKit::StorageProcess::deleteWebsiteData):
203         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
204
205 2017-12-08  Youenn Fablet  <youenn@apple.com>
206
207         WebServiceWorkerProvider should use Cancellation error to notify DTL that it cannot handle a fetch
208         https://bugs.webkit.org/show_bug.cgi?id=180584
209
210         Reviewed by Alex Christensen.
211
212         * WebProcess/Network/WebLoaderStrategy.cpp:
213         (WebKit::WebLoaderStrategy::scheduleLoad):
214
215 2017-12-08  Youenn Fablet  <youenn@apple.com>
216
217         Service Worker should use a correct SessionID
218         https://bugs.webkit.org/show_bug.cgi?id=180585
219
220         Reviewed by Alex Christensen.
221
222         Store SessionID in SWServer and send it as part of service worker instantiation.
223         Use it when creating service worker thread in service worker process.
224
225         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
226         (WebKit::WebSWServerToContextConnection::installServiceWorkerContext):
227         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
228         * StorageProcess/StorageProcess.cpp:
229         (WebKit::StorageProcess::swServerForSession):
230         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
231         (WebKit::WebSWContextManagerConnection::installServiceWorker):
232         * WebProcess/Storage/WebSWContextManagerConnection.h:
233         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
234
235 2017-12-08  Youenn Fablet  <youenn@apple.com>
236
237         FetchResponse should keep unfiltered ResourceResponse so that it can be used in Service Worker
238         https://bugs.webkit.org/show_bug.cgi?id=179641
239         <rdar://problem/35923570>
240
241         Reviewed by Alex Christensen.
242
243         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
244         (WebKit::ServiceWorkerClientFetch::didReceiveResponse): In case of opaque redirected response, handle it as a regular response.
245
246 2017-12-08  Alex Christensen  <achristensen@webkit.org>
247
248         Remove unused code in WebPageGroup
249         https://bugs.webkit.org/show_bug.cgi?id=180604
250
251         Reviewed by Youenn Fablet.
252
253         * UIProcess/WebPageGroup.cpp:
254         (WebKit::WebPageGroup::userContentController):
255         (WebKit::WebPageGroup::createNonNull): Deleted.
256         (WebKit::WebPageGroup::preferencesDidChange): Deleted.
257         * UIProcess/WebPageGroup.h:
258         * UIProcess/WebProcessPool.cpp:
259         (WebKit::WebProcessPool::WebProcessPool):
260
261 2017-12-08  Alex Christensen  <achristensen@webkit.org>
262
263         Modernize APIWebsiteDataStore.h and WebProcessPool.h
264         https://bugs.webkit.org/show_bug.cgi?id=180588
265
266         Reviewed by Chris Dumez.
267
268         pragma once, Ref instead of RefPtr, initializer list in header instead of literals in constructor.
269
270         * UIProcess/API/APIWebsiteDataStore.h:
271         * UIProcess/WebProcessPool.cpp:
272         (WebKit::WebProcessPool::WebProcessPool):
273         * UIProcess/WebProcessPool.h:
274
275 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
276
277         Remove pthread_once in favor of dispatch_once
278         https://bugs.webkit.org/show_bug.cgi?id=180591
279
280         Reviewed by Saam Barati.
281
282         * PluginProcess/mac/PluginProcessMac.mm:
283         (WebKit::shouldCallRealDebugger):
284         (WebKit::initShouldCallRealDebugger): Deleted.
285
286 2017-12-08  Chris Dumez  <cdumez@apple.com>
287
288         ProcessPoolConfiguration::copy() fails to copy the service worker path
289         https://bugs.webkit.org/show_bug.cgi?id=180595
290
291         Reviewed by Brady Eidson.
292
293         * UIProcess/API/APIProcessPoolConfiguration.cpp:
294         (API::ProcessPoolConfiguration::copy):
295
296 2017-12-08  Chris Dumez  <cdumez@apple.com>
297
298         Different WebKitTestRunner instances should use different service worker registrations databases
299         https://bugs.webkit.org/show_bug.cgi?id=180589
300
301         Reviewed by Brady Eidson.
302
303         * UIProcess/API/C/WKContextConfigurationRef.cpp:
304         (WKContextConfigurationCopyServiceWorkerDatabaseDirectory):
305         (WKContextConfigurationSetServiceWorkerDatabaseDirectory):
306         * UIProcess/API/C/WKContextConfigurationRef.h:
307
308 2017-12-08  Alex Christensen  <achristensen@webkit.org>
309
310         Pass std::optional<WebsitePolicies> instead of WebsitePolicies
311         https://bugs.webkit.org/show_bug.cgi?id=180563
312
313         Reviewed by Andy Estes.
314
315         WebsitePolicies are only passed along when a decidePolicyForNavigationAction SPI completion handler
316         is called with a valid _WKWebsitePolicies object.  In other cases, we don't have one.  Rather than
317         making WebsitePolicies have a default value for everything that won't change policies, pass
318         a std::optional<WebsitePolicies> which indicates better when we don't have new policies.
319
320         No change in behavior, but this will enable me to add things to WebsitePolicies that have no default value.
321
322         * Shared/WebsitePolicies.h:
323         Make WebsitePolicies a class with public members because the IPC code generators don't understand std::optional<struct type>
324         * UIProcess/API/C/WKAPICast.h:
325         * UIProcess/Cocoa/NavigationState.mm:
326         (WebKit::tryAppLink):
327         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
328         * UIProcess/WebFrameListenerProxy.cpp:
329         (WebKit::WebFrameListenerProxy::receivedPolicyDecision):
330         * UIProcess/WebFrameListenerProxy.h:
331         * UIProcess/WebFramePolicyListenerProxy.cpp:
332         (WebKit::WebFramePolicyListenerProxy::use):
333         * UIProcess/WebFramePolicyListenerProxy.h:
334         * UIProcess/WebFrameProxy.cpp:
335         (WebKit::WebFrameProxy::receivedPolicyDecision):
336         * UIProcess/WebFrameProxy.h:
337         * UIProcess/WebPageProxy.cpp:
338         (WebKit::WebPageProxy::receivedPolicyDecision):
339         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
340         * UIProcess/WebPageProxy.h:
341         * UIProcess/WebPageProxy.messages.in:
342         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
343         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
344         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
345         * WebProcess/WebPage/WebFrame.cpp:
346         (WebKit::WebFrame::didReceivePolicyDecision):
347         * WebProcess/WebPage/WebFrame.h:
348         * WebProcess/WebPage/WebPage.cpp:
349         (WebKit::WebPage::didReceivePolicyDecision):
350         * WebProcess/WebPage/WebPage.h:
351         * WebProcess/WebPage/WebPage.messages.in:
352
353 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
354
355         [WTF] Remove remaining use of Mutex
356         https://bugs.webkit.org/show_bug.cgi?id=180579
357
358         Reviewed by Alex Christensen.
359
360         Remove unused "BinarySemaphore.h".
361
362         * Platform/IPC/win/ConnectionWin.cpp:
363
364 2017-12-08  Michael Catanzaro  <mcatanzaro@igalia.com>
365
366         [GTK] WebInspectorProxyClient needs a virtual destructor
367         https://bugs.webkit.org/show_bug.cgi?id=180533
368
369         Reviewed by Carlos Garcia Campos.
370
371         Otherwise the derived class portion of the object, WebKitInspectorClient, is not destroyed.
372
373         * UIProcess/gtk/WebInspectorProxyClient.h:
374
375 2017-12-07  Yousuke Kimoto  <yousuke.kimoto@sony.com>
376
377         [WinCairo] Fix ResourceError handling in ArgumentCoder for wincairo webkit
378         https://bugs.webkit.org/show_bug.cgi?id=180483
379
380         Reviewed by Alex Christensen.
381
382         * Shared/curl/WebCoreArgumentCodersCurl.cpp:
383         (IPC::ArgumentCoder<ResourceError>::encodePlatformData):
384         (IPC::ArgumentCoder<ResourceError>::decodePlatformData):
385
386 2017-12-07  Youenn Fablet  <youenn@apple.com>
387
388         StartFetch should take a ServiceWorkerIdentifier
389         https://bugs.webkit.org/show_bug.cgi?id=180478
390
391         Reviewed by Brady Eidson.
392
393         Before the patch, StartFetch was taking an optional ServiceWorkerIdentifier.
394         Now that every navigation fetch is querying its matching registration, it can no longer be optional.
395
396         In the case there is a problem in running the service worker at start fetch time,
397         answer to the WebProcess to go to network so that the request does not get stalled.
398
399         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
400         (WebKit::WebSWServerConnection::startFetch):
401         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
402         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
403         * WebProcess/Storage/WebSWClientConnection.cpp:
404         (WebKit::WebSWClientConnection::startFetch):
405         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
406         (WebKit::WebSWContextManagerConnection::startFetch):
407         * WebProcess/Storage/WebSWContextManagerConnection.h:
408         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
409
410 2017-12-07  Saam Barati  <sbarati@apple.com>
411
412         We need to grab the JSLock in InjectedBundle::createWebDataFromUint8Array
413         https://bugs.webkit.org/show_bug.cgi?id=180492
414
415         Reviewed by Alex Christensen.
416
417         InjectedBundle::createWebDataFromUint8Array calls into WebCore APIs that allocate
418         out of the JS heap. It's only legal to allocate out of the JS heap when holding the JS lock.
419
420         * WebProcess/InjectedBundle/InjectedBundle.cpp:
421         (WebKit::InjectedBundle::createWebDataFromUint8Array):
422
423 2017-12-07  Simon Fraser  <simon.fraser@apple.com>
424
425         Propagate WebKit2Logging channels to the Web Process
426         https://bugs.webkit.org/show_bug.cgi?id=180517
427
428         Reviewed by Tim Horton.
429
430         If you set WebKit2Logging, you want those channels active in both the UI process and
431         the web process, but without tricky 'defaults' gyrations, setting them in the web process
432         was hard.
433
434         Instead, send them through to the process via WebProcessCreationParameters, as we do
435         for WebCoreLogging channels.
436
437         * Platform/LogInitialization.h:
438         * Platform/Logging.cpp:
439         (WebKit::initializeLogChannelsIfNecessary):
440         * Shared/WebProcessCreationParameters.cpp:
441         (WebKit::WebProcessCreationParameters::encode const):
442         (WebKit::WebProcessCreationParameters::decode):
443         * Shared/WebProcessCreationParameters.h:
444         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
445         (WebKit::WebProcessPool::platformInitializeWebProcess):
446         * WebProcess/cocoa/WebProcessCocoa.mm:
447         (WebKit::WebProcess::platformInitializeWebProcess):
448
449 2017-12-07  Simon Fraser  <simon.fraser@apple.com>
450
451         Add logging for EditorState in RemoteLayerTree transactions
452         https://bugs.webkit.org/show_bug.cgi?id=180515
453
454         Reviewed by Wenson Hsieh.
455        
456         Make EditorState TextStream-able, and dump it in layer tree transactions.
457
458         * Shared/EditorState.cpp:
459         (WebKit::operator<<):
460         * Shared/EditorState.h:
461         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
462         (WebKit::RemoteLayerTreeTransaction::description const):
463
464 2017-12-07  Youenn Fablet  <youenn@apple.com>
465
466         CacheStorage Cache should not remove any disk entry when clearing its memory representation
467         https://bugs.webkit.org/show_bug.cgi?id=180546
468
469         Reviewed by Brady Eidson.
470
471         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
472         (WebKit::CacheStorage::Cache::clearMemoryRepresentation):
473
474 2017-12-07  Myles C. Maxfield  <mmaxfield@apple.com>
475
476         [Cocoa] Add SPI to disallow user-installed fonts
477         https://bugs.webkit.org/show_bug.cgi?id=180062
478         <rdar://problem/35042408>
479
480         Reviewed by Simon Fraser.
481
482         * Shared/WebPreferences.yaml:
483         * UIProcess/API/C/WKPreferences.cpp:
484         (WKPreferencesSetShouldDisallowUserInstalledFonts):
485         (WKPreferencesGetShouldDisallowUserInstalledFonts):
486         * UIProcess/API/C/WKPreferencesRefPrivate.h:
487         * UIProcess/API/Cocoa/WKPreferences.mm:
488         (-[WKPreferences _shouldDisallowUserInstalledFonts]):
489         (-[WKPreferences _setShouldDisallowUserInstalledFonts:]):
490         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
491
492 2017-12-07  David Quesada  <david_quesada@apple.com>
493
494         [Web App Manifest] Support display-mode media feature
495         https://bugs.webkit.org/show_bug.cgi?id=180376
496         rdar://problem/35837993
497
498         Reviewed by Geoffrey Garen.
499
500         * UIProcess/API/Cocoa/_WKApplicationManifest.h:
501         * UIProcess/API/Cocoa/_WKApplicationManifest.mm:
502         (-[_WKApplicationManifest initWithCoder:]):
503         (-[_WKApplicationManifest encodeWithCoder:]):
504         (-[_WKApplicationManifest displayMode]):
505
506 2017-12-07  Chris Dumez  <cdumez@apple.com>
507
508         Unreviewed build fix after r225622.
509
510         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
511         (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromServiceWorker):
512
513 2017-12-06  Chris Dumez  <cdumez@apple.com>
514
515         We should be able to recover after a Service Worker process crash
516         https://bugs.webkit.org/show_bug.cgi?id=180477
517
518         Reviewed by Brady Eidson and Youenn Fablet.
519
520         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
521         (WebKit::WebSWServerConnection::startFetch):
522         (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromClient):
523         (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromServiceWorker):
524         Update calls to SWServer::runServiceWorkerIfNecessary() that that it is asynchronous
525         and takes in a lambda.
526
527         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
528         (WebKit::WebSWServerConnection::ipcConnection const):
529         Add getter for the underlying IPC connection.
530
531         * StorageProcess/StorageProcess.cpp:
532         (WebKit::StorageProcess::didClose):
533         (WebKit::StorageProcess::connectionToContextProcessWasClosed):
534         Move some code to connectionToContextProcessWasClosed() to avoid duplication.
535         Also, relaunch the Service Worker process if it has exited but we still
536         have SWServer connections to regular Web Processes.
537
538         (WebKit::StorageProcess::needsServerToContextConnection const):
539         Utility function to determine if we still need the service worker process.
540         The current rule is that we need the service worker (aka "context") process
541         if we still have SWServer connections to regular Web Processes.
542
543         * StorageProcess/StorageProcess.h:
544
545         * StorageProcess/StorageToWebProcessConnection.cpp:
546         (WebKit::StorageToWebProcessConnection::didClose):
547         If didClose() is called for the connection to the service worker context,
548         let the StorageProcess know so that it can clear its state and relaunch
549         the process if necessary.
550
551         * UIProcess/API/C/WKContext.cpp:
552         (WKContextTerminateServiceWorkerProcess):
553         * UIProcess/API/C/WKContextPrivate.h:
554         * UIProcess/API/Cocoa/WKProcessPool.mm:
555         (-[WKProcessPool _terminateServiceWorkerProcess]):
556         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
557         Add SPI to terminate the service worker process.
558
559         * UIProcess/WebProcessPool.cpp:
560         (WebKit::m_serviceWorkerProcessTerminationTimer):
561         (WebKit::WebProcessPool::createNewWebProcess):
562         (WebKit::WebProcessPool::disconnectProcess):
563         (WebKit::WebProcessPool::terminateServiceWorkerProcess):
564         * UIProcess/WebProcessPool.h:
565         We used to shutdown the ServiceWorker process right away as soon as the last regular
566         WebProcess was gone. We now give it a grace period of 5 seconds in case a new
567         WebProcess gets launched shortly after.
568
569 2017-12-02  Darin Adler  <darin@apple.com>
570
571         Modernize some aspects of text codecs, eliminate WebKit use of strcasecmp
572         https://bugs.webkit.org/show_bug.cgi?id=180009
573
574         Reviewed by Alex Christensen.
575
576         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
577         (WebKit::initializeProtectionSpace): Use equalLettersIgnoringASCIICase instead
578         of strcasecmp.
579
580 2017-12-06  David Quesada  <david_quesada@apple.com>
581
582         [Web App Manifest] Add SPI for applying a manifest to a top-level browsing context
583         https://bugs.webkit.org/show_bug.cgi?id=180368
584         rdar://problem/34748067
585
586         Reviewed by Geoffrey Garen.
587
588         Add a new property WKWebViewConfiguration._applicationManifest to specify manifest
589         to apply to application contexts (aka. top-level browsing contexts, i.e. web views).
590         The manifest is ultimately stored on the MainFrame of the Pages created from the
591         web view configuration.
592
593         No new tests, no change in behavior.
594
595         * Shared/WebPageCreationParameters.cpp:
596         (WebKit::WebPageCreationParameters::encode const):
597         (WebKit::WebPageCreationParameters::decode):
598         * Shared/WebPageCreationParameters.h:
599         * UIProcess/API/APIPageConfiguration.cpp:
600         (API::PageConfiguration::copy const):
601         (API::PageConfiguration::applicationManifest const):
602         (API::PageConfiguration::setApplicationManifest):
603         * UIProcess/API/APIPageConfiguration.h:
604         * UIProcess/API/Cocoa/WKWebView.mm:
605         (-[WKWebView _initializeWithConfiguration:]):
606         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
607         (-[WKWebViewConfiguration copyWithZone:]):
608         (-[WKWebViewConfiguration _applicationManifest]):
609         (-[WKWebViewConfiguration _setApplicationManifest:]):
610         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
611         * UIProcess/API/Cocoa/_WKApplicationManifestInternal.h:
612         * UIProcess/WebPageProxy.cpp:
613         (WebKit::WebPageProxy::creationParameters):
614         * WebProcess/WebPage/WebPage.cpp:
615         (WebKit::m_cpuLimit):
616
617 2017-12-06  Jeff Miller  <jeffm@apple.com>
618
619         -[WKWebViewConfiguration copyWithZone] doesn't copy _groupIdentifier
620         https://bugs.webkit.org/show_bug.cgi?id=180504
621
622         Reviewed by Geoffrey Garen.
623
624         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
625         (-[WKWebViewConfiguration copyWithZone:]):
626         Copy _groupIdentifier.
627
628 2017-12-06  David Quesada  <david_quesada@apple.com>
629
630         [Web App Manifest] Add SPI for fetching the manifest
631         https://bugs.webkit.org/show_bug.cgi?id=180294
632         rdar://problem/34747968
633
634         Reviewed by Geoffrey Garen.
635
636         Add a new method -[WKWebView _getApplicationManifestWithCompletionHandler:] to request
637         the manifest associated with the current page.
638
639         * Shared/API/APIObject.h:
640         * Shared/Cocoa/APIObject.mm:
641         (API::Object::newObject):
642         * UIProcess/API/APIApplicationManifest.h: Copied from Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h.
643             Add a new API object type for application manifests.
644         * UIProcess/API/C/WKPage.cpp:
645         (WKPageGetApplicationManifest_b):
646             Add a C version of this SPI for WebKitTestRunner.
647         * UIProcess/API/C/WKPagePrivate.h:
648         * UIProcess/API/Cocoa/WKWebView.mm:
649         (-[WKWebView _getApplicationManifestWithCompletionHandler:]):
650         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
651         * UIProcess/API/Cocoa/_WKApplicationManifest.h: Copied from Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h.
652         * UIProcess/API/Cocoa/_WKApplicationManifest.mm: Added.
653         (-[_WKApplicationManifest initWithCoder:]):
654         (-[_WKApplicationManifest encodeWithCoder:]):
655         (+[_WKApplicationManifest applicationManifestFromJSON:manifestURL:documentURL:]):
656         (-[_WKApplicationManifest _apiObject]):
657         (nullableNSString):
658         (-[_WKApplicationManifest name]):
659         (-[_WKApplicationManifest shortName]):
660         (-[_WKApplicationManifest applicationDescription]):
661         (-[_WKApplicationManifest scope]):
662         (-[_WKApplicationManifest startURL]):
663         * UIProcess/API/Cocoa/_WKApplicationManifestInternal.h: Copied from Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h.
664         (API::wrapper):
665         * UIProcess/WebPageProxy.cpp:
666         (WebKit::WebPageProxy::applicationManifestCallback):
667         (WebKit::WebPageProxy::getApplicationManifest):
668         * UIProcess/WebPageProxy.h:
669         * UIProcess/WebPageProxy.messages.in:
670         * WebKit.xcodeproj/project.pbxproj:
671         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
672         (WebKit::WebFrameLoaderClient::finishedLoadingApplicationManifest):
673         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
674         * WebProcess/WebPage/WebPage.cpp:
675         (WebKit::WebPage::getApplicationManifest):
676         (WebKit::WebPage::didFinishLoadingApplicationManifest):
677         * WebProcess/WebPage/WebPage.h:
678         * WebProcess/WebPage/WebPage.messages.in:
679
680 2017-12-06  Per Arne Vollan  <pvollan@apple.com>
681
682         The WebProcess should use the NSRunLoop runloop type.
683         https://bugs.webkit.org/show_bug.cgi?id=179804
684         <rdar://problem/14012823>
685
686         Reviewed by Brent Fulgham.
687
688         * Platform/IPC/mac/ConnectionMac.mm:
689         (IPC::AccessibilityProcessSuspendedNotification):
690         * Shared/ChildProcess.h:
691         * Shared/mac/ChildProcessMac.mm:
692         (WebKit::ChildProcess::launchServicesCheckIn):
693         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
694         (WebKit::shouldLeakBoost):
695         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist:
696         * WebProcess/WebProcess.cpp:
697         (WebKit::WebProcess::initializeProcess):
698
699 2017-12-06  Nan Wang  <n_wang@apple.com>
700
701         AX: [iOS] Post accessibility notification when a web process changes its suspended state
702         https://bugs.webkit.org/show_bug.cgi?id=180458
703         <rdar://problem/35869115>
704
705         Reviewed by Chris Dumez.
706
707         Post accessibility notification with the pid information when a web process
708         becomes suspended or resumes running.
709
710         * WebProcess/WebProcess.cpp:
711         (WebKit::WebProcess::actualPrepareToSuspend):
712         (WebKit::WebProcess::processDidResume):
713         * WebProcess/WebProcess.h:
714         * WebProcess/cocoa/WebProcessCocoa.mm:
715         (WebKit::WebProcess::accessibilityProcessSuspendedNotification):
716
717 2017-12-06  Ryan Haddad  <ryanhaddad@apple.com>
718
719         Unreviewed build fix, removed unused lambda capture.
720
721         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
722         (WebKit::CacheStorageEngineConnection::open):
723
724 2017-12-06  John Wilander  <wilander@apple.com>
725
726         Storage Access API: Make document.hasStorageAccess a function and always allow access for same-origin iframes
727         https://bugs.webkit.org/show_bug.cgi?id=176944
728         <rdar://problem/34440658>
729
730         Reviewed by Brent Fulgham.
731
732         This change introduces document.hasStorageAccess() as a function which
733         returns a promise instead of being a property. Since cookie access can
734         be due to both a granted request and recent user interaction as first
735         party, the WebKit::WebResourceLoadStatisticsStore needs to be consulted.
736
737         * UIProcess/WebPageProxy.cpp:
738         (WebKit::WebPageProxy::hasStorageAccess):
739         * UIProcess/WebPageProxy.h:
740         * UIProcess/WebPageProxy.messages.in:
741         * UIProcess/WebResourceLoadStatisticsStore.cpp:
742         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
743         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
744             Now adds an entry for granted access. A bug found through testing.
745             Switched from WTF::Function to WTF::CompletionHandler.
746         * UIProcess/WebResourceLoadStatisticsStore.h:
747         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
748         (WebKit::WebsiteDataStore::hasStorageAccess):
749         (WebKit::WebsiteDataStore::requestStorageAccess):
750             Switched from WTF::Function to WTF::CompletionHandler.
751         * UIProcess/WebsiteData/WebsiteDataStore.h:
752         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
753         (WebKit::WebChromeClient::hasStorageAccess):
754         (WebKit::WebChromeClient::requestStorageAccess):
755             Switched from WTF::Function to WTF::CompletionHandler.
756         * WebProcess/WebCoreSupport/WebChromeClient.h:
757         * WebProcess/WebPage/WebPage.cpp:
758         (WebKit::WebPage::hasStorageAccess):
759         (WebKit::WebPage::requestStorageAccess):
760             Switched from WTF::Function to WTF::CompletionHandler.
761         * WebProcess/WebPage/WebPage.h:
762
763 2017-12-06  Youenn Fablet  <youenn@apple.com>
764
765         CacheStorageEngineConnection should protect its IPC Connection when doing asynchronous tasks
766         https://bugs.webkit.org/show_bug.cgi?id=180461
767
768         Reviewed by Chris Dumez.
769
770         Protecting the IPC connection instead of the CacheStorageEngineConnection
771         since CacheStorageEngineConnection only keeps a reference to the NetworkConnectionToWebProcess.
772
773         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
774         (WebKit::CacheStorageEngineConnection::open):
775         (WebKit::CacheStorageEngineConnection::remove):
776         (WebKit::CacheStorageEngineConnection::caches):
777         (WebKit::CacheStorageEngineConnection::retrieveRecords):
778         (WebKit::CacheStorageEngineConnection::deleteMatchingRecords):
779         (WebKit::CacheStorageEngineConnection::putRecords):
780         (WebKit::CacheStorageEngineConnection::clearMemoryRepresentation):
781
782 2017-12-06  Zan Dobersek  <zdobersek@igalia.com>
783
784         [CoordGraphics] Introduce Nicosia::PaintingContext, add Cairo implementation
785         https://bugs.webkit.org/show_bug.cgi?id=180239
786
787         Reviewed by Michael Catanzaro.
788
789         With Nicosia::Buffer now only providing the memory area into which the
790         tile content was rasterized, we can simplify the BitmapTexture update
791         greatly -- we don't have to create a BitmapImage anymore and retrieve
792         memory pointer from the contained cairo_surface_t object. Instead, we
793         just copy to GPU the memory that Nicosia::Buffer controls.
794
795         * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
796         (WebKit::CoordinatedBackingStoreTile::swapBuffers):
797
798 2017-12-05  Brent Fulgham  <bfulgham@apple.com>
799
800         Limit user agent versioning to an upper bound
801         https://bugs.webkit.org/show_bug.cgi?id=180365
802         <rdar://problem/34550617>
803
804         Reviewed by Joseph Pecoraro.
805
806         * UIProcess/ios/WebPageProxyIOS.mm:
807         (WebKit::WebPageProxy::standardUserAgent): Don't pass the WebKit bundle version when
808         creatin the User Agent string.
809         (WebKit::webKitBundleVersionString): Deleted.
810         * UIProcess/mac/WebPageProxyMac.mm:
811         (WebKit::WebPageProxy::standardUserAgent): Ditto.
812         (WebKit::webKitBundleVersionString): Deleted.
813
814 2017-12-05  Alex Christensen  <achristensen@webkit.org>
815
816         Fix crash when loading a file URL that does not have a fileSystemPath representation
817         https://bugs.webkit.org/show_bug.cgi?id=180448
818         <rdar://problem/22805921>
819
820         Reviewed by Chris Dumez.
821
822         * UIProcess/WebProcessProxy.cpp:
823         (WebKit::WebProcessProxy::assumeReadAccessToBaseURL):
824         Check if a String is null before adding it to a HashSet.
825
826 2017-12-05  Youenn Fablet  <youenn@apple.com>
827
828         Implement https://w3c.github.io/ServiceWorker/#clients-claim
829         https://bugs.webkit.org/show_bug.cgi?id=180261
830
831         Reviewed by Chris Dumez.
832
833         Add IPC plumbery for clients claim between ServiceWorker process and Storage process.
834
835         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
836         (WebKit::WebSWServerToContextConnection::claimCompleted):
837         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
838         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
839         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
840         (WebKit::WebSWContextManagerConnection::claim):
841         (WebKit::WebSWContextManagerConnection::claimCompleted):
842         * WebProcess/Storage/WebSWContextManagerConnection.h:
843         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
844
845 2017-12-05  Chris Dumez  <cdumez@apple.com>
846
847         Add support for ServiceWorkerContainer.prototype.ready
848         https://bugs.webkit.org/show_bug.cgi?id=180383
849
850         Reviewed by Youenn Fablet.
851
852         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
853         (WebKit::WebSWServerConnection::whenRegistrationReady):
854         (WebKit::WebSWServerConnection::resolveRegistrationReadyRequests):
855         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
856         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
857         * WebProcess/Storage/WebSWClientConnection.cpp:
858         (WebKit::WebSWClientConnection::matchRegistration):
859         (WebKit::WebSWClientConnection::whenRegistrationReady):
860         (WebKit::WebSWClientConnection::registrationReady):
861         (WebKit::WebSWClientConnection::getRegistrations):
862         * WebProcess/Storage/WebSWClientConnection.h:
863         * WebProcess/Storage/WebSWClientConnection.messages.in:
864
865 2017-12-05  Youenn Fablet  <youenn@apple.com>
866
867         Implement setting of service worker to client in SWServer without going to WebProcess
868         https://bugs.webkit.org/show_bug.cgi?id=180382
869
870         Reviewed by Chris Dumez.
871
872         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
873         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
874         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
875         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
876         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
877         * WebProcess/Storage/WebSWClientConnection.cpp:
878         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
879         (WebKit::WebSWClientConnection::serviceWorkerStartedControllingClient): Deleted.
880         (WebKit::WebSWClientConnection::serviceWorkerStoppedControllingClient): Deleted.
881         * WebProcess/Storage/WebSWClientConnection.h:
882
883 2017-12-04  Chris Dumez  <cdumez@apple.com>
884
885         Support container.getRegistration() / getRegistrations() inside service workers
886         https://bugs.webkit.org/show_bug.cgi?id=180360
887
888         Reviewed by Youenn Fablet.
889
890         * WebProcess/Storage/WebSWClientConnection.cpp:
891         (WebKit::WebSWClientConnection::didMatchRegistration):
892         (WebKit::WebSWClientConnection::didGetRegistrations):
893         (WebKit::WebSWClientConnection::matchRegistration):
894         (WebKit::WebSWClientConnection::getRegistrations):
895
896 2017-12-04  Brady Eidson  <beidson@apple.com>
897
898         Followup to:
899         Get a directory path to SWServers for storing ServiceWorker registrations
900         https://bugs.webkit.org/show_bug.cgi?id=180362
901
902         Unreviewed.
903
904         * StorageProcess/StorageProcess.cpp:
905         (WebKit::StorageProcess::swServerForSession): Change this ASSERT which is invalid in private browsing sessions.
906
907 2017-12-04  Simon Fraser  <simon.fraser@apple.com>
908
909         Minor DisplayRefreshMonitor-related cleanup
910         https://bugs.webkit.org/show_bug.cgi?id=179802
911
912         Reviewed by Sam Weinig.
913
914         Use RunLoopObserver::WellKnownRunLoopOrders. We want to fire before layer flushing.
915
916         * UIProcess/WebPageProxy.cpp:
917         (WebKit::m_configurationPreferenceValues):
918
919 2017-12-04  Brent Fulgham  <bfulgham@apple.com>
920
921         Don't force creation of process pool when enabling resource load statistics
922         https://bugs.webkit.org/show_bug.cgi?id=180374
923         <rdar://problem/35545639>
924
925         Reviewed by Alex Christensen.
926
927         Pass appropriate arguments to the 'processPool' accessor so that we only get the
928         set of existing process pools. We don't want to pay the cost of launching new
929         process pools just to set this flag. The flag will be properly set when the pools
930         are created as soon as a WebView is instantiated.
931
932         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
933         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
934
935 2017-12-04  David Quesada  <david_quesada@apple.com>
936
937         Add a class for parsing application manifests
938         https://bugs.webkit.org/show_bug.cgi?id=177973
939         rdar://problem/34747949
940
941         Reviewed by Geoffrey Garen.
942
943         * Configurations/FeatureDefines.xcconfig: Add ENABLE_APPLICATION_MANIFEST feature flag.
944
945 2017-12-04  Wenson Hsieh  <wenson_hsieh@apple.com>
946
947         Rename a static helper in TouchBarMenuItemData.cpp to match style guidelines.
948         https://bugs.webkit.org/show_bug.cgi?id=180305
949
950         Reviewed by Andy Estes.
951
952         Style guidelines state that we should use bare words for getters, so getItemType should just be
953         itemType. Since this collides with the itemType member variable, this patch also renames that
954         member variable to the more concise "type".
955
956         No change in behavior.
957
958         * Shared/TouchBarMenuItemData.cpp:
959         (WebKit::itemType):
960         (WebKit::TouchBarMenuItemData::TouchBarMenuItemData):
961         (WebKit::TouchBarMenuItemData::encode const):
962         (WebKit::TouchBarMenuItemData::decode):
963         (WebKit::getItemType): Deleted.
964         * Shared/TouchBarMenuItemData.h:
965         (WebKit::operator==):
966
967 2017-12-04  Brian Burg  <bburg@apple.com>
968
969         Web Automation: add flag to preserve legacy page screenshot behavior
970         https://bugs.webkit.org/show_bug.cgi?id=180313
971         <rdar://problem/34379930>
972
973         Reviewed by Joseph Pecoraro.
974
975         For compatibility with JSON Wire Protocol implemented by Safari,
976         we need to retain the ability to perform whole page contents
977         snapshots using Automation.takeScreenshot. Add an extra flag,
978         clipToViewport, which can be used by W3C-conforming drivers.
979
980         * UIProcess/Automation/Automation.json: Add new flag.
981         * UIProcess/Automation/WebAutomationSession.h:
982         * UIProcess/Automation/WebAutomationSession.cpp:
983         (WebKit::WebAutomationSession::takeScreenshot):
984         * WebProcess/Automation/WebAutomationSessionProxy.h:
985         * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
986         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
987         (WebKit::snapshotRectForScreenshot):
988         (WebKit::WebAutomationSessionProxy::takeScreenshot):
989         If the flag is false, take a screenshot of the whole page contents.
990
991 2017-12-04  JF Bastien  <jfbastien@apple.com>
992
993         Update std::expected to match libc++ coding style
994         https://bugs.webkit.org/show_bug.cgi?id=180264
995
996         Reviewed by Alex Christensen.
997
998         Update various uses of Expected, mostly renaming valueOr and
999         hasValue to the STL naming convention.
1000
1001         * NetworkProcess/cache/CacheStorageEngine.cpp:
1002         (WebKit::CacheStorage::Engine::open):
1003         (WebKit::CacheStorage::Engine::retrieveCaches):
1004         (WebKit::CacheStorage::Engine::retrieveRecords):
1005         (WebKit::CacheStorage::Engine::putRecords):
1006         (WebKit::CacheStorage::Engine::deleteMatchingRecords):
1007         (WebKit::CacheStorage::Engine::fetchEntries):
1008         (WebKit::CacheStorage::Engine::clearMemoryRepresentation):
1009         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
1010         (WebKit::CacheStorage::ReadRecordTaskCounter::appendRecord):
1011         (WebKit::CacheStorage::Cache::updateRecordToDisk):
1012         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1013         (WebKit::CacheStorage::Caches::initialize):
1014         (WebKit::CacheStorage::Caches::readCachesFromDisk):
1015         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
1016         (WebKit::NetworkRTCProvider::createResolver):
1017         * Platform/IPC/ArgumentCoders.h:
1018
1019 2017-12-04  Brady Eidson  <beidson@apple.com>
1020
1021         Get a directory path to SWServers for storing ServiceWorker registrations.
1022         https://bugs.webkit.org/show_bug.cgi?id=180362
1023
1024         Reviewed by Chris Dumez.
1025
1026         This gets all of the plumbing in place for specifying a ServiceWorker registration storage path
1027         in a particular WebsiteDataStore.
1028
1029         * Shared/Storage/StorageProcessCreationParameters.cpp:
1030         (WebKit::StorageProcessCreationParameters::encode const):
1031         (WebKit::StorageProcessCreationParameters::decode):
1032         * Shared/Storage/StorageProcessCreationParameters.h:
1033
1034         * StorageProcess/StorageProcess.cpp:
1035         (WebKit::StorageProcess::initializeWebsiteDataStore):
1036         (WebKit::StorageProcess::swServerForSession):
1037         * StorageProcess/StorageProcess.h:
1038
1039         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1040         (API::ProcessPoolConfiguration::createWithLegacyOptions):
1041         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
1042         (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
1043         * UIProcess/API/APIProcessPoolConfiguration.h:
1044
1045         * UIProcess/API/APIWebsiteDataStore.h:
1046         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
1047         (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
1048         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
1049         (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
1050
1051         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1052         (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory):
1053         (WebKit::WebProcessPool::legacyPlatformDefaultServiceWorkerRegistrationDirectory):
1054         * UIProcess/WebProcessPool.cpp:
1055         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
1056         * UIProcess/WebProcessPool.h:
1057
1058         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1059         (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
1060         (WebKit::WebsiteDataStore::storageProcessParameters):
1061         * UIProcess/WebsiteData/WebsiteDataStore.h:
1062         (WebKit::WebsiteDataStore::resolvedServiceWorkerRegistrationDirectory const):
1063
1064         * UIProcess/gtk/WebProcessPoolGtk.cpp:
1065         (WebKit::WebProcessPool::legacyPlatformDefaultServiceWorkerRegistrationDirectory):
1066
1067         * UIProcess/wpe/WebProcessPoolWPE.cpp:
1068         (WebKit::WebProcessPool::legacyPlatformDefaultServiceWorkerRegistrationDirectory):
1069
1070 2017-12-04  Frederic Wang  <fwang@igalia.com>
1071
1072         Make ScrollingTreeNode::enclosingFrameNode return the node itself for frame nodes
1073         https://bugs.webkit.org/show_bug.cgi?id=180353
1074
1075         Reviewed by Antonio Gomes.
1076
1077         This function was introduced in bug 175135 to solve a rendering bug with fixed positioned
1078         nodes in overflow nodes. For a frame node, the reference frame to use for fixed nodes is
1079         actually the frame node itself or otherwise we will get the same rendering bug. This patch
1080         makes enclosingFrameNode return the node itself when it is a frame node and renames it to
1081         clarify this behavior. Currently, enclosingFrameNode is not used for frame nodes so the
1082         behavior is unchanged.
1083
1084         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
1085         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll): Use auto* and
1086         the new function name.
1087
1088 2017-12-04  Michael Catanzaro  <mcatanzaro@igalia.com>
1089
1090         [GTK] Implement PAL::SleepDisabler
1091         https://bugs.webkit.org/show_bug.cgi?id=178485
1092
1093         Reviewed by Carlos Garcia Campos.
1094
1095         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1096         (webkitWebViewBaseDispose):
1097         (webkitWebViewBaseEnterFullScreen):
1098         (webkitWebViewBaseExitFullScreen):
1099         (screenSaverInhibitedCallback): Deleted.
1100         (webkitWebViewBaseSendInhibitMessageToScreenSaver): Deleted.
1101         (screenSaverProxyCreatedCallback): Deleted.
1102         (webkitWebViewBaseInhibitScreenSaver): Deleted.
1103         (webkitWebViewBaseUninhibitScreenSaver): Deleted.
1104
1105 2017-12-03  Yusuke Suzuki  <utatane.tea@gmail.com>
1106
1107         WTF shouldn't have both Thread and ThreadIdentifier
1108         https://bugs.webkit.org/show_bug.cgi?id=180308
1109
1110         Reviewed by Darin Adler.
1111
1112         * UIProcess/API/glib/IconDatabase.cpp:
1113         * UIProcess/GenericCallback.h:
1114         (WebKit::GenericCallback::~GenericCallback):
1115         (WebKit::GenericCallback::performCallbackWithReturnValue):
1116
1117 2017-12-03  Chris Dumez  <cdumez@apple.com>
1118
1119         Support serviceWorker.postMessage() inside service workers
1120         https://bugs.webkit.org/show_bug.cgi?id=180328
1121
1122         Reviewed by Darin Adler.
1123
1124         Support serviceWorker.postMessage() inside service workers.
1125
1126         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1127         (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromClient):
1128         (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromServiceWorker):
1129         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1130         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1131         * WebProcess/Storage/WebSWClientConnection.cpp:
1132         (WebKit::WebSWClientConnection::postMessageToServiceWorker):
1133         * WebProcess/Storage/WebSWClientConnection.h:
1134         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1135         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerFromClient):
1136         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerFromServiceWorker):
1137         * WebProcess/Storage/WebSWContextManagerConnection.h:
1138         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1139
1140 2017-12-03  Chris Dumez  <cdumez@apple.com>
1141
1142         Implement self.skipWaiting() inside service workers
1143         https://bugs.webkit.org/show_bug.cgi?id=180329
1144
1145         Reviewed by Darin Adler.
1146
1147         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1148         (WebKit::WebSWServerToContextConnection::didFinishSkipWaiting):
1149         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
1150         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
1151         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1152         (WebKit::WebSWContextManagerConnection::skipWaiting):
1153         (WebKit::WebSWContextManagerConnection::didFinishSkipWaiting):
1154         * WebProcess/Storage/WebSWContextManagerConnection.h:
1155         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1156
1157 2017-12-02  Youenn Fablet  <youenn@apple.com>
1158
1159         Implement https://w3c.github.io/ServiceWorker/#clients-getall
1160         https://bugs.webkit.org/show_bug.cgi?id=180276
1161
1162         Reviewed by Chris Dumez.
1163
1164         Add IPC plumbery for clients.matchAll between ServiceWorker process and Storage process.
1165
1166         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1167         (WebKit::WebSWServerToContextConnection::matchAllCompleted):
1168         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
1169         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
1170         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1171         (WebKit::WebSWContextManagerConnection::matchAll):
1172         (WebKit::WebSWContextManagerConnection::matchAllCompleted):
1173         * WebProcess/Storage/WebSWContextManagerConnection.h:
1174         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1175
1176 2017-12-02  Joseph Pecoraro  <pecoraro@apple.com>
1177
1178         Remote Web Inspector window always shows up at the default size
1179         https://bugs.webkit.org/show_bug.cgi?id=180284
1180         <rdar://problem/35430255>
1181
1182         Reviewed by Brian Burg.
1183
1184         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
1185         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
1186         Give remote web inspector windows an autosave name so that their frame can
1187         be automatically saved and restored by the system.
1188
1189 2017-12-02  Simon Fraser  <simon.fraser@apple.com>
1190
1191         Add a log channel for viewports
1192         https://bugs.webkit.org/show_bug.cgi?id=180295
1193
1194         Reviewed by Zalan Bujtas.
1195
1196         Add a "Viewports" log channel to log viewport scaling information, and enhance the
1197         WebKit "VisibleRects" channel to log additional data for the same reason.
1198
1199         * UIProcess/API/Cocoa/WKWebView.mm:
1200         (-[WKWebView _didCommitLayerTree:]):
1201         (-[WKWebView _dynamicViewportUpdateChangedTargetToScale:position:nextValidLayerTreeTransactionID:]):
1202         (-[WKWebView _dispatchSetMinimumLayoutSize:]):
1203         (-[WKWebView _endAnimatedResize]):
1204         (-[WKWebView _resizeWhileHidingContentWithUpdates:]):
1205         * WebProcess/WebPage/WebPage.cpp:
1206         (WebKit::WebPage::setFixedLayoutSize):
1207         (WebKit::WebPage::mainFrameDidLayout):
1208         (WebKit::WebPage::didCommitLoad):
1209         * WebProcess/WebPage/ios/WebPageIOS.mm:
1210         (WebKit::scaleAfterViewportWidthChange):
1211         (WebKit::WebPage::setViewportConfigurationMinimumLayoutSize):
1212         (WebKit::WebPage::dynamicViewportSizeUpdate):
1213         (WebKit::WebPage::resetViewportDefaultConfiguration):
1214         (WebKit::WebPage::viewportConfigurationChanged):
1215         (WebKit::WebPage::updateVisibleContentRects):
1216
1217 2017-12-02  Carlos Garcia Campos  <cgarcia@igalia.com>
1218
1219         WebDriver: handle user prompts shown while executing scripts
1220         https://bugs.webkit.org/show_bug.cgi?id=179979
1221
1222         Reviewed by Brian Burg.
1223
1224         * UIProcess/Automation/Automation.json: Add UnexpectedAlertOpen error.
1225         * UIProcess/Automation/WebAutomationSession.cpp:
1226         (WebKit::WebAutomationSession::willShowJavaScriptDialog): Finish pending evaluateJavaScriptFunction operations
1227         with UnexpectedAlertOpen error.
1228
1229 2017-12-02  Wenson Hsieh  <wenson_hsieh@apple.com>
1230
1231         Make some minor adjustments to TouchBarMenuData and TouchBarMenuItemData
1232         https://bugs.webkit.org/show_bug.cgi?id=180305
1233
1234         Reviewed by Joseph Pecoraro.
1235
1236         Mark some methods and parameters as const, use the default constructor in more places, and also remove a few
1237         extraneous imported headers.
1238
1239         * Shared/TouchBarMenuData.cpp:
1240         (WebKit::TouchBarMenuData::TouchBarMenuData):
1241
1242         Add a FIXME regarding the use of the 'id' attribute.
1243
1244         (WebKit::TouchBarMenuData::decode):
1245         * Shared/TouchBarMenuData.h:
1246         (WebKit::TouchBarMenuData::items const):
1247         (WebKit::TouchBarMenuData::setID):
1248         (WebKit::TouchBarMenuData::isPageCustomized const):
1249         (WebKit::TouchBarMenuData::items): Deleted.
1250         (WebKit::TouchBarMenuData::isPageCustomized): Deleted.
1251         * Shared/TouchBarMenuItemData.cpp:
1252         (WebKit::getItemType):
1253
1254         Change a helper method from a static class function to a static function in the implementation file.
1255
1256         (WebKit::TouchBarMenuItemData::TouchBarMenuItemData):
1257         (WebKit::TouchBarMenuItemData::encode const):
1258         (WebKit::TouchBarMenuItemData::decode):
1259         (WebKit::TouchBarMenuItemData::getItemType): Deleted.
1260         * Shared/TouchBarMenuItemData.h:
1261         (WebKit::operator==):
1262
1263         Remove the commandName member variable, since it doesn't make sense to propagate an event handler
1264         attribute from WebCore to the client layer.
1265
1266         * UIProcess/WebPageProxy.messages.in:
1267
1268 2017-12-01  Zan Dobersek  <zdobersek@igalia.com>
1269
1270         Unreviewed GTK+ debug build fix. Replace ASSERT_UNUSED() with UNUSED_PARAM()
1271         in WebKit::WebPage methods that used to operate on HTMLMenuElement pointer
1272         values (which have been converted to references).
1273
1274         * WebProcess/WebPage/WebPage.cpp:
1275         (WebKit::WebPage::didInsertMenuElement):
1276         (WebKit::WebPage::didRemoveMenuElement):
1277         (WebKit::WebPage::didInsertMenuItemElement):
1278         (WebKit::WebPage::didRemoveMenuItemElement):
1279
1280 2017-12-01  Simon Fraser  <simon.fraser@apple.com>
1281
1282         Reduce the number of calls to ViewportConfiguration::updateConfiguration()
1283         https://bugs.webkit.org/show_bug.cgi?id=180299
1284
1285         Reviewed by Zalan Bujtas.
1286
1287         There are several calls to ViewportConfiguration::setDefaultConfiguration() during loading
1288         with the same arguments. We can avoid unnecessary calls to updateConfiguration() by returning
1289         early if the configuration hasn't changed.
1290
1291         Also move the fetching of ViewportConfiguration::xhtmlMobileParameters() from didReceiveMobileDocType()
1292         into resetViewportDefaultConfiguration() where we grab all the other default configs.
1293
1294         * WebProcess/WebPage/WebPage.h:
1295         * WebProcess/WebPage/ios/WebPageIOS.mm:
1296         (WebKit::WebPage::didReceiveMobileDocType):
1297         (WebKit::WebPage::resetViewportDefaultConfiguration):
1298
1299 2017-12-01  Aishwarya Nirmal  <anirmal@apple.com>
1300
1301         [Touch Bar Web API] Object representing Touch Bar Menu to send between Web and UI Processes
1302         https://bugs.webkit.org/show_bug.cgi?id=179714
1303
1304         Reviewed by Wenson Hsieh.
1305
1306         These changes define the TouchBarMenuData and TouchBarMenuItemData objects which draw information
1307         from touch bar HTMLMenuElement and HTMLMenuItemElement. These objects represent the contents of
1308         the page-customized touch bar. Changes to the html elements representing the touch bar are sent 
1309         to the UI process.
1310
1311         * Shared/TouchBarMenuData.cpp: Copied from Source/WebCore/html/HTMLMenuItemElement.cpp.
1312         (WebKit::TouchBarMenuData::TouchBarMenuData):
1313         (WebKit::TouchBarMenuData::addMenuItem):
1314         (WebKit::TouchBarMenuData::removeMenuItem):
1315         (WebKit::TouchBarMenuData::encode const):
1316         (WebKit::TouchBarMenuData::decode):
1317         * Shared/TouchBarMenuData.h: Copied from Source/WebCore/html/HTMLMenuItemElement.h.
1318         (WebKit::TouchBarMenuData::items):
1319         (WebKit::TouchBarMenuData::isPageCustomized):
1320         (WebKit::TouchBarMenuData::setIsPageCustomized):
1321         * Shared/TouchBarMenuItemData.cpp: Added.
1322         (WebKit::TouchBarMenuItemData::getItemType):
1323         (WebKit::TouchBarMenuItemData::TouchBarMenuItemData):
1324         (WebKit::TouchBarMenuItemData::encode const):
1325         (WebKit::TouchBarMenuItemData::decode):
1326         * Shared/TouchBarMenuItemData.h: Added.
1327         (WebKit::operator<):
1328         (WebKit::operator>):
1329         (WebKit::operator<=):
1330         (WebKit::operator>=):
1331         (WebKit::operator==):
1332         (WebKit::operator!=):
1333         * UIProcess/WebPageProxy.cpp:
1334         (WebKit::WebPageProxy::touchBarMenuDataChanged):
1335         (WebKit::WebPageProxy::touchBarMenuItemDataAdded):
1336         (WebKit::WebPageProxy::touchBarMenuItemDataRemoved):
1337         * UIProcess/WebPageProxy.h:
1338         (WebKit::WebPageProxy::touchBarMenuData const):
1339         * UIProcess/WebPageProxy.messages.in:
1340         * WebKit.xcodeproj/project.pbxproj:
1341         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1342         (WebKit::WebChromeClient::didInsertMenuElement):
1343         (WebKit::WebChromeClient::didRemoveMenuElement):
1344         (WebKit::WebChromeClient::didInsertMenuItemElement):
1345         (WebKit::WebChromeClient::didRemoveMenuItemElement):
1346         * WebProcess/WebCoreSupport/WebChromeClient.h:
1347         * WebProcess/WebPage/WebPage.cpp:
1348         (WebKit::WebPage::didInsertMenuElement):
1349         (WebKit::WebPage::didRemoveMenuElement):
1350         (WebKit::WebPage::didInsertMenuItemElement):
1351         (WebKit::WebPage::didRemoveMenuItemElement):
1352         (WebKit::WebPage::sendTouchBarMenuDataRemovedUpdate):
1353         (WebKit::WebPage::sendTouchBarMenuDataAddedUpdate):
1354         (WebKit::WebPage::sendTouchBarMenuItemDataAddedUpdate):
1355         (WebKit::WebPage::sendTouchBarMenuItemDataRemovedUpdate):
1356         * WebProcess/WebPage/WebPage.h:
1357
1358 2017-12-01  Daniel Bates  <dabates@apple.com>
1359
1360         Alternative Presentation Button: Provide a way to query for the replaced elements
1361         https://bugs.webkit.org/show_bug.cgi?id=180114
1362         <rdar://problem/35710539>
1363
1364         Reviewed by Tim Horton.
1365
1366         Add SPI to query for the elements that were replaced by an Alternative Presentation Button.
1367
1368         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
1369         (-[WKWebProcessPlugInFrame elementsReplacedByAlternativePresentationButtonWithIdentifier:]): Added.
1370         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFramePrivate.h:
1371         * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
1372         (WKBundleElementsReplacedByAlternativePresentationButton): Added.
1373         * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h:
1374
1375 2017-12-01  Youenn Fablet  <youenn@apple.com>
1376
1377         Implement https://w3c.github.io/ServiceWorker/#clients-get
1378         https://bugs.webkit.org/show_bug.cgi?id=180167
1379
1380         Reviewed by Chris Dumez.
1381
1382         Add IPC plumbery for clientFromId between ServiceWorker process and Storage process.
1383
1384         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1385         (WebKit::WebSWServerToContextConnection::clientFromIdCompleted):
1386         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
1387         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
1388         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1389         (WebKit::WebSWContextManagerConnection::findClientByIdentifier):
1390         (WebKit::WebSWContextManagerConnection::findClientByIdentifierCompleted):
1391         * WebProcess/Storage/WebSWContextManagerConnection.h:
1392         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1393
1394 2017-12-01  Brian Burg  <bburg@apple.com>
1395
1396         Web Inspector: move Inspector::Protocol::Array<T> to JSON namespace
1397         https://bugs.webkit.org/show_bug.cgi?id=173662
1398
1399         Reviewed by Joseph Pecoraro.
1400
1401         Adopt new type names.
1402
1403         * UIProcess/Automation/WebAutomationSession.cpp:
1404         (WebKit::WebAutomationSession::getNextContext):
1405         (WebKit::WebAutomationSession::getBrowsingContexts):
1406         (WebKit::buildArrayForCookies):
1407         (WebKit::WebAutomationSession::getSessionPermissions):
1408         * UIProcess/Automation/WebAutomationSession.h:
1409
1410 2017-12-01  Wenson Hsieh  <wenson_hsieh@apple.com>
1411
1412         [Attachment Support] Implement SPI for clients to update a given attachment's data
1413         https://bugs.webkit.org/show_bug.cgi?id=180184
1414         <rdar://problem/35355731>
1415
1416         Reviewed by Tim Horton.
1417
1418         Add plumbing to the web process for setting the attachment data (and optionally, the content type and/or file
1419         name) of a given attachment. See WebCore ChangeLog for more detail. Changes covered by new API tests.
1420
1421         * UIProcess/API/APIAttachment.cpp:
1422         (API::Attachment::setDataAndContentType):
1423         * UIProcess/API/APIAttachment.h:
1424         * UIProcess/API/Cocoa/_WKAttachment.h:
1425
1426         Add nullability annotations around _WKAttachment SPI methods.
1427
1428         * UIProcess/API/Cocoa/_WKAttachment.mm:
1429         (-[_WKAttachment setData:newContentType:newFilename:completion:]):
1430         * UIProcess/WebPageProxy.cpp:
1431         (WebKit::WebPageProxy::setAttachmentDataAndContentType):
1432         * UIProcess/WebPageProxy.h:
1433         * WebProcess/WebPage/WebPage.cpp:
1434         (WebKit::WebPage::setAttachmentDataAndContentType):
1435         * WebProcess/WebPage/WebPage.h:
1436         * WebProcess/WebPage/WebPage.messages.in:
1437
1438 2017-12-01  Brady Eidson  <beidson@apple.com>
1439
1440         Add Internals.terminateServiceWorker, and the ability to restart service workers for postMessage.
1441         https://bugs.webkit.org/show_bug.cgi?id=180170
1442
1443         Reviewed by Chris Dumez.
1444
1445         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1446         (WebKit::WebSWServerConnection::startFetch):
1447         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
1448         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1449         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1450
1451         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1452         (WebKit::WebSWServerToContextConnection::syncTerminateWorker):
1453         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
1454
1455         * StorageProcess/StorageToWebProcessConnection.cpp:
1456         (WebKit::StorageToWebProcessConnection::didReceiveSyncMessage):
1457
1458         * WebProcess/Storage/WebSWClientConnection.cpp:
1459         (WebKit::WebSWClientConnection::syncTerminateWorker):
1460         * WebProcess/Storage/WebSWClientConnection.h:
1461
1462         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1463         (WebKit::WebSWContextManagerConnection::terminateWorker):
1464         (WebKit::WebSWContextManagerConnection::syncTerminateWorker):
1465         * WebProcess/Storage/WebSWContextManagerConnection.h:
1466         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1467
1468         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
1469         (WebKit::WebToStorageProcessConnection::didReceiveSyncMessage):
1470         * WebProcess/Storage/WebToStorageProcessConnection.h:
1471
1472 2017-12-01  Youenn Fablet  <youenn@apple.com>
1473
1474         Clear WebSWClientConnection in case storage process IPC connection is closing
1475         https://bugs.webkit.org/show_bug.cgi?id=180210
1476
1477         Reviewed by Chris Dumez.
1478
1479         Clear the sw connection maps when connection is closing.
1480         Call related completion handlers for each connection.
1481
1482         * WebProcess/Storage/WebSWClientConnection.cpp:
1483         (WebKit::WebSWClientConnection::connectionToServerLost):
1484         * WebProcess/Storage/WebSWClientConnection.h:
1485         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
1486         (WebKit::WebToStorageProcessConnection::didClose):
1487         (WebKit::WebToStorageProcessConnection::idbConnectionToServerForSession):
1488         (WebKit::WebToStorageProcessConnection::serviceWorkerConnectionForSession):
1489         * WebProcess/Storage/WebToStorageProcessConnection.h:
1490
1491 2017-12-01  Eric Carlson  <eric.carlson@apple.com>
1492
1493         [MediaStream] Use CaptureDevice instead of device ID to identify devices
1494         https://bugs.webkit.org/show_bug.cgi?id=180206
1495         <rdar://problem/35775758>
1496
1497         Reviewed by Youenn Fablet.
1498
1499         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
1500         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
1501         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
1502         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
1503         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1504         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
1505         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess):
1506         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
1507         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1508         * UIProcess/UserMediaPermissionRequestProxy.cpp:
1509         (WebKit::UserMediaPermissionRequestProxy::allow):
1510         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
1511         (WebKit::UserMediaPermissionRequestManager::userMediaAccessWasGranted):
1512         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
1513         * WebProcess/WebPage/WebPage.cpp:
1514         (WebKit::WebPage::userMediaAccessWasGranted):
1515         * WebProcess/WebPage/WebPage.h:
1516         * WebProcess/WebPage/WebPage.messages.in:
1517         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
1518         (WebKit::UserMediaCaptureManager::createCaptureSource):
1519         * WebProcess/cocoa/UserMediaCaptureManager.h:
1520
1521 2017-12-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1522
1523         WebDriver: link and partial links queries don't work in xhtml documents
1524         https://bugs.webkit.org/show_bug.cgi?id=180191
1525
1526         Reviewed by Brian Burg.
1527
1528         We convert the queries to use xpath, which works for html documents, but it doesn't work for xhtml. In case of
1529         xhtml we would need to provide a namespace resolver and elements would need to be prefixed with 'xhtml:'. It's
1530         easier to simply iterate the link elements and compare the text.
1531
1532         Fixes: imported/w3c/webdriver/tests/retrieval/find_element_from_element.py::test_xhtml_namespace[link text-full link text]
1533                imported/w3c/webdriver/tests/retrieval/find_element_from_element.py::test_xhtml_namespace[partial link text-link text]
1534                imported/w3c/webdriver/tests/retrieval/find_element_from_elements.py::test_xhtml_namespace[link text-full link text]
1535                imported/w3c/webdriver/tests/retrieval/find_element_from_elements.py::test_xhtml_namespace[partial link text-link text]
1536                imported/w3c/webdriver/tests/retrieval/find_element.py::test_xhtml_namespace[link text-full link text]
1537                imported/w3c/webdriver/tests/retrieval/find_element.py::test_xhtml_namespace[partial link text-link text]
1538                imported/w3c/webdriver/tests/retrieval/find_elements.py::test_xhtml_namespace[link text-full link text]
1539                imported/w3c/webdriver/tests/retrieval/find_elements.py::test_xhtml_namespace[partial link text-link text]
1540
1541         * UIProcess/Automation/atoms/FindNodes.js:
1542         (switch):
1543         (tryToFindNode):
1544
1545 2017-11-30  Alex Christensen  <achristensen@webkit.org>
1546
1547         REGRESSION (r224791): cookies are shared between ephemeral sessions in the same process pool
1548         https://bugs.webkit.org/show_bug.cgi?id=180235
1549
1550         Reviewed by Joseph Pecoraro.
1551
1552         In r224791 I assumed that uiProcessCookieStorageIdentifier would be empty in the ephemeral session initialization message.
1553         This is not the case.  We did not catch this because almost all of our ephemeral session testing uses the legacyPrivateSessionID.
1554         I add checks for if the SessionID is ephemeral like we already have in WebFrameNetworkingContext::ensureWebsiteDataStoreSession.
1555         I also add an API test that makes sure cookies are not shared between ephemeral sessions the way they are made through the API.
1556
1557         * NetworkProcess/mac/RemoteNetworkingContext.mm:
1558         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
1559
1560 2017-11-30  Stephan Szabo  <stephan.szabo@sony.com>
1561
1562         Make LegacyCustomProtocolManager optional for network process
1563         https://bugs.webkit.org/show_bug.cgi?id=176230
1564
1565         Reviewed by Alex Christensen.
1566
1567         * CMakeLists.txt:
1568         * Configurations/FeatureDefines.xcconfig:
1569         * NetworkProcess/NetworkProcess.cpp:
1570         (WebKit::NetworkProcess::NetworkProcess):
1571         (WebKit::NetworkProcess::initializeNetworkProcess):
1572         * PlatformGTK.cmake:
1573         * PlatformMac.cmake:
1574         * PlatformWPE.cmake:
1575         * UIProcess/Network/NetworkProcessProxy.cpp:
1576         (WebKit::NetworkProcessProxy::NetworkProcessProxy):
1577         (WebKit::NetworkProcessProxy::didClose):
1578         * UIProcess/Network/NetworkProcessProxy.h:
1579         * UIProcess/WebProcessPool.cpp:
1580         (WebKit::WebProcessPool::setLegacyCustomProtocolManagerClient):
1581         (WebKit::WebProcessPool::registerSchemeForCustomProtocol):
1582         (WebKit::WebProcessPool::unregisterSchemeForCustomProtocol):
1583
1584 2017-11-30  Ryan Haddad  <ryanhaddad@apple.com>
1585
1586         Unreviewed build fix, suppress deprecation warnings.
1587
1588         * Shared/mac/SandboxExtensionMac.mm:
1589         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
1590
1591 2017-11-30  Daniel Bates  <dabates@apple.com>
1592
1593         Expose SPI didClickAlternativePresentationButtonWithUserInfo on iOS
1594         https://bugs.webkit.org/show_bug.cgi?id=180218
1595         <rdar://problem/35782555>
1596
1597         Reviewed by Alex Christensen.
1598
1599         We want to support the SPI didClickAlternativePresentationButtonWithUserInfo on Cocoa platforms.
1600
1601         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1602         * UIProcess/Cocoa/UIDelegate.h:
1603         * UIProcess/Cocoa/UIDelegate.mm:
1604         (WebKit::UIDelegate::setDelegate):
1605         (WebKit::UIDelegate::UIClient::didClickAlternativePresentationButton):
1606
1607 2017-11-30  Joseph Pecoraro  <pecoraro@apple.com>
1608
1609         [Cocoa] Web Automation: _WKAutomationSessionConfiguration leak
1610         https://bugs.webkit.org/show_bug.cgi?id=180222
1611
1612         Reviewed by Brian Burg.
1613
1614         * UIProcess/Cocoa/AutomationClient.mm:
1615         (WebKit::AutomationClient::requestAutomationSessionWithCapabilities):
1616
1617 2017-11-30  Joseph Pecoraro  <pecoraro@apple.com>
1618
1619         Fix some NSOperationQueue leaks
1620         https://bugs.webkit.org/show_bug.cgi?id=180221
1621
1622         Reviewed by Wenson Hsieh.
1623
1624         * UIProcess/Cocoa/WebViewImpl.mm:
1625         (WebKit::WebViewImpl::performDragOperation):
1626
1627 2017-11-30  Brian Burg  <bburg@apple.com>
1628
1629         Web Automation: computeElementLayout does not correctly translate iframe client coordinates to main frame coordinates
1630         https://bugs.webkit.org/show_bug.cgi?id=180213
1631         <rdar://problem/30260141>
1632
1633         Reviewed by Simon Fraser.
1634
1635         The current implementation computes points in terms of the frame in which the element is located.
1636         However, WebDriver expects coordinates to be relative to the top-level document since
1637         these coordinates are used for generating click events, among other things.
1638
1639         To convert from frame client coordinates to main frame client coordinates, round-trip
1640         both inViewCenterPoint and elementBounds to root view coordinates and back
1641         to the main frame's contents/client coordinates. Then convert this to page coordinates if needed.
1642
1643         This progresses several tests in the Selenium Python test suite:
1644
1645          - event_firing_webdriver_tests.py::test_should_fire_navigation_events
1646          - frame_switching_tests.py::testShouldBeAbleToClickInAFrameThatRewritesTopWindowLocation
1647          - frame_switching_tests.py::testShouldBeAbleToSwitchToTheTopIfTheFrameIsDeletedFromUnderUs
1648          - frame_switching_tests.py::testShouldBeAbleToSwitchToTheTopIfTheFrameIsDeletedFromUnderUsWithFrameIndex
1649          - frame_switching_tests.py::testShouldBeAbleToSwitchToTheTopIfTheFrameIsDeletedFromUnderUsWithWebelement
1650          - frame_switching_tests.py::testShouldNotBeAbleToDoAnythingTheFrameIsDeletedFromUnderUs
1651          - position_and_size_tests.py::testShouldGetCoordinatesOfAnInvisibleElement
1652
1653         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1654         (WebKit::WebAutomationSessionProxy::computeElementLayout):
1655         Get both the frame and main frame FrameViews and convert coordinates to the root view.
1656         This is somewhat lossy as clientToDocument* deals with FloatPoints but contentsToRootView
1657         deals with IntPoints. For the purposes of WebDriver, lossiness is not a problem since
1658         integer values are expected anyway.
1659
1660         The imperative nature of the coordinate calculations is difficult to debug, so I converted
1661         this function to only assign to each variable once.
1662
1663 2017-11-30  Alex Christensen  <achristensen@webkit.org>
1664
1665         WKURLSchemeHandler.request should include HTTPBody
1666         https://bugs.webkit.org/show_bug.cgi?id=180220
1667
1668         Reviewed by Brady Eidson.
1669
1670         * Shared/URLSchemeTaskParameters.cpp: Added.
1671         (WebKit::URLSchemeTaskParameters::encode const):
1672         (WebKit::URLSchemeTaskParameters::decode):
1673         * Shared/URLSchemeTaskParameters.h: Added.
1674         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
1675         (-[WKURLSchemeTaskImpl request]):
1676         * UIProcess/WebPageProxy.cpp:
1677         (WebKit::WebPageProxy::startURLSchemeTask):
1678         * UIProcess/WebPageProxy.h:
1679         * UIProcess/WebPageProxy.messages.in:
1680         * UIProcess/WebURLSchemeHandler.cpp:
1681         (WebKit::WebURLSchemeHandler::startTask):
1682         * UIProcess/WebURLSchemeHandler.h:
1683         * UIProcess/WebURLSchemeTask.cpp:
1684         (WebKit::WebURLSchemeTask::create):
1685         (WebKit::WebURLSchemeTask::WebURLSchemeTask):
1686         * UIProcess/WebURLSchemeTask.h:
1687         * WebKit.xcodeproj/project.pbxproj:
1688         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
1689         (WebKit::WebURLSchemeTaskProxy::startLoading):
1690
1691 2017-11-30  Darin Adler  <darin@apple.com>
1692
1693         [Mac] remove unneeded RetainPtr use introduced in r225142
1694         https://bugs.webkit.org/show_bug.cgi?id=180202
1695
1696         Reviewed by Tim Horton.
1697
1698         * WebProcess/Plugins/PDF/PDFPlugin.h: Got rid of unnecessary RetainPtr.
1699         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1700         (WebKit::PDFPlugin::lookupTextAtLocation const): Ditto.
1701         * WebProcess/WebPage/WebPage.h: Ditto.
1702         * WebProcess/WebPage/mac/WebPageMac.mm:
1703         (WebKit::WebPage::performDictionaryLookupAtLocation): Ditto.
1704         (WebKit::WebPage::performDictionaryLookupForSelection): Ditto.
1705         (WebKit::WebPage::performImmediateActionHitTestAtLocation): Ditto.
1706         (WebKit::WebPage::lookupTextAtLocation): Ditto.
1707
1708 2017-11-30  Zan Dobersek  <zdobersek@igalia.com>
1709
1710         [CoordGraphics] Move CoordinatedGraphicsLayer painting behind Nicosia::PaintingEngine
1711         https://bugs.webkit.org/show_bug.cgi?id=180141
1712
1713         Reviewed by Carlos Garcia Campos.
1714
1715         CompositingCoordinator must implement the paintingEngine() method now
1716         that the method's been added to the CoordinatedGraphicsLayerClient
1717         interface. The CompositingCoordinator manages the Nicosia::PaintingEngine
1718         object through the new m_paintingEngine member variable, and returns the
1719         reference to this object in the paintingEngine() method.
1720
1721         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1722         (WebKit::CompositingCoordinator::CompositingCoordinator):
1723         (WebKit::CompositingCoordinator::paintingEngine):
1724         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
1725         Drop unnecessary typedefs.
1726
1727 2017-11-29  Wenson Hsieh  <wenson_hsieh@apple.com>
1728
1729         [Attachment Support] Implement SPI for clients to make an attachment element display in-place
1730         https://bugs.webkit.org/show_bug.cgi?id=180153
1731         <rdar://problem/35735252>
1732
1733         Reviewed by Tim Horton.
1734
1735         Add new WebKit SPI, -[_WKAttachment setDisplayOptions:completion:], and add plumbing for attachment display
1736         options to the web content process. Changes covered by 4 new API tests.
1737
1738         * Scripts/webkit/messages.py:
1739         (headers_for_type):
1740         * UIProcess/API/APIAttachment.cpp:
1741         (API::Attachment::setDisplayOptions):
1742         * UIProcess/API/APIAttachment.h:
1743         * UIProcess/API/Cocoa/WKWebView.mm:
1744         (-[WKWebView _insertAttachmentWithFilename:contentType:data:options:completion:]):
1745
1746         Respect given display options when inserting a new attachment.
1747
1748         * UIProcess/API/Cocoa/_WKAttachment.h:
1749         * UIProcess/API/Cocoa/_WKAttachment.mm:
1750         (-[_WKAttachmentDisplayOptions coreDisplayOptions]):
1751
1752         Introduce a helper to convert from the Cocoa _WKAttachmentDisplayOptions object to platform-agnostic
1753         AttachmentDisplayOptions.
1754
1755         (-[_WKAttachment setDisplayOptions:completion:]):
1756         (WebKit::if): Deleted.
1757         * UIProcess/API/Cocoa/_WKAttachmentInternal.h:
1758         * UIProcess/WebPageProxy.cpp:
1759         (WebKit::WebPageProxy::insertAttachment):
1760         (WebKit::WebPageProxy::setAttachmentDisplayOptions):
1761         * UIProcess/WebPageProxy.h:
1762         * WebProcess/WebPage/WebPage.cpp:
1763         (WebKit::WebPage::insertAttachment):
1764         (WebKit::WebPage::requestAttachmentData):
1765         (WebKit::WebPage::setAttachmentDisplayOptions):
1766         (WebKit::WebPage::attachmentElementWithIdentifier const):
1767
1768         Pull common logic to retrieve an attachment element matching a given identifier out into a helper.
1769
1770         * WebProcess/WebPage/WebPage.h:
1771         * WebProcess/WebPage/WebPage.messages.in:
1772
1773 2017-11-29  Brent Fulgham  <bfulgham@apple.com>
1774
1775         Part 2: Adopt updated NSKeyed[Un]Archiver API when available
1776         https://bugs.webkit.org/show_bug.cgi?id=180127
1777         <rdar://problem/35710738>
1778
1779         Reviewed by Simon Fraser.
1780
1781         The API that accepts a user-allocated NSMutableData is deprecated. Switch (for macOS 10.12 and newer)
1782         to the modern API. Use the original API for macOS builds prior to 10.12.
1783
1784         * Shared/Cocoa/DataDetectionResult.mm:
1785         (WebKit::DataDetectionResult::encode const):
1786         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
1787         (IPC::ArgumentCoder<WebCore::Payment>::encode):
1788         (IPC::ArgumentCoder<WebCore::PaymentContact>::encode):
1789         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode):
1790         (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode):
1791         * Shared/ios/InteractionInformationAtPosition.mm:
1792         (WebKit::InteractionInformationAtPosition::encode const):
1793         * Shared/mac/WebCoreArgumentCodersMac.mm:
1794         (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData):
1795         (IPC::ArgumentCoder<Credential>::encodePlatformData):
1796         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode):
1797         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData):
1798         * Shared/mac/WebHitTestResultData.mm:
1799         (WebKit::WebHitTestResultData::platformEncode const):
1800         * UIProcess/API/Cocoa/WKProcessPool.mm:
1801         (-[WKProcessPool _setObject:forBundleParameter:]):
1802         (-[WKProcessPool _setObjectsForBundleParametersWithDictionary:]):
1803         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1804         (WebKit::WebProcessPool::platformInitializeWebProcess):
1805         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1806         (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]):
1807
1808 2017-11-29  Brady Eidson  <beidson@apple.com>
1809
1810         When managing context startups, make ServiceWorkerJobDataIdentifier's optional.
1811         https://bugs.webkit.org/show_bug.cgi?id=180166
1812
1813         Reviewed by Chris Dumez.
1814
1815         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
1816
1817         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1818         (WebKit::WebSWContextManagerConnection::serviceWorkerStartedWithMessage):
1819         (WebKit::WebSWContextManagerConnection::didFinishInstall):
1820         * WebProcess/Storage/WebSWContextManagerConnection.h:
1821
1822 2017-11-29  Youenn Fablet  <youenn@apple.com>
1823
1824         Add support for service worker generated redirections
1825         https://bugs.webkit.org/show_bug.cgi?id=179498
1826
1827         Reviewed by Darin Adler.
1828
1829         Small refactoring to allow a service worker redirected fetch to follow the redirection through the service worker.
1830
1831         * WebProcess/Network/WebLoaderStrategy.cpp:
1832         (WebKit::WebLoaderStrategy::scheduleLoad): Make use of the loader request in case a network load is needed after a service worker redirection.
1833         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
1834         (WebKit::ServiceWorkerClientFetch::create):
1835         (WebKit::ServiceWorkerClientFetch::~ServiceWorkerClientFetch):
1836         (WebKit::ServiceWorkerClientFetch::ServiceWorkerClientFetch):
1837         (WebKit::ServiceWorkerClientFetch::start):
1838         (WebKit::ServiceWorkerClientFetch::didReceiveResponse): Check for response.
1839         Generate redirected request if needed and call loader callback to process the redirection.
1840         Adding some states so that if didFinish is called before the willSendRequest callback, redirection is followed.
1841         (WebKit::ServiceWorkerClientFetch::didFinish):
1842         In case redirection should be followed, wait for didFinish to follow it.
1843         This simplifies the model although introducing some limited latency.
1844         * WebProcess/Storage/ServiceWorkerClientFetch.h:
1845         * WebProcess/Storage/WebSWClientConnection.cpp:
1846         (WebKit::WebSWClientConnection::startFetch):
1847         * WebProcess/Storage/WebSWClientConnection.h:
1848         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
1849         (WebKit::WebServiceWorkerProvider::handleFetch):
1850
1851 2017-11-29  Youenn Fablet  <youenn@apple.com>
1852
1853         Add support for FetchEvent.clientId
1854         https://bugs.webkit.org/show_bug.cgi?id=180052
1855
1856         Reviewed by Chris Dumez.
1857
1858         Using FetchOption persistency coders for cache API and modernizing IPC FetchOptions decoding.
1859
1860         * WebKit/Shared/WebCoreArgumentCoders.cpp:
1861         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
1862         (WebKit::CacheStorage::Cache::encode):
1863         (WebKit::CacheStorage::Cache::decodeRecordHeader):
1864         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1865         (WebKit::WebSWContextManagerConnection::startFetch):
1866         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1867         (WebKit::WebSWContextManagerConnection::startFetch):
1868
1869 2017-11-29  Alex Christensen  <achristensen@webkit.org>
1870
1871         Make WebFrameLoaderClient more robust against null pointer dereferencing
1872         https://bugs.webkit.org/show_bug.cgi?id=180157
1873         <rdar://problem/34895616>
1874
1875         Reviewed by Tim Horton.
1876
1877         There has always been rare null pointer crashes in this code, but they have become more common
1878         now that we are waiting for completion handlers for redirects, which makes it more likely that
1879         we are hitting this code after we have detached from the core frame.
1880
1881         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1882         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
1883         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
1884         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1885         * WebProcess/WebPage/WebFrame.cpp:
1886         (WebKit::WebFrame::page const):
1887
1888 2017-11-29  Alex Christensen  <achristensen@webkit.org>
1889
1890         Fix Mac CMake build.
1891
1892         * PlatformMac.cmake:
1893
1894 2017-11-29  Chris Dumez  <cdumez@apple.com>
1895
1896         StorageToWebProcessConnection & WebSWServerToContextConnection should use the same underlying IPC::Connection
1897         https://bugs.webkit.org/show_bug.cgi?id=180147
1898
1899         Reviewed by Brady Eidson.
1900
1901         StorageToWebProcessConnection & WebSWServerToContextConnection should use the same underlying IPC::Connection.
1902         Otherwise, we have with 2 IPC::Connections between the StorageProcess and the ServiceWorker (aka Context) process,
1903         which makes synchronization of IPC messages difficult.
1904
1905         * StorageProcess/StorageProcess.cpp:
1906         (WebKit::StorageProcess::createStorageToWebProcessConnection):
1907         (WebKit::StorageProcess::createServerToContextConnection):
1908         * StorageProcess/StorageProcess.h:
1909         * StorageProcess/StorageProcess.messages.in:
1910         * StorageProcess/StorageToWebProcessConnection.cpp:
1911         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
1912         * UIProcess/ServiceWorkerProcessProxy.cpp:
1913         (WebKit::ServiceWorkerProcessProxy::start):
1914         * UIProcess/ServiceWorkerProcessProxy.h:
1915         * UIProcess/Storage/StorageProcessProxy.cpp:
1916         (WebKit::StorageProcessProxy::getStorageProcessConnection):
1917         (WebKit::StorageProcessProxy::didFinishLaunching):
1918         (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcess):
1919         * UIProcess/Storage/StorageProcessProxy.h:
1920         * UIProcess/Storage/StorageProcessProxy.messages.in:
1921         * UIProcess/WebProcessPool.cpp:
1922         (WebKit::WebProcessPool::getStorageProcessConnection):
1923         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
1924         * UIProcess/WebProcessPool.h:
1925         * UIProcess/WebProcessProxy.cpp:
1926         (WebKit::WebProcessProxy::getStorageProcessConnection):
1927         * UIProcess/WebProcessProxy.h:
1928         (WebKit::WebProcessProxy::isServiceWorkerProcess const):
1929         * UIProcess/WebProcessProxy.messages.in:
1930         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
1931         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
1932         * WebProcess/WebProcess.cpp:
1933         (WebKit::WebProcess::didReceiveMessage):
1934         (WebKit::WebProcess::establishWorkerContextConnectionToStorageProcess):
1935         * WebProcess/WebProcess.h:
1936         * WebProcess/WebProcess.messages.in:
1937
1938 2017-11-29  Chris Dumez  <cdumez@apple.com>
1939
1940         ensure*Connection() methods on WebProcess should return a reference
1941         https://bugs.webkit.org/show_bug.cgi?id=180149
1942
1943         Reviewed by Alex Christensen.
1944
1945         ensure*Connection() methods on WebProcess should return a reference instead of not returning
1946         anything. Also get rid of the non-ensure variants which called "ensure" internally and are
1947         no longer needed.
1948
1949         * Shared/mac/CookieStorageShim.mm:
1950         (WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL):
1951         * WebProcess/Cache/WebCacheStorageConnection.cpp:
1952         (WebKit::WebCacheStorageConnection::connection):
1953         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1954         (WebKit::WebIDBConnectionToServer::messageSenderConnection):
1955         (WebKit::preregisterSandboxExtensionsIfNecessary):
1956         * WebProcess/Databases/WebDatabaseProvider.cpp:
1957         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
1958         * WebProcess/FileAPI/BlobRegistryProxy.cpp:
1959         (WebKit::BlobRegistryProxy::registerFileBlobURL):
1960         (WebKit::BlobRegistryProxy::registerBlobURL):
1961         (WebKit::BlobRegistryProxy::registerBlobURLOptionallyFileBacked):
1962         (WebKit::BlobRegistryProxy::unregisterBlobURL):
1963         (WebKit::BlobRegistryProxy::registerBlobURLForSlice):
1964         (WebKit::BlobRegistryProxy::blobSize):
1965         (WebKit::BlobRegistryProxy::writeBlobsToTemporaryFiles):
1966         * WebProcess/Network/NetworkProcessConnection.cpp:
1967         (WebKit::NetworkProcessConnection::writeBlobsToTemporaryFiles):
1968         * WebProcess/Network/WebLoaderStrategy.cpp:
1969         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1970         (WebKit::WebLoaderStrategy::remove):
1971         (WebKit::WebLoaderStrategy::setDefersLoading):
1972         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1973         (WebKit::WebLoaderStrategy::startPingLoad):
1974         (WebKit::WebLoaderStrategy::preconnectTo):
1975         (WebKit::WebLoaderStrategy::storeDerivedDataToCache):
1976         (WebKit::WebLoaderStrategy::setCaptureExtraNetworkLoadMetricsEnabled):
1977         * WebProcess/Network/WebResourceLoader.cpp:
1978         (WebKit::WebResourceLoader::messageSenderConnection):
1979         * WebProcess/Network/WebSocketStream.cpp:
1980         (WebKit::WebSocketStream::WebSocketStream):
1981         (WebKit::WebSocketStream::messageSenderConnection):
1982         * WebProcess/Network/webrtc/LibWebRTCResolver.cpp:
1983         (WebKit::sendOnMainThread):
1984         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
1985         (WebKit::sendOnMainThread):
1986         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
1987         (WebKit::LibWebRTCSocketFactory::CreateServerTcpSocket):
1988         (WebKit::LibWebRTCSocketFactory::CreateUdpSocket):
1989         (WebKit::LibWebRTCSocketFactory::CreateClientTcpSocket):
1990         (WebKit::LibWebRTCSocketFactory::createNewConnectionSocket):
1991         * WebProcess/Network/webrtc/WebRTCMonitor.cpp:
1992         (WebKit::sendOnMainThread):
1993         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
1994         (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession):
1995         (WebKit::WebServiceWorkerProvider::handleFetch):
1996         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1997         (WebKit::WebPlatformStrategies::cookiesForDOM):
1998         (WebKit::WebPlatformStrategies::setCookiesFromDOM):
1999         (WebKit::WebPlatformStrategies::cookiesEnabled):
2000         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
2001         (WebKit::WebPlatformStrategies::getRawCookies):
2002         (WebKit::WebPlatformStrategies::deleteCookie):
2003         * WebProcess/WebPage/WebFrame.cpp:
2004         (WebKit::WebFrame::startDownload):
2005         (WebKit::WebFrame::convertMainResourceLoadToDownload):
2006         * WebProcess/WebProcess.cpp:
2007         (WebKit::WebProcess::ensureLegacyPrivateBrowsingSessionInNetworkProcess):
2008         (WebKit::WebProcess::ensureNetworkProcessConnection):
2009         (WebKit::WebProcess::ensureWebToStorageProcessConnection):
2010         (WebKit::WebProcess::prefetchDNS):
2011         * WebProcess/WebProcess.h:
2012
2013 2017-11-29  Alex Christensen  <achristensen@webkit.org>
2014
2015         Modernize API::SerializedScriptValue
2016         https://bugs.webkit.org/show_bug.cgi?id=180115
2017
2018         Reviewed by Brady Eidson.
2019
2020         Also remove some SPI that hasn't been used anywhere since Mountain Lion.
2021
2022         * Shared/API/APISerializedScriptValue.h:
2023         (API::SerializedScriptValue::create):
2024         (API::SerializedScriptValue::internalRepresentation):
2025         (API::SerializedScriptValue::SerializedScriptValue):
2026         * Shared/API/c/WKSerializedScriptValue.cpp:
2027         (WKSerializedScriptValueDeserialize):
2028         (WKSerializedScriptValueCreateWithInternalRepresentation): Deleted.
2029         (WKSerializedScriptValueGetInternalRepresentation): Deleted.
2030         * Shared/API/c/WKSerializedScriptValuePrivate.h: Removed.
2031         * UIProcess/API/Cocoa/WKWebView.mm:
2032         (-[WKWebView _evaluateJavaScript:forceUserGesture:completionHandler:]):
2033         * WebKit.xcodeproj/project.pbxproj:
2034
2035 2017-11-29  Michael Catanzaro  <mcatanzaro@igalia.com>
2036
2037         REGRESSION(r218064): [GTK] Broke entering fullscreen mode in debug builds
2038         https://bugs.webkit.org/show_bug.cgi?id=180120
2039
2040         Reviewed by Carlos Garcia Campos.
2041
2042         These assertions need to be swapped. Fixes /webkit2/WebKitWebView/fullscreen in debug mode.
2043
2044         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2045         (webkitWebViewBaseEnterFullScreen):
2046         (webkitWebViewBaseExitFullScreen):
2047
2048 2017-11-29  Zan Dobersek  <zdobersek@igalia.com>
2049
2050         [CoordGraphics] Rename CoordinatedBuffer to Nicosia::Buffer
2051         https://bugs.webkit.org/show_bug.cgi?id=180135
2052
2053         Reviewed by Carlos Garcia Campos.
2054
2055         Adjust code to the CoordinatedBuffer -> Nicosia::Buffer transition.
2056
2057         * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
2058         (WebKit::CoordinatedBackingStoreTile::setBackBuffer):
2059         (WebKit::CoordinatedBackingStore::updateTile):
2060         * Shared/CoordinatedGraphics/CoordinatedBackingStore.h:
2061         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2062         (WebKit::CoordinatedGraphicsScene::createUpdateAtlas):
2063         (WebKit::CoordinatedGraphicsScene::updateImageBacking):
2064         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
2065         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2066         (WebKit::CompositingCoordinator::updateImageBacking):
2067         (WebKit::CompositingCoordinator::createUpdateAtlas):
2068         (WebKit::CompositingCoordinator::getCoordinatedBuffer):
2069         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
2070         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp:
2071         (WebKit::UpdateAtlas::UpdateAtlas):
2072         (WebKit::UpdateAtlas::getCoordinatedBuffer):
2073         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h:
2074
2075 2017-11-28  Brent Fulgham  <bfulgham@apple.com>
2076
2077         Adopt updated NSKeyed[Un]Archiver API when available
2078         https://bugs.webkit.org/show_bug.cgi?id=180127
2079         <rdar://problem/35710738>
2080
2081         Reviewed by Alex Christensen.
2082
2083         Switch to new NSKeyed[Un]Archiver methods when available. We do not attempt
2084         to adopt secure coding in places we were not under the original API.
2085
2086         * Platform/ios/AccessibilityIOS.mm:
2087         (WebKit::newAccessibilityRemoteToken): Use secure-by-default API.
2088         * Shared/Cocoa/DataDetectionResult.mm:
2089         (WebKit::DataDetectionResult::encode const): Ditto.
2090         (WebKit::DataDetectionResult::decode): Ditto.
2091         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
2092         (IPC::ArgumentCoder<WebCore::Payment>::encode): Ditto.
2093         (IPC::ArgumentCoder<WebCore::Payment>::decode): Ditto.
2094         (IPC::ArgumentCoder<WebCore::PaymentContact>::encode): Ditto.
2095         (IPC::ArgumentCoder<WebCore::PaymentContact>::decode): Ditto.
2096         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode): Ditto.
2097         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::decode): Ditto.
2098         (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode): Ditto.
2099         (IPC::ArgumentCoder<WebCore::PaymentMethod>::decode): Ditto.
2100         * Shared/ios/InteractionInformationAtPosition.mm:
2101         (WebKit::InteractionInformationAtPosition::encode const): Ditto.
2102         (WebKit::InteractionInformationAtPosition::decode): Ditto.
2103         * Shared/mac/WebCoreArgumentCodersMac.mm:
2104         (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData): Ditto.
2105         (IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData): Ditto.
2106         (IPC::ArgumentCoder<Credential>::encodePlatformData): Ditto.
2107         (IPC::ArgumentCoder<Credential>::decodePlatformData): Ditto.
2108         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode): Ditto.
2109         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::decode): Ditto.
2110         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData): Ditto.
2111         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::decodePlatformData): Ditto.
2112         * Shared/mac/WebHitTestResultData.mm:
2113         (WebKit::WebHitTestResultData::platformEncode const): Ditto.
2114         (WebKit::WebHitTestResultData::platformDecode): Ditto.
2115         * UIProcess/API/Cocoa/WKProcessPool.mm:
2116         (-[WKProcessPool _setObject:forBundleParameter:]): Ditto.
2117         (-[WKProcessPool _setObjectsForBundleParametersWithDictionary:]): Ditto.
2118         * UIProcess/API/Cocoa/WKWebView.mm:
2119         (-[WKWebView _setInputDelegate:]): Ditto.
2120         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2121         (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto.
2122         * UIProcess/ios/PageClientImplIOS.mm:
2123         (WebKit::PageClientImpl::startAssistingNode): Ditto.
2124         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2125         (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): Ditto.
2126         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
2127         (WebKit::InjectedBundle::initialize): Ditto.
2128         (WebKit::InjectedBundle::setBundleParameter): Ditto.
2129         (WebKit::InjectedBundle::setBundleParameters): Ditto.
2130
2131 2017-11-28  Youenn Fablet  <youenn@apple.com>
2132
2133         NetworkCache::Storage should protect itself when removing operations from its maps
2134         https://bugs.webkit.org/show_bug.cgi?id=180118
2135
2136         Reviewed by Antti Koivisto.
2137
2138         The operations can contain ref to the Storage object and removing them from the map may destroy the Storage object
2139
2140         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2141         (WebKit::NetworkCache::Storage::remove):
2142         (WebKit::NetworkCache::Storage::finishReadOperation):
2143         (WebKit::NetworkCache::Storage::finishWriteOperation):
2144         (WebKit::NetworkCache::Storage::traverse):
2145
2146 2017-11-28  Youenn Fablet  <youenn@apple.com>
2147
2148         Register Documents as ServiceWorker clients to the StorageProcess
2149         https://bugs.webkit.org/show_bug.cgi?id=180047
2150
2151         Reviewed by Brady Eidson.
2152
2153         Adding IPC to register/unregister clients to the storage process.
2154         This will be used to enable service worker termination, and implementation of Clients API.
2155
2156         WebSWServerConnection keeps a hash map of all its related clients.
2157         This allows unregistering these clients if the corresponding web process crashes.
2158
2159         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2160         (WebKit::WebSWServerConnection::~WebSWServerConnection):
2161         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
2162         (WebKit::WebSWServerConnection::unregisterServiceWorkerClient):
2163         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2164         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2165         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
2166         * WebProcess/Storage/WebSWClientConnection.cpp:
2167         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
2168         (WebKit::WebSWClientConnection::unregisterServiceWorkerClient):
2169         * WebProcess/Storage/WebSWClientConnection.h:
2170
2171 2017-11-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
2172
2173         [CG] PostScript images should be supported if they are sub-resource images
2174         https://bugs.webkit.org/show_bug.cgi?id=178502
2175         <rdar://problem/35102988>
2176
2177         Reviewed by Simon Fraser.
2178
2179         Make convertPostScriptDataToPDF() be as static function of PDFDocumentImage
2180         in WebCore.
2181
2182         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2183         (WebKit::PDFPlugin::convertPostScriptDataIfNeeded):
2184         (WebKit::convertPostScriptDataToPDF): Deleted.
2185
2186 2017-11-28  Alex Christensen  <achristensen@webkit.org>
2187
2188         Add SPI for adding strings directly to a _WKVisitedLinkStore
2189         https://bugs.webkit.org/show_bug.cgi?id=180100
2190
2191         Reviewed by Geoffrey Garen.
2192
2193         * UIProcess/API/Cocoa/_WKVisitedLinkStore.h:
2194         * UIProcess/API/Cocoa/_WKVisitedLinkStore.mm:
2195         (-[_WKVisitedLinkStore addVisitedLinkWithString:]):
2196         This is a performance optimization for rdar://problem/16321391
2197
2198 2017-11-28  Joseph Pecoraro  <pecoraro@apple.com>
2199
2200         REGRESSION: Web Inspector: context menu actions "Download Image" and "Open Image in New Window" don't work
2201         https://bugs.webkit.org/show_bug.cgi?id=178808
2202         <rdar://problem/35176608>
2203
2204         Reviewed by Brian Burg.
2205
2206         * UIProcess/mac/WKInspectorViewController.mm:
2207         (-[WKInspectorViewController _webView:contextMenu:forElement:]):
2208         Continue to hide the image context menu actions like we used to.
2209         Investigating making these context menus work can be done as a
2210         follow-up task.
2211
2212         * UIProcess/mac/WKWebInspectorWKWebView.mm:
2213         (-[WKWebInspectorWKWebView initWithFrame:configuration:]):
2214         Use nullptr instead of 0.
2215
2216 2017-11-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2217
2218         Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
2219         https://bugs.webkit.org/show_bug.cgi?id=173793
2220
2221         Reviewed by Joseph Pecocaro.
2222
2223         Based on patch by Brian Burg.
2224
2225         * UIProcess/Automation/WebAutomationSession.cpp:
2226         (WebKit::WebAutomationSession::resizeWindowOfBrowsingContext):
2227         (WebKit::WebAutomationSession::moveWindowOfBrowsingContext):
2228         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage):
2229         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnFrame):
2230         (WebKit::WebAutomationSession::respondToPendingPageNavigationCallbacksWithTimeout):
2231         (WebKit::WebAutomationSession::respondToPendingFrameNavigationCallbacksWithTimeout):
2232         (WebKit::WebAutomationSession::navigationOccurredForFrame):
2233         (WebKit::WebAutomationSession::documentLoadedForFrame):
2234         (WebKit::WebAutomationSession::inspectorFrontendLoaded):
2235         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
2236         (WebKit::WebAutomationSession::evaluateJavaScriptFunction):
2237         (WebKit::WebAutomationSession::setFilesToSelectForFileUpload):
2238         (WebKit::WebAutomationSession::addSingleCookie):
2239         (WebKit::WebAutomationSession::setSessionPermissions):
2240         (WebKit::WebAutomationSession::performMouseInteraction):
2241         (WebKit::WebAutomationSession::performKeyboardInteractions):
2242         * UIProcess/Automation/WebAutomationSession.h:
2243
2244 2017-11-28  Daniel Bates  <dabates@apple.com>
2245
2246         [Cocoa] First pass at implementing alternative presentation button element
2247         https://bugs.webkit.org/show_bug.cgi?id=179785
2248         Part of <rdar://problem/34917108>
2249
2250         Reviewed by Brent Fulgham.
2251
2252         Expose SPI to substitute the alternative presentation button for one or more elements
2253         and remove the alternative presentation button. Add a private delegate callback when
2254         the alternative presentation button is clicked.
2255
2256         * UIProcess/API/APIUIClient.h:
2257         (API::UIClient::didClickAlternativePresentationButton): Added.
2258         * UIProcess/API/C/WKPageUIClient.h:
2259         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2260         * UIProcess/Cocoa/UIDelegate.h:
2261         * UIProcess/Cocoa/UIDelegate.mm:
2262         (WebKit::UIDelegate::setDelegate): Wired up delegate callback.
2263         (WebKit::UIDelegate::UIClient::didClickAlternativePresentationButton): Added.
2264         * UIProcess/WebPageProxy.cpp:
2265         (WebKit::WebPageProxy::handleAlternativePresentationButtonClick): Added.
2266         * UIProcess/WebPageProxy.h:
2267         * UIProcess/WebPageProxy.messages.in:
2268         * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
2269         (API::InjectedBundle::PageUIClient::didClickAlternativePresentationButton): Added.
2270         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
2271         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
2272         (-[WKWebProcessPlugInFrame substituteElements:withAlternativePresentationButtonWithIdentifier:]): Added.
2273         (-[WKWebProcessPlugInFrame removeAlternativePresentationButton:]): Added.
2274         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFramePrivate.h:
2275         * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
2276         (WKBundleSubstituteWithAlternativePresentationButton): Added.
2277         (WKBundleRemoveAlternativePresentationButton): Added.
2278         * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h:
2279         * WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h:
2280         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
2281         (WebKit::InjectedBundlePageUIClient::didClickAlternativePresentationButton): Added.
2282         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
2283         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2284         (WebKit::WebChromeClient::handleAlternativePresentationButtonClick): Added.
2285         * WebProcess/WebCoreSupport/WebChromeClient.h:
2286
2287 2017-11-27  Chris Dumez  <cdumez@apple.com>
2288
2289         ASSERTION FAILED: addResult.isNewEntry WebCore::SWServerRegistration::addClientUsingRegistration(WebCore::ServiceWorkerClientIdentifier const&) + 141
2290         https://bugs.webkit.org/show_bug.cgi?id=180049
2291
2292         Reviewed by Brady Eidson.
2293
2294         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2295         * WebProcess/Storage/WebSWClientConnection.cpp:
2296         (WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer):
2297         (WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer):
2298         (WebKit::WebSWClientConnection::serviceWorkerStartedControllingClient):
2299         (WebKit::WebSWClientConnection::serviceWorkerStoppedControllingClient):
2300         * WebProcess/Storage/WebSWClientConnection.h:
2301
2302 2017-11-27  Jeremy Jones  <jeremyj@apple.com>
2303
2304         downcast to WebKit::FullscreenClient can sometimes fail.
2305         https://bugs.webkit.org/show_bug.cgi?id=179849
2306
2307         Reviewed by Darin Adler.
2308
2309         There are cases during teardown where fullscreenClient() has been cleared back to an API::FullscreenClient.
2310         Because those cases, WKWebView should test before downcasting to WebKit::FullscreenClient.
2311
2312         This is causing a crash when fullscreen delegate is cleared after a page is closed.
2313
2314         * UIProcess/API/Cocoa/WKWebView.mm:
2315         (-[WKWebView _setFullscreenDelegate:]):
2316         (-[WKWebView _fullscreenDelegate]):
2317
2318 2017-11-27  Chris Dumez  <cdumez@apple.com>
2319
2320         Give Document a strongly typed identifier instead of a uint64_t
2321         https://bugs.webkit.org/show_bug.cgi?id=180041
2322
2323         Reviewed by Youenn Fablet.
2324
2325         Give Document a strongly typed identifier instead of a uint64_t, for clarity.
2326
2327         * Platform/IPC/ArgumentCoders.h:
2328         * Scripts/webkit/messages.py:
2329         (forward_declarations_and_headers):
2330         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2331         (WebKit::WebSWServerConnection::notifyClientsOfControllerChange):
2332         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
2333         (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient):
2334         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2335         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2336         * StorageProcess/StorageProcess.cpp:
2337         (WebKit::StorageProcess::postMessageToServiceWorkerClient):
2338         * WebProcess/Storage/WebSWClientConnection.cpp:
2339         (WebKit::WebSWClientConnection::postMessageToServiceWorkerGlobalScope):
2340         (WebKit::WebSWClientConnection::serviceWorkerStartedControllingClient):
2341         (WebKit::WebSWClientConnection::serviceWorkerStoppedControllingClient):
2342         (WebKit::WebSWClientConnection::postMessageToServiceWorkerClient):
2343         * WebProcess/Storage/WebSWClientConnection.h:
2344         * WebProcess/Storage/WebSWClientConnection.messages.in:
2345
2346 2017-11-27  Yacine Bandou  <yacine.bandou_ext@softathome.com>
2347
2348         [GTK][WPE] Add "enable-encrypted-media" property to WebKitWebSettings
2349         https://bugs.webkit.org/show_bug.cgi?id=18005
2350
2351         Reviewed by Michael Catanzaro.
2352
2353         EncryptedMedia is an experimental JavaScript API for playing encrypted media in HTML.
2354         This property will only work as intended if the EncryptedMedia feature is enabled at build time
2355         with the ENABLE_ENCRYPTED_MEDIA flag.
2356
2357         * UIProcess/API/glib/WebKitSettings.cpp:
2358         (webKitSettingsSetProperty):
2359         (webKitSettingsGetProperty):
2360         (webkit_settings_class_init):
2361         (webkit_settings_get_enable_encrypted_media):
2362         (webkit_settings_set_enable_encrypted_media):
2363         * UIProcess/API/gtk/WebKitSettings.h:
2364         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
2365         * UIProcess/API/wpe/WebKitSettings.h:
2366
2367 2017-11-27  Tim Horton  <timothy_horton@apple.com>
2368
2369         One too many zeroes in macOS version number in FeatureDefines
2370         https://bugs.webkit.org/show_bug.cgi?id=180011
2371
2372         Reviewed by Dan Bernstein.
2373
2374         * Configurations/FeatureDefines.xcconfig:
2375
2376 2017-11-27  Zan Dobersek  <zdobersek@igalia.com>
2377
2378         [CoordGraphics] Prettify ID value handling in UpdateAtlas and UpdateAtlas::Client
2379         https://bugs.webkit.org/show_bug.cgi?id=180038
2380
2381         Reviewed by Carlos Garcia Campos.
2382
2383         In the UpdateAtlas class, provide an ID type that aliases to uint32_t.
2384         The m_id member variable (ex-m_ID) uses this type, and it's also now
2385         used in the Client interface.
2386
2387         While poking around, the header is modified to use '#pragma once',
2388         and m_id is moved to the more logical first position among member
2389         variables.
2390
2391         The static ID variable is modified to use the new type, and renamed
2392         to s_nextID. Comment alongside the namespace scope closure is fixed
2393         to use the appropriate name.
2394
2395         createUpdateAtlas() and removeUpdateAtlas() methods in the
2396         CompositingCoordinator class are modified to use the UpdateAtlas::ID
2397         type, and the former has the second parameter changed from RefPtr<>
2398         to Ref<>.
2399
2400         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2401         (WebKit::CompositingCoordinator::createUpdateAtlas):
2402         (WebKit::CompositingCoordinator::removeUpdateAtlas):
2403         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
2404         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp:
2405         (WebKit::UpdateAtlas::UpdateAtlas):
2406         (WebKit::UpdateAtlas::~UpdateAtlas):
2407         (WebKit::UpdateAtlas::getCoordinatedBuffer):
2408         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h:
2409
2410 2017-11-27  Zan Dobersek  <zdobersek@igalia.com>
2411
2412         [CoordGraphics] CompositingCoordinator: clean up Client vtable, GraphicsLayerClient overrides
2413         https://bugs.webkit.org/show_bug.cgi?id=180037
2414
2415         Reviewed by Carlos Garcia Campos.
2416
2417         Remove the CompositingCoordinator::Client::paintLayerContents() method since
2418         the only implementation in CoordinatedLayerTreeHost was empty.
2419
2420         Subsequently, the CompositingCoordinator::paintContents() override of the
2421         GraphicsLayerClient method can also be removed. The notifyAnimationStarted()
2422         override is empty, just like the base method, so it's removed as well.
2423
2424         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2425         (WebKit::CompositingCoordinator::deviceScaleFactor const): Bring method up
2426         to the notifyFlushRequired() code, since both are overrides of the
2427         GraphicsLayerClient-inherited methods.
2428         (WebKit::CompositingCoordinator::pageScaleFactor const): Ditto.
2429         (WebKit::CompositingCoordinator::notifyAnimationStarted): Deleted.
2430         (WebKit::CompositingCoordinator::paintContents): Deleted.
2431         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
2432         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
2433         (WebKit::CoordinatedLayerTreeHost::paintLayerContents): Deleted.
2434         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
2435
2436 2017-11-27  Carlos Garcia Campos  <cgarcia@igalia.com>
2437
2438         REGRESSION(r223073): disk cache directory is no longer copied in ProcessPoolConfiguration::copy()
2439         https://bugs.webkit.org/show_bug.cgi?id=180031
2440
2441         Reviewed by Youenn Fablet.
2442
2443         This has caused GTK/WPE test /webkit2/WebKitWebsiteData/configuration to fail, and the wrong directory is used
2444         by the network process. I think it was removed by mistake in r223073.
2445
2446         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2447         (API::ProcessPoolConfiguration::copy): Copy m_diskCacheDirectory too.
2448
2449 2017-11-27  Adrian Perez de Castro  <aperez@igalia.com>
2450
2451         [WPE][GTK] Improve contents of pkg-config .pc files
2452         https://bugs.webkit.org/show_bug.cgi?id=180032
2453
2454         Reviewed by Carlos Garcia Campos.
2455
2456         * gtk/webkit2gtk-web-extension.pc.in: Add URL, edit Name and Description.
2457         * gtk/webkit2gtk.pc.in: Add URL, edit Name.
2458         * wpe/wpe-webkit.pc.in: Add URL, edit Name and Description.
2459
2460 2017-11-23  Darin Adler  <darin@apple.com>
2461
2462         Fix dictionary leak in lookup, convert FindOptions to OptionSet, tweak code style nearby
2463         https://bugs.webkit.org/show_bug.cgi?id=179981
2464
2465         Reviewed by Sam Weinig.
2466
2467         * WebProcess/Plugins/PDF/PDFPlugin.h: Use some references instead of pointers. Made more
2468         things final and private. Changed functions with multiple return values to use tuples
2469         instead of out arguments for clarity, especially because some were using pointers and it
2470         was ambiguous whether the pointers could be nullptr. Tweaked formatting. Moved initialization
2471         of data members into the class definition.
2472
2473         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2474         (WebKit::PDFPlugin::create): Take a reference.
2475         (WebKit::PDFPlugin::PDFPlugin): Ditto. Also moved some initialization to the class definition.
2476         (WebKit::PDFPlugin::countFindMatches): Added comment about ignored maxMatchCount argument.
2477         (WebKit::PDFPlugin::findString): Use contains instead of & to check bits in options.
2478         Simplified slightly confusing match count code that was doing some unnecessary comparisons
2479         with the maximum match count. Use auto a bit.
2480         (WebKit::coreCursor): Renamed from pdfLayerControllerCursorTypeToCursor since this is C++
2481         and overloading works based on the argument type.
2482         (WebKit::PDFPlugin::notifyCursorChanged): Updated for name change.
2483         (WebKit::PDFPlugin::lookupTextAtLocation const): Return a tuple instead of using two out
2484         arguments and use a RetainPtr so we don't leak the options dictionary.
2485
2486         * WebProcess/Plugins/PluginProxy.h: Removed unneeded include of FindOptions.h.
2487
2488         * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
2489         (WebKit::WebContextMenuClient::lookUpInDictionary): Pass a reference.
2490
2491         * WebProcess/WebPage/FindController.cpp:
2492         (WebKit::core): Use |= instead of | to build up a FindOptions.
2493         (WebKit::FindController::FindController): Initialize data members in the class definition.
2494         (WebKit::pluginViewForFrame): Deleted. Callers now use WebPage::pluginViewForFrame.
2495         (WebKit::FindController::updateFindUIAfterPageScroll): Added a FIXME about some peculiar code.
2496         (WebKit::FindController::findString): Use |= rather than | to add in an option.
2497         (WebKit::FindController::hideFindUI): Use { } rather than 0 for no options.
2498         * WebProcess/WebPage/FindController.h: Moved initialization to the header. Exported the core
2499         function that converts WebKit::FindOptions to WebCore::FindOptions.
2500
2501         * WebProcess/WebPage/WebFrame.cpp:
2502         (WebKit::WebFrame::handlesPageScaleGesture const): Use WebPage::pluginViewForFrame.
2503         (WebKit::WebFrame::requiresUnifiedScaleFactor const): Use WebPage::pluginViewForFrame.
2504
2505         * WebProcess/WebPage/WebPage.cpp:
2506         (WebKit::WebPage::createPlugin): Removed unneeded local variable and UNUSED_PARAM.
2507         (WebKit::WebPage::focusedPluginViewForFrame): Use pluginViewForFrame.
2508         (WebKit::WebPage::pluginViewForFrame): Added a null check since this takes a pointer.
2509         Use is/downcast insteadof more ad hoc coding style.
2510         (WebKit::WebPage::findStringFromInjectedBundle): Call core to convert WebKit::FindOptions
2511         to WebCore::FindOptions. Before, this was accidentally relying on the bits from the two
2512         enumrations matching! The stricter type checking of OptionSet helps us catch mistakes
2513         like this.
2514
2515         * WebProcess/WebPage/WebPage.h: Updated for the above. Also flattened out nested #if
2516         statements, made forward declarations unconditional, and re-sorted them. Changed the
2517         Mac-specific lookupTextAtLocation to return a tuple (see below).
2518
2519         * WebProcess/WebPage/ios/WebPageIOS.mm:
2520         (WebKit::WebPage::performDictionaryLookupForSelection): Take a reference instead of a pointer.
2521         (WebKit::WebPage::performDictionaryLookupForRange): Ditto.
2522         (WebKit::rangeNearPositionMatchesText): Use { } rather than 0 for no options.
2523
2524         * WebProcess/WebPage/mac/WebPageMac.mm:
2525         (WebKit::WebPage::performDictionaryLookupAtLocation): Use RetainPtr<NSDictionary> to fix
2526         code that used to leak.
2527         (WebKit::WebPage::performDictionaryLookupForSelection): Ditto.
2528         (WebKit::WebPage::performDictionaryLookupOfCurrentSelection): Use a reference.
2529         (WebKit::WebPage::dictionaryPopupInfoForRange): Updated for changed argument types.
2530         (WebKit::WebPage::dictionaryPopupInfoForSelectionInPDFPlugin): Ditto.
2531         (WebKit::WebPage::performDictionaryLookupForRange): Ditto.
2532         (WebKit::WebPage::performImmediateActionHitTestAtLocation): Updated to handle the
2533         tuple result from the lookupTextAtLocation functions.
2534         (WebKit::WebPage::lookupTextAtLocation): Changed to return a tuple and use RetainPtr
2535         for the NSDictionary to help fix the leak.
2536
2537 2017-11-24  Zan Dobersek  <zdobersek@igalia.com>
2538
2539         [CoordGraphics] CoordinatedGraphicsLayer::updateContentBuffers() should always assume a non-null CoordinatedBuffer
2540         https://bugs.webkit.org/show_bug.cgi?id=179977
2541
2542         Reviewed by Carlos Garcia Campos.
2543
2544         Make CompositingCoordinator::getCoordinatedBuffer() return a Ref<CoordinatedBuffer>
2545         value. In case an UpdateAtlas with enough free area is found, its CoordinatedBuffer
2546         is dereferenced into the return value. In case a new UpdateAtlas is created, the
2547         returned CoordinatedBuffer pointer is asserted to be non-null and dereferenced.
2548
2549         The retrieved CoordinatedBuffer pointer on a newly-created UpdateAtlas should never
2550         be null since the tiles are smaller in size than the UpdateAtlas area. The assert
2551         is done in release configurations as well since the code in CoordinatedGraphicsLayer
2552         assumes the returned pointer will be non-null, so it's just a matter of where to
2553         crash first in case somehow a null value is returned.
2554
2555         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2556         (WebKit::CompositingCoordinator::getCoordinatedBuffer):
2557         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
2558
2559 2017-11-24  Zan Dobersek  <zdobersek@igalia.com>
2560
2561         [CoordGraphics] UpdateAtlas constructor should receive an IntSize, not a dimension value
2562         https://bugs.webkit.org/show_bug.cgi?id=179976
2563
2564         Reviewed by Carlos Garcia Campos.
2565
2566         Have the UpdateAtlas constructor receive an IntSize object that specifies
2567         the desired size for the CoordinatedBuffer. Passing in a dimension doesn't
2568         really make sense since this value isn't dynamically configurable, and
2569         the only value that is passed in is already a power-of-two.
2570
2571         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2572         (WebKit::CompositingCoordinator::getCoordinatedBuffer):
2573         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp:
2574         (WebKit::UpdateAtlas::UpdateAtlas):
2575         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h:
2576
2577 2017-11-23  Sam Weinig  <sam@webkit.org>
2578
2579         Remove unneeded ScriptController::processingUserGesture() forwarding functions
2580         https://bugs.webkit.org/show_bug.cgi?id=179954
2581
2582         Reviewed by Darin Adler.
2583
2584         Replace ScriptController::processingUserGesture() and ScriptController::processingUserGestureForMedia()
2585         with direct calls to the corresponding UserGestureIndicator functions.
2586
2587         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2588         (WebKit::InjectedBundle::isProcessingUserGesture):
2589         * WebProcess/WebPage/WebPage.cpp:
2590         (WebKit::WebPage::addResourceRequest):
2591
2592 2017-11-23  Chris Dumez  <cdumez@apple.com>
2593
2594         WebSWServerConnection should register/unregister itself with the StorageProcess
2595         https://bugs.webkit.org/show_bug.cgi?id=179965
2596
2597         Reviewed by Darin Adler.
2598
2599         WebSWServerConnection should register/unregister itself with the StorageProcess instead of relying
2600         on StorageToWebProcessConnection to do so on its behalf. This is less error-prone.
2601
2602         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2603         (WebKit::WebSWServerConnection::WebSWServerConnection):
2604         (WebKit::WebSWServerConnection::~WebSWServerConnection):
2605         * StorageProcess/StorageToWebProcessConnection.cpp:
2606         (WebKit::StorageToWebProcessConnection::~StorageToWebProcessConnection):
2607         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
2608         (WebKit::StorageToWebProcessConnection::removeSWServerConnection):
2609
2610 2017-11-23  Darin Adler  <darin@apple.com>
2611
2612         Reduce WTF::String operations that do unnecessary Unicode operations instead of ASCII
2613         https://bugs.webkit.org/show_bug.cgi?id=179907
2614
2615         Reviewed by Sam Weinig.
2616
2617         * NetworkProcess/cache/NetworkCache.cpp:
2618         (WebKit::NetworkCache::isMediaMIMEType): Use startsWithLettersIgnoringASCIICase.
2619         * NetworkProcess/cache/NetworkCacheKey.cpp:
2620         (WebKit::NetworkCache::hashString): Use isAllASCII..
2621         * UIProcess/API/C/WKWebsitePolicies.cpp:
2622         (WKWebsitePoliciesSetCustomHeaderFields): Use startsWithLettersIgnoringASCIICase..
2623         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
2624         (-[_WKWebsitePolicies setCustomHeaderFields:]): Ditto.
2625         * UIProcess/WebPageProxy.cpp:
2626         (WebKit::WebPageProxy::savePDFToFileInDownloadsFolder): Use endsWithIgnoringASCIICase.
2627         * UIProcess/WebPreferences.cpp:
2628         (WebKit::WebPreferences::WebPreferences): Initialize m_identifier explicitly. Somehow
2629         changing the String default constructor to be "= default" led to a warning that we
2630         otherwise did not get about not initializing m_identifier. Arguably a compiler bug,
2631         but legitimately strange that the copy constructor does not copy m_identifier and so
2632         nice to be explicit about it, I guess.
2633         * UIProcess/mac/WebPageProxyMac.mm:
2634         (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplicationRaw): Use
2635         endsWithIgnoringASCIICase.
2636         (WebKit::WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication): Ditto.
2637         * WebProcess/WebPage/WebPage.cpp:
2638         (WebKit::WebPage::createPlugin): Ditto.
2639         * WebProcess/WebPage/ios/WebPageIOS.mm:
2640         (WebKit::WebPage::platformEditorState const): Use isAllSpecialCharacters<isHTMLSpace>.
2641
2642 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
2643
2644         [CoordGraphics] Simplify CoordinatedGraphicsLayer's content buffer updates
2645         https://bugs.webkit.org/show_bug.cgi?id=179972
2646
2647         Reviewed by Carlos Garcia Campos.
2648
2649         In CompositingCoordinator, add the getCoordinatedBuffer() method, replacing
2650         paintToSurface(). The new method traverses the list of UpdateAtlases and
2651         returns any CoordinatedBuffer object that was free to use. If none exist,
2652         a new UpdateAtlas object is created, and its CoordinatedBuffer is returned.
2653
2654         In  UpdateAtlas, the paintOnAvailableBuffer() method is replaced with
2655         getCoordinatedBuffer(). The latter allocates the necessary area but then
2656         returns a reference to the CoordinatedBuffer buffer, along with the atlas ID
2657         and the allocated rectangle information, and does not invoke any painting
2658         operation like paintOnAvailableBuffer() did.
2659
2660         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2661         (WebKit::CompositingCoordinator::getCoordinatedBuffer):
2662         (WebKit::CompositingCoordinator::paintToSurface): Deleted.
2663         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
2664         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp:
2665         (WebKit::UpdateAtlas::getCoordinatedBuffer):
2666         (WebKit::UpdateAtlas::paintOnAvailableBuffer): Deleted.
2667         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h:
2668
2669 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
2670
2671         [CoordGraphics] Remove relay CoordinatedBuffer::Client implementations
2672         https://bugs.webkit.org/show_bug.cgi?id=179970
2673
2674         Reviewed by Carlos Garcia Campos.
2675
2676         Drop the helper UpdateAtlasSurfaceClient class and instead directly use
2677         the CoordinatedBuffer's GraphicsContext to perform clip and translation
2678         operations based on the allocated rectangle, to pre-fill the target rect
2679         with transparent color in case the alpha channel is supported, and to
2680         then invoke CoordinatedBuffer::Client::paintToSurfaceContext() method,
2681         passing the GraphicsContext as the argument.
2682
2683         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp:
2684         (WebKit::UpdateAtlas::paintOnAvailableBuffer):
2685         (): Deleted.
2686
2687 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
2688
2689         [CoordGraphics] Replace CoordinatedSurface, ThreadSafeCoordinatedSurface with CoordinatedBuffer
2690         https://bugs.webkit.org/show_bug.cgi?id=179967
2691
2692         Reviewed by Carlos Garcia Campos.
2693
2694         Replace uses of CoordinatedSurface class with CoordinatedBuffer. The
2695         ThreadSafeCoordinatedSurface class is removed, along with the code in
2696         CoordinatedLayerTreeHost that established a CoordinatedSurface factory.
2697
2698         * PlatformGTK.cmake:
2699         * PlatformWPE.cmake:
2700         * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
2701         (WebKit::CoordinatedBackingStoreTile::swapBuffers):
2702         (WebKit::CoordinatedBackingStoreTile::setBackBuffer):
2703         (WebKit::CoordinatedBackingStore::updateTile):
2704         * Shared/CoordinatedGraphics/CoordinatedBackingStore.h:
2705         Rename m_surface to m_buffer, m_surfaceOffset to m_bufferOffset.
2706         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2707         (WebKit::CoordinatedGraphicsScene::createUpdateAtlas):
2708         (WebKit::CoordinatedGraphicsScene::updateImageBacking):
2709         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
2710         * Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.cpp: Removed.
2711         * Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.h: Removed.
2712         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2713         (WebKit::CompositingCoordinator::updateImageBacking):
2714         (WebKit::CompositingCoordinator::createUpdateAtlas):
2715         (WebKit::CompositingCoordinator::paintToSurface):
2716         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
2717         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
2718         (WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost):
2719         (WebKit::CoordinatedLayerTreeHost::createCoordinatedSurface): Deleted.
2720         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
2721         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp:
2722         (WebKit::UpdateAtlas::UpdateAtlas):
2723         (WebKit::UpdateAtlas::~UpdateAtlas):
2724         (WebKit::UpdateAtlas::paintOnAvailableBuffer):
2725         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h:
2726         Rename m_surface to m_buffer.
2727         (WebKit::UpdateAtlas::size const):
2728         (WebKit::UpdateAtlas::supportsAlpha const):
2729
2730 2017-11-22  Ali Juma  <ajuma@chromium.org>
2731
2732         Implement VisualViewport API attributes
2733         https://bugs.webkit.org/show_bug.cgi?id=179385
2734
2735         Reviewed by Frédéric Wang.
2736
2737         Add a VisualViewportAPI experimental feature.
2738
2739         * Shared/WebPreferences.yaml:
2740
2741 2017-11-22  Tim Horton <timothy_horton@apple.com> and Michael Catanzaro <mcatanzaro@igalia.com>
2742
2743         Remove build-webkit's notion of feature flags having a default value
2744         https://bugs.webkit.org/show_bug.cgi?id=177338
2745
2746         Reviewed by Carlos Alberto Lopez Perez.
2747
2748         Use ENABLE_EXPERIMENTAL_FEATURES instead of ENABLE_DEVELOPER_MODE to enable runtime
2749         experimental features.
2750
2751         * Shared/WebPreferencesDefaultValues.h:
2752
2753 2017-11-22  Commit Queue  <commit-queue@webkit.org>
2754
2755         Unreviewed, rolling out r225093.
2756         https://bugs.webkit.org/show_bug.cgi?id=179938
2757
2758         Compilation failed on WinCairo 64-bit Release (Requested by
2759         fredw on #webkit).
2760
2761         Reverted changeset:
2762
2763         "Implement VisualViewport API attributes"
2764         https://bugs.webkit.org/show_bug.cgi?id=179385
2765         https://trac.webkit.org/changeset/225093
2766
2767 2017-11-21  Ali Juma  <ajuma@chromium.org>
2768
2769         Implement VisualViewport API attributes
2770         https://bugs.webkit.org/show_bug.cgi?id=179385
2771
2772         Reviewed by Frédéric Wang.
2773
2774         Add a VisualViewportAPI experimental feature.
2775
2776         * Shared/WebPreferences.yaml:
2777
2778 2017-11-21  Christopher Reid  <chris.reid@sony.com>
2779
2780         [PAL] Remove FileSystem's dependency on WebCoreNSStringExtras
2781         https://bugs.webkit.org/show_bug.cgi?id=179504
2782
2783         Reviewed by Darin Adler.
2784
2785         * UIProcess/Cocoa/WebViewImpl.mm:
2786         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2787         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
2788
2789 2017-11-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2790
2791         [WPE] WPEWebProcess: Couldn't find current GLX or EGL context
2792         https://bugs.webkit.org/show_bug.cgi?id=179883
2793
2794         Reviewed by Žan Doberšek.
2795
2796         I'm seeing that message quite often when running the unit tests. The problem seems to be that some tests run so
2797         fast that the web process never renders the first frame, so the context is created but never made current. I've
2798         checked with apitrace that there are calls to eglQueryContext with null display, causing a EGL_BAD_DISPLAY, but
2799         I don't know where those calls are originated. Making the context current right after it's created fixes the
2800         problem.
2801
2802         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2803         (WebKit::ThreadedCompositor::createGLContext): Always call makeContextCurrent() right after the context is created.
2804
2805 2017-11-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2806
2807         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.19.2 release.
2808
2809         * gtk/NEWS: Add release notes for 2.19.2.
2810
2811 2017-11-20  Don Olmstead  <don.olmstead@sony.com>
2812
2813         Add declspec within WebKit API
2814         https://bugs.webkit.org/show_bug.cgi?id=179893
2815
2816         Reviewed by Darin Adler.
2817
2818         * Shared/API/c/WKDeclarationSpecifiers.h:
2819
2820 2017-11-20  Mario Sanchez Prada  <mario@endlessm.com>
2821
2822         [GTK] New API to add, retrieve and delete cookies via WebKitCookieManager
2823         https://bugs.webkit.org/show_bug.cgi?id=177932
2824
2825         Reviewed by Carlos Garcia Campos.
2826
2827         Added new API to WebKitCookieManager to add, retrieve and delete complete
2828         cookies into/out-of a running session, and updated documentation sections.
2829
2830         * UIProcess/API/glib/WebKitCookieManager.cpp:
2831         (webkit_cookie_manager_add_cookie): New function.
2832         (webkit_cookie_manager_add_cookie_finish): Ditto.
2833         (webkit_cookie_manager_get_cookies): Ditto.
2834         (webkit_cookie_manager_get_cookies_finish): Ditto.
2835         (webkit_cookie_manager_delete_cookie): Ditto.
2836         (webkit_cookie_manager_delete_cookie_finish): Ditto.
2837         * UIProcess/API/gtk/WebKitCookieManager.h: Added new functions.
2838         * UIProcess/API/wpe/WebKitCookieManager.h: Ditto.
2839         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Ditto.
2840
2841 2017-11-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2842
2843         [WPE] webkit_web_view_new() should enable specifying wpe_view_backend object
2844         https://bugs.webkit.org/show_bug.cgi?id=178655
2845
2846         Reviewed by Michael Catanzaro.
2847
2848         Update all WebKitWebView constructors to receive a WebKitWebViewBackend as argument. It's now required to
2849         provide a backend to create a web view, but it can be NULL to use the default one. WebKitWebViewBackend is a
2850         boxed type wrapping a struct wpe_view_backend* used as construct only property of WebKitWebView. The view always
2851         takes the ownership of the WebKitWebViewBackend which owns the struct wpe_view_backend*. An optional
2852         GDestroyNotify and user data pointer can be passed to the WebKitWebViewBackend constructor to provide a custom
2853         deleter for the backend. In the C API the struct wpe_view_backend* is also mandatory now, but it can't be NULL
2854         and it's owned by the caller, not the view.
2855
2856         * PlatformWPE.cmake:
2857         * UIProcess/API/C/wpe/WKView.cpp:
2858         (WKViewCreate):
2859         * UIProcess/API/C/wpe/WKView.h:
2860         * UIProcess/API/glib/WebKitWebView.cpp:
2861         (_WebKitWebViewPrivate::~_WebKitWebViewPrivate):
2862         (webkitWebViewConstructed):
2863         (webkitWebViewSetProperty):
2864         (webkitWebViewGetProperty):
2865         (webkit_web_view_class_init):
2866         (webkitWebViewCreatePage):
2867         (webkit_web_view_get_backend):
2868         * UIProcess/API/wpe/WPEView.cpp:
2869         (WKWPE::m_backend):
2870         (WKWPE::View::~View):
2871         * UIProcess/API/wpe/WebKitWebView.h:
2872         * UIProcess/API/wpe/WebKitWebViewBackend.cpp: Added.
2873         (_WebKitWebViewBackend::_WebKitWebViewBackend):
2874         (_WebKitWebViewBackend::~_WebKitWebViewBackend):
2875         (webkitWebViewBackendRef):
2876         (webkitWebViewBackendUnref):
2877         (webkitWebViewBackendCreateDefault):
2878         (webkit_web_view_backend_new):
2879         (webkit_web_view_backend_get_wpe_backend):
2880         * UIProcess/API/wpe/WebKitWebViewBackend.h: Added.
2881         * UIProcess/API/wpe/WebKitWebViewBackendPrivate.h: Added.
2882         * UIProcess/API/wpe/WebKitWebViewWPE.cpp:
2883         (webkit_web_view_new):
2884         (webkit_web_view_new_with_context):
2885         (webkit_web_view_new_with_related_view):
2886         (webkit_web_view_new_with_settings):
2887         (webkit_web_view_new_with_user_content_manager):
2888         * UIProcess/API/wpe/webkit.h:
2889
2890 2017-11-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2891
2892         [GTK][WPE] webkit_cookie_manager_delete_all_cookies doesn't delete the cookies if called before a web process is running
2893         https://bugs.webkit.org/show_bug.cgi?id=175265
2894
2895         Reviewed by Michael Catanzaro.
2896
2897         This is what happens:
2898
2899         1- We create our WebKitWebContext that creates its WebProcessPool.
2900         2- We set a persistent cookies storage.
2901         3- We ask the website data store to delete all cookies, but since website data store is a web process observer
2902            and we haven't spawned any web process yet, it creates a new WebProcessPool with the default configuration
2903            (no persistent cookies) and sends the message to delete the cookies there.
2904         4- The network process of the second process pool does nothing because it doesn't have cookies at all.
2905
2906         We need to set the primary data store of the WebProcessPool when WebKitWebContext is constructed to ensure that
2907         one is used before the web process is launched.
2908
2909         * UIProcess/API/glib/WebKitWebContext.cpp:
2910         (webkitWebContextConstructed):
2911
2912 2017-11-19  Tim Horton  <timothy_horton@apple.com>
2913
2914         Remove unused TOUCH_ICON_LOADING feature flag
2915         https://bugs.webkit.org/show_bug.cgi?id=179873
2916
2917         Reviewed by Simon Fraser.
2918
2919         * Configurations/FeatureDefines.xcconfig:
2920
2921 2017-11-19  Tim Horton  <timothy_horton@apple.com>
2922
2923         Remove unused LEGACY_VENDOR_PREFIXES feature flag
2924         https://bugs.webkit.org/show_bug.cgi?id=179872
2925
2926         Reviewed by Darin Adler.
2927
2928         * Configurations/FeatureDefines.xcconfig:
2929
2930 2017-11-18  Chris Dumez  <cdumez@apple.com>
2931
2932         ASSERTION FAILED: registration in WebCore::SWServerJobQueue::scriptContextStarted(ServiceWorkerIdentifier)
2933         https://bugs.webkit.org/show_bug.cgi?id=179846
2934
2935         Reviewed by Darin Adler.
2936
2937         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2938         (WebKit::WebSWServerConnection::rejectJobInClient):
2939         (WebKit::WebSWServerConnection::resolveRegistrationJobInClient):
2940         (WebKit::WebSWServerConnection::resolveUnregistrationJobInClient):
2941         (WebKit::WebSWServerConnection::startScriptFetchInClient):
2942         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2943         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
2944         * WebProcess/Storage/WebSWClientConnection.messages.in:
2945         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2946         (WebKit::WebSWContextManagerConnection::serviceWorkerStartedWithMessage):
2947         (WebKit::WebSWContextManagerConnection::didFinishInstall):
2948         * WebProcess/Storage/WebSWContextManagerConnection.h:
2949
2950 2017-11-18  Tim Horton  <timothy_horton@apple.com>
2951
2952         Rename some Network Capture debugging defines
2953         https://bugs.webkit.org/show_bug.cgi?id=179870
2954
2955         Reviewed by Darin Adler.
2956
2957         * NetworkProcess/capture/NetworkCaptureLogging.h:
2958         * NetworkProcess/capture/NetworkCaptureManager.cpp:
2959         (WebKit::NetworkCapture::Manager::findMatch):
2960         (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
2961         These shouldn't have WTF in their name - they have nothing to do with WTF.
2962         These shouldn't use ENABLE(), since they're not features, just debugging macros.
2963
2964 2017-11-17  Chris Dumez  <cdumez@apple.com>
2965
2966         [Service Workers] Implement "Notify Controller Change" algorithm
2967         https://bugs.webkit.org/show_bug.cgi?id=179822
2968
2969         Reviewed by Youenn Fablet.
2970
2971         * Scripts/webkit/messages.py:
2972         (class_template_headers):
2973         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2974         (WebKit::WebSWServerConnection::notifyClientsOfControllerChange):
2975         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2976         * WebProcess/Storage/WebSWClientConnection.messages.in:
2977
2978 2017-11-17  Chris Dumez  <cdumez@apple.com>
2979
2980         Use a strongly typed identifier for SWServer::Connection
2981         https://bugs.webkit.org/show_bug.cgi?id=179848
2982
2983         Reviewed by Brady Eidson.
2984
2985         Use a strongly typed identifier for SWServer::Connection, for clarity.
2986
2987         * Scripts/webkit/messages.py:
2988         (forward_declarations_and_headers):
2989         (forward_declarations_and_headers.templates):
2990         (headers_for_type):
2991         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2992         (WebKit::WebSWServerConnection::WebSWServerConnection):
2993         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
2994         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2995         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2996         * StorageProcess/StorageProcess.cpp:
2997         (WebKit::StorageProcess::didFailFetch):
2998         (WebKit::StorageProcess::didNotHandleFetch):
2999         (WebKit::StorageProcess::didReceiveFetchResponse):
3000         (WebKit::StorageProcess::didReceiveFetchData):
3001         (WebKit::StorageProcess::didReceiveFetchFormData):
3002         (WebKit::StorageProcess::didFinishFetch):
3003         * StorageProcess/StorageProcess.h:
3004         * StorageProcess/StorageProcess.messages.in:
3005         * StorageProcess/StorageToWebProcessConnection.cpp:
3006         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
3007         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
3008         (WebKit::StorageToWebProcessConnection::removeSWServerConnection):
3009         (WebKit::generateIDBConnectionToServerIdentifier):
3010         (WebKit::StorageToWebProcessConnection::establishIDBConnectionToServer):
3011         * StorageProcess/StorageToWebProcessConnection.h:
3012         * StorageProcess/StorageToWebProcessConnection.messages.in:
3013         * WebProcess/Storage/WebSWClientConnection.cpp:
3014         (WebKit::WebSWClientConnection::postMessageToServiceWorkerGlobalScope):
3015         * WebProcess/Storage/WebSWClientConnection.h:
3016         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3017         (WebKit::WebSWContextManagerConnection::startFetch):
3018         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerGlobalScope):
3019         * WebProcess/Storage/WebSWContextManagerConnection.h:
3020         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
3021         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
3022         (WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
3023         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
3024         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
3025         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
3026         (WebKit::WebToStorageProcessConnection::serviceWorkerConnectionForSession):
3027         * WebProcess/Storage/WebToStorageProcessConnection.h:
3028
3029 2017-11-17  John Wilander  <wilander@apple.com>
3030
3031         Storage Access API: UI process should update network process about granted access
3032         https://bugs.webkit.org/show_bug.cgi?id=176943
3033         <rdar://problem/34440612>
3034
3035         Reviewed by Alex Christensen.
3036
3037         * NetworkProcess/NetworkProcess.cpp:
3038         (WebKit::NetworkProcess::updateStorageAccessForPrevalentDomains):
3039             Updates storage access on the session.
3040         * NetworkProcess/NetworkProcess.h:
3041         * NetworkProcess/NetworkProcess.messages.in:
3042         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3043         (WebKit::NetworkProcessCreationParameters::encode const):
3044         (WebKit::NetworkProcessCreationParameters::decode):
3045         * NetworkProcess/NetworkProcessCreationParameters.h:
3046         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3047         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
3048         (WebKit::NetworkProcess::setStorageAccessAPIEnabled):
3049         * UIProcess/API/C/WKCookieManager.cpp:
3050         (WKCookieManagerSetStorageAccessAPIEnabled):
3051         * UIProcess/API/C/WKCookieManager.h:
3052         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3053         (WKWebsiteDataStoreSetStatisticsHasHadNonRecentUserInteraction):
3054         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3055         * UIProcess/API/Cocoa/WKProcessPool.mm:
3056         (-[WKProcessPool _isStorageAccessAPIEnabled]):
3057         (-[WKProcessPool _setStorageAccessAPIEnabled:]):
3058         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3059         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3060         (-[WKWebsiteDataStore _resourceLoadStatisticsSetHasHadNonRecentUserInteractionForHost:]):
3061             Test infrastructure.
3062         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3063         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3064         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3065         (WebKit::WebProcessPool::setStorageAccessAPIEnabled):
3066         * UIProcess/Network/NetworkProcessProxy.cpp:
3067         (WebKit::nextRequestStorageAccessContextId):
3068         (WebKit::NetworkProcessProxy::updateStorageAccessForPrevalentDomains):
3069             Sends a message to the network process to update storage access.
3070         (WebKit::NetworkProcessProxy::storageAccessRequestResult):
3071             Receives a message from the network process that storage access
3072             was updated.
3073         * UIProcess/Network/NetworkProcessProxy.h:
3074         * UIProcess/Network/NetworkProcessProxy.messages.in:
3075         * UIProcess/WebCookieManagerProxy.cpp:
3076         (WebKit::WebCookieManagerProxy::setStorageAccessAPIEnabled):
3077         * UIProcess/WebCookieManagerProxy.h:
3078         * UIProcess/WebProcessPool.h:
3079         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3080         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
3081         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
3082         (WebKit::WebResourceLoadStatisticsStore::logNonRecentUserInteraction):
3083             Test infrastructure.
3084         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains):
3085             Now makes the API call even if the only operation is to clear first.
3086         * UIProcess/WebResourceLoadStatisticsStore.h:
3087         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3088         (WebKit::WebsiteDataStore::updateStorageAccessForPrevalentDomainsHandler):
3089             Propagates the storage access directive to the network process proxy.
3090         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
3091         * UIProcess/WebsiteData/WebsiteDataStore.h:
3092
3093 2017-11-16  Yousuke Kimoto  <yousuke.kimoto@sony.com>
3094
3095         [WinCairo] Add network (curl) files for wincairo webkit
3096         https://bugs.webkit.org/show_bug.cgi?id=179474
3097
3098         Reviewed by Alex Christensen.
3099
3100         * Shared/curl/WebCoreArgumentCodersCurl.cpp:
3101         (IPC::ArgumentCoder<CertificateInfo>::decode): Fidex return value since currently no operation is needed for wincairo webkit.
3102         (IPC::ArgumentCoder<ResourceError>::decodePlatformData): Fidex return value since currently no operation is needed for wincairo webkit.
3103         * WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.cpp: Renamed from Source/WebKit/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.cpp.
3104         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
3105         * WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.h: Renamed from Source/WebKit/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h.
3106
3107 2017-11-16  Don Olmstead  <don.olmstead@sony.com>
3108
3109         [WinCairo] Update WinCairoRequirements
3110         https://bugs.webkit.org/show_bug.cgi?id=179790
3111
3112         Reviewed by Alex Christensen.
3113
3114         * PlatformWin.cmake:
3115
3116 2017-11-16  Youenn Fablet  <youenn@apple.com>
3117
3118         Service Worker should get the body of intercepted requests
3119         https://bugs.webkit.org/show_bug.cgi?id=179776
3120
3121         Reviewed by Alex Christensen.
3122
3123         Pass a FormDataReference when starting fetch IPC.
3124         Convert this FormDataReference in a FormData and using it to set the FetchRequest body properly in Service Worker process.
3125         Forbid fetch interception when URL is not HTTP/HTTPS.
3126
3127         * Platform/IPC/FormDataReference.h:
3128         (IPC::FormDataReference::FormDataReference):
3129         (IPC::FormDataReference::takeData):
3130         (IPC::FormDataReference::encode const):
3131         (IPC::FormDataReference::decode):
3132         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3133         (WebKit::WebSWServerConnection::startFetch):
3134         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3135         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
3136         * WebProcess/Storage/WebSWClientConnection.cpp:
3137         (WebKit::WebSWClientConnection::startFetch):
3138         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3139         (WebKit::WebSWContextManagerConnection::startFetch):
3140         * WebProcess/Storage/WebSWContextManagerConnection.h:
3141         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
3142         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
3143         (WebKit::WebServiceWorkerProvider::handleFetch):
3144
3145 2017-11-16  Daniel Bates  <dabates@apple.com>
3146
3147         Add feature define for alternative presentation button element
3148         https://bugs.webkit.org/show_bug.cgi?id=179692
3149         Part of <rdar://problem/34917108>
3150
3151         Reviewed by Andy Estes.
3152
3153         Only enabled on Cocoa platforms by default.
3154
3155         * Configurations/FeatureDefines.xcconfig:
3156
3157 2017-11-16  Chris Dumez  <cdumez@apple.com>
3158
3159         [Service Worker] Implement "Try Clear Registration" algorithm
3160         https://bugs.webkit.org/show_bug.cgi?id=179791
3161
3162         Reviewed by Youenn Fablet.
3163
3164         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
3165         * WebProcess/Storage/WebSWClientConnection.cpp:
3166         (WebKit::WebSWClientConnection::serviceWorkerStartedControllingClient):
3167         (WebKit::WebSWClientConnection::serviceWorkerStoppedControllingClient):
3168         * WebProcess/Storage/WebSWClientConnection.h:
3169
3170 2017-11-16  Michael Catanzaro  <mcatanzaro@igalia.com>
3171
3172         REGRESSION(r224179): layer flush now requires sync IPC to compute undo/redo availability in EditorState
3173         https://bugs.webkit.org/show_bug.cgi?id=179797
3174
3175         Reviewed by Simon Fraser.
3176
3177         r224179 introduced a performance regression. The newly-added code in WebPage::editorState is
3178         part of a performance-critical path. (The editor state is computed and sent to the UI
3179         process during the layer flush.) Calls to Editor::canUndo and Editor::canRedo were added,
3180         but these calls are both implemented with sync IPC calls to WebPageProxy in the UI process.
3181         WebPageProxy passes them along to PageClientImpl to compute the availability of the
3182         commands.
3183
3184         That's all pointless because this code only exists for the purpose of getting editing
3185         command availability to the UI process. In the case of undo and redo, it's not needed at
3186         all. I did not realize that when writing the code. So canUndo and canRedo should be removed
3187         from EditorState. This ought to be sufficient to avoid the perf regression.
3188
3189         No changes are needed to the GTK/WPE WebKitEditorState API. The API is reimplemented using
3190         WebPageProxy::canUndoRedo instead of EditorState. There should be no changes in behavior,
3191         only performance.
3192
3193         * Shared/EditorState.cpp:
3194         (WebKit::EditorState::PostLayoutData::encode const):
3195         (WebKit::EditorState::PostLayoutData::decode):
3196         * Shared/EditorState.h:
3197         * UIProcess/API/glib/WebKitEditorState.cpp:
3198         (webkitEditorStateCreate):
3199         (webkitEditorStateChanged):
3200         * UIProcess/API/glib/WebKitEditorStatePrivate.h:
3201         * UIProcess/API/glib/WebKitWebView.cpp:
3202         (webkit_web_view_get_editor_state):
3203         * UIProcess/WebPageProxy.cpp:
3204         (WebKit::WebPageProxy::canUndo):
3205         (WebKit::WebPageProxy::canRedo):
3206         * UIProcess/WebPageProxy.h:
3207         * WebProcess/WebPage/WebPage.cpp:
3208         (WebKit::WebPage::editorState const):
3209
3210 2017-11-16  Megan Gardner  <megan_gardner@apple.com>
3211
3212         Remove allowBlockSelection as block selection is not supported anymore
3213         https://bugs.webkit.org/show_bug.cgi?id=179738
3214
3215         Reviewed by Tim Horton.
3216
3217         Remove all instances of the alloweBlockSelection flag. Blocks selection is fully disabled
3218         and thus this flag will do nothing. This was only added as a debug measure last year, and nothing
3219         ever actually used it.
3220
3221         * Shared/WebPageCreationParameters.cpp:
3222         (WebKit::WebPageCreationParameters::encode const):
3223         (WebKit::WebPageCreationParameters::decode):
3224         * Shared/WebPageCreationParameters.h:
3225         * UIProcess/API/Cocoa/WKWebView.mm:
3226         (-[WKWebView _allowsBlockSelection]): Deleted.
3227         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3228         (-[WKWebViewConfiguration init]):
3229         (-[WKWebViewConfiguration copyWithZone:]):
3230         (-[WKWebViewConfiguration _allowsBlockSelection]): Deleted.
3231         (-[WKWebViewConfiguration _setAllowsBlockSelection:]): Deleted.
3232         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
3233         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3234         * UIProcess/PageClient.h:
3235         * UIProcess/WebPageProxy.cpp:
3236         (WebKit::WebPageProxy::creationParameters):
3237         * UIProcess/ios/PageClientImplIOS.h:
3238         * UIProcess/ios/PageClientImplIOS.mm:
3239         (WebKit::PageClientImpl::allowsBlockSelection): Deleted.
3240         * WebProcess/WebPage/WebPage.cpp:
3241         * WebProcess/WebPage/WebPage.h:
3242
3243 2017-11-16  Brent Fulgham  <bfulgham@apple.com>
3244
3245         Whitelist additional IOKit properties based on customer feedback
3246         https://bugs.webkit.org/show_bug.cgi?id=179782
3247         <rdar://problem/35508246>
3248
3249         Reviewed by Dean Jackson.
3250
3251         Expand the IOKit property whitelist to recognize a few more properties as valid based on review of logs
3252         from customer systems and our test infrastructure.
3253
3254         * WebProcess/com.apple.WebProcess.sb.in:
3255
3256 2017-11-15  Brady Eidson  <beidson@apple.com>
3257
3258         Implement basics of "Terminate Service Worker" algorithm.
3259         https://bugs.webkit.org/show_bug.cgi?id=179551
3260
3261         Reviewed by Chris Dumez.
3262
3263         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
3264         (WebKit::WebSWServerToContextConnection::terminateWorker):
3265         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
3266         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
3267
3268         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3269         (WebKit::WebSWContextManagerConnection::terminateWorker):
3270         (WebKit::WebSWContextManagerConnection::workerTerminated):
3271         * WebProcess/Storage/WebSWContextManagerConnection.h:
3272         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
3273
3274 2017-11-15  Brent Fulgham  <bfulgham@apple.com>
3275
3276         Remove access to 'com.apple.mediaaccessibility.public' preferences in WebContent sandbox
3277         https://bugs.webkit.org/show_bug.cgi?id=179747
3278         <rdar://problem/35367346>
3279
3280         Reviewed by Dean Jackson.
3281
3282         The 'mediaaccessibilityd' process handles access to MediaAccessibility preferences. We don't need
3283         to grant the WebContent Process sandbox access to them.
3284
3285         * WebProcess/com.apple.WebProcess.sb.in: 
3286
3287 2017-11-15  Alex Christensen  <achristensen@webkit.org>
3288
3289         Revert r224885
3290         https://bugs.webkit.org/show_bug.cgi?id=179719
3291
3292         * UIProcess/API/APIContentRuleListStore.cpp:
3293         (API::compiledToFile):
3294         r224885 was a speculative fix that did not fix anything on the bots.
3295
3296 2017-11-15  Brent Fulgham  <bfulgham@apple.com>
3297
3298         Unreviewed build fix after r224830.
3299
3300         * WebProcess/com.apple.WebProcess.sb.in: Add missing sysctl-read permissions needed
3301         to support testing on Mac Mini hardware.
3302
3303 2017-11-15  Youenn Fablet  <youenn@apple.com>
3304
3305         Add ServiceWorker to WebProcess plumbery for FormData fetch responses
3306         https://bugs.webkit.org/show_bug.cgi?id=179694
3307
3308         Reviewed by Alex Christensen.
3309
3310         Added plumbery from Service Worker up to Web Process to pass form data response bodies.
3311         A follow-up patch should read the data from Network Process and send it to the ResourceLoader.
3312
3313         * Platform/IPC/FormDataReference.h: Added.
3314         (IPC::FormDataReference::FormDataReference):
3315         (IPC::FormDataReference::takeData):
3316         (IPC::FormDataReference::encode const):
3317         (IPC::FormDataReference::decode):
3318         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3319         (WebKit::WebSWServerConnection::didReceiveFetchFormData):
3320         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3321         * StorageProcess/StorageProcess.cpp:
3322         (WebKit::StorageProcess::didReceiveFetchFormData):
3323         * StorageProcess/StorageProcess.h:
3324         * StorageProcess/StorageProcess.messages.in:
3325         * WebKit.xcodeproj/project.pbxproj:
3326         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
3327         (WebKit::ServiceWorkerClientFetch::didReceiveFormData):
3328         * WebProcess/Storage/ServiceWorkerClientFetch.h:
3329         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in:
3330         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
3331         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormData):
3332         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
3333
3334 2017-11-15  Alex Christensen  <achristensen@webkit.org>
3335
3336         Move a compiled WKContentRuleList to its destination before calling mmap
3337         https://bugs.webkit.org/show_bug.cgi?id=179719
3338
3339         Reviewed by Brady Eidson.
3340
3341         Right now we compile a WKContentRuleList to a temporary file, call mmap, close the file, then move it.
3342         Sometimes, especially on bots running tests, the move fails because the temporary file doesn't exist
3343         any more.  Moving the file before mmaping and closing the file might prevent this failure.
3344
3345         * UIProcess/API/APIContentRuleListStore.cpp:
3346         (API::compiledToFile):
3347
3348 2017-11-15  Chris Dumez  <cdumez@apple.com>
3349
3350         [Service Workers] Implement Client API
3351         https://bugs.webkit.org/show_bug.cgi?id=179709
3352
3353         Reviewed by Alex Christensen.
3354
3355         * Shared/WebCoreArgumentCoders.cpp:
3356         * Shared/WebCoreArgumentCoders.h:
3357         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3358         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
3359         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3360         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
3361         * WebProcess/Storage/WebSWClientConnection.cpp:
3362         (WebKit::WebSWClientConnection::postMessageToServiceWorkerGlobalScope):
3363         * WebProcess/Storage/WebSWClientConnection.h:
3364         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3365         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerGlobalScope):
3366         * WebProcess/Storage/WebSWContextManagerConnection.h:
3367         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
3368
3369 2017-11-15  Ryan Haddad  <ryanhaddad@apple.com>
3370
3371         Unreviewed, rolling out r224863.
3372
3373         Introduced LayoutTest crashes on iOS Simulator.
3374
3375         Reverted changeset:
3376
3377         "Move JSONValues to WTF and convert uses of InspectorValues.h
3378         to JSONValues.h"
3379         https://bugs.webkit.org/show_bug.cgi?id=173793
3380         https://trac.webkit.org/changeset/224863
3381
3382 2017-11-14  Brent Fulgham  <bfulgham@apple.com>
3383
3384         Remove access to "com.apple.pbs.fetch_services" from WebContent sandbox
3385         https://bugs.webkit.org/show_bug.cgi?id=179689
3386         <rdar://problem/35369172>
3387
3388         Reviewed by Per Arne Vollan.
3389
3390         WebKit's WebContent process should not have any need to interact with the fetch_services
3391         API exposed to the system. These interactions (if needed) should be happening in the UIProcess,
3392         so we should prevent the untrusted Web Content Process from being able to connect.
3393
3394         * WebProcess/com.apple.WebProcess.sb.in:
3395
3396 2017-11-15  Michael Catanzaro  <mcatanzaro@igalia.com>
3397
3398         Remove GTK web inspector images
3399         https://bugs.webkit.org/show_bug.cgi?id=179716
3400
3401         Reviewed by Carlos Garcia Campos.
3402
3403         * InspectorGResources.cmake:
3404
3405 2017-11-15  Gabriel Ivascu  <givascu@igalia.com>
3406
3407         [GTK] Automatically adjust font size when gtk-xft-dpi changes
3408         https://bugs.webkit.org/show_bug.cgi?id=142673
3409
3410         Some follow-up fixes for the previous patch.
3411
3412         Reviewed by Carlos Garcia Campos.
3413
3414         * UIProcess/API/glib/WebKitSettings.cpp:
3415         (webKitSettingsDispose):
3416         (webKitSettingsConstructed):
3417
3418 2017-11-14  Nan Wang  <n_wang@apple.com>
3419
3420         AX: AOM: Implement AccessibleNode class and support label and role attributes
3421         https://bugs.webkit.org/show_bug.cgi?id=179494
3422
3423         Reviewed by Ryosuke Niwa.
3424
3425         * Shared/WebPreferences.yaml:
3426         * UIProcess/API/C/WKPreferences.cpp:
3427         (WKPreferencesSetAccessibilityObjectModelEnabled):
3428         (WKPreferencesGetAccessibilityObjectModelEnabled):
3429         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3430
3431 2017-11-14  Carlos Garcia Campos  <cgarcia@igalia.com>
3432
3433         Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
3434         https://bugs.webkit.org/show_bug.cgi?id=173793
3435
3436         Reviewed by Brian Burg.
3437
3438         Based on patch by Brian Burg.
3439
3440         * UIProcess/Automation/WebAutomationSession.cpp:
3441         (WebKit::WebAutomationSession::resizeWindowOfBrowsingContext):
3442         (WebKit::WebAutomationSession::moveWindowOfBrowsingContext):
3443         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage):
3444         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnFrame):
3445         (WebKit::WebAutomationSession::respondToPendingPageNavigationCallbacksWithTimeout):
3446         (WebKit::WebAutomationSession::respondToPendingFrameNavigationCallbacksWithTimeout):
3447         (WebKit::WebAutomationSession::navigationOccurredForFrame):
3448         (WebKit::WebAutomationSession::documentLoadedForFrame):
3449         (WebKit::WebAutomationSession::inspectorFrontendLoaded):
3450         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
3451         (WebKit::WebAutomationSession::evaluateJavaScriptFunction):
3452         (WebKit::WebAutomationSession::setFilesToSelectForFileUpload):
3453         (WebKit::WebAutomationSession::addSingleCookie):
3454         (WebKit::WebAutomationSession::setSessionPermissions):
3455         (WebKit::WebAutomationSession::performMouseInteraction):
3456         (WebKit::WebAutomationSession::performKeyboardInteractions):
3457         * UIProcess/Automation/WebAutomationSession.h:
3458
3459 2017-11-14  Chris Dumez  <cdumez@apple.com>
3460
3461         [Service Workers] Implement container.getRegistrations()
3462         https://bugs.webkit.org/show_bug.cgi?id=179672
3463
3464         Reviewed by Brady Eidson.
3465
3466         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3467         (WebKit::WebSWServerConnection::getRegistrations):
3468         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3469         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
3470         * WebProcess/Storage/WebSWClientConnection.cpp:
3471         (WebKit::WebSWClientConnection::didGetRegistrations):
3472         (WebKit::WebSWClientConnection::getRegistrations):
3473         * WebProcess/Storage/WebSWClientConnection.h:
3474         * WebProcess/Storage/WebSWClientConnection.messages.in:
3475
3476 2017-11-14  Youenn Fablet  <youenn@apple.com>
3477
3478         Implement ServiceWorker handle fetch for navigation loads
3479         https://bugs.webkit.org/show_bug.cgi?id=179404
3480
3481         Reviewed by Alex Christensen and Chris Dumez.
3482
3483         Update handle fetch algorithm to support navigation requests.
3484         In case of navigation requests, set service worker response mime type to text/html if none is provided.
3485
3486         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
3487         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
3488         * WebProcess/Storage/WebSWClientConnection.cpp:
3489         (WebKit::WebSWClientConnection::startFetch):
3490         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
3491         (WebKit::shouldHandleFetch):
3492         (WebKit::WebServiceWorkerProvider::handleFetch):
3493
3494 2017-11-14  Alex Christensen  <achristensen@webkit.org>
3495
3496         Remove Cocoa CFURLConnection loading code
3497         https://bugs.webkit.org/show_bug.cgi?id=179688
3498
3499         Reviewed by Antti Koivisto.
3500
3501         * NetworkProcess/Downloads/Download.h:
3502
3503 2017-11-14  Daniel Bates  <dabates@apple.com>
3504
3505         Update comment in FeatureDefines.xcconfig to reflect location of Visual Studio property files
3506         for feature defines
3507
3508         Following r195498 and r201917 the Visual Studio property files for feature defines have
3509         moved from directory WebKitLibraries/win/tools/vsprops to directory Source/cmake/tools/vsprops.
3510         Update the comment in FeatureDefines.xcconfig to reflect the new location and names of these
3511         files.
3512
3513         * Configurations/FeatureDefines.xcconfig:
3514
3515 2017-11-14  Brent Fulgham  <bfulgham@apple.com>
3516
3517         Whitelist some IOKIt properties to avoid sandbox violations on YouTube
3518         https://bugs.webkit.org/show_bug.cgi?id=179683
3519         <rdar://problem/35415368>
3520
3521         Reviewed by Dean Jackson.
3522
3523         YouTube video playback on some hardware (and some video encodings) generates sandbox violations. Add
3524         whitelist entries for the relevant IOKit properties needed to support these activities.
3525
3526         * WebProcess/com.apple.WebProcess.sb.in:
3527
3528 2017-11-14  Daniel Bates  <dabates@apple.com>
3529
3530         Mark WebChromeClient::requestStorageAccess() as final
3531         https://bugs.webkit.org/show_bug.cgi?id=179673
3532
3533         Reviewed by Sam Weinig.
3534
3535         Mark WebChromeClient::requestStorageAccess() as final so that it overrides the virtual function
3536         in ChromeClient with the same name and hence we actually call it through a ChromeClient pointer.
3537
3538         * WebProcess/WebCoreSupport/WebChromeClient.h:
3539
3540 2017-11-14  Youenn Fablet  <youenn@apple.com>
3541
3542         WebSWClientConnection should do IPC to StorageProcess if its WebSWOriginTable is not yet initialized
3543         https://bugs.webkit.org/show_bug.cgi?id=179668
3544
3545         Reviewed by Chris Dumez.
3546
3547         There may be cases where the origin table is not initialized and we would think there is no service worker registration.
3548         In such a case, we should go to the StorageProcess.
3549         StorageProcess is now sending an IPC message back to each registered SW connection so that WebProcess will know whether its map
3550         is correctly initialized or not.
3551
3552         Renaming hasServiceWorkerRegisteredForOrigin in mayHaveServiceWorkerRegisteredForOrigin.
3553
3554         * WebProcess/Storage/WebSWClientConnection.cpp:
3555         (WebKit::WebSWClientConnection::mayHaveServiceWorkerRegisteredForOrigin const):
3556         (WebKit::WebSWClientConnection::matchRegistration):
3557         (WebKit::WebSWClientConnection::hasServiceWorkerRegisteredForOrigin const): Deleted.
3558         * WebProcess/Storage/WebSWClientConnection.h:
3559         * WebProcess/Storage/WebSWOriginTable.h:
3560         (WebKit::WebSWOriginTable::isInitialized const):
3561         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
3562         (WebKit::shouldHandleFetch):
3563
3564 2017-11-14  Brent Fulgham  <bfulgham@apple.com>
3565
3566         Consolidate sysctl-read rules in WebProcess sandbox
3567         https://bugs.webkit.org/show_bug.cgi?id=179674
3568         <rdar://problem/35367154>
3569
3570         Reviewed by Dean Jackson.
3571
3572         Consolidate the various calls to 'allow sysctl-read' imported during Bug 179548 into
3573         the main function in the sandbox profile.
3574
3575         Remove the statement to grant global sysctl-read permissions that was copied into this
3576         sandbox profile in an earlier checkin. We started blocking the blanket read permissions in
3577         macOS 10.13, and want to continue to do so.
3578         
3579         The earlier "grant global read access" in 'system.sb' apparently allowed some sysctl reads
3580         to occur before we hit the block declaration in the WebContent sandbox. Now that we are
3581         consistently blocking systcl reads from the start, we need to add whitelist entries for a
3582         few more entries to avoid creating new sandbox violations.
3583
3584         * WebProcess/com.apple.WebProcess.sb.in:
3585
3586 2017-11-14  Alex Christensen  <achristensen@webkit.org>
3587
3588         Remove WebKit CFURLConnection code
3589         https://bugs.webkit.org/show_bug.cgi?id=179645
3590
3591         Reviewed by Alexey Proskuryakov.
3592
3593         The CFURLConnection code is Windows-specific now. Nobody can use it in modern WebKit.
3594
3595         * NetworkProcess/Downloads/Download.h:
3596         * NetworkProcess/Downloads/mac/DownloadMac.mm:
3597         * NetworkProcess/NetworkLoad.h:
3598         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3599         (WebKit::serverTrustCredential):
3600         * NetworkProcess/mac/NetworkLoadMac.mm:
3601         * Shared/Authentication/AuthenticationManager.cpp:
3602         (WebKit::AuthenticationManager::useCredentialForSingleChallenge):
3603         (WebKit::AuthenticationManager::continueWithoutCredentialForSingleChallenge):
3604         (WebKit::AuthenticationManager::cancelSingleChallenge):
3605         (WebKit::AuthenticationManager::performDefaultHandlingForSingleChallenge):
3606         (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge):
3607         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
3608         * Shared/Authentication/mac/AuthenticationManager.mac.mm:
3609         (WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge):
3610         * Shared/WebProcessCreationParameters.cpp:
3611         (WebKit::WebProcessCreationParameters::encode const):
3612         (WebKit::WebProcessCreationParameters::decode):
3613         * Shared/WebProcessCreationParameters.h:
3614         * Shared/mac/WebCoreArgumentCodersMac.mm:
3615         (IPC::ArgumentCoder<ResourceRequest>::encodePlatformData):
3616         (IPC::ArgumentCoder<ResourceRequest>::decodePlatformData):
3617         * config.h:
3618
3619 2017-11-14  Alex Christensen  <achristensen@webkit.org>
3620
3621         Remove assertions added in r224791
3622         https://bugs.webkit.org/show_bug.cgi?id=178751#c10
3623
3624         * NetworkProcess/mac/RemoteNetworkingContext.mm:
3625         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
3626         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
3627         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
3628         I had added assertions that sandbox extension handle consumption succeeds.
3629         In the API test IndexedDB.StructuredCloneBackwardCompatibility we get a sandbox extension handle
3630         to give access to a directory that does not exist and consumption fails.  We want it to fail,
3631         so my optimistic addition of a success assertion was incorrect.  The test passes without it
3632         and behaves like it used to.
3633
3634 2017-11-14  Tim Horton  <timothy_horton@apple.com>
3635
3636         Don't use -[NSString stringWithFormat:] to build defaults keys
3637         https://bugs.webkit.org/show_bug.cgi?id=179680
3638
3639         Reviewed by Simon Fraser.
3640
3641         * UIProcess/mac/WebPreferencesMac.mm:
3642         (WebKit::makeKey):
3643         (WebKit::debugUserDefaultsValue):
3644         Use string concatenation instead of stringWithFormat to build
3645         preference keys. This wasn't a huge cost, but it shaves a few milliseconds
3646         off process launch.
3647
3648 2017-11-14  Alex Christensen  <achristensen@webkit.org>
3649
3650         Clean up old URL parser remnants
3651         https://bugs.webkit.org/show_bug.cgi?id=179573
3652
3653         Reviewed by Darin Adler.
3654
3655         * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
3656         (WebKit::WebContextMenuClient::searchWithGoogle):
3657         Use https if we do end up searching with google.
3658
3659 2017-11-14  Antti Koivisto  <antti@apple.com>
3660
3661         Enable display:contents by default
3662         https://bugs.webkit.org/show_bug.cgi?id=179655
3663
3664         Reviewed by Sam Weinig.
3665
3666         * Shared/WebPreferences.yaml:
3667
3668         Make non-experimental and enabled.
3669
3670 2017-11-10  Brent Fulgham  <bfulgham@apple.com>
3671
3672         Consolidate mach-lookup calls in WebProcess sandbox
3673         https://bugs.webkit.org/show_bug.cgi?id=179650
3674         <rdar://problem/35367154>
3675
3676         Reviewed by Dean Jackson.
3677
3678         Consolidate the various calls to 'allow mach-lookup' imported during Bug 179548 into the main
3679         function in the sandbox profile. Remove some entries that are not needed by WebKit.
3680
3681         Remove the statement to grant global permission to perform mach-lookup for any xpc
3682         service name that was copied into this sandbox profile in Bug 179548. We started blocking
3683         this in macOS 10.13 and want to continue to do so.
3684         
3685         The earlier "grant global permission" in 'system.sb' apparently allowed some xpc lookups to occur
3686         before we hit the block declaration in the WebContent sandbox. Now that we are consistently blocking
3687         mach lookups we need to add whitelist entries for a few more services to avoid creating new
3688         sandbox violations.
3689
3690         * WebProcess/com.apple.WebProcess.sb.in:
3691
3692 2017-11-14  Tim Horton  <timothy_horton@apple.com>
3693
3694         Long pressing a phone number with spaces in it results in a link sheet instead of a data detectors sheet
3695         https://bugs.webkit.org/show_bug.cgi?id=179646
3696         <rdar://problem/35337288>
3697
3698         Reviewed by Simon Fraser.
3699
3700         * UIProcess/ios/WKActionSheetAssistant.mm:
3701         (-[WKActionSheetAssistant showImageSheet]):
3702         (-[WKActionSheetAssistant showLinkSheet]):
3703         (-[WKActionSheetAssistant showDataDetectorsSheet]):
3704         * UIProcess/ios/WKContentViewInteraction.mm:
3705         (-[WKContentView _actionForLongPressFromPositionInformation:]):
3706         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
3707         Make use of canBePresentedByDataDetectors with our WebCore URL instead
3708         of (sometimes unsucessfully) reparsing the URL with NSURL's parser.
3709         Also, avoid a few unnecessary round-trips through String when converting
3710         from URL to NSURL.
3711
3712 2017-11-14  Brent Fulgham  <bfulgham@apple.com>
3713
3714         REGRESSION(r224799): WebKit crashes on Sierra due to sandbox violation
3715         https://bugs.webkit.org/show_bug.cgi?id=179656
3716         
3717         Unreviewed build fix.
3718
3719         * WebProcess/com.apple.WebProcess.sb.in: Switch to Dan's recommended version check.
3720
3721 2017-11-13  Joseph Pecoraro  <pecoraro@apple.com>
3722
3723         Give a ServiceWorker WebContentProcess a different display name
3724         https://bugs.webkit.org/show_bug.cgi?id=179653
3725
3726         Reviewed by Brady Eidson.
3727
3728         * UIProcess/WebProcessProxy.h:
3729         * UIProcess/WebProcessProxy.cpp:
3730         (WebKit::WebProcessProxy::create):
3731         Call connect after construction so virtual methods will use subclass implementations.
3732
3733         * UIProcess/ServiceWorkerProcessProxy.h:
3734         * UIProcess/ServiceWorkerProcessProxy.cpp:
3735         (WebKit::ServiceWorkerProcessProxy::create):
3736         Copy the pattern from WebProcessProxy to ensure connect() gets called after construction.
3737
3738         (WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
3739         Set a launch option to signal this is a Service Worker process.
3740
3741         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
3742         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
3743         * WebProcess/cocoa/WebProcessCocoa.mm:
3744         (WebKit::WebProcess::initializeProcessName):
3745         Consume the launch option to configuration the process name.
3746
3747 2017-11-13  Ryosuke Niwa  <rniwa@webkit.org>
3748
3749         REGRESSION(r224799): WebKit crashes at launch on macOS Sierra due to a sandbox violation
3750         https://bugs.webkit.org/show_bug.cgi?id=179656
3751
3752         Unreviewed. Revert r224799 on macOS Sierra.
3753
3754         * WebProcess/com.apple.WebProcess.sb.in:
3755
3756 2017-11-13  Chris Dumez  <cdumez@apple.com>
3757
3758         Send ServiceWorkerData structs to the WebProcesses instead of ServiceWorkerIdentifiers
3759         https://bugs.webkit.org/show_bug.cgi?id=179649
3760
3761         Reviewed by Brady Eidson.
3762
3763         * Shared/WebCoreArgumentCoders.h:
3764         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3765         (WebKit::WebSWServerConnection::updateRegistrationStateInClient):
3766         (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient):
3767         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3768         * WebProcess/Storage/WebSWClientConnection.cpp:
3769         (WebKit::WebSWClientConnection::postMessageToServiceWorkerClient):
3770         * WebProcess/Storage/WebSWClientConnection.h:
3771         * WebProcess/Storage/WebSWClientConnection.messages.in:
3772
3773 2017-11-13  Brady Eidson  <beidson@apple.com>
3774
3775         Massive "Server-process-to-context-process" connection overhaul.
3776         https://bugs.webkit.org/show_bug.cgi?id=179554
3777
3778         Reviewed by Chris Dumez.
3779
3780         * DerivedSources.make:
3781         * WebKit.xcodeproj/project.pbxproj:
3782
3783         * Shared/WebCoreArgumentCoders.h:
3784
3785         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3786         (WebKit::WebSWServerConnection::sendToContextProcess):
3787         (WebKit::WebSWServerConnection::installServiceWorkerContext): Deleted.
3788         (WebKit::WebSWServerConnection::fireInstallEvent): Deleted.
3789         (WebKit::WebSWServerConnection::fireActivateEvent): Deleted.
3790         (WebKit::WebSWServerConnection::setContextConnection): Deleted.
3791         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3792
3793         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp: Copied from Source/WebCore/workers/service/server/SWServerWorker.cpp.
3794         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
3795         (WebKit::WebSWServerToContextConnection::messageSenderConnection):
3796         (WebKit::WebSWServerToContextConnection::messageSenderDestinationID):
3797         (WebKit::WebSWServerToContextConnection::connectionClosed):
3798         (WebKit::WebSWServerToContextConnection::installServiceWorkerContext):
3799         (WebKit::WebSWServerToContextConnection::fireInstallEvent):
3800         (WebKit::WebSWServerToContextConnection::fireActivateEvent):
3801         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h: Copied from Source/WebCore/workers/service/ServiceWorkerTypes.h.
3802         (WebKit::WebSWServerToContextConnection::create):
3803         (WebKit::WebSWServerToContextConnection::ipcConnection const):
3804         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: Copied from Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in.
3805
3806         * StorageProcess/StorageProcess.cpp:
3807         (WebKit::StorageProcess::didClose):
3808         (WebKit::StorageProcess::didReceiveMessage):
3809         (WebKit::StorageProcess::globalServerToContextConnection):
3810         (WebKit::StorageProcess::createServerToContextConnection):
3811         (WebKit::StorageProcess::didGetWorkerContextProcessConnection):
3812         (WebKit::StorageProcess::workerContextProcessConnection): Deleted.
3813         (WebKit::StorageProcess::createWorkerContextProcessConnection): Deleted.
3814         (WebKit::StorageProcess::serviceWorkerContextFailedToStart): Deleted.
3815         (WebKit::StorageProcess::serviceWorkerContextStarted): Deleted.
3816         (WebKit::StorageProcess::didFinishServiceWorkerInstall): Deleted.
3817         (WebKit::StorageProcess::didFinishServiceWorkerActivation): Deleted.
3818         (WebKit::StorageProcess::setServiceWorkerHasPendingEvents): Deleted.
3819         * StorageProcess/StorageProcess.h:
3820         * StorageProcess/StorageProcess.messages.in:
3821
3822         * StorageProcess/StorageToWebProcessConnection.cpp:
3823         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
3824         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
3825         (WebKit::StorageToWebProcessConnection::workerContextProcessConnectionCreated):
3826
3827         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3828         (WebKit::WebSWContextManagerConnection::installServiceWorker):
3829         (WebKit::WebSWContextManagerConnection::serviceWorkerStartedWithMessage):
3830         (WebKit::WebSWContextManagerConnection::fireInstallEvent):
3831         (WebKit::WebSWContextManagerConnection::fireActivateEvent):
3832         (WebKit::WebSWContextManagerConnection::didFinishInstall):
3833         (WebKit::WebSWContextManagerConnection::didFinishActivation):
3834         (WebKit::WebSWContextManagerConnection::setServiceWorkerHasPendingEvents):
3835         * WebProcess/Storage/WebSWContextManagerConnection.h:
3836         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
3837
3838 2017-11-13  Brent Fulgham  <bfulgham@apple.com>
3839
3840         WebContent sandbox should not include 'system.sb'
3841         https://bugs.webkit.org/show_bug.cgi?id=179548
3842         <rdar://problem/35367154>
3843
3844         Reviewed by Darin Adler.
3845
3846         Stop including 'system.sb', and just include the portions of that sandbox that we
3847         actually use in WebContent Process. This is the first step in some further sandbox
3848         tightening.
3849
3850         * WebProcess/com.apple.WebProcess.sb.in:
3851
3852 2017-11-13  Simon Fraser  <simon.fraser@apple.com>
3853
3854         When navigating back to a page, compositing layers may not use accelerated drawing
3855         https://bugs.webkit.org/show_bug.cgi?id=178749
3856         rdar://problem/35158946
3857
3858         Reviewed by Dean Jackson.
3859
3860         Avoid assertions when a test enables accelerated drawing (which we can't support
3861         in the iOS simulator).
3862
3863         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
3864         (WebKit::RemoteLayerBackingStore::ensureBackingStore):
3865
3866 2017-11-13  Youenn Fablet  <youenn@apple.com>
3867
3868         matchRegistration does not need to go to StorageProcess if no service worker is registered
3869         https://bugs.webkit.org/show_bug.cgi?id=179480
3870
3871         Reviewed by Chris Dumez.
3872
3873         Removed origin store handling from StorageProcess since it is now handled within SWServer.
3874         Updated clearing of web site data accordingly.
3875         Optimized matchRegistration by looking at the origin store before doing any IPC.
3876         Do IPC to the StorageProcess if the origin store is not yet initialized on the WebProcess.
3877
3878         * StorageProcess/ServiceWorker/WebSWOriginStore.h:
3879         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3880         (WebKit::WebSWServerConnection::resolveRegistrationJobInClient):
3881         (WebKit::WebSWServerConnection::resolveUnregistrationJobInClient):
3882         * StorageProcess/StorageProcess.cpp:
3883         (WebKit::StorageProcess::deleteWebsiteData):
3884         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
3885         (WebKit::StorageProcess::swServerForSession):
3886         (WebKit::StorageProcess::swOriginStoreForSession):
3887         (WebKit::StorageProcess::registerSWServerConnection):
3888         (WebKit::StorageProcess::unregisterSWServerConnection):
3889         (WebKit::StorageProcess::ensureSWOriginStoreForSession): Deleted.
3890         (WebKit::StorageProcess::swOriginStoreForSession const): Deleted.
3891         * StorageProcess/StorageProcess.h:
3892         * StorageProcess/ServiceWorker/WebSWOriginStore.cpp:
3893         (WebKit::WebSWOriginStore::addToStore):
3894         (WebKit::WebSWOriginStore::removeFromStore):
3895         (WebKit::WebSWOriginStore::clearStore):
3896         (WebKit::WebSWOriginStore::add): Deleted.
3897         (WebKit::WebSWOriginStore::remove): Deleted.
3898         (WebKit::WebSWOriginStore::clear): Deleted.
3899         * StorageProcess/ServiceWorker/WebSWOriginStore.h:
3900         * WebProcess/Storage/WebSWClientConnection.cpp:
3901         (WebKit::WebSWClientConnection::matchRegistration):
3902
3903 2017-11-13  Alex Christensen  <achristensen@webkit.org>
3904
3905         Merge NetworkProcess::EnsurePrivateBrowsingSession and NetworkProcess::AddWebsiteDataStore into one message type
3906         https://bugs.webkit.org/show_bug.cgi?id=178751
3907
3908         Reviewed by Brady Eidson.
3909
3910         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3911         (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
3912         * NetworkProcess/NetworkProcess.cpp:
3913         (WebKit::NetworkProcess::initializeNetworkProcess):
3914         (WebKit::NetworkProcess::ensurePrivateBrowsingSession): Deleted.
3915         * NetworkProcess/NetworkProcess.h:
3916         * NetworkProcess/NetworkProcess.messages.in:
3917         * NetworkProcess/RemoteNetworkingContext.h:
3918         * NetworkProcess/mac/RemoteNetworkingContext.mm:
3919         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
3920         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession): Deleted.
3921         * Shared/WebsiteDataStoreParameters.cpp:
3922         (WebKit::WebsiteDataStoreParameters::legacyPrivateSessionParameters):
3923         * Shared/WebsiteDataStoreParameters.h:
3924         * UIProcess/WebProcessPool.cpp:
3925         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
3926         (WebKit::WebProcessPool::createNewWebProcess):
3927         (WebKit::WebProcessPool::pageAddedToProcess):
3928         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3929         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
3930         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
3931         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
3932         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
3933         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession): Deleted.
3934         * WebProcess/WebPage/WebPage.cpp:
3935         (WebKit::WebPage::setSessionID):
3936         * WebProcess/WebProcess.cpp:
3937         (WebKit::WebProcess::ensurePrivateBrowsingSession): Deleted.
3938         * WebProcess/WebProcess.h:
3939         * WebProcess/WebProcess.messages.in:
3940
3941 2017-11-13  Alex Christensen  <achristensen@webkit.org>
3942
3943         Add logs to debug content extension test failures
3944         https://bugs.webkit.org/show_bug.cgi?id=179624
3945
3946         Reviewed by Chris Dumez.
3947
3948         * UIProcess/API/APIContentRuleListStore.cpp:
3949         (API::compiledToFile):
3950         Right now I'm seeing this log:
3951         "Rule list compilation failed: Unspecified error during compile."
3952         I need more information to debug what is failing on the bots.
3953
3954 2017-11-07  Brian Burg  <bburg@apple.com>
3955
3956         Web Automation: inViewCenterPoint should not include topContentInset when computed in viewport coordinates
3957         https://bugs.webkit.org/show_bug.cgi?id=179129
3958         <rdar://problem/35297038>
3959
3960         Reviewed by Simon Fraser.
3961
3962         When computing the in view center point per W3C specification, the top content inset
3963         is inadvertently added back in when converting to the root view coordinate system.
3964
3965         This patch reworks the protocol command so that it explicitly requests a coordinate
3966         system, with options for "Page" (root / contents), "LayoutViewport", and "VisualViewport".
3967         The latter is not implemented in this patch, since it is intended for use on iOS someday.
3968
3969         * UIProcess/Automation/Automation.json:
3970         Change usesViewport to CoordinateSystem.
3971         Add a new coordinate system enum type and use it.
3972         Fix relevant comments for Automation.computElementLayout.
3973
3974         * UIProcess/Automation/WebAutomationSession.h:
3975         * UIProcess/Automation/WebAutomationSession.cpp:
3976         (WebKit::protocolStringToCoordinateSystem):
3977         (WebKit::WebAutomationSession::computeElementLayout):
3978         Parse the requested coordinate system and send it in the message to the web process.
3979
3980         * WebKit.xcodeproj/project.pbxproj:
3981         * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
3982         * WebProcess/Automation/WebAutomationSessionProxy.h:
3983         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
3984         (WebKit::WebAutomationSessionProxy::computeElementLayout):
3985         Rework the implementation. Get the element bounds and in-view center point in
3986         client coordinates and convert back to root view coordinates for CoordinateSystem::Page.
3987
3988 2017-11-08  Keith Miller  <keith_miller@apple.com>
3989
3990         Async iteration should only fetch the next method once and add feature flag
3991         https://bugs.webkit.org/show_bug.cgi?id=179451
3992
3993         Reviewed by Geoffrey Garen.
3994
3995         Add feature flag for Async iteration.
3996
3997         * Configurations/FeatureDefines.xcconfig:
3998
3999 2017-11-13  Mark Lam  <mark.lam@apple.com>
4000
4001         Add more overflow check book-keeping for MarkedArgumentBuffer.
4002         https://bugs.webkit.org/show_bug.cgi?id=179634
4003         <rdar://problem/35492517>
4004
4005         Reviewed by Saam Barati.
4006
4007         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
4008         (WebKit::NPJSObject::construct):
4009         (WebKit::NPJSObject::invoke):
4010
4011 2017-11-13  Timothy Horton  <timothy_horton@apple.com>
4012
4013         Address some post-landing review comments from r224728
4014         https://bugs.webkit.org/show_bug.cgi?id=179576
4015
4016         * Platform/IPC/mac/MachMessage.h:
4017         (IPC::MachMessage::setMessageReceiverName):
4018         (IPC::MachMessage::setMessageName):
4019         More moving!
4020
4021 2017-11-13  Tim Horton  <timothy_horton@apple.com>
4022
4023         Occasional MobileSafari crash under -[WKPDFView web_setMinimumSize:]
4024         https://bugs.webkit.org/show_bug.cgi?id=179628
4025         <rdar://problem/34773037>
4026
4027         Reviewed by Simon Fraser.
4028
4029         * UIProcess/ios/WKPDFView.mm:
4030         (-[WKPDFView _computePageAndDocumentFrames]):
4031         Similar to r223444, avoid propagating null CGRects into the view hierarchy.
4032         In this case, the null rect comes from applying margins to a rect that is 
4033         smaller than the margins. We could check for that specifically, but a
4034         more-general check for a null rect seems reasonable.