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