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