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