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