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