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