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