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