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