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