[iOS] Paste is missing from callout bar when pasteboard only contains custom data
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-08-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         [iOS] Paste is missing from callout bar when pasteboard only contains custom data
4         https://bugs.webkit.org/show_bug.cgi?id=184271
5         <rdar://problem/39256708>
6
7         Reviewed by Ryosuke Niwa.
8
9         Currently, the "paste:" selector action cannot be performed during editing if the pasteboard only contains
10         custom pasteboard data. This is because logic in -[WKContentView canPerformActionForWebView:withSender:] only
11         checks against a list of pasteboard types which does not include the type identifier for custom pasteboard data.
12         To fix this, we allow pasting only in the case where none of the other type identifiers exist in the pasteboard,
13         as long as the custom pasteboard data type identifier is present, and the custom pasteboard data's origin
14         matches the origin of the focused frame's document.
15
16         Test: PasteMixedContent.CopyAndPasteWithCustomPasteboardDataOnly
17
18         * Shared/EditorState.cpp:
19         (WebKit::EditorState::encode const):
20         (WebKit::EditorState::decode):
21         * Shared/EditorState.h:
22
23         Add a originIdentifierForPasteboard field, and add support for encoding it when propagating EditorState via IPC.
24
25         * UIProcess/ios/WKContentViewInteraction.mm:
26         (-[WKContentView canPerformActionForWebView:withSender:]):
27
28         If none of the conventional pasteboard type identifiers for rich or plain text editing are present, check to see
29         if we have custom pasteboard data; if so, only allow pasting if the custom pasteboard data's origin matches that
30         of the focused frame's document origin.
31
32         Additionally refactor a bit of logic by pulling out `_page->editorState()` into a separate local variable, used
33         throughout the rest of the method.
34
35         * WebProcess/WebPage/WebPage.cpp:
36         (WebKit::WebPage::editorState const):
37
38         Send the focused frame's document origin to the UI process via EditorState.
39
40 2018-08-17  Tim Horton  <timothy_horton@apple.com>
41
42         Start bringing up Unified Sources in WebKit2
43         https://bugs.webkit.org/show_bug.cgi?id=188703
44
45         Reviewed by Simon Fraser.
46
47         * Configurations/BaseTarget.xcconfig:
48         Add SRCROOT to the include path, so unified sources can find the source files.
49
50         * Shared/APIWebArchive.mm:
51         (API::releaseWebArchiveData):
52         (API::WebArchive::data):
53         (API::releaseCFData): Deleted.
54         * Shared/APIWebArchiveResource.mm:
55         (API::releaseWebArchiveResourceData):
56         (API::WebArchiveResource::data):
57         (API::releaseCFData): Deleted.
58         Disambiguate two static methods by renaming them.
59
60         * Shared/cf/ArgumentCodersCF.cpp:
61         Leave a comment about the bizarreness of this file.
62
63         * Shared/NavigationActionData.cpp:
64         (WebKit::NavigationActionData::decode):
65         * Shared/WebPlatformTouchPoint.cpp:
66         * Shared/WebPopupItem.cpp:
67         (WebKit::WebPopupItem::WebPopupItem):
68         (WebKit::WebPopupItem::decode):
69         * Shared/WebPreferencesStore.cpp:
70         * Shared/WebRenderLayer.cpp:
71         (WebKit::WebRenderLayer::create):
72         (WebKit::WebRenderLayer::createArrayFromLayerList):
73         (WebKit::WebRenderLayer::WebRenderLayer):
74         * Shared/gtk/WebEventFactory.cpp:
75         * Shared/mac/WebCoreArgumentCodersMac.mm:
76         * Shared/mac/WebEventFactory.mm:
77         (WebKit::WebEventFactory::createWebMouseEvent):
78         (WebKit::WebEventFactory::createWebWheelEvent):
79         (WebKit::WebEventFactory::createWebKeyboardEvent):
80         * Shared/mac/WebMemorySampler.mac.mm:
81         (WebKit::WebMemorySampler::sampleWebKit const):
82         * UIProcess/API/APIAutomationSessionClient.h:
83         (API::AutomationSessionClient::sessionIdentifier const):
84         (API::AutomationSessionClient::messageOfCurrentJavaScriptDialogOnPage):
85         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
86         (WebKit::RemoteLayerBackingStore::ensureBackingStore):
87         (WebKit::RemoteLayerBackingStore::setNeedsDisplay):
88         (WebKit::RemoteLayerBackingStore::backingStoreSize const):
89         (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
90         (WebKit::RemoteLayerBackingStore::display):
91         (WebKit::RemoteLayerBackingStore::drawInContext):
92         (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
93         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
94         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::LayerCreationProperties):
95         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
96         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
97         (WebKit::RemoteLayerTreeTransaction::decode):
98         (WebKit::RemoteLayerTreeTransaction::setRootLayerID):
99         (WebKit::RemoteLayerTreeTransaction::setDestroyedLayerIDs):
100         (WebKit::RemoteLayerTreeTransaction::setLayerIDsWithNewlyUnreachableBackingStore):
101         (WebKit::dumpChangedLayers):
102         (WebKit::RemoteLayerTreeTransaction::description const):
103         * Shared/WebPlatformTouchPoint.cpp:
104         (WebKit::WebPlatformTouchPoint::WebPlatformTouchPoint):
105         Get rid of lots of `using namespace`.
106
107         * Sources.txt: Added.
108         * SourcesCocoa.txt: Added.
109         * WebKit.xcodeproj/project.pbxproj:
110         Set up unified sources.
111         Right now, we only unify Platform/ and Shared/[^API].
112
113 2018-08-17  Aditya Keerthi  <akeerthi@apple.com>
114
115         [Datalist][iOS] Display suggestions for input[type=color]
116         https://bugs.webkit.org/show_bug.cgi?id=188669
117
118         Reviewed by Tim Horton.
119
120         An input[type=color] element that has an associated datalist element should
121         display the color values provided on iOS. Similar to macOS, we now support 1-12
122         suggested colors, that will be displayed at the top of the color picker.
123
124         Also ensured that we get rounded corners on both sides of a color swatch if it is
125         the only one in its row.
126
127         * Shared/AssistedNodeInformation.cpp: Added suggestedColors field.
128         (WebKit::AssistedNodeInformation::encode const):
129         (WebKit::AssistedNodeInformation::decode):
130         * Shared/AssistedNodeInformation.h:
131         * UIProcess/ios/forms/WKFormColorPicker.mm:
132         (+[WKColorPicker defaultTopColorMatrix]):
133         (-[WKColorPicker initWithView:]): Use the list of suggestedColors if it exists.
134         (-[WKColorPicker drawSelectionIndicatorForColorButton:]):
135         * WebProcess/WebCoreSupport/WebColorChooser.cpp:
136         (WebKit::WebColorChooser::WebColorChooser):
137         (WebKit::WebColorChooser::reattachColorChooser):
138         * WebProcess/WebPage/ios/WebPageIOS.mm:
139         (WebKit::WebPage::getAssistedNodeInformation):
140
141 2018-08-17  Ryan Haddad  <ryanhaddad@apple.com>
142
143         Unreviewed, rolling out r234991.
144
145         Caused an assertion failure on the bots.
146
147         Reverted changeset:
148
149         "Pass webPageID and webFrameID to NetworkLoad for speculative
150         loads"
151         https://bugs.webkit.org/show_bug.cgi?id=188682
152         https://trac.webkit.org/changeset/234991
153
154 2018-08-17  Alex Christensen  <achristensen@webkit.org>
155
156         Add some plumbing for safe browsing
157         https://bugs.webkit.org/show_bug.cgi?id=188709
158
159         Reviewed by Tim Horton.
160
161         Also adding a URL to SafeBrowsingResult because we'll need it.
162         Also adding a bool to LoadParameters because we will need to do special things
163         when loading the safe browsing warning, like adding a way to skip the safe browsing check.
164
165         * Shared/LoadParameters.cpp:
166         (WebKit::LoadParameters::encode const):
167         (WebKit::LoadParameters::decode):
168         * Shared/LoadParameters.h:
169         * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm:
170         (WebKit::SafeBrowsingResult::SafeBrowsingResult):
171         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
172         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
173         * UIProcess/SafeBrowsingResult.h:
174         (WebKit::SafeBrowsingResult::url const):
175         * UIProcess/WebPageProxy.cpp:
176         (WebKit::WebPageProxy::loadAlternateHTML):
177         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
178         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
179         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
180         * UIProcess/WebPageProxy.h:
181         * UIProcess/WebPageProxy.messages.in:
182         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
183         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
184         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
185
186 2018-08-16  Ryosuke Niwa  <rniwa@webkit.org>
187
188         Replace canBubble and cancelable booleans in Event by enum classes
189         https://bugs.webkit.org/show_bug.cgi?id=188692
190
191         Reviewed by Alex Christensen.
192
193         * WebProcess/WebPage/WebPage.cpp:
194         (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
195
196 2018-08-17  Andy Estes  <aestes@apple.com>
197
198         [Xcode] Fix up file reference paths in Source/WebKit/NetworkProcess
199         https://bugs.webkit.org/show_bug.cgi?id=188700
200
201         Rubber-stamped by Dan Bernstein.
202
203         * WebKit.xcodeproj/project.pbxproj:
204
205 2018-08-17  Alex Christensen  <achristensen@webkit.org>
206
207         Pass webPageID and webFrameID to NetworkLoad for speculative loads
208         https://bugs.webkit.org/show_bug.cgi?id=188682
209
210         Reviewed by Youenn Fablet.
211
212         This also removes an authentication shortcut I introduced in r234941
213
214         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
215         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
216         (WebKit::NetworkCache::SpeculativeLoad::didReceiveResponse):
217         * Shared/Authentication/AuthenticationManager.cpp:
218         (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
219
220 2018-08-17  Alex Christensen  <achristensen@webkit.org>
221
222         Simplify server trust authentication flow
223         https://bugs.webkit.org/show_bug.cgi?id=188684
224
225         Reviewed by Youenn Fablet.
226
227         We unnecessarily had the allowsSpecificHTTPSCertificateForHost check at two different abstraction levels.
228
229         * NetworkProcess/NetworkLoad.cpp:
230         (WebKit::NetworkLoad::didReceiveChallenge):
231         * NetworkProcess/NetworkSession.cpp:
232         (WebKit::NetworkSession::allowsSpecificHTTPSCertificateForHost): Deleted.
233         * NetworkProcess/NetworkSession.h:
234         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
235         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
236
237 2018-08-17  Alex Christensen  <achristensen@webkit.org>
238
239         Fix API tests after r234985
240         https://bugs.webkit.org/show_bug.cgi?id=188679
241
242         * UIProcess/API/C/WKPage.cpp:
243         (encodingOf):
244         (dataFrom):
245         The encoding of null strings had changed, which is no big deal because there's no data in that encoding,
246         but switching it back fixes the tests.
247
248 2018-08-17  Alex Christensen  <achristensen@webkit.org>
249
250         Replace WebPageProxy::loadAlternateHTMLString with loadAlternateHTML
251         https://bugs.webkit.org/show_bug.cgi?id=188679
252
253         Reviewed by Carlos Garcia Campos.
254
255         * Shared/LoadParameters.cpp:
256         (WebKit::LoadParameters::encode const):
257         (WebKit::LoadParameters::decode):
258         * Shared/LoadParameters.h:
259         * UIProcess/API/C/WKPage.cpp:
260         (encodingOf):
261         (dataFrom):
262         (loadString):
263         (WKPageLoadAlternateHTMLString):
264         (WKPageLoadAlternateHTMLStringWithUserData):
265         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
266         (-[WKBrowsingContextController loadAlternateHTMLString:baseURL:forUnreachableURL:]):
267         * UIProcess/API/Cocoa/WKWebView.mm:
268         (-[WKWebView _loadAlternateHTMLString:baseURL:forUnreachableURL:]):
269         * UIProcess/WebPageProxy.cpp:
270         (WebKit::WebPageProxy::loadAlternateHTML):
271         (WebKit::WebPageProxy::loadAlternateHTMLString): Deleted.
272         * UIProcess/WebPageProxy.h:
273         * WebProcess/WebPage/WebPage.cpp:
274         (WebKit::WebPage::loadAlternateHTMLString):
275
276 2018-08-17  Michael Catanzaro  <mcatanzaro@igalia.com>
277
278         Unreviewed, rolling out r234259.
279
280         Caused excessive CPU usage
281
282         Reverted changeset:
283
284         "[GTK][WPE] Improve the way request displayRefresh
285         notifications"
286         https://bugs.webkit.org/show_bug.cgi?id=188005
287         https://trac.webkit.org/changeset/234259
288
289 2018-08-16  Commit Queue  <commit-queue@webkit.org>
290
291         Unreviewed, rolling out r234958.
292         https://bugs.webkit.org/show_bug.cgi?id=188683
293
294         Breaking builds due to copy failure (Requested by brichards on
295         #webkit).
296
297         Reverted changeset:
298
299         "Add script to generate WebContent service resource files"
300         https://bugs.webkit.org/show_bug.cgi?id=188601
301         https://trac.webkit.org/changeset/234958
302
303 2018-08-16  Sihui Liu  <sihui_liu@apple.com>
304
305         Remove unused parentProcessName from NetworkProcessCreationParameters
306         https://bugs.webkit.org/show_bug.cgi?id=188618
307
308         Reviewed by Alex Christensen.
309
310         * NetworkProcess/NetworkProcessCreationParameters.cpp:
311         (WebKit::NetworkProcessCreationParameters::encode const):
312         (WebKit::NetworkProcessCreationParameters::decode):
313         * NetworkProcess/NetworkProcessCreationParameters.h:
314         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
315         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
316
317 2018-08-16  Andy Estes  <aestes@apple.com>
318
319         [watchOS] Upstream Proximity Networking (nee Wi-Fi Assertions)
320         https://bugs.webkit.org/show_bug.cgi?id=188664
321
322         Reviewed by Tim Horton.
323
324         Proximity Networking provides two features for speeding up page loads on watchOS:
325
326         1. Binding requests to the Apple Watch's Wi-Fi interface even when the iPhone is in proximity.
327         2. When Wi-Fi isn't available, preemptively upgrading the Bluetooth link to its fastest data
328         rate prior to starting page loads.
329
330         * Configurations/WebKit.xcconfig:
331
332         Added LDFLAGS for Proximity Networking.
333
334         * NetworkProcess/NetworkProcess.cpp:
335         (WebKit::NetworkProcess::NetworkProcess):
336         (WebKit::NetworkProcess::proximityManager):
337         * NetworkProcess/NetworkProcess.h:
338
339         Added NetworkProximityManager as a supplement.
340
341         * NetworkProcess/NetworkProcessCreationParameters.cpp:
342         (WebKit::NetworkProcessCreationParameters::encode const):
343         (WebKit::NetworkProcessCreationParameters::decode):
344         * NetworkProcess/NetworkProcessCreationParameters.h:
345
346         Renamed ENABLE(WIFI_ASSERTIONS) to ENABLE(PROXIMITY_NETWORKING).
347
348         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
349
350         Renamed m_wiFiAssertionHolder to m_proximityAssertionToken and changed its type from an
351         optional WiFiAssertionHolder to an optional NetworkProximityAssertion::Token.
352
353         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
354         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
355         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
356         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
357         (WebKit::NetworkProcess::platformPrepareToSuspend):
358         (WebKit::NetworkProcess::platformProcessDidResume):
359         (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
360         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
361
362         Changed to use NetworkProximityManager.
363
364         * NetworkProcess/cocoa/WiFiAssertionHolder.h: Removed.
365         * NetworkProcess/cocoa/WiFiAssertionHolder.mm: Removed.
366         * NetworkProcess/watchos/NetworkProximityAssertion.h: Added.
367         (WebKit::NetworkProximityAssertion::Token::Token):
368         (WebKit::NetworkProximityAssertion::Token::~Token):
369
370         Added. NetworkDataTasks hold these tokens to keep Bluetooth or Wi-Fi assertions active
371         during loading. When the last token is destroyed, its associated assertion will be
372         deactivated.
373
374         * NetworkProcess/watchos/NetworkProximityAssertion.mm: Added.
375         (WebKit::NetworkProximityAssertion::NetworkProximityAssertion):
376         (WebKit::NetworkProximityAssertion::hold):
377         (WebKit::NetworkProximityAssertion::release):
378         (WebKit::NetworkProximityAssertion::resume):
379         (WebKit::NetworkProximityAssertion::suspend):
380         (WebKit::NetworkProximityAssertion::suspendNow):
381         (WebKit::NetworkProximityAssertion::releaseTimerFired):
382         (WebKit::NetworkProximityAssertion::suspendAfterBackgroundingTimerFired):
383
384         Added. NetworkProximityAssertion is the base class for Bluetooth and Wi-Fi assertions. It
385         manages the logic for holding and releasing assertions as well as responding to network
386         process backgrounding and suspension.
387
388         (WebKit::BluetoothProximityAssertion::BluetoothProximityAssertion):
389         (WebKit::BluetoothProximityAssertion::suspend):
390         (WebKit::BluetoothProximityAssertion::holdNow):
391         (WebKit::BluetoothProximityAssertion::releaseNow):
392
393         Added. Holds a Bluetooth assertion by calling -[IDSService setLinkPreferences:].
394
395         (WebKit::WiFiProximityAssertion::WiFiProximityAssertion):
396         (WebKit::WiFiProximityAssertion::holdNow):
397         (WebKit::WiFiProximityAssertion::releaseNow):
398
399         Added. Holds a Wi-Fi assertion by using WiFiManagerClient.
400
401         * NetworkProcess/watchos/NetworkProximityManager.h: Added.
402         * NetworkProcess/watchos/NetworkProximityManager.mm: Added.
403         (-[WKProximityServiceDelegate setClient:]):
404         (-[WKProximityServiceDelegate service:devicesChanged:]):
405         (-[WKProximityServiceDelegate service:nearbyDevicesChanged:]):
406         (WebKit::NetworkProximityManager::NetworkProximityManager):
407         (WebKit::NetworkProximityManager::~NetworkProximityManager):
408         (WebKit::NetworkProximityManager::supplementName):
409         (WebKit::bindRequestToWiFi):
410         (WebKit::NetworkProximityManager::applyProperties):
411         (WebKit::NetworkProximityManager::resume):
412         (WebKit::NetworkProximityManager::suspend):
413         (WebKit::NetworkProximityManager::recommendation const):
414         (WebKit::NetworkProximityManager::processRecommendations):
415         (WebKit::toProcessID):
416         (WebKit::NetworkProximityManager::resumeRecommendations):
417         (WebKit::NetworkProximityManager::suspendRecommendations):
418         (WebKit::NetworkProximityManager::updateCompanionProximity):
419         (WebKit::NetworkProximityManager::updateRecommendation):
420         (WebKit::NetworkProximityManager::initialize):
421         (WebKit::NetworkProximityManager::devicesChanged):
422
423         Added. NetworkProximityManager is a network process supplement that can bind
424         NetworkDataTasks to Wi-Fi, associate assertions with NetworkDataTasks, check for companion
425         proximity, ask for proximity network recommendations, and respond to network process
426         backgrounding and suspending.
427
428         * Platform/Logging.h:
429
430         Renamed the WiFiAssertions log channel to ProximityNetworking.
431
432         * Platform/spi/ios/MobileWiFiSPI.h:
433         * UIProcess/API/APIProcessPoolConfiguration.cpp:
434         (API::ProcessPoolConfiguration::copy):
435         * UIProcess/API/APIProcessPoolConfiguration.h:
436         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
437         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
438         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
439
440         Renamed ENABLE(WIFI_ASSERTIONS) to ENABLE(PROXIMITY_NETWORKING).
441
442         * WebKit.xcodeproj/project.pbxproj:
443         * config.h:
444
445         Removed unused definition of HAVE_MOBILE_WIFI.
446
447 2018-08-16  Alex Christensen  <achristensen@webkit.org>
448
449         Remove unused and deprecated _WKProcessPoolConfiguration.allowsCellularAccess
450         https://bugs.webkit.org/show_bug.cgi?id=188681
451
452         Reviewed by Tim Horton.
453
454         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
455         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
456         (-[_WKProcessPoolConfiguration allowsCellularAccess]): Deleted.
457         (-[_WKProcessPoolConfiguration setAllowsCellularAccess:]): Deleted.
458
459 2018-08-16  Alex Christensen  <achristensen@webkit.org>
460
461         Deprecate SPI that is or ought to be unused
462         https://bugs.webkit.org/show_bug.cgi?id=188616
463
464         Reviewed by Tim Horton.
465
466         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
467         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
468         * UIProcess/Cocoa/NavigationState.mm:
469         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
470         * UIProcess/Cocoa/UIDelegate.mm:
471         (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu):
472
473 2018-08-16  Alex Christensen  <achristensen@webkit.org>
474
475         Add temporary SPI WKContextHandlesSafeBrowsing
476         https://bugs.webkit.org/show_bug.cgi?id=188676
477
478         Reviewed by Joseph Pecoraro.
479
480         WebKit showing the safe browsing warning doesn't play well with Safari showing the safe browsing warning.
481         I plan to adopt this SPI in Safari to disable Safari's safe browsing check if it's true.
482         Then when I implement safe browsing in WebKit, I can switch this value to true in the same change and
483         not have a broken Safari.
484
485         * UIProcess/API/C/mac/WKContextPrivateMac.h:
486         * UIProcess/API/C/mac/WKContextPrivateMac.mm:
487         (WKContextHandlesSafeBrowsing):
488
489 2018-08-16  Ben Richards  <benton_richards@apple.com>
490
491         Add script to generate WebContent service resource files
492         https://bugs.webkit.org/show_bug.cgi?id=188601
493
494         Reviewed by Dan Bernstein.
495
496         Added new build phase to WebContent service to copy resource files to WebKit.framework/PrivateHeaders/CustomWebContentResource.
497         These resources are intended to be used by a client to create a custom WebContent service.
498
499         * Scripts/copy-webcontent-resources-to-private-headers.sh: Added.
500         * WebKit.xcodeproj/project.pbxproj:
501
502 2018-08-16  Alex Christensen  <achristensen@webkit.org>
503
504         Consolidate data/string API loading paths
505         https://bugs.webkit.org/show_bug.cgi?id=188417
506
507         Reviewed by Michael Catanzaro.
508
509         loadHTMLString and loadData are basically duplicate code.
510         loadPlainTextString was also basically the same except it didn't set up a navigation, which
511         was almost certainly a bug, but nobody uses it in all of Apple and Debian.  We should probably deprecate
512         and remove it, but for now I make it use the same data loading path.
513
514         * UIProcess/API/C/WKPage.cpp:
515         (WKPageLoadData):
516         (WKPageLoadDataWithUserData):
517         (loadString):
518         (WKPageLoadHTMLString):
519         (WKPageLoadHTMLStringWithUserData):
520         (WKPageLoadPlainTextString):
521         (WKPageLoadPlainTextStringWithUserData):
522         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
523         (-[WKBrowsingContextController loadHTMLString:baseURL:userData:]):
524         (-[WKBrowsingContextController loadData:MIMEType:textEncodingName:baseURL:userData:]):
525         * UIProcess/API/Cocoa/WKWebView.mm:
526         (-[WKWebView loadData:MIMEType:characterEncodingName:baseURL:]):
527         (-[WKWebView _loadData:MIMEType:characterEncodingName:baseURL:userData:]):
528         * UIProcess/API/glib/WebKitWebView.cpp:
529         (webkit_web_view_load_html):
530         (webkit_web_view_load_plain_text):
531         * UIProcess/WebPageProxy.cpp:
532         (WebKit::WebPageProxy::loadData):
533         (WebKit::WebPageProxy::loadHTMLString): Deleted.
534         (WebKit::WebPageProxy::loadPlainTextString): Deleted.
535         * UIProcess/WebPageProxy.h:
536         * WebProcess/WebPage/WebPage.cpp:
537         (WebKit::WebPage::loadData):
538         (WebKit::WebPage::loadString): Deleted.
539         * WebProcess/WebPage/WebPage.h:
540         * WebProcess/WebPage/WebPage.messages.in:
541
542 2018-08-16  Alex Christensen  <achristensen@webkit.org>
543
544         Transition more WKWebViewConfiguration ivars to API::PageConfiguration values
545         https://bugs.webkit.org/show_bug.cgi?id=188665
546
547         Reviewed by Joseph Pecoraro.
548
549         APPLICATION_MANIFEST is enabled on all Cocoa platforms, so I removed some guards, too!
550
551         * UIProcess/API/APIPageConfiguration.cpp:
552         (API::PageConfiguration::applicationManifest const):
553         * UIProcess/API/APIPageConfiguration.h:
554         * UIProcess/API/Cocoa/WKWebView.mm:
555         (-[WKWebView _initializeWithConfiguration:]):
556         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
557         (-[WKWebViewConfiguration init]):
558         (-[WKWebViewConfiguration copyWithZone:]):
559         (-[WKWebViewConfiguration _applicationManifest]):
560         (-[WKWebViewConfiguration _setApplicationManifest:]):
561         (-[WKWebViewConfiguration _setCPULimit:]):
562         (-[WKWebViewConfiguration _cpuLimit]):
563
564 2018-08-16  Alex Christensen  <achristensen@webkit.org>
565
566         Transition more WKWebViewConfiguration ivars to API::PageConfiguration values
567         https://bugs.webkit.org/show_bug.cgi?id=188663
568
569         Reviewed by Tim Horton.
570
571         * UIProcess/API/Cocoa/WKWebView.mm:
572         (-[WKWebView _initializeWithConfiguration:]):
573         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
574         (-[WKWebViewConfiguration init]):
575         (-[WKWebViewConfiguration copyWithZone:]):
576         (-[WKWebViewConfiguration _drawsBackground]):
577         (-[WKWebViewConfiguration _setDrawsBackground:]):
578         (-[WKWebViewConfiguration _waitsForPaintAfterViewDidMoveToWindow]):
579         (-[WKWebViewConfiguration _setWaitsForPaintAfterViewDidMoveToWindow:]):
580         (-[WKWebViewConfiguration _isControlledByAutomation]):
581         (-[WKWebViewConfiguration _setControlledByAutomation:]):
582
583 2018-08-16  Alex Christensen  <achristensen@webkit.org>
584
585         Stop using canAuthenticateAgainstProtectionSpace in modern WebKit
586         https://bugs.webkit.org/show_bug.cgi?id=188639
587
588         Reviewed by Youenn Fablet.
589
590         canAuthenticateAgainstProtectionSpace is an unnecessary step in the authentication process.
591         It is leftover from when it was necessary when we used NSURLConnection, which is only used in WebKitLegacy now.
592         Now it's just an extra IPC roundtrip asking if we should use NSURLSessionAuthChallengeRejectProtectionSpace
593         or if we are going to ask the API client.  We can move this step into the C API for compatibility
594         with the 1 client that still uses it (not for long, see rdar://problem/43358403) and simplify and optimize
595         authentication.
596
597         * NetworkProcess/Downloads/PendingDownload.cpp:
598         (WebKit::PendingDownload::canAuthenticateAgainstProtectionSpaceAsync): Deleted.
599         * NetworkProcess/Downloads/PendingDownload.h:
600         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
601         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
602         * NetworkProcess/NetworkLoad.cpp:
603         (WebKit::NetworkLoad::~NetworkLoad):
604         (WebKit::NetworkLoad::didReceiveChallenge):
605         (WebKit::NetworkLoad::completeAuthenticationChallenge): Deleted.
606         (WebKit::NetworkLoad::continueCanAuthenticateAgainstProtectionSpace): Deleted.
607         * NetworkProcess/NetworkLoad.h:
608         * NetworkProcess/NetworkLoadClient.h:
609         * NetworkProcess/NetworkProcess.cpp:
610         (WebKit::NetworkProcess::cancelDownload):
611         (WebKit::NetworkProcess::canAuthenticateAgainstProtectionSpace): Deleted.
612         (WebKit::NetworkProcess::continueCanAuthenticateAgainstProtectionSpace): Deleted.
613         * NetworkProcess/NetworkProcess.h:
614         * NetworkProcess/NetworkProcess.messages.in:
615         * NetworkProcess/NetworkResourceLoader.cpp:
616         (WebKit::NetworkResourceLoader::canAuthenticateAgainstProtectionSpaceAsync): Deleted.
617         * NetworkProcess/NetworkResourceLoader.h:
618         * NetworkProcess/PreconnectTask.cpp:
619         (WebKit::PreconnectTask::canAuthenticateAgainstProtectionSpaceAsync): Deleted.
620         * NetworkProcess/PreconnectTask.h:
621         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
622         (WebKit::NetworkCache::SpeculativeLoad::canAuthenticateAgainstProtectionSpaceAsync): Deleted.
623         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
624         * Shared/Authentication/AuthenticationManager.cpp:
625         (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
626         * Shared/Authentication/AuthenticationManager.h:
627         * UIProcess/API/C/WKPage.cpp:
628         (WKPageSetPageNavigationClient):
629         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
630         * UIProcess/Cocoa/NavigationState.h:
631         * UIProcess/Cocoa/NavigationState.mm:
632         (WebKit::NavigationState::setNavigationDelegate):
633         (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):
634         (WebKit::NavigationState::NavigationClient::canAuthenticateAgainstProtectionSpace): Deleted.
635         * UIProcess/Network/NetworkProcessProxy.cpp:
636         (WebKit::NetworkProcessProxy::canAuthenticateAgainstProtectionSpace): Deleted.
637         * UIProcess/Network/NetworkProcessProxy.h:
638         * UIProcess/Network/NetworkProcessProxy.messages.in:
639         * UIProcess/WebPageProxy.cpp:
640         (WebKit::WebPageProxy::canAuthenticateAgainstProtectionSpace): Deleted.
641         * UIProcess/WebPageProxy.h:
642
643 2018-08-15  Jer Noble  <jer.noble@apple.com>
644
645         Add Experimental Feature support for SourceBuffer.changeType()
646         https://bugs.webkit.org/show_bug.cgi?id=188626
647
648         Reviewed by Eric Carlson.
649
650         * Shared/WebPreferences.yaml:
651         * UIProcess/API/C/WKPreferences.cpp:
652         (WKPreferencesSetSourceBufferChangeTypeEnabled):
653         (WKPreferencesGetSourceBufferChangeTypeEnabled):
654         * UIProcess/API/C/WKPreferencesRefPrivate.h:
655
656 2018-08-16  Alex Christensen  <achristensen@webkit.org>
657
658         Transition more WKWebViewConfiguration ivars to API::PageConfiguration values
659         https://bugs.webkit.org/show_bug.cgi?id=188661
660
661         Reviewed by Anders Carlsson.
662
663         * UIProcess/API/Cocoa/WKWebView.mm:
664         (-[WKWebView _initializeWithConfiguration:]):
665         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
666         (-[WKWebViewConfiguration init]):
667         (-[WKWebViewConfiguration copyWithZone:]):
668         (-[WKWebViewConfiguration _alwaysRunsAtForegroundPriority]):
669         (-[WKWebViewConfiguration _setAlwaysRunsAtForegroundPriority:]):
670         (-[WKWebViewConfiguration _initialCapitalizationEnabled]):
671         (-[WKWebViewConfiguration _setInitialCapitalizationEnabled:]):
672         (-[WKWebViewConfiguration _overrideContentSecurityPolicy]):
673         (-[WKWebViewConfiguration _setOverrideContentSecurityPolicy:]):
674
675 2018-08-16  Aditya Keerthi  <akeerthi@apple.com>
676
677         Support drag-and-drop for input[type=color]
678         https://bugs.webkit.org/show_bug.cgi?id=188464
679
680         Reviewed by Wenson Hsieh.
681
682         On iOS, the drag preview for the color input is a rounded rectangle. In order to
683         ensure that the corners appear transparent, the visiblePath property of the
684         UIDragPreviewParameters was set to match the preview's shape. This also required
685         the creation of an additional ArgumentCoder for Path.
686
687         When beginning the drag session, the preview should appear centered about the
688         color input. This is managed in createTargetedDragPreview. However, once the
689         preview is dragged, the preview should be at the center of the touch location.
690         Consequently, DragSourceActionColor was added to the list of sources that could
691         update the drag preview after lifting.
692
693         * Shared/WebCoreArgumentCoders.cpp:
694         (IPC::ArgumentCoder<Path>::decode):
695         * Shared/WebCoreArgumentCoders.h:
696         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
697         (WebKit::WebPasteboardProxy::setPasteboardColor):
698         * UIProcess/WebPasteboardProxy.h:
699         * UIProcess/WebPasteboardProxy.messages.in:
700         * UIProcess/ios/DragDropInteractionState.h:
701         * UIProcess/ios/DragDropInteractionState.mm:
702         (WebKit::createTargetedDragPreview):
703         (WebKit::shouldUseDragImageToCreatePreviewForDragSource):
704         (WebKit::shouldUseVisiblePathToCreatePreviewForDragSource):
705         (WebKit::canUpdatePreviewForActiveDragSource):
706         (WebKit::DragDropInteractionState::previewForDragItem const):
707         (WebKit::DragDropInteractionState::stageDragItem):
708         (WebKit::DragDropInteractionState::updatePreviewsForActiveDragSources):
709         * UIProcess/ios/forms/WKFormColorPicker.mm:
710         (-[WKColorPicker initWithView:]):
711         * UIProcess/mac/WebColorPickerMac.h:
712         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
713         (WebKit::WebPlatformStrategies::setColor):
714         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
715
716 2018-08-16  Per Arne Vollan  <pvollan@apple.com>
717
718         Assert that calling CGSSetDenyWindowServerConnections(true) succeeds
719         https://bugs.webkit.org/show_bug.cgi?id=188615
720
721         Reviewed by Brent Fulgham.
722
723         If the call to CGSSetDenyWindowServerConnections(true) fails, it means there are open WindowServer connections
724         at this point, and future WindowServer connections will not be denied. We should assert that this call succeeds.
725
726         * WebProcess/cocoa/WebProcessCocoa.mm:
727         (WebKit::WebProcess::platformInitializeProcess):
728
729 2018-08-16  Philippe Normand  <pnormand@igalia.com>
730
731         Unreviewed, WPE build fix after r234920.
732
733         * UIProcess/API/wpe/PageClientImpl.cpp:
734         (WebKit::PageClientImpl::isViewWindowActive):
735         (WebKit::PageClientImpl::isViewFocused):
736         (WebKit::PageClientImpl::isViewVisible):
737         (WebKit::PageClientImpl::isViewInWindow):
738         * UIProcess/API/wpe/WPEView.cpp:
739         (WKWPE::View::setViewState):
740         * UIProcess/API/wpe/WPEView.h:
741
742 2018-08-16  Antti Koivisto  <antti@apple.com>
743
744         Use OptionSet for ActivityState::Flags
745         https://bugs.webkit.org/show_bug.cgi?id=188554
746
747         Reviewed by Brent Fulgham.
748
749         * Shared/WebPageCreationParameters.h:
750         * UIProcess/Cocoa/WebViewImpl.mm:
751         (WebKit::WebViewImpl::windowDidOrderOffScreen):
752         (WebKit::WebViewImpl::windowDidOrderOnScreen):
753         (WebKit::WebViewImpl::viewDidMoveToWindow):
754         * UIProcess/WebPageProxy.cpp:
755         (WebKit::WebPageProxy::updateActivityState):
756         (WebKit::WebPageProxy::activityStateDidChange):
757         (WebKit::WebPageProxy::dispatchActivityStateChange):
758         (WebKit::WebPageProxy::setMuted):
759         (WebKit::WebPageProxy::isPlayingMediaDidChange):
760         * UIProcess/WebPageProxy.h:
761         (WebKit::WebPageProxy::isInWindow const):
762         (WebKit::WebPageProxy::isViewVisible const):
763         (WebKit::WebPageProxy::isViewFocused const):
764         (WebKit::WebPageProxy::isViewWindowActive const):
765         * WebProcess/Plugins/PluginView.cpp:
766         (WebKit::PluginView::activityStateDidChange):
767         * WebProcess/Plugins/PluginView.h:
768         * WebProcess/WebPage/DrawingArea.h:
769         (WebKit::DrawingArea::activityStateDidChange):
770         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
771         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
772         (WebKit::RemoteLayerTreeDrawingArea::activityStateDidChange):
773         * WebProcess/WebPage/WebPage.cpp:
774         (WebKit::WebPage::updateThrottleState):
775         (WebKit::WebPage::updateIsInWindow):
776         (WebKit::WebPage::visibilityDidChange):
777         (WebKit::WebPage::setActivityState):
778         * WebProcess/WebPage/WebPage.h:
779         (WebKit::WebPage::isVisible const):
780         (WebKit::WebPage::isVisibleOrOccluded const):
781         * WebProcess/WebPage/WebPage.messages.in:
782         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
783         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
784         (WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange):
785         * WebProcess/WebProcess.cpp:
786         (WebKit::WebProcess::pageActivityStateDidChange):
787         * WebProcess/WebProcess.h:
788
789 2018-08-15  Ansh Shukla  <ansh_shukla@apple.com>
790
791         NSURLAuthenticationMethodOAuth challenges are surfaced to clients in -didReceiveAuthenticationChallenge as NSURLAuthenticationMethodDefault
792         https://bugs.webkit.org/show_bug.cgi?id=186870
793         <rdar://problem/41314410>
794
795         Reviewed by Alex Christensen.
796
797         Correctly expose the OAuth protection space type in API.
798
799         * UIProcess/API/C/WKAPICast.h:
800         (WebKit::toAPI):
801         * UIProcess/API/C/WKProtectionSpaceTypes.h:
802
803 2018-08-15  Ben Richards  <benton_richards@apple.com>
804
805         We should cache the compiled sandbox profile in a data vault
806         https://bugs.webkit.org/show_bug.cgi?id=184991
807
808         Reviewed by Ryosuke Niwa.
809
810         This patch changes a few things (note: data vaults and sandbox entitlements are only used in internal builds):
811         (1) Instead of compiling a sandbox every time a process is launched, processes now look for a cached sandbox
812             in a process specific data vault on macOS platforms. (ChildProcessMac.mm)
813         (2) If a valid cached sandbox is not found, a process will create the data vault (or ensure that it exists),
814             compile a sandbox, and cache it.
815         (3) In order to create process specific data vaults, each process now has their own <process name>-OSX-sandbox.entitlements
816             file which contains an entitlement with a process specific "storage class" which ensures that each process
817             can only ever access its own data vault. (See the article on confluence "Data Vaults and Restricted Files" for more info)
818         (4) The sandbox entitlements file for the Network and WebContent services are loaded dynamically
819             through Scripts/<process name>-process-entitlements.sh which is triggered in a new build phase for each service.
820             The Storage process sandbox entitlements are loaded directly in Configurations/StorageService.xcconfig.
821             The reason that the sandbox entitlements are applied dynamically is so that these sandbox entitlements
822             are only applied when WK_USE_RESTRICTED_ENTITLEMENTS is YES. This means that open source builds will still work.
823
824         * Configurations/Network-OSX-sandbox.entitlements: Added.
825         * Configurations/Storage-OSX-sandbox.entitlements: Added.
826         * Configurations/StorageService.xcconfig:
827         * Configurations/WebContent-OSX-sandbox.entitlements: Added.
828         * Configurations/WebKit.xcconfig:
829         * NetworkProcess/NetworkProcess.h:
830         * PluginProcess/PluginProcess.h:
831         * Scripts/process-network-sandbox-entitlements.sh: Added.
832         * Scripts/process-webcontent-sandbox-entitlements.sh: Added.
833         * Shared/ChildProcess.h:
834         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
835         (WebKit::XPCServiceInitializer):
836         * Shared/SandboxInitializationParameters.h:
837         (WebKit::SandboxInitializationParameters::setOverrideSandboxProfilePath):
838         (WebKit::SandboxInitializationParameters::overrideSandboxProfilePath const):
839         (WebKit::SandboxInitializationParameters::setSandboxProfile):
840         (WebKit::SandboxInitializationParameters::sandboxProfile const):
841         (): Deleted.
842         * Shared/mac/ChildProcessMac.mm:
843         (WebKit::SandboxProfileDeleter::operator()):
844         (WebKit::SandboxParametersDeleter::operator()):
845         (WebKit::SandboxInfo::SandboxInfo):
846         (WebKit::fileContents):
847         (WebKit::processStorageClass):
848         (WebKit::setAndSerializeSandboxParameters):
849         (WebKit::sandboxDataVaultParentDirectory):
850         (WebKit::sandboxDirectory):
851         (WebKit::sandboxFilePath):
852         (WebKit::ensureSandboxCacheDirectory):
853         (WebKit::writeSandboxDataToCacheFile):
854         (WebKit::compileAndCacheSandboxProfile):
855         (WebKit::tryApplyCachedSandbox):
856         (WebKit::webKit2Bundle):
857         (WebKit::getSandboxProfileOrProfilePath):
858         (WebKit::compileAndApplySandboxSlowCase):
859         (WebKit::applySandbox):
860         (WebKit::initializeSandboxParameters):
861         (WebKit::ChildProcess::initializeSandbox):
862         * Shared/mac/SandboxInitialiationParametersMac.mm:
863         (WebKit::SandboxInitializationParameters::SandboxInitializationParameters):
864         * StorageProcess/StorageProcess.h:
865         * WebKit.xcodeproj/project.pbxproj:
866         * WebProcess/WebProcess.h:
867
868 2018-08-15  Ross Kirsling  <ross.kirsling@sony.com>
869
870         [WinCairo] Unreviewed build fix after r234896.
871
872         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
873         (WebKit::NetworkDataTaskCurl::tryHttpAuthentication):
874
875 2018-08-15  Ryosuke Niwa  <rniwa@webkit.org>
876
877         Can't share an app on AppStore to WeChat due to a release assert
878         https://bugs.webkit.org/show_bug.cgi?id=188621
879         <rdar://problem/43343976>
880
881         Reviewed by Geoffrey Garen.
882
883         Disable the thread safety check when the app is not linked on or after iOS 12 since this release assert
884         is getting hit by third party applications on iOS in UI process.
885
886         * UIProcess/Cocoa/VersionChecks.h:
887         (WebKit::SDKVersion::FirstWithMainThreadReleaseAssertionInWebPageProxy): Added. It's iOS 12 or macOS 10.14 Mojave.
888         * UIProcess/WebProcessProxy.cpp:
889         (WebKit::isMainThreadOrCheckDisabled): Added. Returns true whether when we're in the main thread or if the app
890         is not linked on or after iOS 12 or macOS 10.14 Mojave.
891         (WebKit::globalPageMap):
892         (WebKit::m_isInPrewarmedPool):
893         (WebKit::WebProcessProxy::~WebProcessProxy):
894         (WebKit::WebProcessProxy::shutDown):
895         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
896         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData):
897         (WebKit::WebProcessProxy::didFinishLaunching):
898
899 2018-08-15  Alex Christensen  <achristensen@webkit.org>
900
901         Remove WKNavigationDelegatePrivate's canAuthenticateAgainstProtectionSpace
902         https://bugs.webkit.org/show_bug.cgi?id=188622
903
904         Reviewed by Timothy Hatcher.
905
906         It's been deprecated for a release now, nobody uses it, and it's a concept from NSURLConnection, which we don't use any more in WebKit2.
907
908         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
909         * UIProcess/Cocoa/NavigationState.h:
910         * UIProcess/Cocoa/NavigationState.mm:
911         (WebKit::NavigationState::setNavigationDelegate):
912         (WebKit::NavigationState::NavigationClient::canAuthenticateAgainstProtectionSpace):
913
914 2018-08-15  Tim Horton  <timothy_horton@apple.com>
915
916         Crashes in Quip under _dictionaryPopupInfoForRange, in setObject:forKey:
917         https://bugs.webkit.org/show_bug.cgi?id=188569
918         <rdar://problem/34201095>
919
920         Reviewed by Megan Gardner.
921
922         * WebProcess/WebPage/mac/WebPageMac.mm:
923         (WebKit::WebPage::dictionaryPopupInfoForRange):
924         Speculative fix; the crashes indicate font is null, but we just checked it,
925         so it must be getting made null by convertFont:toSize:. Check again!
926
927 2018-08-15  Ryan Haddad  <ryanhaddad@apple.com>
928
929         Unreviewed, rolling out r234870.
930
931         The test introduced with this change is a flaky failure.
932
933         Reverted changeset:
934
935         "NSURLAuthenticationMethodOAuth challenges are surfaced to
936         clients in -didReceiveAuthenticationChallenge as
937         NSURLAuthenticationMethodDefault"
938         https://bugs.webkit.org/show_bug.cgi?id=186870
939         https://trac.webkit.org/changeset/234870
940
941 2018-08-15  Alex Christensen  <achristensen@webkit.org>
942
943         NetworkCORSPreflightChecker should proceed in case of ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested even though the WebKit app is not implementing the didReceiveAuthenticationChallenge/didReceiveAuthenticationChallengeInFrame callback
944         https://bugs.webkit.org/show_bug.cgi?id=188592
945         <rdar://problem/43210331>
946
947         Reviewed by Youenn Fablet.
948
949         Do a canAuthenticateAgainstProtectionSpace check in NetworkCORSPreflightChecker like we do in NetworkLoad.
950         Use CompletionHandlers to make the now 3 different canAuthenticateAgainstProtectionSpace checks look the same from the NetworkProcess.
951
952         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
953         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
954         * NetworkProcess/NetworkCORSPreflightChecker.h:
955         * NetworkProcess/NetworkDataTask.h:
956         * NetworkProcess/NetworkLoad.cpp:
957         (WebKit::NetworkLoad::didReceiveChallenge):
958         * NetworkProcess/NetworkLoad.h:
959         * NetworkProcess/NetworkProcess.cpp:
960         (WebKit::NetworkProcess::canAuthenticateAgainstProtectionSpace):
961         (WebKit::NetworkProcess::continueCanAuthenticateAgainstProtectionSpace):
962         * NetworkProcess/NetworkProcess.h:
963         * NetworkProcess/NetworkResourceLoader.cpp:
964         (WebKit::NetworkResourceLoader::canAuthenticateAgainstProtectionSpaceAsync):
965         (WebKit::NetworkResourceLoader::continueCanAuthenticateAgainstProtectionSpace): Deleted.
966         * NetworkProcess/NetworkResourceLoader.h:
967         * NetworkProcess/PingLoad.cpp:
968         (WebKit::PingLoad::didReceiveChallenge):
969         * NetworkProcess/PingLoad.h:
970         * NetworkProcess/PreconnectTask.cpp:
971         (WebKit::PreconnectTask::canAuthenticateAgainstProtectionSpaceAsync):
972         (WebKit::PreconnectTask::continueCanAuthenticateAgainstProtectionSpace): Deleted.
973         * NetworkProcess/PreconnectTask.h:
974         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
975         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
976         (WebKit::NetworkDataTaskCocoa::didReceiveChallenge):
977
978 2018-08-15  Michael Catanzaro  <mcatanzaro@igalia.com>
979
980         [WPE][GTK] WaylandCompositor fails to properly remove surface from its page map
981         https://bugs.webkit.org/show_bug.cgi?id=188520
982
983         Reviewed by Alex Christensen.
984
985         willDestroySurface overwrites the surface pointer in the map's iterator in an attempt to
986         change the value of the surface pointer in the map, but it doesn't work because changing
987         the iterator does not change the map itself. There's no need to fix this function: it's
988         better to use WeakPtr instead.
989
990         * UIProcess/gtk/WaylandCompositor.cpp:
991         (WebKit::WaylandCompositor::getTexture):
992         (WebKit::WaylandCompositor::bindSurfaceToWebPage):
993         (WebKit::WaylandCompositor::unregisterWebPage):
994         (WebKit::WaylandCompositor::willDestroySurface): Deleted.
995         * UIProcess/gtk/WaylandCompositor.h:
996
997 2018-08-15  Wenson Hsieh  <wenson_hsieh@apple.com>
998
999         [Attachment SPI] Remove attachment display mode options
1000         https://bugs.webkit.org/show_bug.cgi?id=188596
1001
1002         Reviewed by Dan Bernstein.
1003
1004         Remove attachment display mode from WebKit. Note that _WKAttachmentDisplayOptions needs to remain in the private
1005         header for source compatibility with Mail.
1006
1007         * UIProcess/API/Cocoa/_WKAttachment.mm:
1008         (-[_WKAttachmentDisplayOptions coreDisplayOptions]): Deleted.
1009         * WebProcess/WebPage/WebPage.cpp:
1010         (WebKit::WebPage::setAttachmentDisplayOptions):
1011
1012 2018-08-14 Sihui Liu <sihui_liu@apple.com>
1013
1014         Crash in WebKit::filterPreloadHSTSEntry via NetworkProcess::getHostNamesWithHSTSCache
1015         https://bugs.webkit.org/show_bug.cgi?id=188576
1016         <rdar://problem/43148977>
1017
1018         Reviewed by Alex Christensen.
1019
1020         * NetworkProcess/NetworkProcess.cpp:
1021         (WebKit::NetworkProcess::fetchWebsiteData):
1022
1023 2018-08-14  Alex Christensen  <achristensen@webkit.org>
1024
1025         isValidCSSSelector is unsafe to be called from a non-main thread
1026         https://bugs.webkit.org/show_bug.cgi?id=188581
1027         <rdar://problem/40517358>
1028
1029         Reviewed by Sam Weinig.
1030
1031         * UIProcess/API/APIContentRuleListStore.cpp:
1032         (API::compiledToFile):
1033         (API::ContentRuleListStore::lookupContentRuleList):
1034         (API::ContentRuleListStore::getAvailableContentRuleListIdentifiers):
1035         (API::ContentRuleListStore::compileContentRuleList):
1036         (API::ContentRuleListStore::removeContentRuleList):
1037         (API::ContentRuleListStore::getContentRuleListSource):
1038         * UIProcess/API/APIContentRuleListStore.h:
1039         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
1040
1041 2018-08-14  Ansh Shukla  <ansh_shukla@apple.com>
1042
1043         NSURLAuthenticationMethodOAuth challenges are surfaced to clients in -didReceiveAuthenticationChallenge as NSURLAuthenticationMethodDefault
1044         https://bugs.webkit.org/show_bug.cgi?id=186870
1045         <rdar://problem/41314410>
1046
1047         Reviewed by Alex Christensen.
1048
1049         Correctly expose the OAuth protection space type in API.
1050
1051         * UIProcess/API/C/WKAPICast.h:
1052         (WebKit::toAPI):
1053         * UIProcess/API/C/WKProtectionSpaceTypes.h:
1054
1055 2018-08-14  Ben Richards  <benton_richards@apple.com>
1056
1057         Remove api misuse check so that custom webcontent service identifier can be set at runtime
1058         https://bugs.webkit.org/show_bug.cgi?id=188579
1059
1060         Reviewed by Ryosuke Niwa.
1061
1062         Changed API misuse check so that a custom bundle identifier can be set at runtime with a debug flag
1063
1064         * UIProcess/WebProcessPool.cpp:
1065         (WebKit::WebProcessPool::setCustomWebContentServiceBundleIdentifier):
1066         * UIProcess/WebProcessProxy.cpp:
1067         (WebKit::WebProcessProxy::getLaunchOptions):
1068
1069 2018-08-14  Antti Koivisto  <antti@apple.com>
1070
1071         RemoteLayerTreeTransaction should use OptionSet for change flags
1072         https://bugs.webkit.org/show_bug.cgi?id=188547
1073
1074         Reviewed by Simon Fraser.
1075
1076         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
1077         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
1078         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
1079         (WebKit::RemoteLayerTreeTransaction::LayerProperties::notePropertiesChanged):
1080         (WebKit::RemoteLayerTreeTransaction::LayerProperties::resetChangedProperties):
1081
1082         Also remove unused everChangedProperties.
1083
1084         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1085         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
1086         (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode const):
1087         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
1088         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
1089         (WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
1090         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1091         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
1092
1093 2018-08-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1094
1095         [WK2] [macOS] Implement a mechanism to test drag and drop
1096         https://bugs.webkit.org/show_bug.cgi?id=181898
1097         <rdar://problem/39181698>
1098
1099         Reviewed by Simon Fraser.
1100
1101         Adds a new SPI method, `-_doAfterProcessingAllPendingMouseEvents:`, to WKWebView. This invokes the given
1102         callback after all queued mouse events have been handled by the web process. See Tools/ChangeLog for more
1103         detail.
1104
1105         * UIProcess/API/Cocoa/WKWebView.mm:
1106         (-[WKWebView _doAfterProcessingAllPendingMouseEvents:]):
1107         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1108         * UIProcess/API/gtk/PageClientImpl.h:
1109         * UIProcess/API/wpe/PageClientImpl.h:
1110         * UIProcess/Cocoa/WebViewImpl.h:
1111         * UIProcess/Cocoa/WebViewImpl.mm:
1112         (WebKit::WebViewImpl::processDidExit):
1113
1114         Invoke any outstanding callbacks for processing pending mouse events when the web process is terminated.
1115
1116         (WebKit::WebViewImpl::doAfterProcessingAllPendingMouseEvents):
1117
1118         Either invoke the callback immediately if there are no mouse events to be processed, or insert the callback in
1119         a queue that will be flushed once all mouse events have been handled.
1120
1121         (WebKit::WebViewImpl::didFinishProcessingAllPendingMouseEvents):
1122         (WebKit::WebViewImpl::flushPendingMouseEventCallbacks):
1123         * UIProcess/PageClient.h:
1124         (WebKit::PageClient::pinnedStateWillChange):
1125         (WebKit::PageClient::pinnedStateDidChange):
1126         (WebKit::PageClient::videoControlsManagerDidChange):
1127
1128         Drive-by tweaks: remove unnecessary semicolons after empty implementation stubs.
1129
1130         * UIProcess/WebPageProxy.cpp:
1131         (WebKit::WebPageProxy::didReceiveEvent):
1132
1133         Notify the page client when there are no remaining mouse events left in the queue.
1134
1135         * UIProcess/ios/PageClientImplIOS.h:
1136         * UIProcess/mac/PageClientImplMac.h:
1137         * UIProcess/mac/PageClientImplMac.mm:
1138         (WebKit::PageClientImpl::didFinishProcessingAllPendingMouseEvents):
1139
1140         Add some plumbing through PageClient, so that WebPageProxy can tell WebViewImpl when it is finished processing
1141         all mouse events.
1142
1143         * UIProcess/win/PageClientImpl.h:
1144
1145 2018-08-13  Alex Christensen  <achristensen@webkit.org>
1146
1147         Fix linux build after r234811
1148         https://bugs.webkit.org/show_bug.cgi?id=188501
1149
1150         * UIProcess/API/glib/WebKitWebsiteData.cpp:
1151         (recordContainsSupportedDataTypes):
1152
1153 2018-08-13  Commit Queue  <commit-queue@webkit.org>
1154
1155         Unreviewed, rolling out r234747.
1156         https://bugs.webkit.org/show_bug.cgi?id=188524
1157
1158         plugin processes crash on launch (Requested by smfr on
1159         #webkit).
1160
1161         Reverted changeset:
1162
1163         "We should cache the compiled sandbox profile in a data vault"
1164         https://bugs.webkit.org/show_bug.cgi?id=184991
1165         https://trac.webkit.org/changeset/234747
1166
1167 2018-08-13  Alex Christensen  <achristensen@webkit.org>
1168
1169         Use a 1-byte enum class for TextDirection
1170         https://bugs.webkit.org/show_bug.cgi?id=188350
1171
1172         Reviewed by Simon Fraser.
1173
1174         * Shared/WebPopupItem.cpp:
1175         (WebKit::WebPopupItem::WebPopupItem):
1176         * UIProcess/ios/WKContentViewInteraction.mm:
1177         (-[WKContentView webSelectionRectsForSelectionRects:]):
1178         * UIProcess/mac/WebPopupMenuProxyMac.mm:
1179         (WebKit::WebPopupMenuProxyMac::populate):
1180         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
1181         * WebProcess/WebCoreSupport/WebPopupMenu.cpp:
1182         (WebKit::WebPopupMenu::show):
1183         * WebProcess/WebPage/ios/WebPageIOS.mm:
1184         (WebKit::WebPage::getAssistedNodeInformation):
1185
1186 2018-08-13  Michael Catanzaro  <mcatanzaro@igalia.com>
1187
1188         Unreviewed, silence "enumeral and non-enumeral type in conditional expression" warning
1189
1190         * UIProcess/WebPageProxy.cpp:
1191         (WebKit::WebPageProxy::dispatchActivityStateChange):
1192
1193 2018-08-12  Aditya Keerthi  <akeerthi@apple.com>
1194
1195         [macOS] Color wells should appear pressed when presenting a color picker
1196         https://bugs.webkit.org/show_bug.cgi?id=188477
1197
1198         Reviewed by Tim Horton.
1199
1200         In order for the color well to accurately reflect the state of the picker, it is
1201         necessary to ensure that the picker is destroyed at the appropriate time.
1202
1203         Added windowWillClose and didClosePopover delegate methods to destroy the picker
1204         it has been closed. Also added a call to WebColorPicker::endPicker in
1205         WebColorPickerMac's implementation of endPicker to ensure that the object is
1206         destroyed. Removed redundant calls to endPicker in the WebPageProxy.
1207
1208         The hitTest method was overridden in WKPopoverColorWell to ensure that AppKit's
1209         view does not block our drawn color well from receiving click events.
1210
1211         * UIProcess/WebColorPicker.cpp:
1212         (WebKit::WebColorPicker::endPicker):
1213         * UIProcess/WebColorPicker.h:
1214         * UIProcess/WebPageProxy.cpp:
1215         (WebKit::WebPageProxy::endColorPicker):
1216         (WebKit::WebPageProxy::didEndColorPicker):
1217         (WebKit::WebPageProxy::resetState):
1218         (WebKit::WebPageProxy::closeOverlayedViews):
1219         * UIProcess/mac/WebColorPickerMac.mm:
1220         (WebKit::WebColorPickerMac::~WebColorPickerMac):
1221         (WebKit::WebColorPickerMac::endPicker):
1222         (-[WKPopoverColorWell popoverDidClose:]):
1223         (-[WKPopoverColorWell hitTest:]):
1224         (-[WKColorPopoverMac setAndShowPicker:withColor:suggestions:]):
1225         (-[WKColorPopoverMac invalidate]):
1226         (-[WKColorPopoverMac windowWillClose:]):
1227         (-[WKColorPopoverMac didClosePopover]):
1228
1229 2018-08-10  David Kilzer  <ddkilzer@apple.com>
1230
1231         [Cocoa] WebKit::PlatformPopupMenuData should use member initialization
1232         <https://webkit.org/b/188478>
1233         <rdar://problem/43154363>
1234
1235         Reviewed by Joseph Pecoraro.
1236
1237         * Shared/PlatformPopupMenuData.cpp:
1238         (WebKit::PlatformPopupMenuData::PlatformPopupMenuData): Delete
1239         implementation.  This constructor caused the warning by never
1240         initializing its member variables.
1241         * Shared/PlatformPopupMenuData.h:
1242         (WebKit::PlatformPopupMenuData::PlatformPopupMenuData):
1243         - Use default constructor.
1244         (WebKit::PlatformPopupMenuData::shouldPopOver):
1245         (WebKit::PlatformPopupMenuData::hideArrows):
1246         (WebKit::PlatformPopupMenuData::menuSize):
1247         - Add struct member initialization.
1248
1249 2018-08-10  Chris Dumez  <cdumez@apple.com>
1250
1251         Crash under NetworkResourceLoader::convertToDownload()
1252         https://bugs.webkit.org/show_bug.cgi?id=188479
1253         <rdar://problem/42201724>
1254
1255         Reviewed by Alex Christensen.
1256
1257         In NetworkResourceLoader::convertToDownload(), if m_networkLoad is null then we're trying
1258         to convert a load that came from the disk cache. Since we do not currently support converting
1259         such a load, cancel the current load and start a fresh download.
1260
1261         * NetworkProcess/NetworkResourceLoader.cpp:
1262         (WebKit::NetworkResourceLoader::convertToDownload):
1263
1264 2018-08-10  Sihui Liu  <sihui_liu@apple.com>
1265
1266         Incorrect log message in NetworkSession when creating NetworkDataTask
1267         https://bugs.webkit.org/show_bug.cgi?id=188463
1268
1269         Reviewed by Chris Dumez.
1270
1271         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1272         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1273
1274 2018-08-09  Ben Richards  <benton_richards@apple.com>
1275
1276         We should cache the compiled sandbox profile in a data vault
1277         https://bugs.webkit.org/show_bug.cgi?id=184991
1278
1279         Reviewed by Ryosuke Niwa.
1280
1281         This patch changes a few things (note: data vaults and sandbox entitlements are only used in internal builds):
1282         (1) Instead of compiling a sandbox every time a process is launched, processes now look for a cached sandbox
1283             in a process specific data vault on macOS platforms. (ChildProcessMac.mm)
1284         (2) If a valid cached sandbox is not found, a process will create the data vault (or ensure that it exists),
1285             compile a sandbox, and cache it.
1286         (3) In order to create process specific data vaults, each process now has their own <process name>-OSX-sandbox.entitlements
1287             file which contains an entitlement with a process specific "storage class" which ensures that each process
1288             can only ever access its own data vault. (See the article on confluence "Data Vaults and Restricted Files" for more info)
1289         (4) The sandbox entitlements file for the Network, WebContent and Plugin services are loaded dynamically
1290             through Scripts/<process name>-process-entitlements.sh which is triggered in a new build phase for each service.
1291             The Storage process sandbox entitlements are loaded directly in Configurations/StorageService.xcconfig.
1292             The reason that the sandbox entitlements are applied dynamically is so that these sandbox entitlements
1293             are only applied when WK_USE_RESTRICTED_ENTITLEMENTS is YES. This means that open source builds will still work.
1294
1295         * Configurations/Network-OSX-sandbox.entitlements: Added.
1296         * Configurations/Storage-OSX-sandbox.entitlements: Added.
1297         * Configurations/StorageService.xcconfig:
1298         * Configurations/WebContent-OSX-sandbox.entitlements: Added.
1299         * Configurations/WebKit.xcconfig:
1300         * NetworkProcess/NetworkProcess.h:
1301         * PluginProcess/PluginProcess.h:
1302         * Scripts/process-network-sandbox-entitlements.sh: Added.
1303         * Scripts/process-webcontent-sandbox-entitlements.sh: Added.
1304         * Shared/ChildProcess.h:
1305         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
1306         (WebKit::XPCServiceInitializer):
1307         * Shared/SandboxInitializationParameters.h:
1308         (WebKit::SandboxInitializationParameters::setOverrideSandboxProfilePath):
1309         (WebKit::SandboxInitializationParameters::overrideSandboxProfilePath const):
1310         (WebKit::SandboxInitializationParameters::setSandboxProfile):
1311         (WebKit::SandboxInitializationParameters::sandboxProfile const):
1312         (): Deleted.
1313         * Shared/mac/ChildProcessMac.mm:
1314         (WebKit::SandboxProfileDeleter::operator()):
1315         (WebKit::SandboxParametersDeleter::operator()):
1316         (WebKit::SandboxInfo::SandboxInfo):
1317         (WebKit::fileContents):
1318         (WebKit::processStorageClass):
1319         (WebKit::setAndSerializeSandboxParameters):
1320         (WebKit::sandboxDataVaultParentDirectory):
1321         (WebKit::sandboxDirectory):
1322         (WebKit::sandboxFilePath):
1323         (WebKit::ensureSandboxCacheDirectory):
1324         (WebKit::writeSandboxDataToCacheFile):
1325         (WebKit::compileAndCacheSandboxProfile):
1326         (WebKit::tryApplyCachedSandbox):
1327         (WebKit::webKit2Bundle):
1328         (WebKit::sandboxProfilePath):
1329         (WebKit::compileAndApplySandboxSlowCase):
1330         (WebKit::applySandbox):
1331         (WebKit::initializeSandboxParameters):
1332         (WebKit::ChildProcess::initializeSandbox):
1333         * Shared/mac/SandboxInitialiationParametersMac.mm:
1334         (WebKit::SandboxInitializationParameters::SandboxInitializationParameters):
1335         * StorageProcess/StorageProcess.h:
1336         * WebKit.xcodeproj/project.pbxproj:
1337         * WebProcess/WebProcess.h:
1338
1339 2018-08-09  Jer Noble  <jer.noble@apple.com>
1340
1341         Video playback is using more power
1342         https://bugs.webkit.org/show_bug.cgi?id=188452
1343
1344         Reviewed by Eric Carlson.
1345
1346         * UIProcess/API/Cocoa/WKPreferences.mm:
1347         (-[WKPreferences _setLowPowerVideoAudioBufferSizeEnabled:]):
1348         (-[WKPreferences _lowPowerVideoAudioBufferSizeEnabled]):
1349
1350 2018-08-09  Alex Christensen  <achristensen@webkit.org>
1351
1352         Fix URLSchemeHandler.SyncXHR API test after r234735.
1353         https://bugs.webkit.org/show_bug.cgi?id=188358
1354
1355         * UIProcess/WebURLSchemeTask.cpp:
1356         (WebKit::WebURLSchemeTask::didReceiveData):
1357         Return after appending data for synchronous loads.  We used to send unused messages.
1358
1359 2018-08-09  Alex Christensen  <achristensen@webkit.org>
1360
1361         REGRESSION(234640) Loading stalls in environments without SafariSafeBrowsing framework
1362         https://bugs.webkit.org/show_bug.cgi?id=188453
1363         <rdar://problem/43102553>
1364
1365         Reviewed by Chris Dumez.
1366
1367         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1368         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
1369
1370 2018-08-09  Alex Christensen  <achristensen@webkit.org>
1371
1372         WKURLSchemeHandler crashes when sent errors with sync XHR
1373         https://bugs.webkit.org/show_bug.cgi?id=188358
1374
1375         Reviewed by Chris Dumez.
1376
1377         * UIProcess/WebURLSchemeTask.cpp:
1378         (WebKit::WebURLSchemeTask::didReceiveData):
1379         (WebKit::WebURLSchemeTask::didComplete):
1380         * UIProcess/WebURLSchemeTask.h:
1381
1382 2018-08-09  Sihui Liu  <sihui_liu@apple.com>
1383
1384         REGRESSION (r232083): WKWebView loses first-party cookies on iOS
1385         https://bugs.webkit.org/show_bug.cgi?id=188443
1386         <rdar://problem/42991584>
1387
1388         Reviewed by Chris Dumez.
1389
1390         Revert the change to set sharedCookieStorage for iOS as it is breaking Kayak.
1391
1392         * NetworkProcess/NetworkProcess.h:
1393         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1394         (WebKit::NetworkProcessCreationParameters::encode const):
1395         (WebKit::NetworkProcessCreationParameters::decode):
1396         * NetworkProcess/NetworkProcessCreationParameters.h:
1397         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1398         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1399         * Shared/WebProcessCreationParameters.cpp:
1400         (WebKit::WebProcessCreationParameters::encode const):
1401         (WebKit::WebProcessCreationParameters::decode):
1402         * Shared/WebProcessCreationParameters.h:
1403         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1404         (WebKit::WebProcessPool::platformInitializeWebProcess):
1405         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1406
1407 2018-08-09  Per Arne Vollan  <pvollan@apple.com>
1408
1409         DisplayRefreshMonitorMac should hold a weak pointer to WebPage.
1410         https://bugs.webkit.org/show_bug.cgi?id=186683
1411
1412         Reviewed by Brent Fulgham.
1413
1414         Instead of DisplayRefreshMonitorMac having a RefPtr to WebPage, it should have a weak pointer.
1415         Having a RefPtr could in theory create reference cycles. This potential problem has not been
1416         observed in practice, but it is safer to use a weak pointer.
1417
1418         * WebProcess/WebPage/WebPage.h:
1419         * WebProcess/WebPage/mac/DrawingAreaMac.cpp:
1420         (WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
1421         (WebKit::DisplayRefreshMonitorMac::~DisplayRefreshMonitorMac):
1422         (WebKit::DisplayRefreshMonitorMac::requestRefreshCallback):
1423
1424 2018-08-09  Ali Juma  <ajuma@chromium.org>
1425
1426         Import WPTs for IntersectionObserver
1427         https://bugs.webkit.org/show_bug.cgi?id=188416
1428
1429         Reviewed by Simon Fraser.
1430
1431         Make IntersectionObserver an experimental feature, so that it is enabled in
1432         WebKitTestRunner.
1433
1434         * Shared/WebPreferences.yaml:
1435
1436 2018-08-08  Tim Horton  <timothy_horton@apple.com>
1437
1438         Yet more crashes in MobileSafari under -[WKFormInputSession setSuggestions:]
1439         https://bugs.webkit.org/show_bug.cgi?id=188427
1440         <rdar://problem/43064672>
1441
1442         Reviewed by Wenson Hsieh.
1443
1444         Speculatively fix more crashes seen under setSuggestions.
1445
1446         * UIProcess/ios/WKContentViewInteraction.mm:
1447         (-[WKFormInputSession isValid]):
1448         (-[WKFormInputSession setSuggestions:]):
1449         (-[WKFormInputSession invalidate]):
1450         Belt-and-suspenders fix: use WeakObjCPtr for WKFormInputSession's WKContentView reference.
1451
1452         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1453         Invalidate the WKFormInputSession before replacing it; we theorize that
1454         there is a path in which we get here without having previously called stopAssistingNode.
1455         Most of the code is OK with this, but this leaves WKFormInputSession
1456         with a raw reference to WKContentView which can later become stale.
1457
1458 2018-08-08  Don Olmstead  <don.olmstead@sony.com>
1459
1460         [Curl] Surface additional NetworkLoadMetrics
1461         https://bugs.webkit.org/show_bug.cgi?id=188391
1462
1463         Reviewed by Joseph Pecoraro.
1464
1465         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
1466         (WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):
1467
1468 2018-08-08  Alex Christensen  <achristensen@webkit.org>
1469
1470         Fix possible null dereference in WebBackForwardList::restoreFromState
1471         https://bugs.webkit.org/show_bug.cgi?id=188418
1472         <rdar://problem/42531726>
1473
1474         Reviewed by Chris Dumez.
1475
1476         * UIProcess/WebBackForwardList.cpp:
1477         (WebKit::WebBackForwardList::restoreFromState):
1478         Null-check m_page like we do everywhere else in this file because it can be set to null when closing the page.
1479
1480 2018-08-08  Commit Queue  <commit-queue@webkit.org>
1481
1482         Unreviewed, rolling out r234314, r234320, and r234321.
1483         https://bugs.webkit.org/show_bug.cgi?id=188414
1484
1485         Caused email sign in issue (Requested by ryanhaddad on
1486         #webkit).
1487
1488         Reverted changesets:
1489
1490         "Remove unused WKNavigationDelegatePrivate
1491         decidePolicyForNavigationAction SPI"
1492         https://bugs.webkit.org/show_bug.cgi?id=188077
1493         https://trac.webkit.org/changeset/234314
1494
1495         "Fix API tests after r234314"
1496         https://bugs.webkit.org/show_bug.cgi?id=188077
1497         https://trac.webkit.org/changeset/234320
1498
1499         "Fix API tests after r234314"
1500         https://bugs.webkit.org/show_bug.cgi?id=188077
1501         https://trac.webkit.org/changeset/234321
1502
1503 2018-08-08  Simon Fraser  <simon.fraser@apple.com>
1504
1505         Add a WebKit2 logging channel for ActivityState
1506         https://bugs.webkit.org/show_bug.cgi?id=188411
1507
1508         Reviewed by Tim Horton.
1509         
1510         Add logging for ActivityState changes and the entrypoints that affect ActivityState.
1511
1512         * Platform/Logging.h:
1513         * UIProcess/Cocoa/WebViewImpl.mm:
1514         (WebKit::WebViewImpl::windowDidOrderOffScreen):
1515         (WebKit::WebViewImpl::windowDidOrderOnScreen):
1516         (WebKit::WebViewImpl::windowDidChangeOcclusionState):
1517         (WebKit::WebViewImpl::viewDidMoveToWindow):
1518         (WebKit::WebViewImpl::viewDidHide):
1519         (WebKit::WebViewImpl::viewDidUnhide):
1520         (WebKit::WebViewImpl::activeSpaceDidChange):
1521         * UIProcess/WebPageProxy.cpp:
1522         (WebKit::WebPageProxy::activityStateDidChange):
1523         (WebKit::WebPageProxy::dispatchActivityStateChange):
1524         * UIProcess/mac/PageClientImplMac.mm:
1525         (WebKit::PageClientImpl::isViewVisible):
1526         * WebProcess/WebPage/WebPage.cpp:
1527         (WebKit::WebPage::setActivityState):
1528
1529 2018-08-05  Darin Adler  <darin@apple.com>
1530
1531         [Cocoa] More tweaks and refactoring to prepare for ARC
1532         https://bugs.webkit.org/show_bug.cgi?id=188245
1533
1534         Reviewed by Dan Bernstein.
1535
1536         * Platform/cocoa/WKCrashReporter.mm:
1537         (WebKit::setCrashLogMessage): Refactor into a separate function for clarity.
1538         (WebKit::setCrashReportApplicationSpecificInformation): Use a bridging cast.
1539
1540         * Shared/mac/PasteboardTypes.mm:
1541         (WebKit::PasteboardTypes::forEditing): Use a bridging cast.
1542
1543         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
1544         (WebKit::convertToNPNNString): Added. Uses CFStringRef rather than NSString so we can
1545         manually manage the autoreleasing.
1546         (WebKit::initializeKeyboardEvent): Use convertToNPNNString.
1547         (WebKit::NetscapePlugin::sendComplexTextInput): Ditto.
1548
1549         * WebProcess/Plugins/PDF/PDFPlugin.mm: Use __unsafe_unretained explicitly
1550         for a parent pointer. We could consider moving to __weak after switching to ARC.
1551
1552 2018-08-07  Ben Richards  <benton_richards@apple.com>
1553
1554         Add SPI for launching WebContent process with pre-linked injected bundle
1555         https://bugs.webkit.org/show_bug.cgi?id=188367
1556
1557         Reviewed by Ryosuke Niwa.
1558
1559         Added SPI to allow applications to set a "customWebContentServiceBundleIdentifier" which will be launched instead of the default WebContent XPC service.
1560         The "customWebContentServiceBundleIdentifier" should be the bundle identifier for an XPC service that calls [WKProcessPool _webContentProcessXPCMain].
1561         The new XPC service should be hard linked to the application's injected bundle in order to receive the intended performance benefit.
1562
1563         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
1564         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
1565         (WebKit::XPCServiceMain):
1566         (main):
1567         * UIProcess/API/APIProcessPoolConfiguration.h:
1568         * UIProcess/API/C/WKContext.cpp:
1569         (WKContextSetCustomWebContentServiceBundleIdentifier):
1570         * UIProcess/API/C/WKContext.h:
1571         * UIProcess/API/Cocoa/WKProcessPool.mm:
1572         (+[WKProcessPool _webContentProcessXPCMain]):
1573         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1574         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1575         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1576         (-[_WKProcessPoolConfiguration customWebContentServiceBundleIdentifier]):
1577         (-[_WKProcessPoolConfiguration setCustomWebContentServiceBundleIdentifier:]):
1578         * UIProcess/Launcher/ProcessLauncher.h:
1579         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1580         (WebKit::ProcessLauncher::launchProcess):
1581         * UIProcess/WebProcessPool.cpp:
1582         (WebKit::WebProcessPool::setCustomWebContentServiceBundleIdentifier):
1583         * UIProcess/WebProcessPool.h:
1584         * UIProcess/WebProcessProxy.cpp:
1585         (WebKit::WebProcessProxy::getLaunchOptions):
1586         * WebKit.xcodeproj/project.pbxproj:
1587
1588 2018-08-07  Chris Dumez  <cdumez@apple.com>
1589
1590         StorageManager should stop ref'ing IPC::Connections as this is leak-prone
1591         https://bugs.webkit.org/show_bug.cgi?id=188380
1592
1593         Reviewed by Alex Christensen.
1594
1595         StorageManager should stop ref'ing IPC::Connections as this is leak-prone. Instead, assign a unique identifier
1596         to each IPC::Connection and store this identifier intead of a RefPtr<IPC::Connection>. When the StorageManager
1597         needs an actual IPC::Connection, it can look it up from the identifier.
1598
1599         * Platform/IPC/Connection.cpp:
1600         (IPC::Connection::Connection):
1601         (IPC::Connection::~Connection):
1602         (IPC::Connection::connection):
1603         * Platform/IPC/Connection.h:
1604         (IPC::Connection::uniqueID const):
1605         * UIProcess/WebStorage/StorageManager.cpp:
1606         (WebKit::StorageManager::StorageArea::addListener):
1607         (WebKit::StorageManager::StorageArea::removeListener):
1608         (WebKit::StorageManager::StorageArea::hasListener const):
1609         (WebKit::StorageManager::StorageArea::setItem):
1610         (WebKit::StorageManager::StorageArea::removeItem):
1611         (WebKit::StorageManager::StorageArea::clear):
1612         (WebKit::StorageManager::StorageArea::dispatchEvents const):
1613         (WebKit::StorageManager::SessionStorageNamespace::allowedConnection const):
1614         (WebKit::StorageManager::SessionStorageNamespace::setAllowedConnection):
1615         (WebKit::StorageManager::setAllowedSessionStorageNamespaceConnection):
1616         (WebKit::StorageManager::processDidCloseConnection):
1617         (WebKit::StorageManager::createLocalStorageMap):
1618         (WebKit::StorageManager::createTransientLocalStorageMap):
1619         (WebKit::StorageManager::createSessionStorageMap):
1620         (WebKit::StorageManager::destroyStorageMap):
1621         (WebKit::StorageManager::setItem):
1622         (WebKit::StorageManager::removeItem):
1623         (WebKit::StorageManager::clear):
1624         (WebKit::StorageManager::applicationWillTerminate):
1625         (WebKit::StorageManager::findStorageArea const):
1626         * UIProcess/WebStorage/StorageManager.h:
1627
1628 2018-08-07  Eric Carlson  <eric.carlson@apple.com>
1629
1630         NotReadableError when calling getUserMedia
1631         https://bugs.webkit.org/show_bug.cgi?id=188309
1632         <rdar://problem/42916838>
1633
1634         Reviewed by Brent Fulgham.
1635
1636         * UIProcess/UserMediaProcessManager.cpp:
1637         (WebKit::UserMediaProcessManager::willCreateMediaStream): Deal with audio and video sandbox
1638         extensions being issued at different times. Use new ProcessState methods.
1639         (WebKit::UserMediaProcessManager::endedCaptureSession): Use new ProcessState methods.
1640
1641 2018-08-07  Wenson Hsieh  <wenson_hsieh@apple.com>
1642
1643         REGRESSION (r233778): Text selection sometimes cannot be extended in iframes
1644         https://bugs.webkit.org/show_bug.cgi?id=188374
1645         <rdar://problem/42928657>
1646
1647         Reviewed by Simon Fraser.
1648
1649         rangeForPoint contains logic for converting a selection handle location in root view coordinates to an updated
1650         selection. In doing so, we first convert the selection handle location to content coordinates; however, the call
1651         site to EventHandler::hitTestResultAtPoint still hit-tests using the location in root view coordinates rather
1652         than content coordinates, which means that when the focused frame is a subframe, hit-testing will fail to find
1653         nodes within the subframe under the selection handle. This manifests in behaviors such as snapping to a single
1654         character when selecting text in subframes.
1655
1656         To fix this, we just need to pass in the point in the frame's content coordinates when hit-testing.
1657
1658         Tests:  editing/selection/ios/selection-handles-in-iframe.html
1659                 editing/selection/ios/selection-handles-in-readonly-input.html
1660
1661         * WebProcess/WebPage/ios/WebPageIOS.mm:
1662         (WebKit::rangeForPointInRootViewCoordinates):
1663
1664         Make a couple of other minor adjustments:
1665         1.  Take a Frame& instead of a Frame*, since Frame& is assumed to be non-null here.
1666         2.  Rename rangeForPoint to rangeForPointInRootViewCoordinates, as well as the point argument to
1667             pointInRootViewCoordinates.
1668
1669         (WebKit::WebPage::updateSelectionWithTouches):
1670         (WebKit::rangeForPoint): Deleted.
1671
1672 2018-08-07  Alex Christensen  <achristensen@webkit.org>
1673
1674         Fix things after r234640
1675         https://bugs.webkit.org/show_bug.cgi?id=188133
1676
1677         * UIProcess/WebFramePolicyListenerProxy.cpp:
1678         (WebKit::WebFramePolicyListenerProxy::use):
1679         (WebKit::WebFramePolicyListenerProxy::download):
1680         (WebKit::WebFramePolicyListenerProxy::ignore):
1681         Fix assertions as I had in r234552.  Also fix a possible race condition with fragment navigations by only keeping the first "use" response.
1682         * config.h:
1683         Fix IOSMAC build.
1684
1685 2018-08-07  Per Arne Vollan  <pvollan@apple.com>
1686
1687         [macOS] Scrollbars are not visible when using 3rd party mouse
1688         https://bugs.webkit.org/show_bug.cgi?id=188372
1689
1690         Reviewed by Simon Fraser.
1691
1692         The scrollbars are not visible because they are not updated with the recommended scroller style
1693         when a 3rd party mouse is used. They still have the overlay style, but the system is
1694         recommending the legacy style in this case. The UI process is currently notifying the WebProcess
1695         about changes in the scroller style, but the current style is not set in the WebProcess on
1696         startup. This patch sets the initial scroller style in the WebProcess by passing it as part of
1697         the WebProcess creation parameters. Also, to make sure hot-plugging of a 3rd party mouse is
1698         is visually changing the scroller style of the current page, a class method in NSScrollerImpPair
1699         is called to update all NSScrollerImpPairs with the new recommended style. This method was
1700         previously called by AppKit, but after blocking WindowServer access, AppKit is no longer calling
1701         this method. This has been manually tested by using a 3rd party mouse.
1702
1703         * Shared/WebProcessCreationParameters.cpp:
1704         (WebKit::WebProcessCreationParameters::encode const):
1705         (WebKit::WebProcessCreationParameters::decode):
1706         * Shared/WebProcessCreationParameters.h:
1707         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1708         (WebKit::WebProcessPool::platformInitializeWebProcess):
1709         * WebProcess/cocoa/WebProcessCocoa.mm:
1710         (WebKit::WebProcess::platformInitializeWebProcess):
1711         (WebKit::WebProcess::scrollerStylePreferenceChanged):
1712
1713 2018-08-06  Andy Estes  <aestes@apple.com>
1714
1715         [Wi-Fi Assertions] suspendWiFiAssertions() should be able to delay sending ProcessReadyToSuspend
1716         https://bugs.webkit.org/show_bug.cgi?id=188373
1717         <rdar://problem/42857398>
1718
1719         Reviewed by Tim Horton.
1720
1721         * NetworkProcess/NetworkProcess.cpp:
1722         (WebKit::NetworkProcess::actualPrepareToSuspend):
1723         * NetworkProcess/NetworkProcess.h:
1724         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1725         (WebKit::NetworkProcess::platformPrepareToSuspend):
1726         (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
1727         * NetworkProcess/curl/NetworkProcessCurl.cpp:
1728         (WebKit::NetworkProcess::platformPrepareToSuspend):
1729         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1730         (WebKit::NetworkProcess::platformPrepareToSuspend):
1731
1732 2018-08-06  Alex Christensen  <achristensen@webkit.org>
1733
1734         Check with SafeBrowsing during navigation in WKWebView
1735         https://bugs.webkit.org/show_bug.cgi?id=188133
1736
1737         Reviewed by Chris Dumez.
1738
1739         This turns WebFramePolicyListenerProxy into an object that now listens for the results
1740         of two processes happening in parallel: the API::NavigationClient's decidePolicyForNavigation{Action, Response}
1741         (which it was already waiting for) and, on platforms that support it, the SafariSafeBrowsing framework's check.
1742         The first result is stored as it waits for the second result unless the first result is the API::NavigationClient
1743         saying to cancel or convert the navigation to a download, in which cases we don't care what the safe browsing
1744         framework results are because we won't show the URL in the browser.
1745
1746         Nothing is done with the safe browsing results yet.
1747
1748         * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Added.
1749         (WebKit::SafeBrowsingResult::SafeBrowsingResult):
1750         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1751         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
1752         * UIProcess/SafeBrowsingResult.h: Added.
1753         (WebKit::SafeBrowsingResult::provider const):
1754         (WebKit::SafeBrowsingResult::isPhishing const):
1755         (WebKit::SafeBrowsingResult::isMalware const):
1756         (WebKit::SafeBrowsingResult::isUnwantedSoftware const):
1757         (WebKit::SafeBrowsingResult::isKnownToBeUnsafe const):
1758         * UIProcess/WebFramePolicyListenerProxy.cpp:
1759         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
1760         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
1761         (WebKit::WebFramePolicyListenerProxy::use):
1762         (WebKit::WebFramePolicyListenerProxy::download):
1763         (WebKit::WebFramePolicyListenerProxy::ignore):
1764         * UIProcess/WebFramePolicyListenerProxy.h:
1765         (WebKit::WebFramePolicyListenerProxy::create):
1766         * UIProcess/WebFrameProxy.cpp:
1767         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
1768         * UIProcess/WebFrameProxy.h:
1769         * UIProcess/WebPageProxy.cpp:
1770         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1771         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
1772         (WebKit::WebPageProxy::decidePolicyForResponse):
1773         * UIProcess/WebPageProxy.h:
1774         * WebKit.xcodeproj/project.pbxproj:
1775
1776 2018-08-06  Chris Dumez  <cdumez@apple.com>
1777
1778         Regression(NetworkLoadChecker): CORS preflights are no longer able to deal with client certificate authentication
1779         https://bugs.webkit.org/show_bug.cgi?id=188355
1780         <rdar://problem/42546319>
1781
1782         Reviewed by Alex Christensen.
1783
1784         Before we started using the NetworkLoadChecker to do CORS-preflighting in the Network process, challenges would
1785         use the NetworkLoad::completeAuthenticationChallenge() code path with isAllowedToAskUserForCredentials to set
1786         to false. This would call:
1787         1. completionHandler(AuthenticationChallengeDisposition::UseCredential, { }); for TLS handshakes (server trust
1788            evaluation & client certification authentication)
1789         2. NetworkProcess::singleton().authenticationManager().didReceiveAuthenticationChallenge() otherwise
1790
1791         However, NetworkCORSPreflightChecker::didReceiveChallenge() was behaving differently and calling:
1792         1. completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpace, { }); for server trust evaluations
1793         2. completionHandler(AuthenticationChallengeDisposition::Cancel, { }); otherwise
1794
1795         Restore previous behavior by aligning NetworkCORSPreflightChecker::didReceiveChallenge() with
1796         NetworkLoad::completeAuthenticationChallenge() when isAllowedToAskUserForCredentials is set to false. This means
1797         we end up asking the AuthenticationManager for client certificate authentication instead or cancelling the
1798         preflight.
1799
1800         This fixes CORS-preflighting on some internal sites.
1801
1802         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
1803         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
1804         * NetworkProcess/NetworkCORSPreflightChecker.h:
1805         * NetworkProcess/NetworkLoadChecker.cpp:
1806         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
1807         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
1808         * NetworkProcess/NetworkLoadChecker.h:
1809         * NetworkProcess/NetworkResourceLoader.cpp:
1810         * NetworkProcess/PingLoad.cpp:
1811         (WebKit::PingLoad::PingLoad):
1812
1813 2018-08-06  Alex Christensen  <achristensen@webkit.org>
1814
1815         Use enum classes and OptionSets for PaintPhase and PaintBehavior
1816         https://bugs.webkit.org/show_bug.cgi?id=188323
1817
1818         Reviewed by Simon Fraser.
1819
1820         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
1821         (WebKit::imageForRect):
1822         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
1823         (WebKit::InjectedBundleRangeHandle::renderedImage):
1824         * WebProcess/Plugins/PluginView.cpp:
1825         (WebKit::PluginView::shouldCreateTransientPaintingSnapshot const):
1826
1827 2018-08-06  Ryan Haddad  <ryanhaddad@apple.com>
1828
1829         Unreviewed, rolling out r234552.
1830
1831         Introduced 2 layout test failures on High Sierra.
1832
1833         Reverted changeset:
1834
1835         "Check with SafeBrowsing during navigation in WKWebView"
1836         https://bugs.webkit.org/show_bug.cgi?id=188133
1837         https://trac.webkit.org/changeset/234552
1838
1839 2018-08-06  Ryan Haddad  <ryanhaddad@apple.com>
1840
1841         Unreviewed, rolling out r234569.
1842
1843         Breaks internal builds.
1844
1845         Reverted changeset:
1846
1847         "We should cache the compiled sandbox profile in a data vault"
1848         https://bugs.webkit.org/show_bug.cgi?id=184991
1849         https://trac.webkit.org/changeset/234569
1850
1851 2018-08-06  Chris Dumez  <cdumez@apple.com>
1852
1853         Fix IPC::Connection leak in StorageManager
1854         https://bugs.webkit.org/show_bug.cgi?id=188321
1855         <rdar://problem/42748485>
1856
1857         Reviewed by Alex Christensen.
1858
1859         When a StorageMap is destroyed on WebContent process side, StorageManager::destroyStorageMap()
1860         gets called via IPC with a (IPC::Connection, StorageMapID) pair. Normally, it removes this
1861         pair from m_storageAreasByConnection. However, if this is a *transient* StorageMap (sessionStorage),
1862         then we keep the pair in the map and we merely remove the StorageMapID as a listener from the
1863         StorageArea. We do this so that:
1864         1. The StorageArea stays alive so that it can be reused later on for the same security origin, on
1865            the same IPC::Connection (logic for this is in StorageManager::createTransientLocalStorageMap()
1866         2. Removing the StorageMapID as a listener from the StorageArea is important because
1867            StorageArea::m_eventListeners holds a strong reference to the IPC::Connection in a std::pair
1868            with the StorageMapID (HashSet<std::pair<RefPtr<IPC::Connection>, uint64_t>> m_eventListeners).
1869
1870         As mentioned in 1 above, in StorageManager::createTransientLocalStorageMap(), there is logic to
1871         check if there is already an existing StorageArea for the given IPC::Connection that is transient
1872         and is for the same security origin. In this case, we could avoid constructing a new StorageArea
1873         and we would:
1874         1. Add a new entry to m_storageAreasByConnection with the key (connection, newStorageMapID), using
1875            same same StorageArea as value.
1876         2. Remove the previous (connection, oldStorageMapID) key from m_storageAreasByConnection.
1877
1878         Step 2 here is wrong and is updated in this patch. It is only safe to remove the previous 
1879         (connection, oldStorageMapID) if this oldStorageMapID no longer exists (i.e. destroyStorageMap()
1880         was already called for it). This patch thus adds a check before removing (connection, oldStorageMapID)
1881         from the HashMap to make sure that the oldStorageMapID is no longer a listener of the StorageArea).
1882
1883         This would cause leaks in the following case:
1884         1. We construct a StorageArea for (connection1, storageMapId1)
1885         2. We ask for a StorageArea for (connection1, storageMapId2) and decide to reuse the existing StorageArea
1886            since it has the same SecurityOrigin.
1887         3. As a result of step2, we would remove (connection1, storageMapId1) from m_storageAreasByConnection
1888            and add (connection1, storageMapId2), even though there is still a StorageMap with storageMapId1
1889            on WebContent process side.
1890         4. Later on, we would try to call destroyStorageMap(connection1, storageMap1), it would fail to find
1891            it in m_storageAreasByConnection and return early. It would therefore fail to remove storageMapId1
1892            as a listener of the StorageArea which still exists.
1893         -> This would leak the IPC::Connection that there would be a std::pair<RefPtr<IPC::Connection>, StorageMapID>
1894            with value (connection1, storageMap1) which would get leaked and it would ref the IPC::Connection.
1895
1896         This code should really be refactored to be less leak prone but I have kept the patch minimal for now
1897         to facilitate cherry-picking.
1898
1899         Note that this would reproduce very easily on sina.com.cn, when clicking bold links at the top, which
1900         opens new tabs to different pages in the same WebContent process. When closing all Safari windows, the
1901         IPC::Connection for this WebContent process would stay alive.
1902
1903         * UIProcess/WebStorage/StorageManager.cpp:
1904         (WebKit::StorageManager::StorageArea::hasListener const):
1905         (WebKit::StorageManager::createTransientLocalStorageMap):
1906
1907 2018-08-06  Alex Christensen  <achristensen@webkit.org>
1908
1909         Make BlendMode an enum class
1910         https://bugs.webkit.org/show_bug.cgi?id=188325
1911
1912         Reviewed by Darin Adler.
1913
1914         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1915         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
1916
1917 2018-08-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1918
1919         [iOS] Caret disappears after resigning and becoming first responder if active focus state is retained
1920         https://bugs.webkit.org/show_bug.cgi?id=188322
1921         <rdar://problem/42455270>
1922
1923         Reviewed by Tim Horton.
1924
1925         Prior to r230745, when a user selects a word in non-editable web content without a prior selection, we would
1926         always try to activate the text interaction assistant, creating a selection view (a UITextSelectionView). After
1927         the long press is recognized, this text selection view is configured for "highlight mode", which is a special
1928         mode for presenting selection UI where the grabber handles at the start and end of the selection are suppressed.
1929         UIKit then prepares to show the selection by asking WKContentView for the number of selection rects; if this
1930         number is zero, the UITextSelectionView is removed from the superview, and state that keeps track of whether the
1931         selection view is in "highlight mode" is reset.
1932
1933         In the case where there's no prior selection, our cached EditorState in the UI process will not be up to date
1934         yet when the gesture is recognized. This means that when UIKit asks us for the number of selection rects, we'll
1935         return 0, which causes any state tracking "highlight mode" for the selection to be reset, subsequently resulting
1936         in selection handles showing up before the user has ended the initial loupe gesture.
1937
1938         r230745 addressed this bug by removing logic to activate the text selection when becoming first responder,
1939         instead deferring until the next `-_selectionChanged` call with post-layout editor state data to activate the
1940         selection. While this does ensure that selection handles don't erroneously appear, it also means that clients
1941         that call -becomeFirstResponder to show selection UI and the keyboard in a web view while an element is already
1942         focused will not have an active selection assistant (i.e. the selection view will still be hidden). One way this
1943         happens is when Safari uses `-_retainActiveFocusedState` in combination with `-resignFirstResponder` and
1944         `-becomeFirstResponder` to temporarily switch focus away from the web view when the URL bar is tapped.
1945
1946         To fix both the inactive selection after `-becomeFirstResponder` as well as the selection handles showing up
1947         when performing a loupe gesture, we simply make the check in `-becomeFirstResponderForWebView` more nuanced.
1948         Instead of always activating the selection or never activating the selection, only activate the selection if the
1949         current editor state has information about a selection to avoid causing the selection view to be immediately
1950         removed and "highlight mode" to be reset when selecting a word via loupe gesture for the first time.
1951
1952         Tests:  KeyboardInputTests.CaretSelectionRectAfterRestoringFirstResponder
1953                 KeyboardInputTests.RangedSelectionRectAfterRestoringFirstResponder
1954                 editing/selection/ios/selection-handles-after-touch-end.html
1955
1956         * UIProcess/ios/WKContentViewInteraction.mm:
1957         (-[WKContentView becomeFirstResponderForWebView]):
1958         (-[WKContentView canShowNonEmptySelectionView]):
1959
1960 2018-08-06  Zan Dobersek  <zdobersek@igalia.com>
1961
1962         [Nicosia] Add Nicosia::Scene
1963         https://bugs.webkit.org/show_bug.cgi?id=188340
1964
1965         Reviewed by Carlos Garcia Campos.
1966
1967         CompositingCoordinator spawns a Nicosia::Scene object that it shares
1968         with the CoordinatedGraphicsSceneState instance. All the
1969         Nicosia::CompositionLayer objects indirectly managed by
1970         CompositingCoordinator are now stored in a local Nicosia::Scene::State
1971         member object. Upon each flush that requires frame synchronization the
1972         Nicosia::Scene object is updated in a thread-safe manner, increasing
1973         the scene ID value as well as copying the local HashSet and root layer
1974         values into the shared Scene object, allowing for the consumer (which
1975         currently is the related CoordinatedGraphicsScene instance) to update
1976         its output accordingly.
1977
1978         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1979         (WebKit::CompositingCoordinator::CompositingCoordinator):
1980         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
1981         (WebKit::CompositingCoordinator::initializeRootCompositingLayerIfNeeded):
1982         (WebKit::CompositingCoordinator::createGraphicsLayer):
1983         (WebKit::CompositingCoordinator::detachLayer):
1984         (WebKit::CompositingCoordinator::attachLayer):
1985         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
1986
1987 2018-08-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1988
1989         Add support for microtasks in workers
1990         https://bugs.webkit.org/show_bug.cgi?id=188246
1991
1992         Reviewed by Darin Adler.
1993
1994         Rename JSMainThreadExecState.h to JSExecState.h.
1995
1996         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMAttr.cpp:
1997         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMBlob.cpp:
1998         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCDATASection.cpp:
1999         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRule.cpp:
2000         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRuleList.cpp:
2001         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleDeclaration.cpp:
2002         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleSheet.cpp:
2003         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValue.cpp:
2004         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCharacterData.cpp:
2005         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.cpp:
2006         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp:
2007         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMComment.cpp:
2008         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp:
2009         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMSelection.cpp:
2010         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMTokenList.cpp:
2011         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
2012         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDeprecated.cpp:
2013         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentFragment.cpp:
2014         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
2015         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentType.cpp:
2016         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementGtk.cpp:
2017         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEvent.cpp:
2018         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFile.cpp:
2019         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFileList.cpp:
2020         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAnchorElement.cpp:
2021         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAppletElement.cpp:
2022         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAreaElement.cpp:
2023         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBRElement.cpp:
2024         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBaseElement.cpp:
2025         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBodyElement.cpp:
2026         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLButtonElement.cpp:
2027         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLCanvasElement.cpp:
2028         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLCollection.cpp:
2029         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDListElement.cpp:
2030         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDirectoryElement.cpp:
2031         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDivElement.cpp:
2032         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDocument.cpp:
2033         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLElement.cpp:
2034         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLEmbedElement.cpp:
2035         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFieldSetElement.cpp:
2036         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFontElement.cpp:
2037         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFormElement.cpp:
2038         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameElement.cpp:
2039         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameSetElement.cpp:
2040         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHRElement.cpp:
2041         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadElement.cpp:
2042         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadingElement.cpp:
2043         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHtmlElement.cpp:
2044         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLIFrameElement.cpp:
2045         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLImageElement.cpp:
2046         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLInputElement.cpp:
2047         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLIElement.cpp:
2048         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLabelElement.cpp:
2049         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLegendElement.cpp:
2050         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLinkElement.cpp:
2051         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMapElement.cpp:
2052         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMarqueeElement.cpp:
2053         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMenuElement.cpp:
2054         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMetaElement.cpp:
2055         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLModElement.cpp:
2056         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOListElement.cpp:
2057         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLObjectElement.cpp:
2058         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptGroupElement.cpp:
2059         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptionElement.cpp:
2060         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptionsCollection.cpp:
2061         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParagraphElement.cpp:
2062         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParamElement.cpp:
2063         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLPreElement.cpp:
2064         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLQuoteElement.cpp:
2065         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLScriptElement.cpp:
2066         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLSelectElement.cpp:
2067         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLStyleElement.cpp:
2068         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCaptionElement.cpp:
2069         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCellElement.cpp:
2070         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableColElement.cpp:
2071         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableElement.cpp:
2072         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableRowElement.cpp:
2073         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableSectionElement.cpp:
2074         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTextAreaElement.cpp:
2075         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTitleElement.cpp:
2076         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLUListElement.cpp:
2077         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMKeyboardEvent.cpp:
2078         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMediaList.cpp:
2079         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMouseEvent.cpp:
2080         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNamedNodeMap.cpp:
2081         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeGtk.cpp:
2082         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeIterator.cpp:
2083         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeList.cpp:
2084         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMProcessingInstruction.cpp:
2085         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMRange.cpp:
2086         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMStyleSheet.cpp:
2087         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMStyleSheetList.cpp:
2088         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMText.cpp:
2089         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMTreeWalker.cpp:
2090         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMUIEvent.cpp:
2091         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMWheelEvent.cpp:
2092         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathExpression.cpp:
2093         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathNSResolver.cpp:
2094         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathResult.cpp:
2095
2096 2018-08-03  Ben Richards  <benton_richards@apple.com>
2097
2098         We should cache the compiled sandbox profile in a data vault
2099         https://bugs.webkit.org/show_bug.cgi?id=184991
2100
2101         Reviewed by Ryosuke Niwa.
2102
2103         This patch changes a few things (note: data vaults and sandbox entitlements are only used in internal builds):
2104         (1) Instead of compiling a sandbox every time a process is launched, processes now look for a cached sandbox
2105             in a process specific data vault on macOS platforms. (ChildProcessMac.mm)
2106         (2) If a valid cached sandbox is not found, a process will create the data vault (or ensure that it exists),
2107             compile a sandbox, and cache it.
2108         (3) In order to create process specific data vaults, each process now has their own <process name>-OSX-sandbox.entitlements
2109             file which contains an entitlement with a process specific "storage class" which ensures that each process
2110             can only ever access its own data vault. (See the article on confluence "Data Vaults and Restricted Files" for more info)
2111         (4) The sandbox entitlements file for the Network, WebContent and Plugin services are loaded dynamically
2112             through Scripts/<process name>-process-entitlements.sh which is triggered in a new build phase for each service.
2113             The Storage process sandbox entitlements are loaded directly in Configurations/StorageService.xcconfig.
2114             The reason that the sandbox entitlements are applied dynamically is so that these sandbox entitlements
2115             are only applied when WK_USE_RESTRICTED_ENTITLEMENTS is YES. This means that open source builds will still work.
2116
2117         * Configurations/Network-OSX-sandbox.entitlements: Added.
2118         * Configurations/Plugin-OSX-sandbox.entitlements: Added.
2119         * Configurations/Storage-OSX-sandbox.entitlements: Added.
2120         * Configurations/StorageService.xcconfig:
2121         * Configurations/WebContent-OSX-sandbox.entitlements: Added.
2122         * Configurations/WebKit.xcconfig:
2123         * NetworkProcess/NetworkProcess.h:
2124         * PluginProcess/PluginProcess.h:
2125         * Scripts/process-network-entitlements.sh: Added.
2126         * Scripts/process-plugin-entitlements.sh: Added.
2127         * Scripts/process-webcontent-entitlements.sh:
2128         * Shared/ChildProcess.h:
2129         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
2130         (WebKit::XPCServiceInitializer):
2131         * Shared/SandboxInitializationParameters.h:
2132         (WebKit::SandboxInitializationParameters::setOverrideSandboxProfilePath):
2133         (WebKit::SandboxInitializationParameters::overrideSandboxProfilePath const):
2134         (WebKit::SandboxInitializationParameters::setSandboxProfile):
2135         (WebKit::SandboxInitializationParameters::sandboxProfile const):
2136         (): Deleted.
2137         * Shared/mac/ChildProcessMac.mm:
2138         (WebKit::SandboxProfileDeleter::operator()):
2139         (WebKit::SandboxParametersDeleter::operator()):
2140         (WebKit::SandboxInfo::SandboxInfo):
2141         (WebKit::fileContents):
2142         (WebKit::processStorageClass):
2143         (WebKit::setAndSerializeSandboxParameters):
2144         (WebKit::getUserCacheDirectory):
2145         (WebKit::sandboxDataVaultParentDirectory):
2146         (WebKit::sandboxDirectory):
2147         (WebKit::sandboxFilePath):
2148         (WebKit::ensureSandboxCacheDirectory):
2149         (WebKit::writeSandboxDataToCacheFile):
2150         (WebKit::compileAndCacheSandboxProfile):
2151         (WebKit::tryApplyCachedSandbox):
2152         (WebKit::webKit2Bundle):
2153         (WebKit::sandboxProfilePath):
2154         (WebKit::compileAndApplySandboxSlowCase):
2155         (WebKit::applySandbox):
2156         (WebKit::initializeSandboxParameters):
2157         (WebKit::ChildProcess::initializeSandbox):
2158         * Shared/mac/SandboxInitialiationParametersMac.mm:
2159         (WebKit::SandboxInitializationParameters::SandboxInitializationParameters):
2160         * StorageProcess/StorageProcess.h:
2161         * WebKit.xcodeproj/project.pbxproj:
2162         * WebProcess/WebProcess.h:
2163
2164 2018-08-03  Alex Christensen  <achristensen@webkit.org>
2165
2166         Fix spelling of "overridden"
2167         https://bugs.webkit.org/show_bug.cgi?id=188315
2168
2169         Reviewed by Darin Adler.
2170
2171         * Platform/IPC/mac/ConnectionMac.mm:
2172         (IPC::Connection::receiveSourceEventHandler):
2173         * Shared/WebPreferencesStore.cpp:
2174         (WebKit::WebPreferencesStore::encode const):
2175         (WebKit::WebPreferencesStore::decode):
2176         (WebKit::valueForKey):
2177         (WebKit::setValueForKey):
2178         (WebKit::WebPreferencesStore::setStringValueForKey):
2179         (WebKit::WebPreferencesStore::getStringValueForKey const):
2180         (WebKit::WebPreferencesStore::setBoolValueForKey):
2181         (WebKit::WebPreferencesStore::getBoolValueForKey const):
2182         (WebKit::WebPreferencesStore::setUInt32ValueForKey):
2183         (WebKit::WebPreferencesStore::getUInt32ValueForKey const):
2184         (WebKit::WebPreferencesStore::setDoubleValueForKey):
2185         (WebKit::WebPreferencesStore::getDoubleValueForKey const):
2186         (WebKit::WebPreferencesStore::setOverrideDefaultsStringValueForKey):
2187         (WebKit::WebPreferencesStore::setOverrideDefaultsBoolValueForKey):
2188         (WebKit::WebPreferencesStore::setOverrideDefaultsUInt32ValueForKey):
2189         (WebKit::WebPreferencesStore::setOverrideDefaultsDoubleValueForKey):
2190         * Shared/WebPreferencesStore.h:
2191         * UIProcess/ios/WKContentViewInteraction.mm:
2192         (-[WKContentView dragInteraction:previewForLiftingItem:session:]):
2193         (-[WKContentView dragInteraction:previewForCancellingItem:withDefault:]):
2194         * UIProcess/ios/WKScrollView.mm:
2195         (-[WKScrollView _systemContentInset]):
2196
2197 2018-08-03  David Fenton  <david_fenton@apple.com>
2198
2199         Unreviewed, rolling out r234517.
2200
2201         Caused API test failures on iOS
2202
2203         Reverted changeset:
2204
2205         "[Cocoa] setCookie API fails to set session cookies for
2206         defaultDataStore if processPool created but not used"
2207         https://bugs.webkit.org/show_bug.cgi?id=188209
2208         https://trac.webkit.org/changeset/234517
2209
2210 2018-08-03  Ben Richards  <benton_richards@apple.com>
2211
2212         Add configuration for automatic process pre-warming
2213         https://bugs.webkit.org/show_bug.cgi?id=187108
2214
2215         Reviewed by Ryosuke Niwa.
2216
2217         Added configurations to allow setting the maximum number of processes that should be automatically prewarmed.
2218
2219         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2220         (API::ProcessPoolConfiguration::copy):
2221         * UIProcess/API/APIProcessPoolConfiguration.h:
2222         * UIProcess/API/C/WKContext.cpp:
2223         (WKContextSetMaximumNumberOfPrewarmedProcesses):
2224         * UIProcess/API/C/WKContextPrivate.h:
2225         * UIProcess/API/Cocoa/WKProcessPool.mm:
2226         (-[WKProcessPool _setMaximumNumberOfPrewarmedProcesses:]):
2227         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2228         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2229         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2230         (-[_WKProcessPoolConfiguration setMaximumPrewarmedProcessCount:]):
2231         (-[_WKProcessPoolConfiguration maximumPrewarmedProcessCount]):
2232         * UIProcess/WebPageProxy.cpp:
2233         (WebKit::WebPageProxy::didFinishLoadForFrame): Moved call to notifyProcessPoolToPrewarm from didFirstVisuallyNonEmptyLayoutForFrame to here.
2234         This is to try to ensure that frame loading and prewarming don't happen at the same time as this would be heavy for some devices.
2235         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
2236         * UIProcess/WebProcessPool.cpp:
2237         (WebKit::WebProcessPool::setMaximumNumberOfProcesses): Condition changed so that calling setMaximumNumberOfProcesses after warmInitialProcess
2238         doesn't result in a crash.
2239         (WebKit::WebProcessPool::setMaximumNumberOfPrewarmedProcesses):
2240         (WebKit::WebProcessPool::warmInitialProcess):
2241         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
2242         * UIProcess/WebProcessPool.h:
2243
2244 2018-08-03  Alex Christensen  <achristensen@webkit.org>
2245
2246         Check with SafeBrowsing during navigation in WKWebView
2247         https://bugs.webkit.org/show_bug.cgi?id=188133
2248
2249         Reviewed by Chris Dumez.
2250
2251         This turns WebFramePolicyListenerProxy into an object that now listens for the results
2252         of two processes happening in parallel: the API::NavigationClient's decidePolicyForNavigation{Action, Response}
2253         (which it was already waiting for) and, on platforms that support it, the SafariSafeBrowsing framework's check.
2254         The first result is stored as it waits for the second result unless the first result is the API::NavigationClient
2255         saying to cancel or convert the navigation to a download, in which cases we don't care what the safe browsing
2256         framework results are because we won't show the URL in the browser.
2257
2258         Nothing is done with the safe browsing results yet.
2259
2260         * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Added.
2261         (WebKit::SafeBrowsingResult::SafeBrowsingResult):
2262         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2263         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
2264         * UIProcess/SafeBrowsingResult.h: Added.
2265         (WebKit::SafeBrowsingResult::provider const):
2266         (WebKit::SafeBrowsingResult::isPhishing const):
2267         (WebKit::SafeBrowsingResult::isMalware const):
2268         (WebKit::SafeBrowsingResult::isUnwantedSoftware const):
2269         (WebKit::SafeBrowsingResult::isKnownToBeUnsafe const):
2270         * UIProcess/WebFramePolicyListenerProxy.cpp:
2271         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
2272         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
2273         (WebKit::WebFramePolicyListenerProxy::use):
2274         (WebKit::WebFramePolicyListenerProxy::download):
2275         (WebKit::WebFramePolicyListenerProxy::ignore):
2276         * UIProcess/WebFramePolicyListenerProxy.h:
2277         (WebKit::WebFramePolicyListenerProxy::create):
2278         * UIProcess/WebFrameProxy.cpp:
2279         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
2280         * UIProcess/WebFrameProxy.h:
2281         * UIProcess/WebPageProxy.cpp:
2282         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2283         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2284         (WebKit::WebPageProxy::decidePolicyForResponse):
2285         * UIProcess/WebPageProxy.h:
2286         * WebKit.xcodeproj/project.pbxproj:
2287
2288 2018-08-03  Ryan Haddad  <ryanhaddad@apple.com>
2289
2290         Unreviewed, rolling out r234513.
2291
2292         14 API tests fail the assertions added in this change.
2293
2294         Reverted changeset:
2295
2296         "Check with SafeBrowsing during navigation in WKWebView"
2297         https://bugs.webkit.org/show_bug.cgi?id=188133
2298         https://trac.webkit.org/changeset/234513
2299
2300 2018-08-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2301
2302         [WPE] WebDriver: add support for action commands
2303         https://bugs.webkit.org/show_bug.cgi?id=188301
2304
2305         Reviewed by Žan Doberšek.
2306
2307         WPE doesn't support action commands because the platform specific code for handling events is not implemented.
2308
2309         * SourcesWPE.txt: Add new file to compilation.
2310         * UIProcess/API/glib/WebKitUIClient.cpp: Use the drawing area size as window size in WPE.
2311         * UIProcess/API/wpe/PageClientImpl.cpp:
2312         (WebKit::PageClientImpl::viewBackend): Return the WPE backend of the view.
2313         * UIProcess/API/wpe/PageClientImpl.h:
2314         * UIProcess/Automation/WebAutomationSession.cpp:
2315         (WebKit::WebAutomationSession::performMouseInteraction):
2316         (WebKit::WebAutomationSession::performKeyboardInteractions):
2317         (WebKit::WebAutomationSession::performInteractionSequence):
2318         (WebKit::WebAutomationSession::cancelInteractionSequence):
2319         * UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp: Added.
2320         (WebKit::modifiersToEventState):
2321         (WebKit::mouseButtonToWPEButton):
2322         (WebKit::stateModifierForWPEButton):
2323         (WebKit::doMouseEvent):
2324         (WebKit::doMotionEvent):
2325         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
2326         (WebKit::doKeyStrokeEvent):
2327         (WebKit::keyCodeForVirtualKey):
2328         (WebKit::modifiersForKeyCode):
2329         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
2330         (WebKit::WebAutomationSession::platformSimulateKeySequence):
2331         * UIProcess/WebPageProxy.h:
2332         * UIProcess/wpe/WebPageProxyWPE.cpp:
2333         (WebKit::WebPageProxy::viewBackend): Return the WPE backend.
2334
2335 2018-08-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2336
2337         [WPE] Implement MouseEvent.buttons
2338         https://bugs.webkit.org/show_bug.cgi?id=187998
2339
2340         Reviewed by Žan Doberšek.
2341
2342         Pass buttons currently pressed to WebMouseEvent.
2343
2344         * Shared/wpe/WebEventFactory.cpp:
2345         (WebKit::pressedMouseButtons): Helper to get the pressed buttons mask for the WPE modifiers.
2346         (WebKit::WebEventFactory::createWebMouseEvent): Use pressedMouseButtons().
2347         * UIProcess/API/wpe/PageClientImpl.cpp:
2348         (WebKit::PageClientImpl::doneWithTouchEvent): Update the event modifiers.
2349
2350 2018-08-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2351
2352         [WPE] Use WPE key symbols and new API instead of xkbcommon and the key mapper
2353         https://bugs.webkit.org/show_bug.cgi?id=188093
2354
2355         Reviewed by Žan Doberšek.
2356
2357         * Shared/WebEvent.h: Add WebKeyboardEvent constructor for WPE.
2358         * Shared/WebKeyboardEvent.cpp:
2359         (WebKit::WebKeyboardEvent::WebKeyboardEvent): WebKeyboardEvent constructor for WPE.
2360         * Shared/wpe/WebEventFactory.cpp:
2361         (WebKit::isWPEKeyCodeFromKeyPad): Helper tpo check if a key symbols is from key pad.
2362         (WebKit::WebEventFactory::createWebKeyboardEvent): Use PlatformKeyboardEvent API to provide key code, hardware
2363         key code, key identifier and windows key code to WebKeyboardEvent.
2364         * UIProcess/API/wpe/WPEView.cpp:
2365         (WKWPE::m_backend): Use WPE key symbols.
2366
2367 2018-08-02  Tim Horton  <timothy_horton@apple.com>
2368
2369         PDFPlugin: Context menus in RTL are left-aligned
2370         https://bugs.webkit.org/show_bug.cgi?id=188292
2371         <rdar://problem/32293787>
2372
2373         Reviewed by Simon Fraser.
2374
2375         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h:
2376         Add some SPI.
2377
2378         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2379         (WebKit::PDFPlugin::handleContextMenuEvent):
2380         Translate UI layout direction back into the platform enum, and pass it to PDFKit.
2381
2382         * WebProcess/WebPage/WebPage.h:
2383         (WebKit::WebPage::userInterfaceLayoutDirection const):
2384         Add a getter for UI layout direction.
2385
2386 2018-08-02  Chris Dumez  <cdumez@apple.com>
2387
2388         Regression(r234486): assertion hit in ~CallbackAggregator()
2389         https://bugs.webkit.org/show_bug.cgi?id=188283
2390         <rdar://problem/42851342>
2391
2392         Reviewed by Alex Christensen.
2393
2394         [NSHTTPCookieStorage _saveCookies:] SPI may call its completion block on the background queue
2395         so we need to make sure we dispatch back to the main thread before calling our completion
2396         handler.
2397
2398         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2399         (WebKit::saveCookies):
2400         (WebKit::NetworkProcess::platformSyncAllCookies):
2401
2402 2018-08-02  Alex Christensen  <achristensen@webkit.org>
2403
2404         Fix some builds after r234516
2405         ​https://bugs.webkit.org/show_bug.cgi?id=188250
2406
2407         * Platform/IPC/ArgumentCoders.h:
2408         This assertion was comparing integers of different signs.
2409         Since we don't allow exception throwing in WebKit, valueless_by_exception won't be true,
2410         so this assertion will always be true.  I'll just remove it.
2411
2412 2018-08-02  Sihui Liu  <sihui_liu@apple.com>
2413
2414         httpCookieStore.getAllCookies() does not always call completion block
2415         https://bugs.webkit.org/show_bug.cgi?id=188242
2416
2417         Reviewed by Chris Dumez.
2418
2419         Take background assertion for network process to keep it alive during cookieStore API calls.
2420
2421         * UIProcess/GenericCallback.h:
2422         * UIProcess/WebCookieManagerProxy.cpp:
2423         (WebKit::WebCookieManagerProxy::getHostnamesWithCookies):
2424         (WebKit::WebCookieManagerProxy::deleteCookie):
2425         (WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince):
2426         (WebKit::WebCookieManagerProxy::setCookie):
2427         (WebKit::WebCookieManagerProxy::setCookies):
2428         (WebKit::WebCookieManagerProxy::getAllCookies):
2429         (WebKit::WebCookieManagerProxy::getCookies):
2430         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
2431         (WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy):
2432
2433 2018-08-02  Sihui Liu  <sihui_liu@apple.com>
2434
2435         [Cocoa] setCookie API fails to set session cookies for defaultDataStore if processPool created but not used
2436         https://bugs.webkit.org/show_bug.cgi?id=188209
2437
2438         Reviewed by Geoffrey Garen.
2439
2440         If defaultDataStore is already created when launching network process, it means user 
2441         probably set cookies for default session via API, so we should update m_websiteDataStore to 
2442         make sure pendingCookies is passed to network process.
2443
2444         * UIProcess/WebProcessPool.cpp:
2445         (WebKit::WebProcessPool::ensureNetworkProcess):
2446
2447 2018-08-02  Alex Christensen  <achristensen@webkit.org>
2448
2449         Use WTF::Variant for WebPreferencesStore::Value
2450         https://bugs.webkit.org/show_bug.cgi?id=188250
2451
2452         Reviewed by Sam Weinig.
2453
2454         It was conceptually a variant. This just uses an actual WTF::Variant.
2455         Since it's encoded and decoded, I wrote variadic template encoders and decoders
2456         like we have for other types (Expected, std::tuple, KeyValuePair, etc.)
2457
2458         * Platform/IPC/ArgumentCoders.h:
2459         (IPC::VariantCoder::encode):
2460         (IPC::VariantCoder::decode):
2461         Introduce ArgumentCoder<Variant>, which encodes which type the Variant currently
2462         holds followed by the encoding of the current type.
2463         * Platform/IPC/Decoder.cpp:
2464         (IPC::Decoder::Decoder):
2465         * Platform/IPC/Decoder.h:
2466         * Platform/IPC/mac/ConnectionMac.mm:
2467         (IPC::createMessageDecoder):
2468         Use move semantics to prevent an unnecessary copy of the Vector<Attachment>
2469         * Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb:
2470         * Shared/WebPreferencesStore.cpp:
2471         (WebKit::WebPreferencesStore::decode):
2472         Use modern std::optional-based decoding supported by the new Variant decoding.
2473         (WebKit::valueForKey):
2474         Use WTF::get and WTF::holds_alternative instead of custom type checks.
2475         (WebKit::WebPreferencesStore::Value::encode const): Deleted.
2476         (WebKit::WebPreferencesStore::Value::decode): Deleted.
2477         (WebKit::as<String>): Deleted.
2478         (WebKit::as<bool>): Deleted.
2479         (WebKit::as<uint32_t>): Deleted.
2480         (WebKit::as<double>): Deleted.
2481         * Shared/WebPreferencesStore.h:
2482         (WebKit::WebPreferencesStore::Value::Value): Deleted.
2483         (WebKit::WebPreferencesStore::Value::operator=): Deleted.
2484         (WebKit::WebPreferencesStore::Value::~Value): Deleted.
2485         (WebKit::WebPreferencesStore::Value::type const): Deleted.
2486         (WebKit::WebPreferencesStore::Value::asString const): Deleted.
2487         (WebKit::WebPreferencesStore::Value::asBool const): Deleted.
2488         (WebKit::WebPreferencesStore::Value::asUInt32 const): Deleted.
2489         (WebKit::WebPreferencesStore::Value::asDouble const): Deleted.
2490         (WebKit::WebPreferencesStore::Value::destroy): Deleted.
2491         (): Deleted.
2492         Use WTF::Variant instead of a custom type/union pair.
2493
2494 2018-08-02  Alex Christensen  <achristensen@webkit.org>
2495
2496         Check with SafeBrowsing during navigation in WKWebView
2497         https://bugs.webkit.org/show_bug.cgi?id=188133
2498
2499         Reviewed by Chris Dumez.
2500
2501         This turns WebFramePolicyListenerProxy into an object that now listens for the results
2502         of two processes happening in parallel: the API::NavigationClient's decidePolicyForNavigation{Action, Response}
2503         (which it was already waiting for) and, on platforms that support it, the SafariSafeBrowsing framework's check.
2504         The first result is stored as it waits for the second result unless the first result is the API::NavigationClient
2505         saying to cancel or convert the navigation to a download, in which cases we don't care what the safe browsing
2506         framework results are because we won't show the URL in the browser.
2507
2508         Nothing is done with the safe browsing results yet.
2509
2510         * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Added.
2511         (WebKit::SafeBrowsingResult::SafeBrowsingResult):
2512         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2513         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
2514         * UIProcess/SafeBrowsingResult.h: Added.
2515         (WebKit::SafeBrowsingResult::provider const):
2516         (WebKit::SafeBrowsingResult::isPhishing const):
2517         (WebKit::SafeBrowsingResult::isMalware const):
2518         (WebKit::SafeBrowsingResult::isUnwantedSoftware const):
2519         (WebKit::SafeBrowsingResult::isKnownToBeUnsafe const):
2520         * UIProcess/WebFramePolicyListenerProxy.cpp:
2521         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
2522         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
2523         (WebKit::WebFramePolicyListenerProxy::use):
2524         (WebKit::WebFramePolicyListenerProxy::download):
2525         (WebKit::WebFramePolicyListenerProxy::ignore):
2526         * UIProcess/WebFramePolicyListenerProxy.h:
2527         (WebKit::WebFramePolicyListenerProxy::create):
2528         * UIProcess/WebFrameProxy.cpp:
2529         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
2530         * UIProcess/WebFrameProxy.h:
2531         * UIProcess/WebPageProxy.cpp:
2532         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2533         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2534         (WebKit::WebPageProxy::decidePolicyForResponse):
2535         * UIProcess/WebPageProxy.h:
2536         * WebKit.xcodeproj/project.pbxproj:
2537
2538 2018-08-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2539
2540         [iOS] Keyboard becomes unresponsive after pressing delete while pressing down on a character key with accents
2541         https://bugs.webkit.org/show_bug.cgi?id=188251
2542         <rdar://problem/37842108>
2543
2544         Reviewed by Tim Horton.
2545
2546         Fixes a bug in key event handling where invoking -handleKeyWebEvent:withCompletionHandler: from within the
2547         completion callback of a previous call to -handleKeyWebEvent:withCompletionHandler: would cause the completion
2548         callback to be cleared out prematurely. In some cases (as described in the title of this bug), UIKit exercises
2549         this codepath and subsequently hangs due to their completion block never getting invoked by WebKit.
2550
2551         Test: KeyboardInputTests.CanHandleKeyEventInCompletionHandler
2552
2553         * UIProcess/ios/WKContentViewInteraction.h:
2554         * UIProcess/ios/WKContentViewInteraction.mm:
2555         (-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
2556         (-[WKContentView _didHandleKeyEvent:eventWasHandled:]):
2557
2558 2018-08-01  Dan Bernstein  <mitz@apple.com>
2559
2560         Optionally expose Attr::style to JavaScript
2561         https://bugs.webkit.org/show_bug.cgi?id=188226
2562         <rdar://problem/42818113>
2563
2564         Reviewed by Darin Adler.
2565
2566         * Shared/WebProcessCreationParameters.cpp:
2567         (WebKit::WebProcessCreationParameters::encode const): Encode new attrStyleEnabled member.
2568         (WebKit::WebProcessCreationParameters::decode): Decode new attrStyleEnabled member.
2569         * Shared/WebProcessCreationParameters.h: Define new attrStyleEnabled member, initialized to
2570           false.
2571
2572         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2573         (API::ProcessPoolConfiguration::copy): Copy new m_attrStyleEnabled member.
2574         * UIProcess/API/APIProcessPoolConfiguration.h: Define new m_attrStyleEnabled member.
2575
2576         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: Declare new attrStyleEnabled boolean
2577           property.
2578         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2579         (-[_WKProcessPoolConfiguration attrStyleEnabled]): New accessor.
2580         (-[_WKProcessPoolConfiguration setAttrStyleEnabled:]): Ditto.
2581
2582         * UIProcess/WebProcessPool.cpp:
2583         (WebKit::WebProcessPool::initializeNewWebProcess): Initialize parameters.attrStyleEnabled
2584           from the configuration.
2585
2586         * WebProcess/WebProcess.cpp:
2587         (WebKit::WebProcess::initializeWebProcess): Set the attrStyleEnabled runtime feature based
2588           on the creation parameters.
2589
2590 2018-08-02  David Fenton  <david_fenton@apple.com>
2591
2592         Unreviewed, rolling out r234489.
2593
2594         Caused 50+ crashes and 60+ API failures on iOS
2595
2596         Reverted changeset:
2597
2598         "[WTF] Rename String::format to String::deprecatedFormat"
2599         https://bugs.webkit.org/show_bug.cgi?id=188191
2600         https://trac.webkit.org/changeset/234489
2601
2602 2018-08-01  Tomas Popela  <tpopela@redhat.com>
2603
2604         [WTF] Rename String::format to String::deprecatedFormat
2605         https://bugs.webkit.org/show_bug.cgi?id=188191
2606
2607         Reviewed by Darin Adler.
2608
2609         It should be replaced with string concatenation.
2610
2611         * NetworkProcess/soup/NetworkProcessSoup.cpp:
2612         (WebKit::buildAcceptLanguages):
2613         * Platform/IPC/win/ConnectionWin.cpp:
2614         (IPC::Connection::createServerAndClientIdentifiers):
2615         * Shared/WebMemorySampler.cpp:
2616         (WebKit::WebMemorySampler::writeHeaders):
2617         * Shared/win/WebEventFactory.cpp:
2618         (WebKit::keyIdentifierFromEvent):
2619         * Shared/wpe/WebEventFactory.cpp:
2620         (WebKit::identifierStringForKeyEvent):
2621         * UIProcess/API/APINavigation.cpp:
2622         (API::Navigation::loggingString const):
2623         * UIProcess/API/glib/IconDatabase.cpp:
2624         (WebKit::IconDatabase::performURLImport):
2625         * UIProcess/Cocoa/ViewGestureController.cpp:
2626         (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog):
2627         * UIProcess/SuspendedPageProxy.cpp:
2628         (WebKit::SuspendedPageProxy::loggingString const):
2629         * UIProcess/WebBackForwardList.cpp:
2630         (WebKit::WebBackForwardList::loggingString):
2631         * UIProcess/WebInspectorUtilities.cpp:
2632         (WebKit::inspectorPageGroupIdentifierForPage):
2633         * UIProcess/WebProcessPool.cpp:
2634         (WebKit::WebProcessPool::processDidFinishLaunching):
2635         (WebKit::WebProcessPool::startMemorySampler):
2636         * UIProcess/gtk/InputMethodFilter.cpp:
2637         (WebKit::InputMethodFilter::logHandleKeyboardEventForTesting):
2638         (WebKit::InputMethodFilter::logHandleKeyboardEventWithCompositionResultsForTesting):
2639         (WebKit::InputMethodFilter::logConfirmCompositionForTesting):
2640         (WebKit::InputMethodFilter::logSetPreeditForTesting):
2641
2642 2018-08-01  Tim Horton  <timothy_horton@apple.com>
2643
2644         Using the keyboard arrow keys to scroll a webpage is very slow, not smooth, takes too long
2645         https://bugs.webkit.org/show_bug.cgi?id=188239
2646         <rdar://problem/22997654>
2647
2648         Reviewed by Simon Fraser.
2649
2650         Instead of depending on key repeat to drive scrolling with arrow keys held down,
2651         run a display link that animates the scroll. We still do a single discrete scroll
2652         first (so that you can tap the key and shift by line/page), but then on the first
2653         repeat we ramp up to a constant velocity determined by the desired increment,
2654         stopping when the key is lifted or a different key is pressed.
2655
2656         * UIProcess/API/Cocoa/WKWebView.mm:
2657         (-[WKWebView _scrollByContentOffset:animated:]):
2658         (-[WKWebView _scrollByContentOffset:]): Deleted.
2659         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2660         Add animated parameter to scrollByContentOffset, and plumb it through to UIScrollView.
2661
2662         * UIProcess/ios/WKContentViewInteraction.h:
2663         Add a WKKeyboardScrollingAnimator member.
2664         Conform to WKKeyboardScrollable.
2665
2666         * UIProcess/ios/WKContentViewInteraction.mm:
2667         (-[WKContentView setupInteraction]):
2668         Install the WKKeyboardScrollingAnimator.
2669
2670         (-[WKContentView cleanupInteraction]):
2671         Uninstall the WKKeyboardScrollingAnimator.
2672
2673         (-[WKContentView unscaledView]):
2674         Fix a stupid style nit.
2675
2676         (-[WKContentView handleKeyWebEvent:]):
2677         Give WKKeyboardScrollingAnimator the first shot at incoming keyboard events.
2678         It will only consume events here if it's already performing a scrolling animation
2679         (because otherwise they should go straight through to the page).
2680
2681         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
2682         Give WKKeyboardScrollingAnimator a shot at handling keyboard events that
2683         the web content did not handle. We will only start a scrolling animation
2684         if the page did not handle an event that would start a scroll.
2685
2686         (-[WKContentView isKeyboardScrollable]):
2687         Part of WKKeyboardScrollable; only report ourselves as scrollable if
2688         we would previously have allowed scrolling from keyboard events (if
2689         we're not in contenteditable, and don't have a <select> focused).
2690
2691         (-[WKContentView distanceForScrollingIncrement:]):
2692         Part of WKKeyboardScrollable; compute the distance for each scrolling increment.
2693
2694         (-[WKContentView scrollByContentOffset:animated:]):
2695         Part of WKKeyboardScrollable; plumb scrolls up to WKWebView.
2696
2697         (-[WKContentView _scrollOffsetForEvent:]): Moved to WKKeyboardScrollingAnimator.mm.
2698
2699         * UIProcess/ios/WKKeyboardScrollingAnimator.h: Added.
2700         * UIProcess/ios/WKKeyboardScrollingAnimator.mm: Added.
2701         (-[WKKeyboardScrollingAnimator init]):
2702         (-[WKKeyboardScrollingAnimator initWithScrollable:]):
2703         (-[WKKeyboardScrollingAnimator invalidate]):
2704         (-[WKKeyboardScrollingAnimator _scrollOffsetForEvent:]):
2705         Compute the scroll offset given a particular event. This is moved from WKContentView;
2706         otherwise the primary change is that it now asks the WKKeyboardScrollable
2707         for the distance instead of computing it directly.
2708
2709         (-[WKKeyboardScrollingAnimator beginWithEvent:]):
2710         If we're currently in the initial state (WaitingForFirstEvent), and
2711         a given event should start a scroll, transition into WaitingForRepeat,
2712         and do a single animated scroll of the appropriate distance.
2713
2714         (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
2715         If this key event should terminate a scroll (because it is either a keyup
2716         or a non-scrolling keydown), shut down any running animations.
2717
2718         If this is the first key repeat after the initial scroll, start a scrolling
2719         animation.
2720
2721         Eat the event if it either started or continued a scroll.
2722
2723         (-[WKKeyboardScrollingAnimator startAnimatedScroll]):
2724         (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
2725         Helpers to start and stop the display link and do some bookkeeping.
2726
2727         (-[WKKeyboardScrollingAnimator displayLinkFired:]):
2728         Ask the WKKeyboardScrollable to scroll the content based on the frame time,
2729         an acceleration curve, and the current animation's scrolling increment.
2730
2731         * WebKit.xcodeproj/project.pbxproj:
2732
2733 2018-08-01  Chris Dumez  <cdumez@apple.com>
2734
2735         Make sure cookies get flushed to disk before exiting or suspending the network process
2736         https://bugs.webkit.org/show_bug.cgi?id=188241
2737         <rdar://problem/42831831>
2738
2739         Reviewed by Alex Christensen and Geoffrey Garen.
2740
2741         Make sure cookies get flushed to disk before exiting or suspending the network process,
2742         to make sure they do not get lost.
2743
2744         * NetworkProcess/NetworkProcess.cpp:
2745         (WebKit::NetworkProcess::didClose):
2746         (WebKit::NetworkProcess::actualPrepareToSuspend):
2747         (WebKit::NetworkProcess::platformSyncAllCookies):
2748         * NetworkProcess/NetworkProcess.h:
2749         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2750         (WebKit::NetworkProcess::syncAllCookies):
2751         (WebKit::NetworkProcess::platformSyncAllCookies):
2752         * Shared/ChildProcess.cpp:
2753         (WebKit::ChildProcess::didClose):
2754         (WebKit::callExitNow):
2755         (WebKit::callExitSoon):
2756         (WebKit::ChildProcess::initialize):
2757         (WebKit::didCloseOnConnectionWorkQueue): Deleted.
2758         * Shared/ChildProcess.h:
2759         (WebKit::ChildProcess::shouldCallExitWhenConnectionIsClosed const):
2760
2761 2018-08-01  Alex Christensen  <achristensen@webkit.org>
2762
2763         Move all calls to ResourceLoader::start to WebKitLegacy
2764         https://bugs.webkit.org/show_bug.cgi?id=184946
2765
2766         Reviewed by Andy Estes.
2767
2768         * WebProcess/Network/WebLoaderStrategy.cpp:
2769         (WebKit::WebLoaderStrategy::setDefersLoading):
2770         * WebProcess/Network/WebLoaderStrategy.h:
2771
2772 2018-08-01  Nan Wang  <n_wang@apple.com>
2773
2774         AX: AOM: Add ARIA IDL Attribute Reflection
2775         https://bugs.webkit.org/show_bug.cgi?id=184676
2776         <rdar://problem/39476882>
2777
2778         Added ARIA property string reflection on Element, behind
2779         a new runtime flag. 
2780         Spec: https://w3c.github.io/aria/#idl-interface
2781
2782         Reviewed by Chris Fleizach.
2783
2784         * Shared/WebPreferences.yaml:
2785         * UIProcess/API/C/WKPreferences.cpp:
2786         (WKPreferencesSetAriaReflectionEnabled):
2787         (WKPreferencesGetAriaReflectionEnabled):
2788         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2789
2790 2018-08-01  Alex Christensen  <achristensen@webkit.org>
2791
2792         Allow WebFramePolicyListenerProxy to be used multiple times
2793         https://bugs.webkit.org/show_bug.cgi?id=188229
2794
2795         Reviewed by Chris Dumez.
2796
2797         This fixes a regression from r234210 in clients that misuse the API.
2798
2799         * UIProcess/WebFramePolicyListenerProxy.cpp:
2800         (WebKit::WebFramePolicyListenerProxy::use):
2801         (WebKit::WebFramePolicyListenerProxy::download):
2802         (WebKit::WebFramePolicyListenerProxy::ignore):
2803
2804 2018-08-01  Aditya Keerthi  <akeerthi@apple.com>
2805
2806         [iOS] Color picker should have a border when presented in a popover
2807         https://bugs.webkit.org/show_bug.cgi?id=188207
2808
2809         Reviewed by Wenson Hsieh.
2810
2811         The color picker should have a border when presented in a popover. This matches
2812         the behavior of color pickers in other parts of iOS.
2813
2814         Since the popover will resize its view to fill its size, we first place the
2815         color picker in a container view. The container view can then fill the popover,
2816         while the smaller color picker is centered in it's container - creating the
2817         appearance of a border.
2818
2819         * UIProcess/ios/forms/WKFormColorControl.mm:
2820         (-[WKColorPopover initWithView:]):
2821         * UIProcess/ios/forms/WKFormColorPicker.mm:
2822
2823 2018-08-01  Commit Queue  <commit-queue@webkit.org>
2824
2825         Unreviewed, rolling out r234443 and r234445.
2826         https://bugs.webkit.org/show_bug.cgi?id=188224
2827
2828         Revision caused 3 api failures across all platforms.
2829         (Requested by Truitt on #webkit).
2830
2831         Reverted changesets:
2832
2833         "Add configuration for automatic process pre-warming"
2834         https://bugs.webkit.org/show_bug.cgi?id=187108
2835         https://trac.webkit.org/changeset/234443
2836
2837         "Add configuration for automatic process pre-warming"
2838         https://bugs.webkit.org/show_bug.cgi?id=187108
2839         https://trac.webkit.org/changeset/234445
2840
2841 2018-08-01  Aditya Keerthi  <akeerthi@apple.com>
2842
2843         [iOS] WKColorPicker's selection indicator doesn't always cover the selected swatch
2844         https://bugs.webkit.org/show_bug.cgi?id=188124
2845
2846         Reviewed by Wenson Hsieh.
2847
2848         - On iPhone, the size of an individual color swatch can change on rotation. In
2849         this case, we should resize the selection indicator along with the swatch. Added
2850         a new delegate method to WKColorMatrixViewDelegate to notify the color picker if
2851         the matrix was redrawn. We then resize the selection indicator to match the
2852         selected swatch's size.
2853
2854         - On iPad, the selection indicator should have rounded corners if it's at the
2855         corner of the color picker. Otherwise, part of the indicator will be hidden by
2856         the popover. The selected swatch's position is checked before drawing the
2857         indicator. If it's at one of the four corners of the picker, the appropriate mask
2858         is applied to the color selection indicator's border.
2859
2860         * UIProcess/ios/forms/WKFormColorPicker.h:
2861         * UIProcess/ios/forms/WKFormColorPicker.mm:
2862         (-[WKColorMatrixView layoutSubviews]):
2863         (-[WKColorPicker initWithView:]):
2864         (-[WKColorPicker drawSelectionIndicatorForColorButton:]):
2865         (-[WKColorPicker colorMatrixViewDidLayoutSubviews:]):
2866         (-[WKColorPicker colorMatrixView:didTapColorButton:]):
2867         (-[WKColorPicker didPanColors:]):
2868
2869 2018-08-01  Zan Dobersek  <zdobersek@igalia.com>
2870
2871         [CoordGraphics] Move CoordinatedBackingStore to WebCore
2872         https://bugs.webkit.org/show_bug.cgi?id=188158
2873
2874         Reviewed by Carlos Garcia Campos.
2875
2876         Move the CoordinatedBackingStore class from WebKit to WebCore. It has no
2877         dependency on anything in the WebKit layer, and it's more suitable to
2878         future needs to keep it in the WebCore layer.
2879
2880         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2881         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
2882         * SourcesGTK.txt:
2883         * SourcesWPE.txt:
2884
2885 2018-07-31  Alex Christensen  <achristensen@webkit.org>
2886
2887         REGRESSION (r231107): MoviStar+ launches to a blank black screen
2888         https://bugs.webkit.org/show_bug.cgi?id=188139
2889
2890         Reviewed by Brent Fulgham.
2891
2892         Add infrastructure to check UIProcess SDK from the WebProcess and NetworkProcess for linked-on-or-after checks.
2893
2894         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2895         (WebKit::NetworkProcessCreationParameters::encode const):
2896         (WebKit::NetworkProcessCreationParameters::decode):
2897         * NetworkProcess/NetworkProcessCreationParameters.h:
2898         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2899         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2900         * Shared/WebProcessCreationParameters.cpp:
2901         (WebKit::WebProcessCreationParameters::encode const):
2902         (WebKit::WebProcessCreationParameters::decode):
2903         * Shared/WebProcessCreationParameters.h:
2904         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2905         (WebKit::WebProcessPool::platformInitializeWebProcess):
2906         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2907         * WebProcess/cocoa/WebProcessCocoa.mm:
2908         (WebKit::WebProcess::platformInitializeWebProcess):
2909
2910 2018-07-31  Ryosuke Niwa  <rniwa@webkit.org>
2911
2912         Add configuration for automatic process pre-warming
2913         https://bugs.webkit.org/show_bug.cgi?id=187108
2914
2915         Reviewed by Ryosuke Niwa.
2916
2917         Added the missing availability macros.
2918
2919         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2920
2921 2018-07-31  Ben Richards  <benton_richards@apple.com>
2922
2923         Add configuration for automatic process pre-warming
2924         https://bugs.webkit.org/show_bug.cgi?id=187108
2925
2926         Reviewed by Ryosuke Niwa.
2927
2928         Added configurations to allow setting the maximum number of processes that should be automatically prewarmed.
2929
2930         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2931         (API::ProcessPoolConfiguration::copy):
2932         * UIProcess/API/APIProcessPoolConfiguration.h:
2933         * UIProcess/API/C/WKContext.cpp:
2934         (WKContextSetMaximumNumberOfPrewarmedProcesses):
2935         * UIProcess/API/C/WKContextPrivate.h:
2936         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2937         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2938         (-[_WKProcessPoolConfiguration setMaximumPrewarmedProcessCount:]):
2939         (-[_WKProcessPoolConfiguration maximumPrewarmedProcessCount]):
2940         * UIProcess/WebPageProxy.cpp:
2941         (WebKit::WebPageProxy::didFinishLoadForFrame): Moved call to notifyProcessPoolToPrewarm from didFirstVisuallyNonEmptyLayoutForFrame to here.
2942         This is to try to ensure that frame loading and prewarming don't happen at the same time as this would be heavy for some devices.
2943         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
2944         * UIProcess/WebProcessPool.cpp:
2945         (WebKit::WebProcessPool::setMaximumNumberOfProcesses): Condition changed so that calling setMaximumNumberOfProcesses after warmInitialProcess
2946         doesn't result in a crash.
2947         (WebKit::WebProcessPool::setMaximumNumberOfPrewarmedProcesses):
2948         (WebKit::WebProcessPool::warmInitialProcess):
2949         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
2950         * UIProcess/WebProcessPool.h:
2951
2952 2018-07-31  Stephan Szabo  <stephan.szabo@sony.com>
2953
2954         [WinCairo] <select> elements do not popup options
2955         https://bugs.webkit.org/show_bug.cgi?id=188172
2956
2957         Reviewed by Fujii Hironori.
2958
2959         * PlatformWin.cmake: Add WebPopupMenuProxyWin
2960         * Shared/PlatformPopupMenuData.cpp:
2961         (WebKit::PlatformPopupMenuData::encode const): Encode
2962         windows parameters
2963         (WebKit::PlatformPopupMenuData::decode): Decode windows
2964         parameters
2965         * Shared/PlatformPopupMenuData.h: Add the windows specific
2966         parameters (based on removed Windows implementation)
2967         * UIProcess/win/PageClientImpl.cpp:
2968         (WebKit::PageClientImpl::createPopupMenuProxy):
2969         * UIProcess/win/WebPopupMenuProxyWin.cpp: Added. (based on
2970         removed Windows implementation plus some fixes/api changes
2971         since the removal)
2972         (WebKit::isASCIIPrintable):
2973         (WebKit::translatePoint):
2974         (WebKit::WebPopupMenuProxyWin::WebPopupMenuProxyWndProc):
2975         (WebKit::WebPopupMenuProxyWin::wndProc):
2976         (WebKit::WebPopupMenuProxyWin::registerWindowClass):
2977         (WebKit::WebPopupMenuProxyWin::WebPopupMenuProxyWin):
2978         (WebKit::WebPopupMenuProxyWin::~WebPopupMenuProxyWin):
2979         (WebKit::WebPopupMenuProxyWin::showPopupMenu):
2980         (WebKit::WebPopupMenuProxyWin::hidePopupMenu):
2981         (WebKit::WebPopupMenuProxyWin::calculatePositionAndSize):
2982         (WebKit::WebPopupMenuProxyWin::clientRect const):
2983         (WebKit::WebPopupMenuProxyWin::invalidateItem):
2984         (WebKit::WebPopupMenuProxyWin::scrollSize const):
2985         (WebKit::WebPopupMenuProxyWin::setScrollOffset):
2986         (WebKit::WebPopupMenuProxyWin::visibleSize const):
2987         (WebKit::WebPopupMenuProxyWin::contentsSize const):
2988         (WebKit::WebPopupMenuProxyWin::scrollableAreaBoundingBox const):
2989         (WebKit::WebPopupMenuProxyWin::scrollTo):
2990         (WebKit::WebPopupMenuProxyWin::invalidateScrollbarRect):
2991         (WebKit::WebPopupMenuProxyWin::onMouseActivate):
2992         (WebKit::WebPopupMenuProxyWin::onSize):
2993         (WebKit::WebPopupMenuProxyWin::onKeyDown):
2994         (WebKit::WebPopupMenuProxyWin::onChar):
2995         (WebKit::WebPopupMenuProxyWin::onMouseMove):
2996         (WebKit::WebPopupMenuProxyWin::onLButtonDown):
2997         (WebKit::WebPopupMenuProxyWin::onLButtonUp):
2998         (WebKit::WebPopupMenuProxyWin::onMouseWheel):
2999         (WebKit::WebPopupMenuProxyWin::onPaint):
3000         (WebKit::WebPopupMenuProxyWin::onPrintClient):
3001         (WebKit::WebPopupMenuProxyWin::down):
3002         (WebKit::WebPopupMenuProxyWin::up):
3003         (WebKit::WebPopupMenuProxyWin::paint):
3004         (WebKit::WebPopupMenuProxyWin::setFocusedIndex):
3005         (WebKit::WebPopupMenuProxyWin::visibleItems const):
3006         (WebKit::WebPopupMenuProxyWin::listIndexAtPoint const):
3007         (WebKit::WebPopupMenuProxyWin::focusedIndex const):
3008         (WebKit::WebPopupMenuProxyWin::focusFirst):
3009         (WebKit::WebPopupMenuProxyWin::focusLast):
3010         (WebKit::WebPopupMenuProxyWin::incrementWheelDelta):
3011         (WebKit::WebPopupMenuProxyWin::reduceWheelDelta):
3012         (WebKit::WebPopupMenuProxyWin::scrollToRevealSelection):
3013         * UIProcess/win/WebPopupMenuProxyWin.h: Added. (based on
3014         removed Windows implementation plus some fixes/api changes
3015         since then)
3016         (WebKit::WebPopupMenuProxyWin::create):
3017         (WebKit::WebPopupMenuProxyWin::hide):
3018         (WebKit::WebPopupMenuProxyWin::scrollbar const):
3019         (WebKit::WebPopupMenuProxyWin::itemHeight const):
3020         (WebKit::WebPopupMenuProxyWin::windowRect const):
3021         (WebKit::WebPopupMenuProxyWin::wheelDelta const):
3022         (WebKit::WebPopupMenuProxyWin::setWasClicked):
3023         (WebKit::WebPopupMenuProxyWin::wasClicked const):
3024         (WebKit::WebPopupMenuProxyWin::scrollbarCapturingMouse const):
3025         (WebKit::WebPopupMenuProxyWin::setScrollbarCapturingMouse):
3026         * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp:
3027         (WebKit::WebPopupMenu::setUpPlatformData): Make the data to
3028         pass between processes.
3029
3030 2018-07-31  John Wilander  <wilander@apple.com>
3031
3032         Resource Load Statistics: Remove partitioned cookies for reduced complexity, lower memory footprint, and ability to support more platforms
3033         https://bugs.webkit.org/show_bug.cgi?id=188109
3034         <rdar://problem/42664391>
3035
3036         Reviewed by Brent Fulgham, Chris Dumez, and Alex Christensen.
3037
3038         This patch removes cookie partitioning which reduces the model to just
3039         blocked cookies (in third-party contexts) and first-party cookie access.
3040
3041         Several of the changes are renaming to reflect that there are no more
3042         cookie partitions. However, the compile-time check remains for now since
3043         this change is not ready to ship.
3044
3045         The API changes are mostly in C APIs used for layout tests. The slight
3046         change in Cocoa API is that there no longer is a functionality to
3047         "enable" cookie partitioning. The boolean member is still there but it
3048         no longer does anything.
3049
3050         The functional changes are in WebKit::ResourceLoadStatisticsMemoryStore
3051         and WebKit::NetworkDataTaskCocoa where cookie partitioning used to be
3052         managed and applied respectively. The IPC communication has changed to
3053         reflect this.
3054
3055         * NetworkProcess/NetworkProcess.cpp:
3056         (WebKit::NetworkProcess::updatePrevalentDomainsToBlockCookiesFor):
3057             Name change from updatePrevalentDomainsToPartitionOrBlockCookies().
3058             No longer supports the partitioned category.
3059         (WebKit::NetworkProcess::removeAllStorageAccess):
3060             Now supports a completion handler. This change was made to address
3061             flakiness that came after layout test changes that were needed because
3062             of the removal of partitioned cookies.
3063         (WebKit::NetworkProcess::updatePrevalentDomainsToPartitionOrBlockCookies): Deleted.
3064         * NetworkProcess/NetworkProcess.h:
3065         * NetworkProcess/NetworkProcess.messages.in:
3066             Partitioning removed from message name.
3067             RemoveAllStorageAccess message now supports a completion handler
3068             as explained above
3069         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3070         (WebKit::NetworkProcessCreationParameters::encode const):
3071             Removed parameter cookieStoragePartitioningEnabled.
3072         (WebKit::NetworkProcessCreationParameters::decode):
3073             Removed parameter cookieStoragePartitioningEnabled.
3074         * NetworkProcess/NetworkProcessCreationParameters.h:
3075         * NetworkProcess/NetworkResourceLoader.cpp:
3076         (WebKit::NetworkResourceLoader::logCookieInformation):
3077             No longer takes partitioning into account.
3078         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
3079         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3080         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
3081             Now only applies cookie blocking.
3082         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
3083             Now only applies cookie blocking.
3084         (WebKit::NetworkDataTaskCocoa::applyCookiePartitioningPolicy): Deleted.
3085         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3086         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
3087             Removed the call to setCookieStoragePartitioningEnabled().
3088         (WebKit::NetworkProcess::setCookieStoragePartitioningEnabled): Deleted.
3089         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3090         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
3091         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
3092             WebCore::NetworkStorageSession::shouldBlockCookies() now takes a
3093             frame ID and page ID to resolve cookie access with the Storage
3094             Access API. This was previously handled by
3095             WebCore::NetworkStorageSession::cookieStoragePartition().
3096         * UIProcess/API/C/WKCookieManager.cpp:
3097         (WKCookieManagerSetCookieStoragePartitioningEnabled): Deleted.
3098         * UIProcess/API/C/WKCookieManager.h:
3099         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3100         (WKWebsiteDataStoreStatisticsUpdateCookieBlocking):
3101         (WKWebsiteDataStoreSetStatisticsHasHadNonRecentUserInteraction): Deleted.
3102             There is no longer a difference between recent and non-recent
3103             user interaction so this test function was removed.
3104         (WKWebsiteDataStoreSetStatisticsTimeToLiveCookiePartitionFree): Deleted.
3105         (WKWebsiteDataStoreStatisticsUpdateCookiePartitioning): Deleted.
3106         (WKWebsiteDataStoreSetStatisticsShouldPartitionCookiesForHost): Deleted.
3107             Deleted because partitioning is no longer a thing.
3108         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3109         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3110             Deprecated _isCookieStoragePartitioningEnabled() and
3111             _setCookieStoragePartitioningEnabled() via WK_API_DEPRECATED.
3112         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
3113         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
3114             Removed support for ResourceLoadStatisticsTimeToLiveCookiePartitionFree.
3115         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3116         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3117             No longer sets a parameter based on cookieStoragePartitioningEnabled().
3118         (WebKit::WebProcessPool::setCookieStoragePartitioningEnabled):
3119             Added a FIXME comment that this setter no longer does anything meaningful.
3120             Removed the IPC call to the network process to propagate the setting.
3121         * UIProcess/Network/NetworkProcessProxy.cpp:
3122         (WebKit::NetworkProcessProxy::clearCallbackStates):
3123             Name change from m_updatePartitionOrBlockCookiesCallbackMap to
3124             m_updateBlockCookiesCallbackMap.
3125         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
3126             Name change plus it now just takes one vector of strings named domainsToBlock.
3127         (WebKit::NetworkProcessProxy::didUpdateBlockCookies):
3128             Name change from didUpdatePartitionOrBlockCookies().
3129         (WebKit::NetworkProcessProxy::storageAccessRequestResult):
3130             Just moved to its right place.
3131         (WebKit::NetworkProcessProxy::removeAllStorageAccess):
3132             Now take a completion handler.
3133         (WebKit::NetworkProcessProxy::didRemoveAllStorageAccess):
3134             To call the completion handler.
3135         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToPartitionOrBlockCookies): Deleted.
3136             Name change.
3137         (WebKit::NetworkProcessProxy::didUpdatePartitionOrBlockCookies): Deleted.
3138             Name change.
3139         * UIProcess/Network/NetworkProcessProxy.h:
3140         * UIProcess/Network/NetworkProcessProxy.messages.in:
3141             Name change and added completion handler message for removeAllStorageAccess().
3142         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
3143         (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
3144         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
3145         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
3146         (WebKit::ResourceLoadStatisticsMemoryStore::scheduleStatisticsProcessingRequestIfNecessary):
3147         (WebKit::ResourceLoadStatisticsMemoryStore::logUserInteraction):
3148         (WebKit::ResourceLoadStatisticsMemoryStore::mergeWithDataFromDecoder):
3149         (WebKit::ResourceLoadStatisticsMemoryStore::clear):
3150         (WebKit::ResourceLoadStatisticsMemoryStore::wasAccessedAsFirstPartyDueToUserInteraction const):
3151         (WebKit::ResourceLoadStatisticsMemoryStore::shouldBlockAndKeepCookies):
3152         (WebKit::ResourceLoadStatisticsMemoryStore::shouldBlockAndPurgeCookies):
3153         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking):
3154         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlockingForDomains):
3155         (WebKit::ResourceLoadStatisticsMemoryStore::clearBlockingStateForDomains):
3156         (WebKit::ResourceLoadStatisticsMemoryStore::resetCookieBlockingState):
3157         (WebKit::ResourceLoadStatisticsMemoryStore::removeAllStorageAccess):
3158         (WebKit::ResourceLoadStatisticsMemoryStore::logNonRecentUserInteraction): Deleted.
3159             There is no longer a difference between recent and non-recent
3160             user interaction so this test function was removed.
3161         (WebKit::ResourceLoadStatisticsMemoryStore::setTimeToLiveCookiePartitionFree): Deleted.
3162         (WebKit::ResourceLoadStatisticsMemoryStore::shouldPartitionCookies): Deleted.
3163         (WebKit::ResourceLoadStatisticsMemoryStore::shouldBlockCookies): Deleted.
3164             Now split into shouldBlockAndKeepCookies() and shouldBlockAndPurgeCookies().
3165         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookiePartitioning): Deleted.
3166         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookiePartitioningForDomains): Deleted.
3167         (WebKit::ResourceLoadStatisticsMemoryStore::clearPartitioningStateForDomains): Deleted.
3168         (WebKit::ResourceLoadStatisticsMemoryStore::resetCookiePartitioningState): Deleted.
3169         * UIProcess/ResourceLoadStatisticsMemoryStore.h:
3170         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
3171         (WebKit::ResourceLoadStatisticsPersistentStorage::startMonitoringDisk):
3172             Added an empty completion handler to the m_memoryStore.clear() call.
3173         * UIProcess/WebCookieManagerProxy.cpp:
3174         (WebKit::WebCookieManagerProxy::setCookieStoragePartitioningEnabled): Deleted.
3175         * UIProcess/WebCookieManagerProxy.h:
3176         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3177         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
3178         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
3179             Now has a completion handler.
3180         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdate):
3181         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains):
3182         (WebKit::WebResourceLoadStatisticsStore::scheduleClearBlockingStateForDomains):
3183         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingStateReset):
3184         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory):
3185             Now supports a completion handler for removeAllStorageAccess().
3186         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
3187         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler):
3188         (WebKit::WebResourceLoadStatisticsStore::logNonRecentUserInteraction): Deleted.
3189             There is no longer a difference between recent and non-recent
3190             user interaction so this test function was removed.
3191         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate): Deleted.
3192             Renamed to scheduleCookieBlockingUpdate().
3193         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains): Deleted.
3194             Renamed to scheduleCookieBlockingUpdateForDomains().
3195         (WebKit::WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains): Deleted.
3196             Renamed to scheduleClearBlockingStateForDomains().
3197         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningStateReset): Deleted.
3198             Renamed to scheduleCookieBlockingStateReset().
3199         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree): Deleted.
3200         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToPartitionOrBlockCookiesHandler): Deleted.
3201             Renamed callUpdatePrevalentDomainsToBlockCookiesForHandler().
3202         * UIProcess/WebResourceLoadStatisticsStore.h:
3203         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3204         (WebKit::WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor):
3205         (WebKit::WebsiteDataStore::removeAllStorageAccessHandler):
3206             Now supports a completion handler for removeAllStorageAccess().
3207         (WebKit::WebsiteDataStore::networkProcessDidCrash):
3208             Name change in function called to get rid of "partitioning."
3209         (WebKit::WebsiteDataStore::updatePrevalentDomainsToPartitionOrBlockCookies): Deleted.
3210             Renamed updatePrevalentDomainsToBlockCookiesFor().
3211         * UIProcess/WebsiteData/WebsiteDataStore.h:
3212
3213 2018-07-31  Rob Buis  <rbuis@igalia.com>
3214
3215         Remove ResourceResponse::cacheBodyKey API
3216         https://bugs.webkit.org/show_bug.cgi?id=188192
3217
3218         Reviewed by Frédéric Wang.
3219
3220         Remove unused API.
3221
3222         * NetworkProcess/cache/NetworkCacheEntry.cpp:
3223         (WebKit::NetworkCache::Entry::decodeStorageRecord):
3224
3225 2018-07-30  Sihui Liu  <sihui_liu@apple.com>
3226
3227         Add support for fetching and remove type  _WKWebsiteDataTypeHSTSCache
3228         https://bugs.webkit.org/show_bug.cgi?id=187379
3229         <rdar://problem/41879559>
3230
3231         WKWebsiteDataStore should support _WKWebsiteDataTypeHSTSCache so Safari could list HSTS cache entries
3232         and be able to remove them on a per-domain basis.
3233
3234         Reviewed by Geoffrey Garen.
3235
3236         * NetworkProcess/NetworkProcess.cpp:
3237         (WebKit::NetworkProcess::fetchWebsiteData):
3238         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
3239         * NetworkProcess/NetworkProcess.h:
3240         * NetworkProcess/NetworkProcess.messages.in:
3241         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3242         (WebKit::filterPreloadHSTSEntry):
3243         (WebKit::NetworkProcess::getHostNamesWithHSTSCache):
3244         (WebKit::NetworkProcess::deleteHSTSCacheForHostNames):
3245         * Shared/WebsiteData/WebsiteData.cpp:
3246         (WebKit::WebsiteData::encode const):
3247         (WebKit::WebsiteData::decode):
3248         * Shared/WebsiteData/WebsiteData.h:
3249         * UIProcess/Network/NetworkProcessProxy.cpp:
3250         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
3251         * UIProcess/Network/NetworkProcessProxy.h:
3252         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
3253         (WebKit::WebsiteDataRecord::displayNameForCookieHostName):
3254         (WebKit::WebsiteDataRecord::displayNameForHostName):
3255         (WebKit::WebsiteDataRecord::addHSTSCacheHostname):
3256         (WebKit::WebsiteDataRecord::displayNameForPluginDataHostName): Deleted.
3257         * UIProcess/WebsiteData/WebsiteDataRecord.h:
3258         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3259         (WebKit::WebsiteDataStore::fetchDataAndApply):
3260         (WebKit::WebsiteDataStore::removeData):
3261
3262 2018-07-30  Simon Fraser  <simon.fraser@apple.com>
3263
3264         Shrink GraphicsLayerCA
3265         https://bugs.webkit.org/show_bug.cgi?id=188141
3266
3267         Reviewed by Zalan Bujtas.
3268
3269         Shrink GraphicsLayerCA from 1040 to 880 bytes by:
3270         * moving all the clone-related stuff into the lazily-allocated m_layerClones
3271         * moving all the animation-related stuff into the lazily-allocated m_animations
3272         * making enums be 8-bit
3273         * re-ordering data members
3274
3275         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
3276         (WebKit::updateCustomAppearance):
3277         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
3278         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
3279         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
3280         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
3281         (WebKit::PlatformCALayerRemote::requiresCustomAppearanceUpdateOnBoundsChange const):
3282
3283 2018-07-30  Wenson Hsieh  <wenson_hsieh@apple.com>
3284
3285         REGRESSION (r230817): Terrible performance when selecting text on Stash code review
3286         https://bugs.webkit.org/show_bug.cgi?id=188144
3287         <rdar://problem/42642489>
3288
3289         Reviewed by Darin Adler.
3290
3291         After r230817, mouse events were serially dispatched to the web process and handled before the subsequent mouse
3292         event. However, this resulted in rapid-fire mouse move events filling up the mouse event queue in the case where
3293         mouse move events were being handled by the web process at a slower rate than the UI process was enqueueing
3294         them. To mitigate this, r231511 introduced a mechanism for replacing the most recently enqueued mouse move event
3295         with an incoming mouse move event.
3296
3297         However, when a user with a force-click-enabled trackpad performs a mouse drag, a rapid stream of
3298         "mouseforcechanged" events is interleaved alongside the stream of "mousemove" events. This renders r231511
3299         ineffective, since the most recently queued event is often a "mouseforcechanged" event instead of a "mousemove".
3300         On the stash code review page, this can result in hundreds of mouse events being backed up in the mouse event
3301         queue, causing perceived slowness when selecting text.
3302
3303         To fix this, we extend the mechanism introduced in r231511, such that it is capable of replacing both
3304         "mouseforcechanged" and "mousemove" events in the queue. Rather than consider only the most recently queued
3305         item, we instead find the most recently queued event that matches the type of the incoming event, remove it from
3306         the queue, and then append the incoming event to the end of the queue. To avoid the risk of removing the only
3307         "mousemove" or "mouseforcechanged" event in the middle of a mouse down and mouse up, we also bail when searching
3308         backwards for an event to replace if we come across any event that is neither of these types.
3309
3310         This effectively throttles the rate at which mouseforcechanged or mousemove events are dispatched when a user
3311         with force-click-enabled hardware clicks and drags the mouse across the page.
3312
3313         * UIProcess/WebPageProxy.cpp:
3314         (WebKit::removeOldRedundantEvent):
3315         (WebKit::WebPageProxy::handleMouseEvent):
3316
3317 2018-07-30  Devin Rousso  <webkit@devinrousso.com>
3318
3319         Add missing CoreGraphics SPI
3320         https://bugs.webkit.org/show_bug.cgi?id=188177
3321
3322         Reviewed by Joseph Pecoraro.
3323
3324         * WebProcess/cocoa/WebProcessCocoa.mm:
3325
3326 2018-07-30  Rob Buis  <rbuis@igalia.com>
3327
3328         https://bugs.webkit.org/show_bug.cgi?id=188137
3329         Merge PlatformCookieJar functions into NetworkStorageSession
3330
3331         Adapt callsites to use NetworkStorageSession instead of CookieJar functions.
3332
3333         Reviewed by Alex Christensen.
3334
3335         * NetworkProcess/Cookies/WebCookieManager.cpp:
3336         (WebKit::WebCookieManager::getHostnamesWithCookies):
3337         (WebKit::WebCookieManager::deleteCookiesForHostname):
3338         (WebKit::WebCookieManager::deleteAllCookies):
3339         (WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
3340         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3341         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
3342         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
3343         (WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
3344         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
3345         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
3346         (WebKit::NetworkConnectionToWebProcess::deleteCookie):
3347         * NetworkProcess/NetworkProcess.cpp:
3348         (WebKit::NetworkProcess::fetchWebsiteData):
3349         (WebKit::NetworkProcess::deleteWebsiteData):
3350         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
3351         * NetworkProcess/NetworkResourceLoader.cpp:
3352         (WebKit::logCookieInformationInternal):
3353         * NetworkProcess/cache/NetworkCache.cpp:
3354         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3355
3356 2018-07-30  Alex Christensen  <achristensen@webkit.org>
3357
3358         Add RefCounted CompletionHandler wrapping abstraction for sending policy decisions back to WebProcess
3359         https://bugs.webkit.org/show_bug.cgi?id=188089
3360
3361         Reviewed by Geoffrey Garen and Said Abou-Hallawa.
3362
3363         This will be necessary for when I add an asynchronous parallel step to decidePolicyForNavigationAction.
3364         We will want to wait for that asynchronous step for decidePolicyForNavigationActionSync but not for a client.
3365
3366         No change in behavior.
3367
3368         * UIProcess/WebPageProxy.cpp:
3369         (WebKit::WebPageProxy::PolicyDecisionSender::create):
3370         (WebKit::WebPageProxy::PolicyDecisionSender::operator()):
3371         (WebKit::WebPageProxy::PolicyDecisionSender::PolicyDecisionSender):
3372         (WebKit::WebPageProxy::receivedPolicyDecision):
3373         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
3374         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3375         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
3376         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
3377         (WebKit::WebPageProxy::decidePolicyForResponse):
3378         * UIProcess/WebPageProxy.h:
3379         * UIProcess/WebPageProxy.messages.in:
3380         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3381         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3382
3383 2018-07-30  David Fenton  <david_fenton@apple.com>
3384
3385         Unreviewed, rolling out r234327.
3386
3387         Caused 2 crashes on macOS and iOS debug API tests
3388
3389         Reverted changeset:
3390
3391         "Add RefCounted CompletionHandler wrapping abstraction for