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