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