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