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