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