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