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