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