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